From dcc4a983446b0616f72cc43e140d9846938a6f4e Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 12 Mar 2024 02:35:15 +0100 Subject: [PATCH 1/5] Add question hint about total capacity --- assets/layers/bike_parking/bike_parking.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/layers/bike_parking/bike_parking.json b/assets/layers/bike_parking/bike_parking.json index ff7183254..61f48a813 100644 --- a/assets/layers/bike_parking/bike_parking.json +++ b/assets/layers/bike_parking/bike_parking.json @@ -513,6 +513,10 @@ "pt_BR": "Quantas bicicletas cabem nesse estacionamento de bicicletas (incluindo possíveis bicicletas de carga)?", "pt": "Quantas bicicletas cabem neste estacionamento de bicicletas (incluindo possíveis bicicletas de carga)?" }, + "questionHint": { + "en": "This includes regular bicycles, cargo bikes, ebikes, ...", + "nl": "Dit is het totaal aantal gewone fietsen, bakfietsen, elektrische fietsen, ..." + }, "render": { "en": "Place for {capacity} bikes", "fr": "Place pour {capacity} vélos", From 7210b3ff5d054c6037ef1a8fe9972b5135a2c140 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 12 Mar 2024 03:40:55 +0100 Subject: [PATCH 2/5] UX: translate 'creating point', indicate that a new background layer is loading in the selectBackgroundButton --- langs/en.json | 1 + langs/layers/en.json | 1 + langs/layers/nl.json | 6 ++++++ src/UI/Base/Loading.svelte | 4 ++-- .../OpenBackgroundSelectorButton.svelte | 13 ++++++++++--- src/UI/Image/UploadingImageCounter.svelte | 8 ++++++-- src/UI/Map/StyleLoadingIndicator.svelte | 16 ++++++++++++++-- src/UI/Popup/AddNewPoint/AddNewPoint.svelte | 2 +- 8 files changed, 41 insertions(+), 10 deletions(-) diff --git a/langs/en.json b/langs/en.json index 1cdc592ee..fa54d79f3 100644 --- a/langs/en.json +++ b/langs/en.json @@ -123,6 +123,7 @@ "confirmLocation": "Confirm this location", "confirmTitle": "Add a {title}?", "confirmWarning": "The feature you create here will be visible for everyone. Please, only add things on to the map if they truly exist. A lot of applications use this data.", + "creating": "Creating a new point...", "disableFilters": "Disable all filters", "disableFiltersExplanation": "Some features might be hidden by a filter", "enableLayer": "Enable layer {name}", diff --git a/langs/layers/en.json b/langs/layers/en.json index 0a7d8debf..ed2f2655d 100644 --- a/langs/layers/en.json +++ b/langs/layers/en.json @@ -1412,6 +1412,7 @@ }, "Capacity": { "question": "How many bicycles fit in this bicycle parking (including possible cargo bicycles)?", + "questionHint": "This includes regular bicycles, cargo bikes, ebikes, ...", "render": "Place for {capacity} bikes" }, "Cargo bike capacity?": { diff --git a/langs/layers/nl.json b/langs/layers/nl.json index 103eb5db3..a608bc35a 100644 --- a/langs/layers/nl.json +++ b/langs/layers/nl.json @@ -1151,6 +1151,7 @@ }, "Capacity": { "question": "Hoeveel fietsen kunnen in deze fietsparking (inclusief potentiëel bakfietsen)?", + "questionHint": "Dit is het totaal aantal gewone fietsen, bakfietsen, elektrische fietsen, ...", "render": "Plaats voor {capacity} fietsen" }, "Cargo bike capacity?": { @@ -6545,6 +6546,11 @@ } }, "opening_hours": { + "mappings": { + "0": { + "then": "Gesloten voor onbepaalde duur" + } + }, "question": "Wat zijn de openingstijden van {title()}?", "render": "

Openingstijden

{opening_hours_table(opening_hours)}" }, diff --git a/src/UI/Base/Loading.svelte b/src/UI/Base/Loading.svelte index e76881db0..7c0c14b99 100644 --- a/src/UI/Base/Loading.svelte +++ b/src/UI/Base/Loading.svelte @@ -2,10 +2,10 @@ import { twMerge } from "tailwind-merge" import Loading from "../../assets/svg/Loading.svelte" - export let cls: string = undefined + export let cls: string = "flex p-1 pl-2" -
+
diff --git a/src/UI/BigComponents/OpenBackgroundSelectorButton.svelte b/src/UI/BigComponents/OpenBackgroundSelectorButton.svelte index e617e877d..af07c92b3 100644 --- a/src/UI/BigComponents/OpenBackgroundSelectorButton.svelte +++ b/src/UI/BigComponents/OpenBackgroundSelectorButton.svelte @@ -1,15 +1,19 @@ @@ -17,7 +21,10 @@ arialabel={Translations.t.general.labels.background} on:click={() => state.guistate.backgroundLayerSelectionIsOpened.setData(true)} > - + + + + {#if !hideTooltip} {/if} diff --git a/src/UI/Image/UploadingImageCounter.svelte b/src/UI/Image/UploadingImageCounter.svelte index e78f4a009..99c99ad2c 100644 --- a/src/UI/Image/UploadingImageCounter.svelte +++ b/src/UI/Image/UploadingImageCounter.svelte @@ -36,13 +36,17 @@
{:else if $retried === 1} - +
+ +
{:else} - +
+ +
{/if} {:else if $uploadStarted > 1} {#if $uploadFinished + $failed === $uploadStarted && $uploadFinished > 0} diff --git a/src/UI/Map/StyleLoadingIndicator.svelte b/src/UI/Map/StyleLoadingIndicator.svelte index 5398bacb8..9b3558cbe 100644 --- a/src/UI/Map/StyleLoadingIndicator.svelte +++ b/src/UI/Map/StyleLoadingIndicator.svelte @@ -6,14 +6,26 @@ let isLoading = false export let map: UIEventSource + export let rasterLayer: UIEventSource = undefined + + let didChange = undefined + onDestroy(rasterLayer?.addCallback(() => { + didChange = true + }) ??( () => {})) + onDestroy(Stores.Chronic(250).addCallback( () => { - isLoading = !map.data?.isStyleLoaded() + isLoading = !map.data?.isStyleLoaded() && (didChange === undefined || didChange) + if(didChange){ + didChange = false + } }, )) {#if isLoading} - + +{:else} + {/if} diff --git a/src/UI/Popup/AddNewPoint/AddNewPoint.svelte b/src/UI/Popup/AddNewPoint/AddNewPoint.svelte index 6dd3f3575..b8d4659d5 100644 --- a/src/UI/Popup/AddNewPoint/AddNewPoint.svelte +++ b/src/UI/Popup/AddNewPoint/AddNewPoint.svelte @@ -364,7 +364,7 @@
{:else} - Creating point... + {/if} From 8b4e0b02762d53baaeaccf6ac2aa9e94e88feb10 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 12 Mar 2024 04:02:38 +0100 Subject: [PATCH 3/5] Add testcase --- src/Models/ThemeConfig/TagRenderingConfig.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Models/ThemeConfig/TagRenderingConfig.ts b/src/Models/ThemeConfig/TagRenderingConfig.ts index d3c1a8bd0..20c743fca 100644 --- a/src/Models/ThemeConfig/TagRenderingConfig.ts +++ b/src/Models/ThemeConfig/TagRenderingConfig.ts @@ -635,6 +635,14 @@ export default class TagRenderingConfig { * config.constructChangeSpecification("second_hand", 1, undefined, {}).asHumanString(false, false, {}) // => "shop=second_hand" * * + * const config = new TagRenderingConfig({id: "oh", render: "{opening_hours}", question: {"en":"When open?"}, freeform: {key: "opening_hours"}, + * mappings: [{ "if": "opening_hours=closed", + * "then": { + * "en": "Marked as closed for an unspecified time", + * }, + * "hideInAnswer": true}] } + * const tags = config.constructChangeSpecification("Tu-Fr 05:30-09:30", undefined, undefined, { }} + * tags // =>new And([ new Tag("opening_hours", "Tu-Fr 05:30-09:30")]) * * @param freeformValue The freeform value which will be applied as 'freeform.key'. Ignored if 'freeform.key' is not set * @@ -648,6 +656,12 @@ export default class TagRenderingConfig { multiSelectedMapping: boolean[] | undefined, currentProperties: Record ): UploadableTag { + console.log("constructChangeSpecification:", { + freeformValue, + singleSelectedMapping, + multiSelectedMapping, + currentProperties, + }) if (typeof freeformValue === "string") { freeformValue = freeformValue?.trim() } From e7b7f2a09dbcb87c58071719a9e5ba76818b2b1e Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 12 Mar 2024 11:23:00 +0100 Subject: [PATCH 4/5] Typing: make arguments optional --- src/Logic/Tags/And.ts | 2 +- src/Logic/Tags/SubstitutingTag.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Logic/Tags/And.ts b/src/Logic/Tags/And.ts index 57c6ac3ba..f28e65065 100644 --- a/src/Logic/Tags/And.ts +++ b/src/Logic/Tags/And.ts @@ -78,7 +78,7 @@ export class And extends TagsFilter { return { and: this.and.map((a) => a.asJson()) } } - asHumanString(linkToWiki: boolean, shorten: boolean, properties: Record) { + asHumanString(linkToWiki?: boolean, shorten?: boolean, properties?: Record) { return this.and .map((t) => { let e = t.asHumanString(linkToWiki, shorten, properties) diff --git a/src/Logic/Tags/SubstitutingTag.ts b/src/Logic/Tags/SubstitutingTag.ts index acdda6835..492243720 100644 --- a/src/Logic/Tags/SubstitutingTag.ts +++ b/src/Logic/Tags/SubstitutingTag.ts @@ -43,7 +43,7 @@ export default class SubstitutingTag extends TagsFilter { return new Tag(this._key, Utils.SubstituteKeys(this._value, currentProperties)) } - asHumanString(linkToWiki: boolean, shorten: boolean, properties) { + asHumanString(linkToWiki?: boolean, shorten?: boolean, properties?: Record) { return ( this._key + (this._invert ? "!" : "") + From f7e2dc7457f366d9cf4722beccfe6b16467ab435 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 12 Mar 2024 11:47:28 +0100 Subject: [PATCH 5/5] Fix: force redrawing the questions in a questionbox to avoid rendering artefacts and unselectable items --- src/UI/Popup/TagRendering/Questionbox.svelte | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/UI/Popup/TagRendering/Questionbox.svelte b/src/UI/Popup/TagRendering/Questionbox.svelte index 5724d872a..4d485c29d 100644 --- a/src/UI/Popup/TagRendering/Questionbox.svelte +++ b/src/UI/Popup/TagRendering/Questionbox.svelte @@ -4,7 +4,7 @@ * The questions can either be shown all at once or one at a time (in which case they can be skipped) */ import TagRenderingConfig from "../../../Models/ThemeConfig/TagRenderingConfig" - import { UIEventSource } from "../../../Logic/UIEventSource" + import { Store, UIEventSource } from "../../../Logic/UIEventSource" import type { Feature } from "geojson" import type { SpecialVisualizationState } from "../../SpecialVisualization" import LayerConfig from "../../../Models/ThemeConfig/LayerConfig" @@ -12,6 +12,7 @@ import Tr from "../../Base/Tr.svelte" import Translations from "../../i18n/Translations.js" import { Utils } from "../../../Utils" + import { onDestroy } from "svelte" export let layer: LayerConfig export let tags: UIEventSource> @@ -67,8 +68,13 @@ }, [skippedQuestions] ) - let firstQuestion = questionsToAsk.map((qta) => qta[0]) - + let firstQuestion: UIEventSource = new UIEventSource() + + onDestroy(questionsToAsk.addCallback(qta => { + firstQuestion.setData(undefined) + firstQuestion.setData(qta[0]) + })) + let answered: number = 0 let skipped: number = 0 @@ -144,7 +150,7 @@ {/each} - {:else} + {:else if $firstQuestion !== undefined}