Merge branch 'master' into develop

This commit is contained in:
Pieter Vander Vennet 2024-03-12 11:49:24 +01:00
commit 319f758d32
13 changed files with 71 additions and 16 deletions

View file

@ -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",

View file

@ -124,6 +124,7 @@
"confirmLocation": "Confirm this location",
"confirmTitle": "Add a {title}?",
"confirmWarning": "The feature you create here will be <b>visible for everyone</b>. 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}",

View file

@ -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?": {

View file

@ -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": "<h3>Openingstijden</h3>{opening_hours_table(opening_hours)}"
},

View file

@ -78,7 +78,7 @@ export class And extends TagsFilter {
return { and: this.and.map((a) => a.asJson()) }
}
asHumanString(linkToWiki: boolean, shorten: boolean, properties: Record<string, string>) {
asHumanString(linkToWiki?: boolean, shorten?: boolean, properties?: Record<string, string>) {
return this.and
.map((t) => {
let e = t.asHumanString(linkToWiki, shorten, properties)

View file

@ -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<string, string>) {
return (
this._key +
(this._invert ? "!" : "") +

View file

@ -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<string, string>
): UploadableTag {
console.log("constructChangeSpecification:", {
freeformValue,
singleSelectedMapping,
multiSelectedMapping,
currentProperties,
})
if (typeof freeformValue === "string") {
freeformValue = freeformValue?.trim()
}

View file

@ -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"
</script>
<div class={twMerge("flex p-1 pl-2", cls)}>
<div class={cls}>
<div class="min-w-6 h-6 w-6 shrink-0 animate-spin self-center">
<Loading />
</div>

View file

@ -1,15 +1,19 @@
<script lang="ts">
/**
* A mapcontrol button which allows the user to select a different background.
* Even though the component is very small, it gets it's own class as it is often reused
* Even though the component is very small, it gets its own class as it is often reused
*/
import { Square3Stack3dIcon } from "@babeard/svelte-heroicons/solid"
import type { SpecialVisualizationState } from "../SpecialVisualization"
import Translations from "../i18n/Translations"
import MapControlButton from "../Base/MapControlButton.svelte"
import Tr from "../Base/Tr.svelte"
import StyleLoadingIndicator from "../Map/StyleLoadingIndicator.svelte"
import { UIEventSource } from "../../Logic/UIEventSource"
import { Map as MlMap } from "maplibre-gl"
import ThemeViewState from "../../Models/ThemeViewState"
export let state: SpecialVisualizationState
export let state: ThemeViewState
export let hideTooltip = false
</script>
@ -17,7 +21,10 @@
arialabel={Translations.t.general.labels.background}
on:click={() => state.guistate.backgroundLayerSelectionIsOpened.setData(true)}
>
<Square3Stack3dIcon class="h-6 w-6" />
<StyleLoadingIndicator map={state.map} rasterLayer={state.mapProperties.rasterLayer} >
<Square3Stack3dIcon class="h-6 w-6" />
</StyleLoadingIndicator>
{#if !hideTooltip}
<Tr cls="mx-2" t={Translations.t.general.backgroundSwitch} />
{/if}

View file

@ -41,13 +41,17 @@
{:else if $failed === 1}
<UploadFailedMessage failed={$failed} on:click={() => dismissed = $failed}/>
{:else if $retried === 1}
<Loading cls="alert">
<div class="alert">
<Loading>
<Tr t={t.upload.one.retrying} />
</Loading>
</div>
{:else}
<Loading cls="alert">
<div class="alert">
<Loading>
<Tr t={t.upload.one.uploading} />
</Loading>
</div>
{/if}
{:else if $uploadStarted > 1}
{#if $uploadFinished + $failed === $uploadStarted}

View file

@ -6,14 +6,26 @@
let isLoading = false
export let map: UIEventSource<MlMap>
export let rasterLayer: UIEventSource<any> = 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
}
},
))
</script>
{#if isLoading}
<Loading />
<Loading cls="h-6 w-6" />
{:else}
<slot />
{/if}

View file

@ -364,7 +364,7 @@
</div>
</div>
{:else}
<Loading>Creating point...</Loading>
<Loading><Tr t={Translations.t.general.add.creating}/> </Loading>
{/if}
</div>
</LoginToggle>

View file

@ -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<Record<string, string>>
@ -67,8 +68,13 @@
},
[skippedQuestions]
)
let firstQuestion = questionsToAsk.map((qta) => qta[0])
let firstQuestion: UIEventSource<TagRenderingConfig> = new UIEventSource<TagRenderingConfig>()
onDestroy(questionsToAsk.addCallback(qta => {
firstQuestion.setData(undefined)
firstQuestion.setData(qta[0])
}))
let answered: number = 0
let skipped: number = 0
@ -144,7 +150,7 @@
<TagRenderingQuestion config={question} {tags} {selectedElement} {state} {layer} />
{/each}
</div>
{:else}
{:else if $firstQuestion !== undefined}
<TagRenderingQuestion
config={$firstQuestion}
{layer}