Themes: add toilet information in food and shops

This commit is contained in:
Pieter Vander Vennet 2025-04-21 04:10:51 +02:00
parent 92eca242ec
commit 3bc8eae6b1
9 changed files with 174 additions and 15 deletions
assets/layers
food
questions
shops
toilet
toilet_at_amenity
toilet_at_amenity_lib
src
Models/ThemeConfig/Conversion
UI

View file

@ -1433,7 +1433,8 @@
"dog-access",
"internet",
"internet-fee",
"internet-ssid"
"internet-ssid",
"toilet_at_amenity_lib.all"
],
"filter": [
"open_now",

View file

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

View file

@ -1326,7 +1326,8 @@
}
},
"dog-access",
"description"
"description",
"toilet_at_amenity_lib.all"
],
"filter": [
{

View file

@ -1494,7 +1494,11 @@
"prefixed",
"adult-changing-table"
],
"condition": "changing_table:adult=yes",
"condition": {
"and": [
"changing_table:adult=yes"
]
},
"classes": "bold text-lg"
}
},

View file

@ -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": [

View file

@ -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"
}
]
}
]
}

View file

@ -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
}

View file

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

View file

@ -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
/**