diff --git a/assets/layers/food/food.json b/assets/layers/food/food.json index c259f6edb..3d02e4d0e 100644 --- a/assets/layers/food/food.json +++ b/assets/layers/food/food.json @@ -1433,7 +1433,8 @@ "dog-access", "internet", "internet-fee", - "internet-ssid" + "internet-ssid", + "toilet_at_amenity_lib.all" ], "filter": [ "open_now", diff --git a/assets/layers/questions/questions.json b/assets/layers/questions/questions.json index c12842a1a..f620399ba 100644 --- a/assets/layers/questions/questions.json +++ b/assets/layers/questions/questions.json @@ -1827,7 +1827,11 @@ "labels": [ "level" ], - "condition": "repeat_on~*", + "condition": { + "and": [ + "repeat_on~*" + ] + }, "render": { "en": "Multiple, identical objects can be found on floors {repeat_on}.", "nl": "Er zijn verschillende, identieke objecten op verdiepingen {repeat_on}.", @@ -1842,7 +1846,11 @@ "labels": [ "level" ], - "condition": "repeat_on=", + "condition": { + "and": [ + "repeat_on=" + ] + }, "question": { "nl": "Op welke verdieping bevindt dit punt zich?", "en": "On what level is this feature located?", @@ -2053,7 +2061,11 @@ "pl": "Czy w {title()} wolno palić?" }, "#condition": "Based on https://en.wikipedia.org/wiki/List_of_smoking_bans", - "condition": "_country!~al|be", + "condition": { + "and": [ + "_country!~al|be" + ] + }, "mappings": [ { "if": "smoking=yes", @@ -2401,7 +2413,11 @@ "labels": [ "internet-all" ], - "condition": "internet_access~.*wlan.*", + "condition": { + "and": [ + "internet_access~.*wlan.*" + ] + }, "question": { "en": "What is the network name for the wireless internet access?", "nl": "Wat is de netwerknaam voor de draadloze internettoegang?", @@ -3321,6 +3337,29 @@ "freeform": { "key": "name" } + }, + { + "id": "has_toilets", + "question": { + "en": "Has {title()} toilets?", + "nl": "Heeft {title()} toiletten?" + }, + "mappings": [ + { + "if": "toilets=yes", + "then": { + "en": "Has toilets", + "nl": "Heeft toiletten" + } + }, + { + "if": "toilets=no", + "then": { + "en": "Has no toilets", + "nl": "Heeft geenad toiletten" + } + } + ] } ], "allowMove": false, diff --git a/assets/layers/shops/shops.json b/assets/layers/shops/shops.json index 9c6bf084b..9b9c70351 100644 --- a/assets/layers/shops/shops.json +++ b/assets/layers/shops/shops.json @@ -1326,7 +1326,8 @@ } }, "dog-access", - "description" + "description", + "toilet_at_amenity_lib.all" ], "filter": [ { diff --git a/assets/layers/toilet/toilet.json b/assets/layers/toilet/toilet.json index 40ac047a3..bd7988e06 100644 --- a/assets/layers/toilet/toilet.json +++ b/assets/layers/toilet/toilet.json @@ -1494,7 +1494,11 @@ "prefixed", "adult-changing-table" ], - "condition": "changing_table:adult=yes", + "condition": { + "and": [ + "changing_table:adult=yes" + ] + }, "classes": "bold text-lg" } }, diff --git a/assets/layers/toilet_at_amenity/toilet_at_amenity.json b/assets/layers/toilet_at_amenity/toilet_at_amenity.json index 01e45c10b..ef47dae59 100644 --- a/assets/layers/toilet_at_amenity/toilet_at_amenity.json +++ b/assets/layers/toilet_at_amenity/toilet_at_amenity.json @@ -141,14 +141,32 @@ "lineRendering": [], "tagRenderings": [ "images", + { + "id": "dead", + "labels": [ + "hidden", + "relevant_questions" + ], + "condition": "id=", + "render": "Only used to make sure 'relevant-questions' is known" + }, { "builtin": "toilet.amenity-no-prefix", - "prefix": "toilets" + "prefix": "toilets", + "override": { + "labels+": [ + "relevant_questions" + ] + } }, { "builtin": "opening_hours", "override": { - "condition": "toilets:access!=no", + "condition": { + "and+": [ + "toilets:access!=no" + ] + }, "question": { "en": "When is the amenity where these toilets are located open?", "de": "Wann ist der Ort, an dem sich diese Toiletten befinden, geöffnet?", @@ -159,7 +177,14 @@ } } }, - "toilet.amenity-prefixed", + { + "builtin": "toilet.amenity-prefixed", + "override": { + "labels+": [ + "relevant_questions" + ] + } + }, { "id": "toilets-wheelchair", "labels": [ diff --git a/assets/layers/toilet_at_amenity_lib/toilet_at_amenity_lib.json b/assets/layers/toilet_at_amenity_lib/toilet_at_amenity_lib.json new file mode 100644 index 000000000..85cc85af5 --- /dev/null +++ b/assets/layers/toilet_at_amenity_lib/toilet_at_amenity_lib.json @@ -0,0 +1,88 @@ +{ + "id": "toilet_at_amenity_lib", + "description": "Special layer which makes it easy to add, as a group, information about toilets to any POI", + "source": "special:library", + "tagRenderings": [ + { + "id": "toilets-group", + "labels": [ + "all" + ], + "render": { + "special": { + "type": "group", + "header": "grouptitle", + "labels": "toilet-questions" + } + } + }, + { + "id": "grouptitle", + "render": { + "en": "Toilet information", + "nl": "Informatie over de toiletten" + }, + "mappings": [ + { + "if": "toilets=no", + "then": { + "en": "Does not have toilets", + "nl": "Heeft geen toiletten" + } + } + ] + }, + { + "builtin": "has_toilets", + "override": { + "labels+": [ + "toilet-questions", + "hidden", + "all" + ] + } + }, + { + "builtin": "toilet_at_amenity.relevant_questions", + "override": { + "labels+": [ + "toilet-questions", + "hidden", + "all" + ], + "condition": { + "and+": [ + "toilets=yes" + ] + } + } + }, + { + "id": "toilet-question-box", + "labels": [ + "toilet-questions", + "all" + ], + "render": { + "special": { + "type": "questions", + "labels": "toilet-questions" + } + } + } + ], + "allowMove": false, + "pointRendering": [ + { + "location": [ + "centroid", + "point" + ], + "marker": [ + { + "icon": "circle" + } + ] + } + ] +} diff --git a/src/Models/ThemeConfig/Conversion/ExpandTagRendering.ts b/src/Models/ThemeConfig/Conversion/ExpandTagRendering.ts index 8429a0479..a1cece1f8 100644 --- a/src/Models/ThemeConfig/Conversion/ExpandTagRendering.ts +++ b/src/Models/ThemeConfig/Conversion/ExpandTagRendering.ts @@ -410,7 +410,8 @@ export class ExpandTagRendering extends Conversion< name + " was not found.\n\tDid you mean one of " + candidates.join(", ") + - "?\n(Hint: did you add a new label and are you trying to use this label at the same time? Run 'reset:layeroverview' first" + "?\n(Hint: did you add a new label and are you trying to use this label at the same time? Run 'reset:layeroverview' first\n" + + "HINT: are you overriding a `condition`? Check that the source condition has the format `condition: {and: [...]}`" ) continue } diff --git a/src/UI/SpecialVisualisations/ImageVisualisations.ts b/src/UI/SpecialVisualisations/ImageVisualisations.ts index 1f35bfbce..0517950e4 100644 --- a/src/UI/SpecialVisualisations/ImageVisualisations.ts +++ b/src/UI/SpecialVisualisations/ImageVisualisations.ts @@ -14,7 +14,7 @@ import NearbyImagesCollapsed from "../Image/NearbyImagesCollapsed.svelte" class NearbyImageVis implements SpecialVisualizationSvelte { // Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests - args: [ + args = [ { name: "mode", defaultValue: "closed", @@ -26,7 +26,7 @@ class NearbyImageVis implements SpecialVisualizationSvelte { doc: "If 'readonly' or 'yes', will not show the 'link'-button", }, ] - group: "images" + group = "images" docs = "A component showing nearby images loaded from various online services such as Mapillary. In edit mode and when used on a feature, the user can select an image to add to the feature" funcName = "nearby_images" diff --git a/src/UI/SpecialVisualization.ts b/src/UI/SpecialVisualization.ts index df980e4b2..8f6cd8f04 100644 --- a/src/UI/SpecialVisualization.ts +++ b/src/UI/SpecialVisualization.ts @@ -97,7 +97,7 @@ export interface SpecialVisualization { defaultValue?: string doc: string required?: false | boolean, - type?: "key" + type?: "key" | string }[] readonly getLayerDependencies?: (argument: string[]) => string[] @@ -112,7 +112,7 @@ export interface SpecialVisualization { ): BaseUIElement } -export interface SpecialVisualizationSvelte { +export interface SpecialVisualizationSvelte extends SpecialVisualization { readonly funcName: string readonly docs: string /**