From 2594e75535f61136cbb8cc111446f960c58ac7fc Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sat, 29 Jul 2023 21:53:09 +0200 Subject: [PATCH 01/19] Update food.json: add filter per category --- assets/layers/food/food.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/assets/layers/food/food.json b/assets/layers/food/food.json index 84df6f9086..891318d418 100644 --- a/assets/layers/food/food.json +++ b/assets/layers/food/food.json @@ -961,6 +961,33 @@ } ] }, + + { + "id": "food-category", + "options": [ + { + "question": { + "en": "All categories" + }}, + + + + { + "question": { + "en"; "Only fastfood buisinesses" + }, + "osmTags": "amenity=fast_food" } + +{ + "question": { + "en": "Only restaurants" + }, + "osmTags": "amenity=restaurant" } + + + ] + }, + { "id": "vegetarian", "options": [ From 366577f70b40765b3e10ccae222193ca07cae4bb Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sun, 30 Jul 2023 04:56:10 +0200 Subject: [PATCH 02/19] Fix: typo in filter --- assets/layers/food/food.json | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/assets/layers/food/food.json b/assets/layers/food/food.json index 891318d418..0870511274 100644 --- a/assets/layers/food/food.json +++ b/assets/layers/food/food.json @@ -961,33 +961,28 @@ } ] }, - { "id": "food-category", "options": [ { "question": { "en": "All categories" - }}, - - - + } + }, { "question": { - "en"; "Only fastfood buisinesses" - }, - "osmTags": "amenity=fast_food" } - -{ + "en": "Only fastfood buisinesses" + }, + "osmTags": "amenity=fast_food" + }, + { "question": { "en": "Only restaurants" - }, - "osmTags": "amenity=restaurant" } - - + }, + "osmTags": "amenity=restaurant" + } ] }, - { "id": "vegetarian", "options": [ From 565b9f0bb55faf99e1e36cc713d3984bb5da591e Mon Sep 17 00:00:00 2001 From: pelderson <38458314+pelderson@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:33:31 +0200 Subject: [PATCH 03/19] Update waste_disposal.json iconsize verkleind naar 20,20 en minzoom opgehoogd naar 14 --- assets/layers/waste_disposal/waste_disposal.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/layers/waste_disposal/waste_disposal.json b/assets/layers/waste_disposal/waste_disposal.json index 0bf07f8864..cdc6324a50 100644 --- a/assets/layers/waste_disposal/waste_disposal.json +++ b/assets/layers/waste_disposal/waste_disposal.json @@ -39,7 +39,8 @@ "point", "centroid" ], - "icon": "circle:white;./assets/layers/waste_disposal/waste_disposal.svg" + "icon": "circle:white;./assets/layers/waste_disposal/waste_disposal.svg", + "iconSize": "20,20" } ], "presets": [ From 5d00f3cc6a75a22732ec7ffa63d9335d9d75853c Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 8 Aug 2023 20:41:18 +0200 Subject: [PATCH 04/19] Fix: fix #1532 --- src/Models/ThemeConfig/TagRenderingConfig.ts | 82 ++++++++++++-------- 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/src/Models/ThemeConfig/TagRenderingConfig.ts b/src/Models/ThemeConfig/TagRenderingConfig.ts index dbc0ba2f3f..6cd5dc4dc8 100644 --- a/src/Models/ThemeConfig/TagRenderingConfig.ts +++ b/src/Models/ThemeConfig/TagRenderingConfig.ts @@ -58,7 +58,7 @@ export default class TagRenderingConfig { public readonly freeform?: { readonly key: string - readonly type: string + readonly type: ValidatorType readonly placeholder: Translation readonly addExtraTags: UploadableTag[] readonly inline: boolean @@ -133,7 +133,17 @@ export default class TagRenderingConfig { ) { throw `Freeform.addExtraTags should be a list of strings - not a single string (at ${context})` } - const type = json.freeform.type ?? "string" + if ( + json.freeform.type && + Validators.availableTypes.indexOf(json.freeform.type) < 0 + ) { + throw `At ${context}: invalid type, perhaps you meant ${Utils.sortedByLevenshteinDistance( + json.freeform.key, + Validators.availableTypes, + (s) => s + )}` + } + const type: ValidatorType = json.freeform.type ?? "string" let placeholder: Translation = Translations.T(json.freeform.placeholder) if (placeholder === undefined) { @@ -622,7 +632,7 @@ export default class TagRenderingConfig { * * @param singleSelectedMapping (Only used if multiAnswer == false): the single mapping to apply. Use (mappings.length) for the freeform * @param multiSelectedMapping (Only used if multiAnswer == true): all the mappings that must be applied. Set multiSelectedMapping[mappings.length] to use the freeform as well - * @param currentProperties: The current properties of the object for which the question should be answered + * @param currentProperties The current properties of the object for which the question should be answered */ public constructChangeSpecification( freeformValue: string | undefined, @@ -685,38 +695,42 @@ export default class TagRenderingConfig { return undefined } return and - } else { - // Is at least one mapping shown in the answer? - const someMappingIsShown = this.mappings.some((m) => { - if (typeof m.hideInAnswer === "boolean") { - return !m.hideInAnswer - } - const isHidden = m.hideInAnswer.matchesProperties(currentProperties) - return !isHidden - }) - // If all mappings are hidden for the current tags, we can safely assume that we should use the freeform key - const useFreeform = - freeformValue !== undefined && - (singleSelectedMapping === this.mappings.length || !someMappingIsShown) - if (useFreeform) { - return new And([ - new Tag(this.freeform.key, freeformValue), - ...(this.freeform.addExtraTags ?? []), - ]) - } else if (singleSelectedMapping !== undefined) { - return new And([ - this.mappings[singleSelectedMapping].if, - ...(this.mappings[singleSelectedMapping].addExtraTags ?? []), - ]) - } else { - console.warn("TagRenderingConfig.ConstructSpecification has a weird fallback for", { - freeformValue, - singleSelectedMapping, - multiSelectedMapping, - currentProperties, - }) - return undefined + } + + // Is at least one mapping shown in the answer? + const someMappingIsShown = this.mappings.some((m) => { + if (typeof m.hideInAnswer === "boolean") { + return !m.hideInAnswer } + const isHidden = m.hideInAnswer.matchesProperties(currentProperties) + return !isHidden + }) + // If all mappings are hidden for the current tags, we can safely assume that we should use the freeform key + const useFreeform = + freeformValue !== undefined && + (singleSelectedMapping === this.mappings.length || + !someMappingIsShown || + singleSelectedMapping === undefined) + if (useFreeform) { + return new And([ + new Tag(this.freeform.key, freeformValue), + ...(this.freeform.addExtraTags ?? []), + ]) + } else if (singleSelectedMapping !== undefined) { + return new And([ + this.mappings[singleSelectedMapping].if, + ...(this.mappings[singleSelectedMapping].addExtraTags ?? []), + ]) + } else { + console.error("TagRenderingConfig.ConstructSpecification has a weird fallback for", { + freeformValue, + singleSelectedMapping, + multiSelectedMapping, + currentProperties, + useFreeform, + }) + + return undefined } } From 7d5aa725fb319b14cc82f54a35c2601274773d43 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 8 Aug 2023 20:44:34 +0200 Subject: [PATCH 05/19] Typing: Fix some typing errors --- .../mapcomplete-changes.json | 97 +++++-------------- src/UI/InputElement/ValidatedInput.svelte | 3 +- src/UI/InputElement/Validator.ts | 10 +- .../InputElement/Validators/FloatValidator.ts | 5 +- .../TagRendering/TagRenderingQuestion.svelte | 2 +- 5 files changed, 37 insertions(+), 80 deletions(-) diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index deda66b656..56555e8719 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -1,19 +1,13 @@ { "id": "mapcomplete-changes", "title": { - "en": "Changes made with MapComplete", - "de": "Mit MapComplete erstellte Änderungen", - "nl": "Wijzigingen gemaakt met MapComplete" + "en": "Changes made with MapComplete" }, "shortDescription": { - "en": "Show changes made with MapComplete", - "de": "Mit MapComplete erstellte Änderungen anzeigen", - "nl": "Toon wijzigingen gemaakt met MapComplete" + "en": "Shows changes made by MapComplete" }, "description": { - "en": "This maps shows all the changes made with MapComplete", - "de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen", - "nl": "Deze kaart toont alle wijzigingen die met MapComplete gemaakt werden" + "en": "This maps shows all the changes made with MapComplete" }, "icon": "./assets/svg/logo.svg", "hideFromOverview": true, @@ -26,9 +20,7 @@ { "id": "mapcomplete-changes", "name": { - "en": "Changeset centers", - "de": "Zentrum der Änderungssätze", - "nl": "Centerpunt van changeset" + "en": "Changeset centers" }, "minzoom": 0, "source": { @@ -39,51 +31,41 @@ }, "title": { "render": { - "en": "Changeset for {theme}", - "de": "Änderungssatz für {theme}" + "en": "Changeset for {theme}" } }, "description": { - "en": "Show all MapComplete changes", - "de": "Alle MapComplete-Änderungen anzeigen", - "nl": "Toon alle MapComplete wijzigingen" + "en": "Shows all MapComplete changes" }, "tagRenderings": [ { "id": "show_changeset_id", "render": { - "en": "Changeset {id}", - "de": "Änderungssatz {id}" + "en": "Changeset {id}" } }, { "id": "contributor", "question": { - "en": "Which contributor made this change?", - "de": "Welcher Mitwirkende hat diese Änderung vorgenommen?", - "nl": "Welke bijdrager maakte deze wijziging?" + "en": "What contributor did make this change?" }, "freeform": { "key": "user" }, "render": { - "en": "Change made by {user}", - "de": "Änderung gemacht von {user}", - "nl": "Wijziging gemaakt door {user}" + "en": "Change made by {user}" } }, { "id": "theme-id", "question": { - "en": "What theme was used to make this change?", - "de": "Welches Thema wurde für diese Änderung verwendet?" + "en": "What theme was used to make this change?" }, "freeform": { "key": "theme" }, "render": { - "en": "Change with theme {theme}", - "de": "Geändert mit Thema {theme}" + "en": "Change with theme {theme}" } }, { @@ -92,27 +74,19 @@ "key": "locale" }, "question": { - "en": "What locale (language) was this change made in?", - "de": "In welcher Sprache wurde diese Änderung vorgenommen?", - "nl": "In welke locale (taal) werd deze wijziging gemaakt?" + "en": "What locale (language) was this change made in?" }, "render": { - "en": "User locale is {locale}", - "de": "Usersprache ist {locale}", - "nl": "De gebruikerstaal is {locale}" + "en": "User locale is {locale}" } }, { "id": "host", "render": { - "en": "Change made with {host}", - "de": "Änderung vorgenommen mit {host}", - "nl": "Wijziging gemaakt met {host}" + "en": "Change with with {host}" }, "question": { - "en": "What host (website) was this change made with?", - "de": "Mit welchem Host / welcher Website wurde diese Änderung gemacht?", - "nl": "Met welke host (website) werd deze wijziging gemaakt?" + "en": "What host (website) was this change made with?" }, "freeform": { "key": "host" @@ -133,12 +107,10 @@ { "id": "version", "question": { - "en": "What version of MapComplete was used to make this change?", - "de": "Mit welcher Version von MapComplete wurde diese Änderung gemacht?" + "en": "What version of MapComplete was used to make this change?" }, "render": { - "en": "Made with {editor}", - "de": "Erstellt mit {editor}" + "en": "Made with {editor}" }, "freeform": { "key": "editor" @@ -480,9 +452,7 @@ } ], "question": { - "en": "Theme name contains {search}", - "de": "Themenname enthält {search}", - "nl": "Themenaam bevat {search}" + "en": "Themename contains {search}" } } ] @@ -498,9 +468,7 @@ } ], "question": { - "en": "Made by contributor {search}", - "de": "Erstellt von {search}", - "nl": "Gemaakt door bijdrager {search}" + "en": "Made by contributor {search}" } } ] @@ -516,9 +484,7 @@ } ], "question": { - "en": "Not made by contributor {search}", - "de": "Nicht erstellt von {search}", - "nl": "Niet gemaakt door bijdrager {search}" + "en": "Not made by contributor {search}" } } ] @@ -535,9 +501,7 @@ } ], "question": { - "en": "Made before {search}", - "de": "Erstellt vor {search}", - "nl": "Gemaakt voor {search}" + "en": "Made before {search}" } } ] @@ -554,9 +518,7 @@ } ], "question": { - "en": "Made after {search}", - "de": "Erstellt nach {search}", - "nl": "Gemaakt na {search}" + "en": "Made after {search}" } } ] @@ -572,9 +534,7 @@ } ], "question": { - "en": "User language (iso-code) {search}", - "de": "Benutzersprache (ISO-Code) {search}", - "nl": "De taal van de bijdrager is {search}" + "en": "User language (iso-code) {search}" } } ] @@ -590,9 +550,7 @@ } ], "question": { - "en": "Made with host {search}", - "de": "Erstellt mit Host {search}", - "nl": "Gemaakt met host {search}" + "en": "Made with host {search}" } } ] @@ -603,9 +561,7 @@ { "osmTags": "add-image>0", "question": { - "en": "Changeset added at least one image", - "de": "Changeset fügte mindestens ein Bild hinzu", - "nl": "Changeset bevat minstens één afbeelding" + "en": "Changeset added at least one image" } } ] @@ -620,8 +576,7 @@ { "id": "link_to_more", "render": { - "en": "More statistics can be found here", - "de": "Mehr Statistiken gibt es hier" + "en": "More statistics can be found here" } }, { diff --git a/src/UI/InputElement/ValidatedInput.svelte b/src/UI/InputElement/ValidatedInput.svelte index 3656e819f1..57b702e1d5 100644 --- a/src/UI/InputElement/ValidatedInput.svelte +++ b/src/UI/InputElement/ValidatedInput.svelte @@ -9,7 +9,7 @@ import { Unit } from "../../Models/Unit" import UnitInput from "../Popup/UnitInput.svelte" - export let type: ValidatorType + export let type: ValidatorType export let feedback: UIEventSource | undefined = undefined export let getCountry: () => string | undefined export let placeholder: string | Translation | undefined @@ -63,6 +63,7 @@ } if (unit && isNaN(Number(v))) { + console.debug("Not a number, but a unit is required") value.setData(undefined) return } diff --git a/src/UI/InputElement/Validator.ts b/src/UI/InputElement/Validator.ts index 5172b2433d..e63a98f94a 100644 --- a/src/UI/InputElement/Validator.ts +++ b/src/UI/InputElement/Validator.ts @@ -1,6 +1,6 @@ -import BaseUIElement from "../BaseUIElement" -import { Translation } from "../i18n/Translation" -import Translations from "../i18n/Translations" +import BaseUIElement from "../BaseUIElement"; +import { Translation } from "../i18n/Translation"; +import Translations from "../i18n/Translations"; /** * A 'TextFieldValidator' contains various methods to check and cleanup an entered value or to give feedback. @@ -16,13 +16,13 @@ export abstract class Validator { /** * What HTML-inputmode to use */ - public readonly inputmode?: string + public readonly inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' public readonly textArea: boolean constructor( name: string, explanation: string | BaseUIElement, - inputmode?: string, + inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search', textArea?: false | boolean ) { this.name = name diff --git a/src/UI/InputElement/Validators/FloatValidator.ts b/src/UI/InputElement/Validators/FloatValidator.ts index f984a9fc07..2c3f6adbbc 100644 --- a/src/UI/InputElement/Validators/FloatValidator.ts +++ b/src/UI/InputElement/Validators/FloatValidator.ts @@ -1,11 +1,12 @@ import { Translation } from "../../i18n/Translation" import Translations from "../../i18n/Translations" import { Validator } from "../Validator" +import { ValidatorType } from "../Validators"; export default class FloatValidator extends Validator { - inputmode = "decimal" + inputmode: "decimal" = "decimal" - constructor(name?: string, explanation?: string) { + constructor(name?: ValidatorType, explanation?: string) { super(name ?? "float", explanation ?? "A decimal number", "decimal") } diff --git a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte index a746aba3d9..0454187e31 100644 --- a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte @@ -69,7 +69,7 @@ export let selectedTags: TagsFilter = undefined let mappings: Mapping[] = config?.mappings - let searchTerm: Store = new UIEventSource("") + let searchTerm: UIEventSource = new UIEventSource("") $: { try { From 1b8970b34aae337edfe5567315cc36319add1ff7 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 8 Aug 2023 20:46:40 +0200 Subject: [PATCH 06/19] Fix: small CSS fix --- src/UI/Popup/DeleteFlow/DeleteWizard.svelte | 45 ++++++++++----------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/UI/Popup/DeleteFlow/DeleteWizard.svelte b/src/UI/Popup/DeleteFlow/DeleteWizard.svelte index 5135b7ff9e..9a895f4477 100644 --- a/src/UI/Popup/DeleteFlow/DeleteWizard.svelte +++ b/src/UI/Popup/DeleteFlow/DeleteWizard.svelte @@ -1,24 +1,24 @@ {#if $canBeDeleted === false && !hasSoftDeletion} -
- +
- +
{:else} From 37dc6a71616fc9510d1bf6e814060390dd329629 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 9 Aug 2023 14:16:17 +0200 Subject: [PATCH 07/19] Fix: correctly interpret 'hideInAnswer'-conditions, recalculate them dynamically --- src/UI/Popup/TagRendering/TagRenderingQuestion.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte index a746aba3d9..b8bd989e0b 100644 --- a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte @@ -38,11 +38,12 @@ let selectedMapping: number = undefined let checkedMappings: boolean[] $: { + let tgs = $tags mappings = config.mappings?.filter((m) => { if (typeof m.hideInAnswer === "boolean") { return !m.hideInAnswer } - return m.hideInAnswer.matchesProperties(tags.data) + return !m.hideInAnswer.matchesProperties(tgs) }) // We received a new config -> reinit unit = layer.units.find((unit) => unit.appliesToKeys.has(config.freeform?.key)) @@ -59,7 +60,7 @@ if (config.freeform?.key) { if (!config.multiAnswer) { // Somehow, setting multianswer freeform values is broken if this is not set - freeformInput.setData(tags.data[config.freeform.key]) + freeformInput.setData(tgs[config.freeform.key]) } } else { freeformInput.setData(undefined) From fd9c48b5b56fe7a08e3532cad777246b82b3a073 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 9 Aug 2023 14:16:48 +0200 Subject: [PATCH 08/19] Fix: add 'maxspeed=20' to living street --- assets/layers/maxspeed/maxspeed.json | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/assets/layers/maxspeed/maxspeed.json b/assets/layers/maxspeed/maxspeed.json index 2ec3588879..3ee814e945 100644 --- a/assets/layers/maxspeed/maxspeed.json +++ b/assets/layers/maxspeed/maxspeed.json @@ -79,24 +79,6 @@ "type": "pnat" }, "mappings": [ - { - "if": { - "and": [ - "highway=living_street", - "_country!=be" - ] - }, - "then": { - "en": "This is a living street, which has a maxspeed of 20km/h", - "de": "Dies ist eine Wohnstraße, auf der eine Höchstgeschwindigkeit von 20 km/h gilt", - "nl": "Dit is een woonerf en heeft dus een maximale snelheid van 20km/h" - }, - "icon": { - "path": "./assets/layers/maxspeed/living_street_be.svg", - "class": "large" - }, - "hideInAnswer": true - }, { "if": "highway=living_street", "then": { @@ -108,6 +90,7 @@ "path": "./assets/layers/maxspeed/living_street_be.svg", "class": "large" }, + "addExtraTags": ["maxspeed=20"], "hideInAnswer": "_country!=be" } ], From 4602df30469b57a57b9b8e1b8c6cc5c70ff901d7 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 9 Aug 2023 14:18:06 +0200 Subject: [PATCH 09/19] Fix: add safety check to not overuse the OSM-api --- src/Logic/FeatureSource/Sources/OsmFeatureSource.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Logic/FeatureSource/Sources/OsmFeatureSource.ts b/src/Logic/FeatureSource/Sources/OsmFeatureSource.ts index 31616f4391..1475744e9f 100644 --- a/src/Logic/FeatureSource/Sources/OsmFeatureSource.ts +++ b/src/Logic/FeatureSource/Sources/OsmFeatureSource.ts @@ -72,6 +72,11 @@ export default class OsmFeatureSource extends FeatureSourceMerger { return } + if (neededTiles.total > 100) { + console.error("Too much tiles to download!") + return + } + this.isRunning.setData(true) try { const tileNumbers = Tiles.MapRange(neededTiles, (x, y) => { @@ -133,7 +138,6 @@ export default class OsmFeatureSource extends FeatureSourceMerger { } private async LoadTile(z: number, x: number, y: number): Promise { - console.log("OsmFeatureSource: loading ", z, x, y, "from", this._backend) if (z >= 22) { throw "This is an absurd high zoom level" } @@ -145,6 +149,7 @@ export default class OsmFeatureSource extends FeatureSourceMerger { if (this._downloadedTiles.has(index)) { return } + console.log("OsmFeatureSource: loading ", z, x, y, "from", this._backend) this._downloadedTiles.add(index) const bbox = BBox.fromTile(z, x, y) From c2628cb5e7ca4443b1de56464ac270dd76b62803 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 9 Aug 2023 14:18:31 +0200 Subject: [PATCH 10/19] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 18f75eed6b..07948e4e65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mapcomplete", - "version": "0.31.2", + "version": "0.31.3", "repository": "https://github.com/pietervdvn/MapComplete", "description": "A small website to edit OSM easily", "bugs": "https://github.com/pietervdvn/MapComplete/issues", From c1a25af54da0e11d0998ad56b0dec4af40008a76 Mon Sep 17 00:00:00 2001 From: Robin van der Linde Date: Wed, 9 Aug 2023 18:26:06 +0200 Subject: [PATCH 11/19] Add check_date, payment, allow move and delete --- assets/layers/questions/questions.json | 27 +++++++++++++++++++ .../themes/elongated_coin/elongated_coin.json | 23 +++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/assets/layers/questions/questions.json b/assets/layers/questions/questions.json index 3774c0a912..678b0b4024 100644 --- a/assets/layers/questions/questions.json +++ b/assets/layers/questions/questions.json @@ -2174,6 +2174,33 @@ } } ] + }, + { + "id": "check_date", + "question": { + "en": "When was this object last checked?", + "de": "Wann wurde dieses Objekt zuletzt kontrolliert?", + "nl": "Wanneer is dit object voor het laatst gecontroleerd?" + }, + "freeform": { + "key": "check_date", + "type": "date" + }, + "render": { + "en": "This object was last checked on {check_date}", + "de": "Dieses Objekt wurde zuletzt kontrolliert am {check_date}", + "nl": "Dit object is voor het laatst gecontroleerd op {check_date}" + }, + "mappings": [ + { + "if": "check_date:={_now:date}", + "then": { + "en": "This object was last checked today", + "de": "Dieses Objekt wurde heute zuletzt kontrolliert", + "nl": "Dit object is vandaag voor het laatst gecontroleerd" + } + } + ] } ] } \ No newline at end of file diff --git a/assets/themes/elongated_coin/elongated_coin.json b/assets/themes/elongated_coin/elongated_coin.json index 627ce25b45..d1a97f4920 100644 --- a/assets/themes/elongated_coin/elongated_coin.json +++ b/assets/themes/elongated_coin/elongated_coin.json @@ -86,6 +86,21 @@ } ] }, + { + "id": "payment", + "builtin": "payment-options-split", + "override": { + "mappings": [ + {}, + {}, + {}, + {}, + { + "hideInAnswer": true + } + ] + } + }, { "id": "coin", "question": { @@ -205,7 +220,8 @@ } ] }, - "level" + "level", + "check_date" ], "mapRendering": [ { @@ -235,6 +251,11 @@ ] } ], + "allowMove": { + "enableImproveAccuracy": true, + "enableRelocation": true + }, + "deletion": true, "filter": [ "open_now" ] From 8485a4af036945022317f791d4077c75d85859b7 Mon Sep 17 00:00:00 2001 From: Robin van der Linde Date: Wed, 9 Aug 2023 19:41:23 +0200 Subject: [PATCH 12/19] Add filters, remove override --- assets/layers/filters/filters.json | 22 +++++++++++++++++++ .../themes/elongated_coin/elongated_coin.json | 20 ++++------------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/assets/layers/filters/filters.json b/assets/layers/filters/filters.json index 4b1f6edadd..1f9abce814 100644 --- a/assets/layers/filters/filters.json +++ b/assets/layers/filters/filters.json @@ -55,6 +55,28 @@ } ] }, + { + "id": "accepts_debit_cards", + "options": [ + { + "osmTags": "payment:debit_cards=yes", + "question": { + "en": "Accepts debit cards" + } + } + ] + }, + { + "id": "accepts_credit_cards", + "options": [ + { + "osmTags": "payment:credit_cards=yes", + "question": { + "en": "Accepts credit cards" + } + } + ] + }, { "id": "has_image", "options": [ diff --git a/assets/themes/elongated_coin/elongated_coin.json b/assets/themes/elongated_coin/elongated_coin.json index d1a97f4920..9ad55da16f 100644 --- a/assets/themes/elongated_coin/elongated_coin.json +++ b/assets/themes/elongated_coin/elongated_coin.json @@ -86,21 +86,7 @@ } ] }, - { - "id": "payment", - "builtin": "payment-options-split", - "override": { - "mappings": [ - {}, - {}, - {}, - {}, - { - "hideInAnswer": true - } - ] - } - }, + "payment-options-split", { "id": "coin", "question": { @@ -257,7 +243,9 @@ }, "deletion": true, "filter": [ - "open_now" + "open_now", + "accepts_debit_cards", + "accepts_credit_cards" ] } ], From 03aafbe99c0d9f4fa5768d18e7bde093529ce93f Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 10 Aug 2023 14:10:06 +0200 Subject: [PATCH 13/19] Themes: add possibility to add an icon to 'render' (just like with mappings), add contact:mastodon support as general question, add mastodon question to hackerspaces --- assets/layers/hackerspace/hackerspace.json | 1 + assets/layers/questions/questions.json | 27 +++- langs/en.json | 5 + .../Json/TagRenderingConfigJson.ts | 20 +++ src/Models/ThemeConfig/TagRenderingConfig.ts | 64 +++++--- src/UI/InputElement/Validators.ts | 3 + .../Validators/FediverseValidator.ts | 63 ++++++++ src/UI/SpecialVisualizations.ts | 153 ++++++++++-------- 8 files changed, 237 insertions(+), 99 deletions(-) create mode 100644 src/UI/InputElement/Validators/FediverseValidator.ts diff --git a/assets/layers/hackerspace/hackerspace.json b/assets/layers/hackerspace/hackerspace.json index 8ebf9bf87f..2beb640e20 100644 --- a/assets/layers/hackerspace/hackerspace.json +++ b/assets/layers/hackerspace/hackerspace.json @@ -112,6 +112,7 @@ "website", "email", "phone", + "mastodon", { "builtin": "opening_hours_24_7", "override": { diff --git a/assets/layers/questions/questions.json b/assets/layers/questions/questions.json index 678b0b4024..c3412b52d7 100644 --- a/assets/layers/questions/questions.json +++ b/assets/layers/questions/questions.json @@ -173,11 +173,13 @@ "render": { "*": "{phone}" }, + "icon": "./assets/layers/questions/phone.svg", "mappings": [ { "if": "contact:phone~*", "then": "{contact:phone}", - "hideInAnswer": true + "hideInAnswer": true, + "icon": "./assets/layers/questions/phone.svg" } ], "freeform": { @@ -188,6 +190,21 @@ ] } }, + { + "id": "mastodon", + "description": "Shows and asks for the mastodon handle", + "question": { + "en": "What is the Mastodon-handle of {title()}?" + }, + "freeform": { + "key": "contact:mastodon", + "type": "fediverse" + }, + "render": { + "*": "{fediverse_link(contact:mastodon)}" + }, + "icon": "./assets/svg/mastodon.svg" + }, { "id": "osmlink", "render": { @@ -205,6 +222,7 @@ "render": { "*": "{email}" }, + "icon": "./assets/svg/envelope.svg", "labels": [ "contact" ], @@ -236,6 +254,7 @@ "mappings": [ { "if": "contact:email~*", + "icon": "./assets/svg/envelope.svg", "then": "{contact:email}", "hideInAnswer": true } @@ -253,6 +272,7 @@ "labels": [ "contact" ], + "icon": "./assets/layers/icons/website.svg", "question": { "en": "What is the website of {title()}?", "nl": "Wat is de website van {title()}?", @@ -292,7 +312,8 @@ { "if": "contact:website~*", "then": "{contact:website}", - "hideInAnswer": true + "hideInAnswer": true, + "icon": "./assets/layers/icons/website.svg" } ] }, @@ -2203,4 +2224,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/langs/en.json b/langs/en.json index 62a4818434..24f6953cf1 100644 --- a/langs/en.json +++ b/langs/en.json @@ -610,6 +610,11 @@ "feedback": "This is not a valid email address", "noAt": "An e-mail address must contain an @" }, + "fediverse": { + "description": "A fediverse handle, often @username@server.tld", + "feedback": "A fediverse handle consists of @username@server.tld or is a link to a profile", + "invalidHost": "{host} is not a valid hostname" + }, "float": { "description": "a number", "feedback": "This is not a number" diff --git a/src/Models/ThemeConfig/Json/TagRenderingConfigJson.ts b/src/Models/ThemeConfig/Json/TagRenderingConfigJson.ts index 583294f3df..56bfd78766 100644 --- a/src/Models/ThemeConfig/Json/TagRenderingConfigJson.ts +++ b/src/Models/ThemeConfig/Json/TagRenderingConfigJson.ts @@ -41,6 +41,26 @@ export interface TagRenderingConfigJson { | Record | { special: Record> & { type: string } } + /** + * An icon shown next to the rendering; typically shown pretty small + * This is only shown next to the "render" value + * Type: icon + */ + icon?: + | string + | { + /** + * The path to the icon + * Type: icon + */ + path: string + /** + * A hint to mapcomplete on how to render this icon within the mapping. + * This is translated to 'mapping-icon-', so defining your own in combination with a custom CSS is possible (but discouraged) + */ + class?: "small" | "medium" | "large" | string + } + /** * Only show this tagrendering (or ask the question) if the selected object also matches the tags specified as `condition`. * diff --git a/src/Models/ThemeConfig/TagRenderingConfig.ts b/src/Models/ThemeConfig/TagRenderingConfig.ts index 6cd5dc4dc8..940056a99b 100644 --- a/src/Models/ThemeConfig/TagRenderingConfig.ts +++ b/src/Models/ThemeConfig/TagRenderingConfig.ts @@ -1,23 +1,24 @@ -import { Translation, TypedTranslation } from "../../UI/i18n/Translation" -import { TagsFilter } from "../../Logic/Tags/TagsFilter" +import {Translation, TypedTranslation} from "../../UI/i18n/Translation" +import {TagsFilter} from "../../Logic/Tags/TagsFilter" import Translations from "../../UI/i18n/Translations" -import { TagUtils, UploadableTag } from "../../Logic/Tags/TagUtils" -import { And } from "../../Logic/Tags/And" -import { Utils } from "../../Utils" -import { Tag } from "../../Logic/Tags/Tag" +import {TagUtils, UploadableTag} from "../../Logic/Tags/TagUtils" +import {And} from "../../Logic/Tags/And" +import {Utils} from "../../Utils" +import {Tag} from "../../Logic/Tags/Tag" import BaseUIElement from "../../UI/BaseUIElement" import Combine from "../../UI/Base/Combine" import Title from "../../UI/Base/Title" import Link from "../../UI/Base/Link" import List from "../../UI/Base/List" -import { - MappingConfigJson, - QuestionableTagRenderingConfigJson, -} from "./Json/QuestionableTagRenderingConfigJson" -import { FixedUiElement } from "../../UI/Base/FixedUiElement" -import { Paragraph } from "../../UI/Base/Paragraph" +import {MappingConfigJson, QuestionableTagRenderingConfigJson,} from "./Json/QuestionableTagRenderingConfigJson" +import {FixedUiElement} from "../../UI/Base/FixedUiElement" +import {Paragraph} from "../../UI/Base/Paragraph" import Svg from "../../Svg" -import Validators, { ValidatorType } from "../../UI/InputElement/Validators" +import Validators, {ValidatorType} from "../../UI/InputElement/Validators" + +export interface Icon { + +} export interface Mapping { readonly if: UploadableTag @@ -45,6 +46,8 @@ export interface Mapping { export default class TagRenderingConfig { public readonly id: string public readonly render?: TypedTranslation + public readonly renderIcon?: string + public readonly renderIconClass?: string public readonly question?: TypedTranslation public readonly questionhint?: TypedTranslation public readonly condition?: TagsFilter @@ -121,9 +124,16 @@ export default class TagRenderingConfig { this.question = Translations.T(json.question, translationKey + ".question") this.questionhint = Translations.T(json.questionHint, translationKey + ".questionHint") this.description = Translations.T(json.description, translationKey + ".description") - this.condition = TagUtils.Tag(json.condition ?? { and: [] }, `${context}.condition`) + this.condition = TagUtils.Tag(json.condition ?? {and: []}, `${context}.condition`) + if (typeof json.icon === "string") { + this.renderIcon = json.icon + this.renderIconClass = "small" + }else if (typeof json.icon === "object"){ + this.renderIcon = json.icon.path + this.renderIconClass = json.icon.class + } this.metacondition = TagUtils.Tag( - json.metacondition ?? { and: [] }, + json.metacondition ?? {and: []}, `${context}.metacondition` ) if (json.freeform) { @@ -238,15 +248,17 @@ export default class TagRenderingConfig { if (txt.indexOf("{" + this.freeform.key + ":") >= 0) { continue } - if (txt.indexOf("{canonical(" + this.freeform.key + ")") >= 0) { - continue - } + if ( this.freeform.type === "opening_hours" && txt.indexOf("{opening_hours_table(") >= 0 ) { continue } + const keyFirstArg = ["canonical", "fediverse_link"] + if (keyFirstArg.some(funcName => txt.indexOf(`{${funcName}(${this.freeform.key}`) >= 0)) { + continue + } if ( this.freeform.type === "wikidata" && txt.indexOf("{wikipedia(" + this.freeform.key) >= 0 @@ -532,7 +544,7 @@ export default class TagRenderingConfig { */ public GetRenderValueWithImage( tags: Record - ): { then: TypedTranslation; icon?: string } | undefined { + ): { then: TypedTranslation; icon?: string, iconClass?: string } | undefined { if (this.condition !== undefined) { if (!this.condition.matchesProperties(tags)) { return undefined @@ -551,7 +563,7 @@ export default class TagRenderingConfig { } if (this.freeform?.key === undefined || tags[this.freeform.key] !== undefined) { - return { then: this.render } + return {then: this.render, icon: this.renderIcon, iconClass: this.renderIconClass} } return undefined @@ -773,7 +785,7 @@ export default class TagRenderingConfig { if (m.ifnot !== undefined) { msgs.push( "Unselecting this answer will add " + - m.ifnot.asHumanString(true, false, {}) + m.ifnot.asHumanString(true, false, {}) ) } return msgs @@ -803,12 +815,12 @@ export default class TagRenderingConfig { this.description, this.question !== undefined ? new Combine([ - "The question is ", - new FixedUiElement(this.question.txt).SetClass("font-bold bold"), - ]) + "The question is ", + new FixedUiElement(this.question.txt).SetClass("font-bold bold"), + ]) : new FixedUiElement( - "This tagrendering has no question and is thus read-only" - ).SetClass("italic"), + "This tagrendering has no question and is thus read-only" + ).SetClass("italic"), new Combine(withRender), mappings, condition, diff --git a/src/UI/InputElement/Validators.ts b/src/UI/InputElement/Validators.ts index c340fc3552..1e10e8ec3e 100644 --- a/src/UI/InputElement/Validators.ts +++ b/src/UI/InputElement/Validators.ts @@ -18,6 +18,7 @@ import ColorValidator from "./Validators/ColorValidator" import BaseUIElement from "../BaseUIElement" import Combine from "../Base/Combine" import Title from "../Base/Title" +import FediverseValidator from "./Validators/FediverseValidator"; export type ValidatorType = (typeof Validators.availableTypes)[number] @@ -39,6 +40,7 @@ export default class Validators { "phone", "opening_hours", "color", + "fediverse" ] as const public static readonly AllValidators: ReadonlyArray = [ @@ -58,6 +60,7 @@ export default class Validators { new PhoneValidator(), new OpeningHoursValidator(), new ColorValidator(), + new FediverseValidator() ] private static _byType = Validators._byTypeConstructor() diff --git a/src/UI/InputElement/Validators/FediverseValidator.ts b/src/UI/InputElement/Validators/FediverseValidator.ts new file mode 100644 index 0000000000..f1d5f6682e --- /dev/null +++ b/src/UI/InputElement/Validators/FediverseValidator.ts @@ -0,0 +1,63 @@ +import {Validator} from "../Validator" +import {Translation} from "../../i18n/Translation"; +import Translations from "../../i18n/Translations"; + +export default class FediverseValidator extends Validator { + + public static readonly usernameAtServer: RegExp = /^@?(\w+)@((\w|\.)+)$/ + + constructor() { + super("fediverse", "Validates fediverse addresses and normalizes them into `@username@server`-format"); + } + + /** + * Returns an `@username@host` + * @param s + */ + reformat(s: string): string { + if(!s.startsWith("@")){ + s = "@"+s + } + if (s.match(FediverseValidator.usernameAtServer)) { + return s + } + try { + const url = new URL(s) + const path = url.pathname + if (path.match(/^\/\w+$/)) { + return `@${path.substring(1)}@${url.hostname}`; + } + } catch (e) { + // Nothing to do here + } + return undefined + } +getFeedback(s: string): Translation | undefined { + const match = s.match(FediverseValidator.usernameAtServer) + console.log("Match:", match) + if (match) { + const host = match[2] + try { + const url = new URL("https://" + host) + return undefined + } catch (e) { + return Translations.t.validation.fediverse.invalidHost.Subs({host}) + } + } + try { + const url = new URL(s) + const path = url.pathname + if (path.match(/^\/\w+$/)) { + return undefined + } + } catch (e) { + // Nothing to do here + } + return Translations.t.validation.fediverse.feedback +} + + isValid(s): boolean { + return this.getFeedback(s) === undefined + + } +} diff --git a/src/UI/SpecialVisualizations.ts b/src/UI/SpecialVisualizations.ts index 7395c4f14b..2c0260c477 100644 --- a/src/UI/SpecialVisualizations.ts +++ b/src/UI/SpecialVisualizations.ts @@ -1,56 +1,52 @@ import Combine from "./Base/Combine" -import { FixedUiElement } from "./Base/FixedUiElement" +import {FixedUiElement} from "./Base/FixedUiElement" import BaseUIElement from "./BaseUIElement" import Title from "./Base/Title" import Table from "./Base/Table" -import { - RenderingSpecification, - SpecialVisualization, - SpecialVisualizationState, -} from "./SpecialVisualization" -import { HistogramViz } from "./Popup/HistogramViz" -import { MinimapViz } from "./Popup/MinimapViz" -import { ShareLinkViz } from "./Popup/ShareLinkViz" -import { UploadToOsmViz } from "./Popup/UploadToOsmViz" -import { MultiApplyViz } from "./Popup/MultiApplyViz" -import { AddNoteCommentViz } from "./Popup/AddNoteCommentViz" -import { PlantNetDetectionViz } from "./Popup/PlantNetDetectionViz" +import {RenderingSpecification, SpecialVisualization, SpecialVisualizationState,} from "./SpecialVisualization" +import {HistogramViz} from "./Popup/HistogramViz" +import {MinimapViz} from "./Popup/MinimapViz" +import {ShareLinkViz} from "./Popup/ShareLinkViz" +import {UploadToOsmViz} from "./Popup/UploadToOsmViz" +import {MultiApplyViz} from "./Popup/MultiApplyViz" +import {AddNoteCommentViz} from "./Popup/AddNoteCommentViz" +import {PlantNetDetectionViz} from "./Popup/PlantNetDetectionViz" import TagApplyButton from "./Popup/TagApplyButton" -import { CloseNoteButton } from "./Popup/CloseNoteButton" -import { MapillaryLinkVis } from "./Popup/MapillaryLinkVis" -import { Store, Stores, UIEventSource } from "../Logic/UIEventSource" +import {CloseNoteButton} from "./Popup/CloseNoteButton" +import {MapillaryLinkVis} from "./Popup/MapillaryLinkVis" +import {Store, Stores, UIEventSource} from "../Logic/UIEventSource" import AllTagsPanel from "./Popup/AllTagsPanel.svelte" import AllImageProviders from "../Logic/ImageProviders/AllImageProviders" -import { ImageCarousel } from "./Image/ImageCarousel" -import { ImageUploadFlow } from "./Image/ImageUploadFlow" -import { VariableUiElement } from "./Base/VariableUIElement" -import { Utils } from "../Utils" -import Wikidata, { WikidataResponse } from "../Logic/Web/Wikidata" -import { Translation } from "./i18n/Translation" +import {ImageCarousel} from "./Image/ImageCarousel" +import {ImageUploadFlow} from "./Image/ImageUploadFlow" +import {VariableUiElement} from "./Base/VariableUIElement" +import {Utils} from "../Utils" +import Wikidata, {WikidataResponse} from "../Logic/Web/Wikidata" +import {Translation} from "./i18n/Translation" import Translations from "./i18n/Translations" import ReviewForm from "./Reviews/ReviewForm" import ReviewElement from "./Reviews/ReviewElement" import OpeningHoursVisualization from "./OpeningHours/OpeningHoursVisualization" import LiveQueryHandler from "../Logic/Web/LiveQueryHandler" -import { SubtleButton } from "./Base/SubtleButton" +import {SubtleButton} from "./Base/SubtleButton" import Svg from "../Svg" import NoteCommentElement from "./Popup/NoteCommentElement" import ImgurUploader from "../Logic/ImageProviders/ImgurUploader" import FileSelectorButton from "./Input/FileSelectorButton" -import { LoginToggle } from "./Popup/LoginButton" +import {LoginToggle} from "./Popup/LoginButton" import Toggle from "./Input/Toggle" -import { SubstitutedTranslation } from "./SubstitutedTranslation" +import {SubstitutedTranslation} from "./SubstitutedTranslation" import List from "./Base/List" import StatisticsPanel from "./BigComponents/StatisticsPanel" import AutoApplyButton from "./Popup/AutoApplyButton" -import { LanguageElement } from "./Popup/LanguageElement" +import {LanguageElement} from "./Popup/LanguageElement" import FeatureReviews from "../Logic/Web/MangroveReviews" import Maproulette from "../Logic/Maproulette" import SvelteUIElement from "./Base/SvelteUIElement" -import { BBoxFeatureSourceForLayer } from "../Logic/FeatureSource/Sources/TouchesBboxFeatureSource" +import {BBoxFeatureSourceForLayer} from "../Logic/FeatureSource/Sources/TouchesBboxFeatureSource" import QuestionViz from "./Popup/QuestionViz" -import { Feature, Point } from "geojson" -import { GeoOperations } from "../Logic/GeoOperations" +import {Feature, Point} from "geojson" +import {GeoOperations} from "../Logic/GeoOperations" import CreateNewNote from "./Popup/CreateNewNote.svelte" import AddNewPoint from "./Popup/AddNewPoint/AddNewPoint.svelte" import UserProfile from "./BigComponents/UserProfile.svelte" @@ -58,30 +54,27 @@ import LanguagePicker from "./LanguagePicker" import Link from "./Base/Link" import LayerConfig from "../Models/ThemeConfig/LayerConfig" import TagRenderingConfig from "../Models/ThemeConfig/TagRenderingConfig" -import NearbyImages, { - NearbyImageOptions, - P4CPicture, - SelectOneNearbyImage, -} from "./Popup/NearbyImages" -import { Tag } from "../Logic/Tags/Tag" +import NearbyImages, {NearbyImageOptions, P4CPicture, SelectOneNearbyImage,} from "./Popup/NearbyImages" +import {Tag} from "../Logic/Tags/Tag" import ChangeTagAction from "../Logic/Osm/Actions/ChangeTagAction" -import { And } from "../Logic/Tags/And" -import { SaveButton } from "./Popup/SaveButton" +import {And} from "../Logic/Tags/And" +import {SaveButton} from "./Popup/SaveButton" import Lazy from "./Base/Lazy" -import { CheckBox } from "./Input/Checkboxes" +import {CheckBox} from "./Input/Checkboxes" import Slider from "./Input/Slider" -import { OsmTags, WayId } from "../Models/OsmFeature" +import {OsmTags, WayId} from "../Models/OsmFeature" import MoveWizard from "./Popup/MoveWizard" import SplitRoadWizard from "./Popup/SplitRoadWizard" -import { ExportAsGpxViz } from "./Popup/ExportAsGpxViz" +import {ExportAsGpxViz} from "./Popup/ExportAsGpxViz" import WikipediaPanel from "./Wikipedia/WikipediaPanel.svelte" import TagRenderingEditable from "./Popup/TagRendering/TagRenderingEditable.svelte" -import { PointImportButtonViz } from "./Popup/ImportButtons/PointImportButtonViz" +import {PointImportButtonViz} from "./Popup/ImportButtons/PointImportButtonViz" import WayImportButtonViz from "./Popup/ImportButtons/WayImportButtonViz" import ConflateImportButtonViz from "./Popup/ImportButtons/ConflateImportButtonViz" import DeleteWizard from "./Popup/DeleteFlow/DeleteWizard.svelte" -import { OpenJosm } from "./BigComponents/OpenJosm" +import {OpenJosm} from "./BigComponents/OpenJosm" import OpenIdEditor from "./BigComponents/OpenIdEditor.svelte" +import FediverseValidator from "./InputElement/Validators/FediverseValidator"; class NearbyImageVis implements SpecialVisualization { // Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests @@ -180,7 +173,7 @@ class NearbyImageVis implements SpecialVisualization { towardsCenter, new Combine([ new VariableUiElement( - radius.GetValue().map((radius) => t.withinRadius.Subs({ radius })) + radius.GetValue().map((radius) => t.withinRadius.Subs({radius})) ), radius, ]).SetClass("flex justify-between"), @@ -393,24 +386,24 @@ export default class SpecialVisualizations { viz.docs, viz.args.length > 0 ? new Table( - ["name", "default", "description"], - viz.args.map((arg) => { - let defaultArg = arg.defaultValue ?? "_undefined_" - if (defaultArg == "") { - defaultArg = "_empty string_" - } - return [arg.name, defaultArg, arg.doc] - }) - ) + ["name", "default", "description"], + viz.args.map((arg) => { + let defaultArg = arg.defaultValue ?? "_undefined_" + if (defaultArg == "") { + defaultArg = "_empty string_" + } + return [arg.name, defaultArg, arg.doc] + }) + ) : undefined, new Title("Example usage of " + viz.funcName, 4), new FixedUiElement( viz.example ?? - "`{" + - viz.funcName + - "(" + - viz.args.map((arg) => arg.defaultValue).join(",") + - ")}`" + "`{" + + viz.funcName + + "(" + + viz.args.map((arg) => arg.defaultValue).join(",") + + ")}`" ).SetClass("literal-code"), ]) } @@ -469,14 +462,14 @@ export default class SpecialVisualizations { s.structuredExamples === undefined ? [] : s.structuredExamples().map((e) => { - return s.constr( - state, - new UIEventSource>(e.feature.properties), - e.args, - e.feature, - undefined - ) - }) + return s.constr( + state, + new UIEventSource>(e.feature.properties), + e.args, + e.feature, + undefined + ) + }) return new Combine([new Title(s.funcName), s.docs, ...examples]) } @@ -491,7 +484,7 @@ export default class SpecialVisualizations { let [lon, lat] = GeoOperations.centerpointCoordinates(feature) return new SvelteUIElement(AddNewPoint, { state, - coordinate: { lon, lat }, + coordinate: {lon, lat}, }) }, }, @@ -610,7 +603,7 @@ export default class SpecialVisualizations { feature: Feature ): BaseUIElement { const [lon, lat] = GeoOperations.centerpointCoordinates(feature) - return new SvelteUIElement(CreateNewNote, { state, coordinate: { lon, lat } }) + return new SvelteUIElement(CreateNewNote, {state, coordinate: {lon, lat}}) }, }, new CloseNoteButton(), @@ -687,7 +680,7 @@ export default class SpecialVisualizations { docs: "Prints all key-value pairs of the object - used for debugging", args: [], constr: (state, tags: UIEventSource) => - new SvelteUIElement(AllTagsPanel, { tags, state }), + new SvelteUIElement(AllTagsPanel, {tags, state}), }, { funcName: "image_carousel", @@ -1326,7 +1319,7 @@ export default class SpecialVisualizations { ], constr(state, featureTags, args) { const [key, tr] = args - const translation = new Translation({ "*": tr }) + const translation = new Translation({"*": tr}) return new VariableUiElement( featureTags.map((tags) => { const properties: object[] = JSON.parse(tags[key]) @@ -1344,12 +1337,32 @@ export default class SpecialVisualizations { ) }, }, + { + funcName: "fediverse_link", + docs: "Converts a fediverse username or link into a clickable link", + args: [{ + name: "key", + doc: "The attribute-name containing the link", + required: true + }], + constr(state: SpecialVisualizationState, tagSource: UIEventSource>, argument: string[], feature: Feature, layer: LayerConfig): BaseUIElement { + const key = argument[0] + const validator = new FediverseValidator() + return new VariableUiElement(tagSource.map(tags => tags[key]).map(fediAccount => { + fediAccount = validator.reformat(fediAccount) + const [_, username, host] = fediAccount.match(FediverseValidator.usernameAtServer) + + return new Link(fediAccount, "https://" + host + "/@" + username, true) + } + )) + } + } ] specialVisualizations.push(new AutoApplyButton(specialVisualizations)) const invalid = specialVisualizations - .map((sp, i) => ({ sp, i })) + .map((sp, i) => ({sp, i})) .filter((sp) => sp.sp.funcName === undefined) if (invalid.length > 0) { throw ( From 7a953348824f6d601c16a0e632aac8353e0283fb Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 9 Aug 2023 14:42:38 +0200 Subject: [PATCH 14/19] Fix: open correct menu if set in hash --- src/Logic/Web/ThemeViewStateHashActor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Logic/Web/ThemeViewStateHashActor.ts b/src/Logic/Web/ThemeViewStateHashActor.ts index e69d005568..a474b029bd 100644 --- a/src/Logic/Web/ThemeViewStateHashActor.ts +++ b/src/Logic/Web/ThemeViewStateHashActor.ts @@ -100,7 +100,7 @@ export default class ThemeViewStateHashActor { private loadStateFromHash(hash: string) { const state = this._state - const parts = hash.split(";") + const parts = hash.split(":") outer: for (const { toggle, name, showOverOthers, submenu } of state.guistate.allToggles) { for (const part of parts) { if (part === name) { From f511423845ffe867fcda22ea12052a26aa6885ba Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 10 Aug 2023 15:36:32 +0200 Subject: [PATCH 15/19] Scripts: small fixes --- scripts/generateDocs.ts | 10 +++++----- scripts/removeTranslationString.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/generateDocs.ts b/scripts/generateDocs.ts index a0ea6dd87e..376cd4d20f 100644 --- a/scripts/generateDocs.ts +++ b/scripts/generateDocs.ts @@ -10,7 +10,6 @@ import Title from "../src/UI/Base/Title" import QueryParameterDocumentation from "../src/UI/QueryParameterDocumentation" import ScriptUtils from "./ScriptUtils" import List from "../src/UI/Base/List" -import SharedTagRenderings from "../src/Customizations/SharedTagRenderings" import Translations from "../src/UI/i18n/Translations" import themeOverview from "../src/assets/generated/theme_overview.json" import LayoutConfig from "../src/Models/ThemeConfig/LayoutConfig" @@ -27,6 +26,7 @@ import ThemeViewState from "../src/Models/ThemeViewState" import Validators from "../src/UI/InputElement/Validators" import questions from "../src/assets/generated/layers/questions.json" import { LayerConfigJson } from "../src/Models/ThemeConfig/Json/LayerConfigJson" + function WriteFile( filename, html: BaseUIElement, @@ -384,11 +384,11 @@ WriteFile("./Docs/BuiltinQuestions.md", qLayer.GenerateDocumentation([], new Map } } for (const usedBuiltin of usedBuiltins) { - var using = layersUsingBuiltin.get(usedBuiltin) - if (using === undefined) { + const usingLayers = layersUsingBuiltin.get(usedBuiltin) + if (usingLayers === undefined) { layersUsingBuiltin.set(usedBuiltin, [layer.id]) } else { - using.push(layer.id) + usingLayers.push(layer.id) } } @@ -409,7 +409,7 @@ WriteFile("./Docs/URL_Parameters.md", QueryParameterDocumentation.GenerateQueryP "src/Logic/Web/QueryParameters.ts", "src/UI/QueryParameterDocumentation.ts", ]) -if (fakedom === undefined || window === undefined) { +if (fakedom === undefined) { throw "FakeDom not initialized" } QueryParameters.GetQueryParameter( diff --git a/scripts/removeTranslationString.ts b/scripts/removeTranslationString.ts index f7b55e2e8f..e18a80038c 100644 --- a/scripts/removeTranslationString.ts +++ b/scripts/removeTranslationString.ts @@ -1,5 +1,5 @@ import ScriptUtils from "./ScriptUtils" -import { Utils } from "../Utils" +import { Utils } from "../src/Utils" import * as fs from "fs" async function main(args: string[]) { From 488ef487e181de74c70841435c8c457f63302d67 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 10 Aug 2023 15:37:02 +0200 Subject: [PATCH 16/19] Chore: remove some no longer needed translations, add new translation --- langs/ca.json | 13 ------------- langs/cs.json | 13 ------------- langs/da.json | 13 ------------- langs/de.json | 13 ------------- langs/en.json | 14 +------------- langs/eo.json | 2 -- langs/es.json | 13 ------------- langs/fr.json | 13 ------------- langs/gl.json | 11 ----------- langs/hu.json | 11 ----------- langs/id.json | 9 --------- langs/it.json | 13 ------------- langs/ja.json | 11 ----------- langs/layers/da.json | 7 +++++++ langs/layers/de.json | 10 +++++++--- langs/layers/en.json | 16 +++++++++++++--- langs/layers/es.json | 7 +++++++ langs/layers/fr.json | 7 +++++++ langs/layers/nl.json | 10 +++++++--- langs/nb_NO.json | 12 ------------ langs/nl.json | 13 ------------- langs/pa_PK.json | 1 - langs/pl.json | 11 ----------- langs/pt.json | 13 ------------- langs/pt_BR.json | 11 ----------- langs/ru.json | 11 ----------- langs/zh_Hant.json | 13 ------------- 27 files changed, 49 insertions(+), 242 deletions(-) diff --git a/langs/ca.json b/langs/ca.json index d96cbec37b..80b345b8ff 100644 --- a/langs/ca.json +++ b/langs/ca.json @@ -262,21 +262,8 @@ "searching": "Cercant…" }, "sharescreen": { - "addToHomeScreen": "

Afegir-lo a la pantalla d'inici

Pots afegir aquesta web a la pantalla d'inici del teu smartphone per a que es vegi més nadiu. Apreta al botó 'Afegir a l'inici' a la barra d'adreces URL per fer-ho.", "copiedToClipboard": "Enllaç copiat al portapapers", - "downloadCustomTheme": "Descarrega la configuració per a aquest tema", - "downloadCustomThemeHelp": "Un contribuïdor amb experiència pot utilitzar un arxiu per a millorar el vostre tema", - "editThemeDescription": "Afegir o canviar preguntes d'aquesta petició", - "editThisTheme": "Editar aquest repte", "embedIntro": "

Inclou-ho a la teva pàgina web

Per favor, inclou aquest mapa dins de la teva pàgina web.
T'animem a que ho facis, no cal que demanis permís.
És gratuït, i sempre ho serà. A més gent que ho faci servir més valuós serà.", - "fsAddNew": "Activar el botó d'afegir nou PDI'", - "fsGeolocation": "Activar el botó de 'geolocalitza'm' (només mòbil)", - "fsIncludeCurrentBackgroundMap": "Incloure l'opció de fons actual {name}", - "fsIncludeCurrentLayers": "Incloure les opcions de capa actual", - "fsIncludeCurrentLocation": "Incloure localització actual", - "fsLayerControlToggle": "Iniciar el control de capes avançat", - "fsLayers": "Activar el control de capes", - "fsSearch": "Activar la barra de cerca", "fsUserbadge": "Activar el botó d'entrada", "fsWelcomeMessage": "Mostra el missatge emergent de benvinguda i pestanyes associades", "intro": "

Comparteix aquest mapa

Comparteix aquest mapa copiant l'enllaç de sota i enviant-lo a amics i família:", diff --git a/langs/cs.json b/langs/cs.json index 00d662fbd0..16adfe5617 100644 --- a/langs/cs.json +++ b/langs/cs.json @@ -262,21 +262,8 @@ "searching": "Hledání…" }, "sharescreen": { - "addToHomeScreen": "

Přidejte stránku na domovskou obrazovku

Tuto webovou stránku můžete snadno přidat na domovskou obrazovku vašeho smartphonu, aby působila nativně. Klikněte na tlačítko „Přidat na domovskou obrazovku“ na panelu s adresou URL.", "copiedToClipboard": "Odkaz zkopírovaný do schránky", - "downloadCustomTheme": "Stáhnout konfiguraci tohoto tématu", - "downloadCustomThemeHelp": "Zkušený přispěvatel může tento soubor použít k vylepšení vašeho tématu", - "editThemeDescription": "Přidejte nebo změňte otázky k tomuto tématu mapy", - "editThisTheme": "Upravit toto téma", "embedIntro": "

Vložte mapu na své webové stránky

Prosíme, vložte tuto mapu na své webové stránky.
Doporučujeme vám to udělat - nemusíte ani žádat o povolení.
Je a vždy to bude zdarma. Čím více lidí bude projekt používat, tím bude cennější.", - "fsAddNew": "Povolit tlačítko „přidat nový bod zájmu“", - "fsGeolocation": "Povolit tlačítko „geolokovat mě“ (pouze pro mobilní zařízení)", - "fsIncludeCurrentBackgroundMap": "Zahrnout aktuální volbu pozadí {name}", - "fsIncludeCurrentLayers": "Zahrnout aktuální volby vrstvy", - "fsIncludeCurrentLocation": "Zahrnout aktuální polohu", - "fsLayerControlToggle": "Začněte s rozšířeným ovládáním vrstvy", - "fsLayers": "Povolit ovládání vrstev", - "fsSearch": "Povolit vyhledávací pole", "fsUserbadge": "Povolit tlačítko přihlášení", "fsWelcomeMessage": "Zobrazit vyskakovací okno s uvítací zprávou a související karty", "intro": "

Sdílejte tuto mapu

Sdílejte tuto mapu zkopírováním níže uvedeného odkazu a jeho zasláním přátelům a rodině:", diff --git a/langs/da.json b/langs/da.json index 9b5e9d7ce0..3fcbfa065d 100644 --- a/langs/da.json +++ b/langs/da.json @@ -203,21 +203,8 @@ "searching": "Søger…" }, "sharescreen": { - "addToHomeScreen": "

Tilføj til din hjemmeskærm

Du kan let tilføje denne hjemmeside til din smartphones hjemmeskærm for at få den integreret. Klik på 'Tilføj til hjemmeskærm' knappen i URL-feltet for at gøre det.", "copiedToClipboard": "Link kopierer til udklipsholder", - "downloadCustomTheme": "Download opsætningen for dette tema", - "downloadCustomThemeHelp": "En erfaren bidragyder kan bruge denne fil til at forbedre dit tema", - "editThemeDescription": "Tilføj eller ret spørgsmål til dette korttema", - "editThisTheme": "Ret dette tema", "embedIntro": "

Indlejr på din hjemmeside

Indlejr venligst dette kort på din hjemmeside.
Vi tilskynder dig til det - du behøver ikke engang at spørge om tilladelse.
Det det frit og gratis og vil altid være det. Jo flere der bruger det, jo mere værdifuldt bliver det.", - "fsAddNew": "Slå 'tilføj nyt POI' knappen til", - "fsGeolocation": "Slå 'geolocate-me' knappen til (kun mobil)", - "fsIncludeCurrentBackgroundMap": "Inkluder det aktuelle baggrundsvalg {name}", - "fsIncludeCurrentLayers": "Inkluder det aktuelle valg af lag", - "fsIncludeCurrentLocation": "Inkludere det aktuelle sted", - "fsLayerControlToggle": "Start med lagkontrollen udvidet", - "fsLayers": "Slå lagkontrollen til", - "fsSearch": "Slå søgefeltet til", "fsUserbadge": "Slå loginknappen til", "fsWelcomeMessage": "Vis velkomstbeskeden og tilknyttede faner", "intro": "

Del dette kort

Del dette kort ved at kopiere linket nedenunder og send det til venner og familie:", diff --git a/langs/de.json b/langs/de.json index ff399a2cdc..b296020883 100644 --- a/langs/de.json +++ b/langs/de.json @@ -304,21 +304,8 @@ "searching": "Suchen …" }, "sharescreen": { - "addToHomeScreen": "

Karte zum Startbildschirm hinzufügen

Fügen Sie diese Webseite zum Startbildschirm Ihres Smartphones hinzu, um ein natives Gefühl zu erhalten. Klicken Sie dazu in der Adressleiste auf die Schaltfläche 'Zum Startbildschirm hinzufügen'.", "copiedToClipboard": "Verknüpfung in Zwischenablage kopiert", - "downloadCustomTheme": "Konfiguration für diese Karte herunterladen", - "downloadCustomThemeHelp": "Ein erfahrener Mitwirkender kann diese Datei verwenden, um Ihr Thema zu verbessern", - "editThemeDescription": "Fragen zu diesem Thema hinzufügen oder ändern", - "editThisTheme": "Dieses Thema bearbeiten", "embedIntro": "

Karte in Webseiten einbetten

Betten Sie diese Karte in Ihre Webseite ein.
Wir ermutigen Sie gern dazu - Sie müssen nicht mal um Erlaubnis fragen.
Die Karte ist kostenlos und wird es immer sein. Je mehr Leute die Karte benutzen, desto wertvoller wird sie.", - "fsAddNew": "Schaltfläche 'neuen POI hinzufügen' aktivieren", - "fsGeolocation": "Schaltfläche 'Mich geolokalisieren' aktivieren (nur mobil)", - "fsIncludeCurrentBackgroundMap": "Aktuellen Hintergrund übernehmen ({name})", - "fsIncludeCurrentLayers": "Aktuelle Ebenenauswahl übernehmen", - "fsIncludeCurrentLocation": "Aktuelle Position übernehmen", - "fsLayerControlToggle": "Ausgeklappte Ebenenauswahl anzeigen", - "fsLayers": "Ebenensteuerung aktivieren", - "fsSearch": "Suchleiste aktivieren", "fsUserbadge": "Anmeldefeld aktivieren", "fsWelcomeMessage": "Begrüßung und Registerkarten anzeigen", "intro": "

Karte teilen

Mit dem folgenden Link können Sie diese Karte mit Freunden und Familie teilen:", diff --git a/langs/en.json b/langs/en.json index 24f6953cf1..026bc3df5a 100644 --- a/langs/en.json +++ b/langs/en.json @@ -304,21 +304,9 @@ "searching": "Searching…" }, "sharescreen": { - "addToHomeScreen": "

Add to your home screen

You can easily add this website to your smartphone home screen for a native feel. Click the 'Add to home screen' button in the URL bar to do this.", "copiedToClipboard": "Link copied to clipboard", - "downloadCustomTheme": "Download the configuration for this theme", - "downloadCustomThemeHelp": "An experienced contributor can use this file to improve your theme", - "editThemeDescription": "Add or change questions to this map theme", - "editThisTheme": "Edit this theme", + "documentation": "For more information on available URL-parameters, consult the documentation", "embedIntro": "

Embed on your website

Please, embed this map into your website.
We encourage you to do it - you don't even have to ask permission.
It is free, and always will be. The more people are using this, the more valuable it becomes.", - "fsAddNew": "Enable the 'add new POI' button", - "fsGeolocation": "Enable the 'geolocate-me' button (mobile only)", - "fsIncludeCurrentBackgroundMap": "Include the current background choice {name}", - "fsIncludeCurrentLayers": "Include the current layer choices", - "fsIncludeCurrentLocation": "Include current location", - "fsLayerControlToggle": "Start with the layer control expanded", - "fsLayers": "Enable the layer control", - "fsSearch": "Enable the search bar", "fsUserbadge": "Enable the login button", "fsWelcomeMessage": "Show the welcome message popup and associated tabs", "intro": "

Share this map

Share this map by copying the link below and sending it to friends and family:", diff --git a/langs/eo.json b/langs/eo.json index eb175272cc..ef95a47de0 100644 --- a/langs/eo.json +++ b/langs/eo.json @@ -61,8 +61,6 @@ "searching": "Serĉante…" }, "sharescreen": { - "editThisTheme": "Modifi ĉi tiun etoson", - "fsSearch": "Ŝalti la serĉbreton", "fsUserbadge": "Ŝalti la salutbutonon" }, "skip": "Preterpasi ĉi tiun demandon", diff --git a/langs/es.json b/langs/es.json index 4a3d2da7b4..96a06e3dcd 100644 --- a/langs/es.json +++ b/langs/es.json @@ -209,21 +209,8 @@ "searching": "Buscando…" }, "sharescreen": { - "addToHomeScreen": "

Añadir a la pantalla de inicio

Puedes añadir esta web en la pantalla de inicio de tu smartphone para que se vea más nativo. Aprieta el botón 'añadir a inicio' en la barra de direcciones URL para hacerlo.", "copiedToClipboard": "Enlace copiado en el portapapeles", - "downloadCustomTheme": "Descargar la configuración para este tema", - "downloadCustomThemeHelp": "Un contributor con experiencia puede utilizar este archivo para mejorar tu tema", - "editThemeDescription": "Añadir o cambiar preguntas de este reto", - "editThisTheme": "Editar este reto", "embedIntro": "

Inclúyelo en tu página web

Incluye este mapa en tu página web.
Te animamos a que lo hagas, no hace falta que pidas permiso.
Es gratis, y siempre lo será. A más gente que lo use más valioso será.", - "fsAddNew": "Activar el botón de añadir nuevo PDI'", - "fsGeolocation": "Activar el botón de 'geolocalízame' (només mòbil)", - "fsIncludeCurrentBackgroundMap": "Incluir la opción de fondo actual {name}", - "fsIncludeCurrentLayers": "Incluir las opciones de capa actual", - "fsIncludeCurrentLocation": "Incluir localización actual", - "fsLayerControlToggle": "Iniciar el control de capas avanzado", - "fsLayers": "Activar el control de capas", - "fsSearch": "Activar la barra de búsqueda", "fsUserbadge": "Activar el botón de entrada", "fsWelcomeMessage": "Muestra el mensaje emergente de bienvenida y pestañas asociadas", "intro": "

Comparte este mapa

Comparte este mapa copiando el enlace de debajo y enviándolo a amigos y familia:", diff --git a/langs/fr.json b/langs/fr.json index 7527e367fc..08a5671bc1 100644 --- a/langs/fr.json +++ b/langs/fr.json @@ -242,21 +242,8 @@ "searching": "Chargement…" }, "sharescreen": { - "addToHomeScreen": "

Ajouter à votre page d'accueil

Vous pouvez facilement ajouter la carte à votre écran d'accueil de téléphone. Cliquer sur le bouton 'ajouter à l'écran d'accueil' dans la barre d'adresse pour effectuer cette tâche.", "copiedToClipboard": "Lien copié dans le presse-papier", - "downloadCustomTheme": "Téléchargez la configuration de ce thème", - "downloadCustomThemeHelp": "Un contributeur expérimenté peut utiliser ce fichier pour améliorer votre thème", - "editThemeDescription": "Ajouter ou modifier des questions à ce thème", - "editThisTheme": "Editer ce thème", "embedIntro": "

Incorporer à votre site Web

Ajouter la carte à votre site Web.
Nous vous y encourageons – pas besoin de permission.
C'est gratuit et pour toujours. Plus de personnes l'utilisent, mieux c'est.", - "fsAddNew": "Activer le bouton 'ajouter un POI'", - "fsGeolocation": "Activer le bouton 'Localisez-moi' (seulement sur mobile)", - "fsIncludeCurrentBackgroundMap": "Include le choix actuel d'arrière plan {name}", - "fsIncludeCurrentLayers": "Inclure la couche selectionnée", - "fsIncludeCurrentLocation": "Inclure l'emplacement actuel", - "fsLayerControlToggle": "Démarrer avec le contrôle des couches ouvert", - "fsLayers": "Activer le contrôle des couches", - "fsSearch": "Activer la barre de recherche", "fsUserbadge": "Activer le bouton de connexion", "fsWelcomeMessage": "Afficher le message de bienvenue et les onglets associés", "intro": "

Partager cette carte

Partagez cette carte en copiant le lien suivant et envoyez-le à vos amis :", diff --git a/langs/gl.json b/langs/gl.json index 8271789517..ed4dc6c299 100644 --- a/langs/gl.json +++ b/langs/gl.json @@ -101,19 +101,8 @@ "searching": "Procurando..." }, "sharescreen": { - "addToHomeScreen": "

Engadir á pantalla de inicio

Podes engadir esta web na pantalla de inicio do teu smartphone para que se vexa máis nativo. Preme o botón 'engadir ó inicio' na barra de enderezos URL para facelo.", "copiedToClipboard": "Ligazón copiada ó portapapeis", - "editThemeDescription": "Engadir ou mudar preguntas a este tema do mapa", - "editThisTheme": "Editar este tema", "embedIntro": "

Inclúeo na túa páxina web

Inclúe este mapa na túa páxina web.
Animámoche a que o fagas, non fai falla que pidas permiso.
É de balde, e sempre será. Canta máis xente que o empregue máis valioso será.", - "fsAddNew": "Activar o botón de 'engadir novo PDI'", - "fsGeolocation": "Activar o botón de 'xeolocalizarme' (só móbil)", - "fsIncludeCurrentBackgroundMap": "Incluír a opción de fondo actual {name}", - "fsIncludeCurrentLayers": "Incluír as opcións de capa actual", - "fsIncludeCurrentLocation": "Incluír localización actual", - "fsLayerControlToggle": "Comenza co control de capas expandido", - "fsLayers": "Activar o control de capas", - "fsSearch": "Activar a barra de procura", "fsUserbadge": "Activar botón de inicio de sesión", "fsWelcomeMessage": "Amosar a xanela emerxente da mensaxe de benvida e as lapelas asociadas", "intro": "

Comparte este mapa

Comparte este mapa copiando a ligazón de embaixo e enviándoa ás amizades e familia:", diff --git a/langs/hu.json b/langs/hu.json index afd36563bd..eb0a18b766 100644 --- a/langs/hu.json +++ b/langs/hu.json @@ -196,19 +196,8 @@ "searching": "Keresés…" }, "sharescreen": { - "addToHomeScreen": "

Hozzáadás a kezdőképernyőhöz

Könnyedén hozzáadhatod ezt a weboldalt az okostelefon kezdőképernyőjéhez a natív hangulat érdekében. Ehhez kattints az URL-sávban a „Hozzáadás a kezdőképernyőhöz” gombra.", "copiedToClipboard": "Link a vágólapra másolva", - "editThemeDescription": "Térképtémához tartozó kérdések hozzáadása vagy módosítása", - "editThisTheme": "Téma szerkesztése", "embedIntro": "

Beágyazás egy weboldalon

Kérjük, illeszd be ezt a térképet a weboldalba.
Biztatunk, tedd meg – még engedélyt sem kell kérned.
Ingyenes, és az is marad. Minél többen használják, annál értékesebbé válik. A pipákra kattintva módosíthatod a paramétereket:", - "fsAddNew": "„Új érdekes pont (POI) hozzáadása” gomb engedélyezése", - "fsGeolocation": "„Saját helyem megjelenítése” gomb engedélyezése (csak mobileszközön)", - "fsIncludeCurrentBackgroundMap": "Tartalmazza a jelenleg kiválasztott hátteret ({name})", - "fsIncludeCurrentLayers": "Tartalmazza a jelenleg kiválasztott rétegeket", - "fsIncludeCurrentLocation": "Tartalmazza az aktuális helyet", - "fsLayerControlToggle": "Kezdés kibontott rétegvezérlővel", - "fsLayers": "Rétegvezérlő engedélyezése", - "fsSearch": "Keresősáv engedélyezése", "fsUserbadge": "Bejelentkezési gomb engedélyezése", "fsWelcomeMessage": "Felugró üdvözlő üzenet és kapcsolódó fülek megjelenítése", "intro": "

Térkép megosztása

Oszd meg ezt a térképet! Másold ki az alábbi linket, és küldd el a barátaidnak és a családodnak:", diff --git a/langs/id.json b/langs/id.json index 7fa0ddf5ea..69e86090a1 100644 --- a/langs/id.json +++ b/langs/id.json @@ -106,15 +106,6 @@ }, "sharescreen": { "copiedToClipboard": "Tautan disalin ke papan klip", - "editThemeDescription": "Tambahkan atau ubah pertanyaan ke tema peta ini", - "editThisTheme": "Sunting tema ini", - "fsAddNew": "Aktifkan tombol 'tambah POI baru'", - "fsGeolocation": "Aktifkan tombol 'geolocate-me' (hanya seluler)", - "fsIncludeCurrentBackgroundMap": "Sertakan pilihan latar belakang saat ini {name}", - "fsIncludeCurrentLayers": "Sertakan pilihan lapisan saat ini", - "fsIncludeCurrentLocation": "Sertakan lokasi saat ini", - "fsLayers": "Aktifkan kontrol lapisan", - "fsSearch": "Aktifkan bilah pencarian", "fsUserbadge": "Aktifkan tombol masuk", "fsWelcomeMessage": "Tampilkan popup pesan selamat datang dan tab terkait", "thanksForSharing": "Terima kasih telah berbagi!" diff --git a/langs/it.json b/langs/it.json index 171f0fcbd3..d3ff401efc 100644 --- a/langs/it.json +++ b/langs/it.json @@ -204,21 +204,8 @@ "searching": "Ricerca…" }, "sharescreen": { - "addToHomeScreen": "

Aggiungi alla tua schermata Home

Puoi aggiungere facilmente questo sito web alla schermata Home del tuo smartphone. Per farlo, clicca sul pulsante ‘Aggiungi a schermata Home’ nella barra degli indirizzi.", "copiedToClipboard": "Collegamento copiato negli appunti", - "downloadCustomTheme": "Scarica la configurazione di questo argomento", - "downloadCustomThemeHelp": "Una persona esperta può utilizzare questo file per migliorare il tuo argomento", - "editThemeDescription": "Aggiungi o modifica le domande a questo tema della mappa", - "editThisTheme": "Modifica questo tema", "embedIntro": "

Incorpora nel tuo sito web

Siamo lieti se vorrai includere questa cartina nel tuo sito web.
Ti incoraggiamo a farlo (non devi neanche chieder il permesso).
È gratuito e lo sarà per sempre. Più persone lo useranno e più valore acquisirà.", - "fsAddNew": "Abilita il pulsante ‘aggiungi nuovo PDI’", - "fsGeolocation": "Abilita il pusante ‘geo-localizzami’ (solo da mobile)", - "fsIncludeCurrentBackgroundMap": "Includi lo sfondo attualmente selezionato {name}", - "fsIncludeCurrentLayers": "Includi i livelli correntemente selezionati", - "fsIncludeCurrentLocation": "Includi la posizione attuale", - "fsLayerControlToggle": "Inizia con il pannello dei livelli aperto", - "fsLayers": "Abilita il controllo dei livelli", - "fsSearch": "Abilita la barra di ricerca", "fsUserbadge": "Abilita il pulsante di accesso", "fsWelcomeMessage": "Mostra il messaggio di benvenuto e le schede associate", "intro": "

Condividi questa mappa

Condividi questa mappa copiando il collegamento qua sotto e inviandolo ad amici o parenti:", diff --git a/langs/ja.json b/langs/ja.json index 9d78c1e1c2..6418961d52 100644 --- a/langs/ja.json +++ b/langs/ja.json @@ -101,19 +101,8 @@ "searching": "検索中…" }, "sharescreen": { - "addToHomeScreen": "

ホーム画面に追加する

このサイトはスマートフォンのホーム画面に簡単に追加でき、ネイティブな雰囲気になります。これを行うには、URLバーの「ホーム画面に追加ボタン」をクリックします。", "copiedToClipboard": "クリップボードにコピーされたリンク", - "editThemeDescription": "このマップテーマに質問を追加または変更する", - "editThisTheme": "このテーマを編集", "embedIntro": "

お客様のWebサイトに埋め込む

この地図をお客様のWebサイトに埋め込みます。
許可を得る必要もありませんので、ぜひご利用ください。
無料であり、常に利用できます。使う人が増えれば増えるほど、価値が増大します。", - "fsAddNew": "[新しいPOIの追加]ボタンを有効にする", - "fsGeolocation": "[geolocate-me]ボタンを有効にする(モバイルのみ)", - "fsIncludeCurrentBackgroundMap": "現在の背景の選択肢{name}を含める", - "fsIncludeCurrentLayers": "現在のレイヤの選択肢を含める", - "fsIncludeCurrentLocation": "現在の場所を含める", - "fsLayerControlToggle": "レイヤコントロールを展開して開始", - "fsLayers": "レイヤコントロールを有効にする", - "fsSearch": "検索バーを有効にする", "fsUserbadge": "ログインボタンを有効にする", "fsWelcomeMessage": "ウェルカムメッセージのポップアップと関連するタブを表示します", "intro": "

このマップを共有

このマップを共有するには、次のリンクをコピーして、友人や家族に送信します。", diff --git a/langs/layers/da.json b/langs/layers/da.json index 029940a8a9..d21af0de0f 100644 --- a/langs/layers/da.json +++ b/langs/layers/da.json @@ -2065,6 +2065,13 @@ "question": "Har en halalmenu" } } + }, + "5": { + "options": { + "0": { + "question": "Har en halalmenu" + } + } } }, "name": "Restauranter og fastfood" diff --git a/langs/layers/de.json b/langs/layers/de.json index 3f2b2918f2..141874ae28 100644 --- a/langs/layers/de.json +++ b/langs/layers/de.json @@ -4754,6 +4754,13 @@ "question": "Halal Gerichte im Angebot" } } + }, + "5": { + "options": { + "0": { + "question": "Halal Gerichte im Angebot" + } + } } }, "name": "Restaurants und Imbisse", @@ -5855,9 +5862,6 @@ "mappings": { "0": { "then": "Dies ist eine Wohnstraße, auf der eine Höchstgeschwindigkeit von 20 km/h gilt" - }, - "1": { - "then": "Dies ist eine Wohnstraße, auf der eine Höchstgeschwindigkeit von 20 km/h gilt" } }, "question": "Wie hoch ist die zulässige Höchstgeschwindigkeit, die man auf dieser Straße fahren darf?", diff --git a/langs/layers/en.json b/langs/layers/en.json index bbbdb9367d..28f683e3c0 100644 --- a/langs/layers/en.json +++ b/langs/layers/en.json @@ -4738,6 +4738,12 @@ "options": { "0": { "question": "Has a vegetarian menu" + }, + "1": { + "question": "Only fastfood buisinesses" + }, + "2": { + "question": "Only restaurants" } } }, @@ -4754,6 +4760,13 @@ "question": "Has a halal menu" } } + }, + "5": { + "options": { + "0": { + "question": "Has a halal menu" + } + } } }, "name": "Restaurants and fast food", @@ -5855,9 +5868,6 @@ "mappings": { "0": { "then": "This is a living street, which has a maxspeed of 20km/h" - }, - "1": { - "then": "This is a living street, which has a maxspeed of 20km/h" } }, "question": "What is the legal maximum speed one is allowed to drive on this road?", diff --git a/langs/layers/es.json b/langs/layers/es.json index 28a0c8b256..101a6f0790 100644 --- a/langs/layers/es.json +++ b/langs/layers/es.json @@ -2610,6 +2610,13 @@ "question": "Tiene menú halah" } } + }, + "5": { + "options": { + "0": { + "question": "Tiene menú halah" + } + } } }, "name": "Restaurantes y comida rápida", diff --git a/langs/layers/fr.json b/langs/layers/fr.json index 5f3dae47f2..0b5771aa36 100644 --- a/langs/layers/fr.json +++ b/langs/layers/fr.json @@ -3278,6 +3278,13 @@ "question": "A un menu halal" } } + }, + "5": { + "options": { + "0": { + "question": "A un menu halal" + } + } } }, "name": "Restaurants et nourriture rapide", diff --git a/langs/layers/nl.json b/langs/layers/nl.json index 477ddd2c39..aeedb955ae 100644 --- a/langs/layers/nl.json +++ b/langs/layers/nl.json @@ -4530,6 +4530,13 @@ "question": "Heeft een halal menu" } } + }, + "5": { + "options": { + "0": { + "question": "Heeft een halal menu" + } + } } }, "name": "Eetgelegenheden", @@ -5553,9 +5560,6 @@ "mappings": { "0": { "then": "Dit is een woonerf en heeft dus een maximale snelheid van 20km/h" - }, - "1": { - "then": "Dit is een woonerf en heeft dus een maximale snelheid van 20km/h" } }, "question": "Wat is de legale maximumsnelheid voor deze weg?", diff --git a/langs/nb_NO.json b/langs/nb_NO.json index 7856c11fbe..f9c61d57af 100644 --- a/langs/nb_NO.json +++ b/langs/nb_NO.json @@ -233,20 +233,8 @@ "searching": "Søker …" }, "sharescreen": { - "addToHomeScreen": "

Legg til på hjemmeskjermen din

Du kan enkelt legge til denne nettsiden på din smarttelefon-hjemmeskjerm for å få det hele integrert. Klikk på «Legg til på hjemmeskjerm»-knappen i nettadressefeltet for å gjøre dette.", "copiedToClipboard": "Lenke kopiert til utklippstavle", - "downloadCustomTheme": "Last ned oppsettet for dette temaet", - "downloadCustomThemeHelp": "En dreven bidragsyter kan bruke denne filen for å forbedre temaet ditt", - "editThemeDescription": "Legg til eller endre spørsmål for dette karttemaet", - "editThisTheme": "Rediger dette temaet", "embedIntro": "

Bygg inn på nettsiden din

Legg til dette kartet på nettsiden din.
Du oppfordres til å gjøre dette, og trenger ikke å spørre om tillatelse.
Det er fritt, og vil alltid være det. Desto flere som bruker dette, desto mer verdifullt blir det.", - "fsGeolocation": "Skru på «Geolokaliser meg»-knappen (kun for mobil)", - "fsIncludeCurrentBackgroundMap": "Inkluder nåværende bakgrunnsvalg {name}", - "fsIncludeCurrentLayers": "Inkluder nåværende lagvalg", - "fsIncludeCurrentLocation": "Inkluder nåværende posisjon", - "fsLayerControlToggle": "Start med lagkontrollen utvidet", - "fsLayers": "Skru på lagkontrollen", - "fsSearch": "Skru på søkefeltet", "fsUserbadge": "Skru på innloggingsknappen", "fsWelcomeMessage": "Vis velkomst-oppsprettsmeldinger og tilknyttede faner", "intro": "

Del dette kartet

Del dette kartet ved å kopiere lenken nedenfor og sende den til venner og familie:", diff --git a/langs/nl.json b/langs/nl.json index adfb3b0afa..1f2d39ce43 100644 --- a/langs/nl.json +++ b/langs/nl.json @@ -304,21 +304,8 @@ "searching": "Aan het zoeken…" }, "sharescreen": { - "addToHomeScreen": "

Voeg toe aan je thuisscherm

Je kan eenvoudigweg deze website aan het thuisscherm van je smartphone toevoegen voor een \"native feel\"", "copiedToClipboard": "Link gekopieerd naar klembord", - "downloadCustomTheme": "Download de instellingen van dit thema", - "downloadCustomThemeHelp": "Een ervaren bijdrager kan op basis van dit bestand je thema verder verbeteren", - "editThemeDescription": "Pas vragen aan of voeg vragen toe aan dit kaartthema", - "editThisTheme": "Pas dit thema aan", "embedIntro": "

Plaats dit op je website

Voeg dit kaartje toe op je eigen website.
We moedigen dit zelfs aan - je hoeft geen toestemming te vragen.
Het is gratis en zal dat altijd blijven. Hoe meer het gebruikt wordt, hoe waardevoller", - "fsAddNew": "Activeer het toevoegen van nieuwe POI", - "fsGeolocation": "Toon het knopje voor geolocalisatie (enkel op mobiel)", - "fsIncludeCurrentBackgroundMap": "Gebruik de huidige achtergrond {name}", - "fsIncludeCurrentLayers": "Toon enkel de huidig getoonde lagen", - "fsIncludeCurrentLocation": "Start op de huidige locatie", - "fsLayerControlToggle": "Toon de laagbediening meteen volledig", - "fsLayers": "Toon de knop voor laagbediening", - "fsSearch": "Activeer de zoekbalk", "fsUserbadge": "Activeer de login-knop", "fsWelcomeMessage": "Toon het welkomstbericht en de bijhorende tabbladen", "intro": "

Deel deze kaart

Kopieer onderstaande link om deze kaart naar vrienden en familie door te sturen:", diff --git a/langs/pa_PK.json b/langs/pa_PK.json index b59c81bbbe..15de79618e 100644 --- a/langs/pa_PK.json +++ b/langs/pa_PK.json @@ -55,7 +55,6 @@ "searching": "کھوجیا جا رہا اے۔ ۔ ۔" }, "sharescreen": { - "editThisTheme": "ایہہ تھیم سودھو", "thanksForSharing": "ٹھیک اے، مہربانی۔" }, "weekdays": { diff --git a/langs/pl.json b/langs/pl.json index b5003ebd83..cfa569f962 100644 --- a/langs/pl.json +++ b/langs/pl.json @@ -98,19 +98,8 @@ "searching": "Szukanie…" }, "sharescreen": { - "addToHomeScreen": "

Dodaj do ekranu głównego

Możesz łatwo dodać tę stronę do ekranu głównego smartfona, aby poczuć się jak w domu. Kliknij przycisk \"Dodaj do ekranu głównego\" na pasku adresu URL, aby to zrobić.", "copiedToClipboard": "Link został skopiowany do schowka", - "editThemeDescription": "Dodaj lub zmień pytania do tego motywu mapy", - "editThisTheme": "Edytuj ten motyw", "embedIntro": "

Umieść na swojej stronie internetowej

Proszę, umieść tę mapę na swojej stronie internetowej.
Zachęcamy cię do tego - nie musisz nawet pytać o zgodę.
Jest ona darmowa i zawsze będzie. Im więcej osób jej używa, tym bardziej staje się wartościowa.", - "fsAddNew": "Włącz przycisk \"Dodaj nowe POI\"", - "fsGeolocation": "Włącz przycisk „Zlokalizuj mnie” (tylko na urządzeniach mobilnych)", - "fsIncludeCurrentBackgroundMap": "Dołącz bieżący wybór tła {name}", - "fsIncludeCurrentLayers": "Uwzględnij wybór bieżącej warstwy", - "fsIncludeCurrentLocation": "Uwzględnij bieżącą lokalizację", - "fsLayerControlToggle": "Zacznij od rozwiniętej kontroli warstw", - "fsLayers": "Włącz kontrolę warstw", - "fsSearch": "Włącz pasek wyszukiwania", "fsUserbadge": "Włącz przycisk logowania", "fsWelcomeMessage": "Pokaż wyskakujące okienko wiadomości powitalnej i powiązane zakładki", "intro": "

Udostępnij tę mapę

Udostępnij tę mapę, kopiując poniższy link i wysyłając ją do przyjaciół i rodziny:", diff --git a/langs/pt.json b/langs/pt.json index c6ac285a5b..96dad75485 100644 --- a/langs/pt.json +++ b/langs/pt.json @@ -242,21 +242,8 @@ "searching": "A procurar…" }, "sharescreen": { - "addToHomeScreen": "

Adicionar ao seu ecrã inicial

Pode adicionar facilmente este site ao ecrã inicial do seu telemóvel. Para isso clique no botão 'Adicionar ao ecrã inicial' na barra de URL.", "copiedToClipboard": "Hiperligação copiada para a área de transferência", - "downloadCustomTheme": "Descarregar a configuração para este tema", - "downloadCustomThemeHelp": "Um colaborador experiente pode utilizar este ficheiro para melhorar o seu tema", - "editThemeDescription": "Adicionar ou alterar perguntas deste tema", - "editThisTheme": "Editar este tema", "embedIntro": "

Incorporar no seu site

Por favor, insira este mapa no seu site.
Encorajamos a fazê-lo - nem precisa de pedir permissão.
É grátis e sempre será. Quanto mais pessoas estiverem a usar isto, mais valioso se torna.", - "fsAddNew": "Ativar o botão 'adicionar novo POI'", - "fsGeolocation": "Ativar o botão 'localizar-me geograficamente' (apenas telemóvel)", - "fsIncludeCurrentBackgroundMap": "Incluir a escolha de fundo atual {name}", - "fsIncludeCurrentLayers": "Incluir as opções de camada atuais", - "fsIncludeCurrentLocation": "Incluir localização atual", - "fsLayerControlToggle": "Começar com o controlo de camadas expandido", - "fsLayers": "Ativar o controlo das camadas", - "fsSearch": "Ativar a barra de pesquisa", "fsUserbadge": "Ativar o botão de iniciar sessão", "fsWelcomeMessage": "Mostrar a janela com a mensagem de boas-vindas e separadores associados", "intro": "

Partilhar este mapa

Partilhe este mapa copiando a hiperligação abaixo e enviando-a a amigos e familiares:", diff --git a/langs/pt_BR.json b/langs/pt_BR.json index 8998369c23..c72ba63eb6 100644 --- a/langs/pt_BR.json +++ b/langs/pt_BR.json @@ -98,19 +98,8 @@ "searching": "Procurando…" }, "sharescreen": { - "addToHomeScreen": "

Adicionar à sua tela inicial

Você pode adicionar facilmente este site à tela inicial do smartphone para uma sensação nativa. Clique no botão 'adicionar à tela inicial' na barra de URL para fazer isso.", "copiedToClipboard": "Link copiado para a área de transferência", - "editThemeDescription": "Adicione ou altere perguntas a este tema do mapa", - "editThisTheme": "Editar neste tema", "embedIntro": "

Incorpore em seu site

Por favor, incorpore este mapa em seu site.
Nós o encorajamos a fazer isso - você nem precisa pedir permissão.
É gratuito e sempre será. Quanto mais pessoas usarem isso, mais valioso se tornará.", - "fsAddNew": "Habilite o botão 'adicionar novo POI'", - "fsGeolocation": "Ative o botão 'localizar-me geograficamente' (apenas para celular)", - "fsIncludeCurrentBackgroundMap": "Incluir a escolha de fundo atual {name}", - "fsIncludeCurrentLayers": "Incluir as opções de camada atuais", - "fsIncludeCurrentLocation": "Incluir localização atual", - "fsLayerControlToggle": "Iniciar com o controle de camada expandido", - "fsLayers": "Ativar o controle de camada", - "fsSearch": "Ativar a barra de pesquisa", "fsUserbadge": "Habilite o botão de login", "fsWelcomeMessage": "Mostra o pop-up da mensagem de boas-vindas e as guias associadas", "intro": "

Compartilhe este mapa

Compartilhe este mapa copiando o link abaixo e enviando-o para amigos e familiares:", diff --git a/langs/ru.json b/langs/ru.json index c666b2e077..aaa9683b7b 100644 --- a/langs/ru.json +++ b/langs/ru.json @@ -114,19 +114,8 @@ "searching": "Поиск…" }, "sharescreen": { - "addToHomeScreen": "

Добавить на домашний экран

Вы можете легко добавить этот сайт на домашний экран вашего смартфона. Для этого нажмите кнопку \"Добавить на главный экран\" в строке URL.", "copiedToClipboard": "Ссылка скопирована в буфер обмена", - "editThemeDescription": "Добавить или изменить вопросы к этой теме карты", - "editThisTheme": "Редактировать эту тему", "embedIntro": "

Встроить на свой сайт

Пожалуйста, вставьте эту карту на свой сайт.
Мы призываем вас сделать это - вам даже не нужно спрашивать разрешения.
Карта бесплатна и всегда будет бесплатной. Чем больше людей пользуются ею, тем более ценной она становится.", - "fsAddNew": "Включить кнопку \"добавить новую точку интереса\"", - "fsGeolocation": "Включить кнопку \"найди меня\" (только в мобильной версии)", - "fsIncludeCurrentBackgroundMap": "Включить текущий фоновый слой {name}", - "fsIncludeCurrentLayers": "Включить текущие выбранные слои", - "fsIncludeCurrentLocation": "Включить текущее местоположение карты", - "fsLayerControlToggle": "Открыть панель выбора слоя", - "fsLayers": "Включить выбор слоя карты", - "fsSearch": "Включить строку поиска", "fsUserbadge": "Включить кнопку входа в систему", "fsWelcomeMessage": "Показать всплывающее окно с приветствием и соответствующие вкладки", "intro": "

Поделиться этой картой

Поделитесь этой картой, скопировав ссылку ниже и отправив её друзьям и близким:", diff --git a/langs/zh_Hant.json b/langs/zh_Hant.json index 3d48b102ef..0065848478 100644 --- a/langs/zh_Hant.json +++ b/langs/zh_Hant.json @@ -226,21 +226,8 @@ "searching": "搜尋中…" }, "sharescreen": { - "addToHomeScreen": "

新增到你主頁畫面

你可以輕易將這網站加到你智慧型手機的主頁畫面,在網址列點選 '新增到主頁按鈕'來做這件事情。", "copiedToClipboard": "複製連結到簡貼簿", - "downloadCustomTheme": "下載這個主題的設定", - "downloadCustomThemeHelp": "有經驗的貢獻者能使用這個檔案來改善你的主題", - "editThemeDescription": "新增或改變這個地圖主題的問題", - "editThisTheme": "編輯這個主題", "embedIntro": "

嵌入到你的網站

請考慮將這份地圖嵌入您的網站。
地圖毋須額外授權,非常歡迎您多加利用。
一切都是免費的,而且之後也是免費的,越有更多人使用,則越顯得它的價值。", - "fsAddNew": "啟用'新增新的興趣點'按鈕", - "fsGeolocation": "啟用'地理定位自身'按鈕 (只有行動版本)", - "fsIncludeCurrentBackgroundMap": "包含目前背景選擇{name}", - "fsIncludeCurrentLayers": "包含目前選擇圖層", - "fsIncludeCurrentLocation": "包含目前位置", - "fsLayerControlToggle": "開始時擴展圖層控制", - "fsLayers": "啟用圖層控制", - "fsSearch": "啟用搜尋列", "fsUserbadge": "啟用登入按鈕", "fsWelcomeMessage": "顯示歡迎訊息以及相關頁籤", "intro": "

分享這地圖

複製下面的連結來向朋友與家人分享這份地圖:", From b30b029aff65851a950aba8ba0603b0f53b68da6 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 10 Aug 2023 15:37:20 +0200 Subject: [PATCH 17/19] Chore: translation sync --- assets/layers/food/food.json | 27 +++--- assets/layers/maxspeed/maxspeed.json | 4 +- assets/themes/fritures/fritures.json | 4 +- .../mapcomplete-changes.json | 97 ++++++++++++++----- 4 files changed, 92 insertions(+), 40 deletions(-) diff --git a/assets/layers/food/food.json b/assets/layers/food/food.json index 0870511274..6030d3a353 100644 --- a/assets/layers/food/food.json +++ b/assets/layers/food/food.json @@ -966,7 +966,11 @@ "options": [ { "question": { - "en": "All categories" + "en": "Has a vegetarian menu", + "de": "Vegetarische Gerichte im Angebot", + "es": "Tiene menú vegetariano", + "fr": "A un menu végétarien", + "nl": "Heeft een vegetarisch menu" } }, { @@ -988,11 +992,11 @@ "options": [ { "question": { - "en": "Has a vegetarian menu", - "nl": "Heeft een vegetarisch menu", - "de": "Vegetarische Gerichte im Angebot", - "es": "Tiene menú vegetariano", - "fr": "A un menu végétarien" + "en": "Has a vegan menu", + "nl": "Heeft een veganistisch menu", + "de": "Vegane Gerichte im Angebot", + "es": "Tiene menú vegano", + "fr": "A un menu végétalien" }, "osmTags": { "or": [ @@ -1010,11 +1014,12 @@ "options": [ { "question": { - "en": "Has a vegan menu", - "nl": "Heeft een veganistisch menu", - "de": "Vegane Gerichte im Angebot", - "es": "Tiene menú vegano", - "fr": "A un menu végétalien" + "en": "Has a halal menu", + "nl": "Heeft een halal menu", + "de": "Halal Gerichte im Angebot", + "es": "Tiene menú halah", + "fr": "A un menu halal", + "da": "Har en halalmenu" }, "osmTags": { "or": [ diff --git a/assets/layers/maxspeed/maxspeed.json b/assets/layers/maxspeed/maxspeed.json index 3ee814e945..1c5304cd34 100644 --- a/assets/layers/maxspeed/maxspeed.json +++ b/assets/layers/maxspeed/maxspeed.json @@ -90,7 +90,9 @@ "path": "./assets/layers/maxspeed/living_street_be.svg", "class": "large" }, - "addExtraTags": ["maxspeed=20"], + "addExtraTags": [ + "maxspeed=20" + ], "hideInAnswer": "_country!=be" } ], diff --git a/assets/themes/fritures/fritures.json b/assets/themes/fritures/fritures.json index 8f2f3bfda5..18804d3322 100644 --- a/assets/themes/fritures/fritures.json +++ b/assets/themes/fritures/fritures.json @@ -63,10 +63,10 @@ { "builtin": "food", "override": { - "minzoom": 19, + "minzoom": 18, "filter": null, "name": null } } ] -} \ No newline at end of file +} diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index 56555e8719..deda66b656 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -1,13 +1,19 @@ { "id": "mapcomplete-changes", "title": { - "en": "Changes made with MapComplete" + "en": "Changes made with MapComplete", + "de": "Mit MapComplete erstellte Änderungen", + "nl": "Wijzigingen gemaakt met MapComplete" }, "shortDescription": { - "en": "Shows changes made by MapComplete" + "en": "Show changes made with MapComplete", + "de": "Mit MapComplete erstellte Änderungen anzeigen", + "nl": "Toon wijzigingen gemaakt met MapComplete" }, "description": { - "en": "This maps shows all the changes made with MapComplete" + "en": "This maps shows all the changes made with MapComplete", + "de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen", + "nl": "Deze kaart toont alle wijzigingen die met MapComplete gemaakt werden" }, "icon": "./assets/svg/logo.svg", "hideFromOverview": true, @@ -20,7 +26,9 @@ { "id": "mapcomplete-changes", "name": { - "en": "Changeset centers" + "en": "Changeset centers", + "de": "Zentrum der Änderungssätze", + "nl": "Centerpunt van changeset" }, "minzoom": 0, "source": { @@ -31,41 +39,51 @@ }, "title": { "render": { - "en": "Changeset for {theme}" + "en": "Changeset for {theme}", + "de": "Änderungssatz für {theme}" } }, "description": { - "en": "Shows all MapComplete changes" + "en": "Show all MapComplete changes", + "de": "Alle MapComplete-Änderungen anzeigen", + "nl": "Toon alle MapComplete wijzigingen" }, "tagRenderings": [ { "id": "show_changeset_id", "render": { - "en": "Changeset {id}" + "en": "Changeset {id}", + "de": "Änderungssatz {id}" } }, { "id": "contributor", "question": { - "en": "What contributor did make this change?" + "en": "Which contributor made this change?", + "de": "Welcher Mitwirkende hat diese Änderung vorgenommen?", + "nl": "Welke bijdrager maakte deze wijziging?" }, "freeform": { "key": "user" }, "render": { - "en": "Change made by {user}" + "en": "Change made by {user}", + "de": "Änderung gemacht von {user}", + "nl": "Wijziging gemaakt door {user}" } }, { "id": "theme-id", "question": { - "en": "What theme was used to make this change?" + "en": "What theme was used to make this change?", + "de": "Welches Thema wurde für diese Änderung verwendet?" }, "freeform": { "key": "theme" }, "render": { - "en": "Change with theme {theme}" + "en": "Change with theme {theme}", + "de": "Geändert mit Thema {theme}" } }, { @@ -74,19 +92,27 @@ "key": "locale" }, "question": { - "en": "What locale (language) was this change made in?" + "en": "What locale (language) was this change made in?", + "de": "In welcher Sprache wurde diese Änderung vorgenommen?", + "nl": "In welke locale (taal) werd deze wijziging gemaakt?" }, "render": { - "en": "User locale is {locale}" + "en": "User locale is {locale}", + "de": "Usersprache ist {locale}", + "nl": "De gebruikerstaal is {locale}" } }, { "id": "host", "render": { - "en": "Change with with {host}" + "en": "Change made with {host}", + "de": "Änderung vorgenommen mit {host}", + "nl": "Wijziging gemaakt met {host}" }, "question": { - "en": "What host (website) was this change made with?" + "en": "What host (website) was this change made with?", + "de": "Mit welchem Host / welcher Website wurde diese Änderung gemacht?", + "nl": "Met welke host (website) werd deze wijziging gemaakt?" }, "freeform": { "key": "host" @@ -107,10 +133,12 @@ { "id": "version", "question": { - "en": "What version of MapComplete was used to make this change?" + "en": "What version of MapComplete was used to make this change?", + "de": "Mit welcher Version von MapComplete wurde diese Änderung gemacht?" }, "render": { - "en": "Made with {editor}" + "en": "Made with {editor}", + "de": "Erstellt mit {editor}" }, "freeform": { "key": "editor" @@ -452,7 +480,9 @@ } ], "question": { - "en": "Themename contains {search}" + "en": "Theme name contains {search}", + "de": "Themenname enthält {search}", + "nl": "Themenaam bevat {search}" } } ] @@ -468,7 +498,9 @@ } ], "question": { - "en": "Made by contributor {search}" + "en": "Made by contributor {search}", + "de": "Erstellt von {search}", + "nl": "Gemaakt door bijdrager {search}" } } ] @@ -484,7 +516,9 @@ } ], "question": { - "en": "Not made by contributor {search}" + "en": "Not made by contributor {search}", + "de": "Nicht erstellt von {search}", + "nl": "Niet gemaakt door bijdrager {search}" } } ] @@ -501,7 +535,9 @@ } ], "question": { - "en": "Made before {search}" + "en": "Made before {search}", + "de": "Erstellt vor {search}", + "nl": "Gemaakt voor {search}" } } ] @@ -518,7 +554,9 @@ } ], "question": { - "en": "Made after {search}" + "en": "Made after {search}", + "de": "Erstellt nach {search}", + "nl": "Gemaakt na {search}" } } ] @@ -534,7 +572,9 @@ } ], "question": { - "en": "User language (iso-code) {search}" + "en": "User language (iso-code) {search}", + "de": "Benutzersprache (ISO-Code) {search}", + "nl": "De taal van de bijdrager is {search}" } } ] @@ -550,7 +590,9 @@ } ], "question": { - "en": "Made with host {search}" + "en": "Made with host {search}", + "de": "Erstellt mit Host {search}", + "nl": "Gemaakt met host {search}" } } ] @@ -561,7 +603,9 @@ { "osmTags": "add-image>0", "question": { - "en": "Changeset added at least one image" + "en": "Changeset added at least one image", + "de": "Changeset fügte mindestens ein Bild hinzu", + "nl": "Changeset bevat minstens één afbeelding" } } ] @@ -576,7 +620,8 @@ { "id": "link_to_more", "render": { - "en": "More statistics can be found here" + "en": "More statistics can be found here", + "de": "Mehr Statistiken gibt es hier" } }, { From 96d036781f55987732629355be118373c363830d Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 10 Aug 2023 15:37:44 +0200 Subject: [PATCH 18/19] Fix: update and simplification of sharescreen, rename some feature switches, remove some no longer relevant feature switches --- src/Logic/State/FeatureSwitchState.ts | 21 +- src/Logic/Web/QueryParameters.ts | 30 ++- src/Logic/Web/ThemeViewStateHashActor.ts | 16 ++ src/Models/MenuState.ts | 8 +- src/Models/ThemeViewState.ts | 11 +- src/UI/BigComponents/ShareScreen.svelte | 121 +++++++++ src/UI/BigComponents/ShareScreen.ts | 256 -------------------- src/UI/BigComponents/ThemeIntroPanel.svelte | 2 - src/UI/QueryParameterDocumentation.ts | 2 + src/UI/ThemeViewGUI.svelte | 109 ++++----- src/Utils.ts | 19 ++ 11 files changed, 252 insertions(+), 343 deletions(-) create mode 100644 src/UI/BigComponents/ShareScreen.svelte delete mode 100644 src/UI/BigComponents/ShareScreen.ts diff --git a/src/Logic/State/FeatureSwitchState.ts b/src/Logic/State/FeatureSwitchState.ts index ebdb057c93..389c966a80 100644 --- a/src/Logic/State/FeatureSwitchState.ts +++ b/src/Logic/State/FeatureSwitchState.ts @@ -51,10 +51,9 @@ export default class FeatureSwitchState extends OsmConnectionFeatureSwitches { */ public readonly layoutToUse: LayoutConfig - public readonly featureSwitchUserbadge: UIEventSource + public readonly featureSwitchEnableLogin: UIEventSource public readonly featureSwitchSearch: UIEventSource public readonly featureSwitchBackgroundSelection: UIEventSource - public readonly featureSwitchAddNew: UIEventSource public readonly featureSwitchWelcomeMessage: UIEventSource public readonly featureSwitchCommunityIndex: UIEventSource public readonly featureSwitchExtraLinkEnabled: UIEventSource @@ -78,10 +77,10 @@ export default class FeatureSwitchState extends OsmConnectionFeatureSwitches { // Helper function to initialize feature switches - this.featureSwitchUserbadge = FeatureSwitchUtils.initSwitch( - "fs-userbadge", + this.featureSwitchEnableLogin = FeatureSwitchUtils.initSwitch( + "fs-enable-login", layoutToUse?.enableUserBadge ?? true, - "Disables/Enables the user information pill (userbadge) at the top left. Disabling this disables logging in and thus disables editing all together, effectively putting MapComplete into read-only mode." + "Disables/Enables logging in and thus disables editing all together. This effectively puts MapComplete into read-only mode." ) this.featureSwitchSearch = FeatureSwitchUtils.initSwitch( "fs-search", @@ -99,11 +98,7 @@ export default class FeatureSwitchState extends OsmConnectionFeatureSwitches { layoutToUse?.enableLayers ?? true, "Disables/Enables the filter view" ) - this.featureSwitchAddNew = FeatureSwitchUtils.initSwitch( - "fs-add-new", - layoutToUse?.enableAddNewPoints ?? true, - "Disables/Enables the 'add new feature'-popup. (A theme without presets might not have it in the first place)" - ) + this.featureSwitchWelcomeMessage = FeatureSwitchUtils.initSwitch( "fs-welcome-message", true, @@ -201,12 +196,6 @@ export default class FeatureSwitchState extends OsmConnectionFeatureSwitches { ) ) - this.featureSwitchUserbadge.addCallbackAndRun((userbadge) => { - if (!userbadge) { - this.featureSwitchAddNew.setData(false) - } - }) - this.backgroundLayerId = QueryParameters.GetQueryParameter( "background", layoutToUse?.defaultBackgroundId ?? "osm", diff --git a/src/Logic/Web/QueryParameters.ts b/src/Logic/Web/QueryParameters.ts index 208c8e8dd5..8d0dd9a1f4 100644 --- a/src/Logic/Web/QueryParameters.ts +++ b/src/Logic/Web/QueryParameters.ts @@ -4,14 +4,13 @@ import { UIEventSource } from "../UIEventSource" import Hash from "./Hash" import { Utils } from "../../Utils" -import doc = Mocha.reporters.doc export class QueryParameters { static defaults: Record = {} static documentation: Map = new Map() - private static order: string[] = ["layout", "test", "z", "lat", "lon"] protected static readonly _wasInitialized: Set = new Set() protected static readonly knownSources: Record> = {} + private static order: string[] = ["layout", "test", "z", "lat", "lon"] private static initialized = false public static GetQueryParameter( @@ -74,6 +73,7 @@ export class QueryParameters { this.init() return QueryParameters._wasInitialized.has(key) } + public static initializedParameters(): ReadonlyArray { return Array.from(QueryParameters._wasInitialized.keys()) } @@ -108,14 +108,12 @@ export class QueryParameters { } } - /** - * Set the query parameters of the page location - * @constructor - * @private - */ - private static Serialize() { - const parts = [] + public static GetParts(exclude?: Set) { + const parts: string[] = [] for (const key of QueryParameters.order) { + if (exclude?.has(key)) { + continue + } if (QueryParameters.knownSources[key]?.data === undefined) { continue } @@ -134,6 +132,16 @@ export class QueryParameters { encodeURIComponent(QueryParameters.knownSources[key].data) ) } + return parts + } + + /** + * Set the query parameters of the page location + * @constructor + * @private + */ + private static Serialize() { + const parts = QueryParameters.GetParts() if (!Utils.runningFromConsole) { // Don't pollute the history every time a parameter changes try { @@ -151,4 +159,8 @@ export class QueryParameters { QueryParameters._wasInitialized.clear() QueryParameters.order = [] } + + static GetDefaultFor(key: string): string { + return QueryParameters.defaults[key] + } } diff --git a/src/Logic/Web/ThemeViewStateHashActor.ts b/src/Logic/Web/ThemeViewStateHashActor.ts index a474b029bd..b10208f09e 100644 --- a/src/Logic/Web/ThemeViewStateHashActor.ts +++ b/src/Logic/Web/ThemeViewStateHashActor.ts @@ -1,9 +1,25 @@ import ThemeViewState from "../../Models/ThemeViewState" import Hash from "./Hash" +import { MenuState } from "../../Models/MenuState" export default class ThemeViewStateHashActor { private readonly _state: ThemeViewState + public static readonly documentation = [ + "The URL-hash can contain multiple values:", + "", + "- The id of the currently selected object, e.g. `node/1234`", + "- The currently opened menu view", + "- The base64-encoded JSON-file specifying a custom theme (only when loading)", + "", + "### Possible hashes to open a menu", + "", + "The possible hashes are:", + "", + MenuState._menuviewTabs.map((tab) => "`menu:" + tab + "`").join(","), + MenuState._themeviewTabs.map((tab) => "`theme-menu:" + tab + "`").join(","), + ] + /** * Converts the hash to the appropriate themeview state and, vice versa, sets the hash. * diff --git a/src/Models/MenuState.ts b/src/Models/MenuState.ts index 3b6aa600a0..63dda397cf 100644 --- a/src/Models/MenuState.ts +++ b/src/Models/MenuState.ts @@ -50,11 +50,15 @@ export class MenuState { ) public highlightedUserSetting: UIEventSource = new UIEventSource(undefined) - constructor(themeid: string = "") { + constructor(shouldOpenWelcomeMessage: boolean, themeid: string = "") { + // Note: this class is _not_ responsible to update the Hash, @see ThemeViewStateHashActor for this if (themeid) { themeid += "-" } - this.themeIsOpened = LocalStorageSource.GetParsed(themeid + "thememenuisopened", true) + this.themeIsOpened = LocalStorageSource.GetParsed( + themeid + "thememenuisopened", + shouldOpenWelcomeMessage + ) this.themeViewTabIndex = LocalStorageSource.GetParsed(themeid + "themeviewtabindex", 0) this.themeViewTab = this.themeViewTabIndex.sync( (i) => MenuState._themeviewTabs[i], diff --git a/src/Models/ThemeViewState.ts b/src/Models/ThemeViewState.ts index 395c4a7c92..c9471bf5f0 100644 --- a/src/Models/ThemeViewState.ts +++ b/src/Models/ThemeViewState.ts @@ -114,15 +114,18 @@ export default class ThemeViewState implements SpecialVisualizationState { constructor(layout: LayoutConfig) { this.layout = layout - this.guistate = new MenuState(layout.id) + this.featureSwitches = new FeatureSwitchState(layout) + this.guistate = new MenuState( + this.featureSwitches.featureSwitchWelcomeMessage.data, + layout.id + ) this.map = new UIEventSource(undefined) const initial = new InitialMapPositioning(layout) this.mapProperties = new MapLibreAdaptor(this.map, initial) const geolocationState = new GeoLocationState() - this.featureSwitches = new FeatureSwitchState(layout) this.featureSwitchIsTesting = this.featureSwitches.featureSwitchIsTesting - this.featureSwitchUserbadge = this.featureSwitches.featureSwitchUserbadge + this.featureSwitchUserbadge = this.featureSwitches.featureSwitchEnableLogin this.osmConnection = new OsmConnection({ dryRun: this.featureSwitches.featureSwitchIsTesting, @@ -469,7 +472,7 @@ export default class ThemeViewState implements SpecialVisualizationState { new ShowDataLayer(this.map, { features: new FilteringFeatureSource(last_click_layer, last_click), - doShowLayer: new ImmutableStore(true), + doShowLayer: this.featureSwitches.featureSwitchEnableLogin, layer: last_click_layer.layerDef, selectedElement: this.selectedElement, selectedLayer: this.selectedLayer, diff --git a/src/UI/BigComponents/ShareScreen.svelte b/src/UI/BigComponents/ShareScreen.svelte new file mode 100644 index 0000000000..f17c3553d7 --- /dev/null +++ b/src/UI/BigComponents/ShareScreen.svelte @@ -0,0 +1,121 @@ + + + +
+ + +
+ {#if typeof navigator?.share === "function"} + + {/if} + {#if navigator.clipboard !== undefined} + + {/if} +
Utils.selectTextIn(e.target)}> + {linkToShare} +
+
+ +
+ + {#if isCopied} + + {/if} +
+ + + + + + + +
+ <span class="literal-code iframe-code-block">
+ <iframe src="${url}"
+ allow="geolocation" width="100%" height="100%" style="min-width: 250px; min-height: 250px"
+ title="${state.layout.title?.txt ?? "MapComplete" } with MapComplete">
+ </iframe>
+ </span> +
+ +
diff --git a/src/UI/BigComponents/ShareScreen.ts b/src/UI/BigComponents/ShareScreen.ts deleted file mode 100644 index f1956c1979..0000000000 --- a/src/UI/BigComponents/ShareScreen.ts +++ /dev/null @@ -1,256 +0,0 @@ -import { VariableUiElement } from "../Base/VariableUIElement" -import { Translation } from "../i18n/Translation" -import Svg from "../../Svg" -import Combine from "../Base/Combine" -import { Store, UIEventSource } from "../../Logic/UIEventSource" -import { Utils } from "../../Utils" -import Translations from "../i18n/Translations" -import BaseUIElement from "../BaseUIElement" -import LayerConfig from "../../Models/ThemeConfig/LayerConfig" -import { InputElement } from "../Input/InputElement" -import { CheckBox } from "../Input/Checkboxes" -import { SubtleButton } from "../Base/SubtleButton" -import LZString from "lz-string" -import { SpecialVisualizationState } from "../SpecialVisualization" - -export class ShareScreen extends Combine { - constructor(state: SpecialVisualizationState) { - const layout = state?.layout - const tr = Translations.t.general.sharescreen - - const optionCheckboxes: InputElement[] = [] - const optionParts: Store[] = [] - - const includeLocation = new CheckBox(tr.fsIncludeCurrentLocation, true) - optionCheckboxes.push(includeLocation) - - const currentLocation = state.mapProperties.location - const zoom = state.mapProperties.zoom - - optionParts.push( - includeLocation.GetValue().map( - (includeL) => { - if (currentLocation === undefined) { - return null - } - if (includeL) { - return [ - ["z", zoom.data], - ["lat", currentLocation.data?.lat], - ["lon", currentLocation.data?.lon], - ] - .filter((p) => p[1] !== undefined) - .map((p) => p[0] + "=" + p[1]) - .join("&") - } else { - return null - } - }, - [currentLocation, zoom] - ) - ) - - function fLayerToParam(flayer: { - isDisplayed: UIEventSource - layerDef: LayerConfig - }) { - if (flayer.isDisplayed.data) { - return null // Being displayed is the default - } - return "layer-" + flayer.layerDef.id + "=" + flayer.isDisplayed.data - } - - const currentLayer: Store< - { id: string; name: string | Record } | undefined - > = state.mapProperties.rasterLayer.map((l) => l?.properties) - const currentBackground = new VariableUiElement( - currentLayer.map((layer) => { - return tr.fsIncludeCurrentBackgroundMap.Subs({ name: layer?.name ?? "" }) - }) - ) - const includeCurrentBackground = new CheckBox(currentBackground, true) - optionCheckboxes.push(includeCurrentBackground) - optionParts.push( - includeCurrentBackground.GetValue().map( - (includeBG) => { - if (includeBG) { - return "background=" + currentLayer.data?.id - } else { - return null - } - }, - [currentLayer] - ) - ) - - const includeLayerChoices = new CheckBox(tr.fsIncludeCurrentLayers, true) - optionCheckboxes.push(includeLayerChoices) - - optionParts.push( - includeLayerChoices.GetValue().map( - (includeLayerSelection) => { - if (includeLayerSelection) { - return Utils.NoNull( - Array.from(state.layerState.filteredLayers.values()).map(fLayerToParam) - ).join("&") - } else { - return null - } - }, - Array.from(state.layerState.filteredLayers.values()).map( - (flayer) => flayer.isDisplayed - ) - ) - ) - - const switches = [ - { urlName: "fs-userbadge", human: tr.fsUserbadge }, - { urlName: "fs-search", human: tr.fsSearch }, - { urlName: "fs-welcome-message", human: tr.fsWelcomeMessage }, - { urlName: "fs-layers", human: tr.fsLayers }, - { urlName: "fs-add-new", human: tr.fsAddNew }, - { urlName: "fs-geolocation", human: tr.fsGeolocation }, - ] - - for (const swtch of switches) { - const checkbox = new CheckBox(Translations.W(swtch.human)) - optionCheckboxes.push(checkbox) - optionParts.push( - checkbox.GetValue().map((isEn) => { - if (isEn) { - return null - } else { - return `${swtch.urlName}=false` - } - }) - ) - } - - if (layout.definitionRaw !== undefined) { - optionParts.push(new UIEventSource("userlayout=" + (layout.definedAtUrl ?? layout.id))) - } - - const options = new Combine(optionCheckboxes).SetClass("flex flex-col") - const url = (currentLocation ?? new UIEventSource(undefined)).map(() => { - const host = window.location.host - let path = window.location.pathname - path = path.substr(0, path.lastIndexOf("/")) - let id = layout.id.toLowerCase() - if (layout.definitionRaw !== undefined) { - id = "theme.html" - } - let literalText = `https://${host}${path}/${id}` - - let hash = "" - if (layout.definedAtUrl === undefined && layout.definitionRaw !== undefined) { - hash = "#" + LZString.compressToBase64(Utils.MinifyJSON(layout.definitionRaw)) - } - const parts = Utils.NoEmpty( - Utils.NoNull(optionParts.map((eventSource) => eventSource.data)) - ) - if (parts.length === 0) { - return literalText + hash - } - return literalText + "?" + parts.join("&") + hash - }, optionParts) - - const iframeCode = new VariableUiElement( - url.map((url) => { - return ` - <iframe src="${url}" allow="geolocation" width="100%" height="100%" style="min-width: 250px; min-height: 250px" title="${ - layout.title?.txt ?? "MapComplete" - } with MapComplete"></iframe> - ` - }) - ) - - const linkStatus = new UIEventSource("") - const link = new VariableUiElement( - url.map( - (url) => - `` - ) - ).onClick(async () => { - const shareData = { - title: Translations.W(layout.title)?.ConstructElement().textContent ?? "", - text: Translations.W(layout.description)?.ConstructElement().textContent ?? "", - url: url.data, - } - - function rejected() { - const copyText = document.getElementById("code-link--copyable") - - // @ts-ignore - copyText.select() - // @ts-ignore - copyText.setSelectionRange(0, 99999) /*For mobile devices*/ - - document.execCommand("copy") - const copied = tr.copiedToClipboard.Clone() - copied.SetClass("thanks") - linkStatus.setData(copied) - } - - try { - navigator - .share(shareData) - .then(() => { - const thx = tr.thanksForSharing.Clone() - thx.SetClass("thanks") - linkStatus.setData(thx) - }, rejected) - .catch(rejected) - } catch (err) { - rejected() - } - }) - - let downloadThemeConfig: BaseUIElement = undefined - if (layout.definitionRaw !== undefined) { - const downloadThemeConfigAsJson = new SubtleButton( - Svg.download_svg(), - new Combine([tr.downloadCustomTheme, tr.downloadCustomThemeHelp.SetClass("subtle")]) - .onClick(() => { - Utils.offerContentsAsDownloadableFile( - layout.definitionRaw, - layout.id + ".mapcomplete-theme-definition.json", - { - mimetype: "application/json", - } - ) - }) - .SetClass("flex flex-col") - ) - let editThemeConfig: BaseUIElement = undefined - if (layout.definedAtUrl === undefined) { - const patchedDefinition = JSON.parse(layout.definitionRaw) - patchedDefinition["language"] = Object.keys(patchedDefinition.title) - editThemeConfig = new SubtleButton( - Svg.pencil_svg(), - "Edit this theme on the custom theme generator", - { - url: `https://pietervdvn.github.io/mc/legacy/070/customGenerator.html#${btoa( - JSON.stringify(patchedDefinition) - )}`, - } - ) - } - downloadThemeConfig = new Combine([ - downloadThemeConfigAsJson, - editThemeConfig, - ]).SetClass("flex flex-col") - } - - super([ - tr.intro, - link, - new VariableUiElement(linkStatus), - downloadThemeConfig, - tr.addToHomeScreen, - tr.embedIntro, - options, - iframeCode, - ]) - this.SetClass("flex flex-col link-underline") - } -} diff --git a/src/UI/BigComponents/ThemeIntroPanel.svelte b/src/UI/BigComponents/ThemeIntroPanel.svelte index 60b38a81e1..9e58063dfc 100644 --- a/src/UI/BigComponents/ThemeIntroPanel.svelte +++ b/src/UI/BigComponents/ThemeIntroPanel.svelte @@ -45,9 +45,7 @@ {#if layout.layers.some((l) => l.presets?.length > 0)} - - {/if} diff --git a/src/UI/QueryParameterDocumentation.ts b/src/UI/QueryParameterDocumentation.ts index 4c2255f4bc..55956ae54a 100644 --- a/src/UI/QueryParameterDocumentation.ts +++ b/src/UI/QueryParameterDocumentation.ts @@ -6,6 +6,7 @@ import Translations from "./i18n/Translations" import { QueryParameters } from "../Logic/Web/QueryParameters" import FeatureSwitchState from "../Logic/State/FeatureSwitchState" import LayoutConfig from "../Models/ThemeConfig/LayoutConfig" +import ThemeViewStateHashActor from "../Logic/Web/ThemeViewStateHashActor" export default class QueryParameterDocumentation { private static QueryParamDocsIntro = [ @@ -60,6 +61,7 @@ export default class QueryParameterDocumentation { public static GenerateQueryParameterDocs(): BaseUIElement { const docs: (string | BaseUIElement)[] = [ ...QueryParameterDocumentation.QueryParamDocsIntro, + ...ThemeViewStateHashActor.documentation, ] this.UrlParamDocs().forEach((value, key) => { const c = new Combine([ diff --git a/src/UI/ThemeViewGUI.svelte b/src/UI/ThemeViewGUI.svelte index 88fe5c24ac..e69d73fd5b 100644 --- a/src/UI/ThemeViewGUI.svelte +++ b/src/UI/ThemeViewGUI.svelte @@ -1,57 +1,57 @@