From e13c7ae677aa003c13def3e3121878d4bf3f52fa Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 20 Jun 2022 01:42:30 +0200 Subject: [PATCH] Move some assets to the 'tagRenderings'-directory as they are only needed there, add 'smoking' question, add 'nightclubs' to 'pub_cafe'-layer --- Models/ThemeConfig/Conversion/Validation.ts | 105 +++++++----- assets/layers/cafe_pub/cafe_pub.json | 44 ++++- assets/layers/cafe_pub/license_info.json | 10 ++ assets/layers/cafe_pub/nightclub.svg | 27 +++ assets/license_info.json | 16 ++ assets/svg/license_info.json | 72 -------- assets/{svg => tagRenderings}/cash.svg | 0 assets/tagRenderings/icons.json | 21 ++- assets/tagRenderings/license_info.json | 96 +++++++++++ assets/{svg => tagRenderings}/nfc_card.svg | 0 assets/tagRenderings/no_smoking.svg | 160 ++++++++++++++++++ .../{svg => tagRenderings}/payment_card.svg | 0 assets/{svg => tagRenderings}/phone.svg | 0 assets/tagRenderings/questions.json | 43 ++++- assets/{svg => tagRenderings}/send_email.svg | 0 assets/{svg => tagRenderings}/smartphone.svg | 0 assets/tagRenderings/smoking.svg | 8 + package.json | 2 +- 18 files changed, 472 insertions(+), 132 deletions(-) create mode 100644 assets/layers/cafe_pub/nightclub.svg rename assets/{svg => tagRenderings}/cash.svg (100%) create mode 100644 assets/tagRenderings/license_info.json rename assets/{svg => tagRenderings}/nfc_card.svg (100%) create mode 100644 assets/tagRenderings/no_smoking.svg rename assets/{svg => tagRenderings}/payment_card.svg (100%) rename assets/{svg => tagRenderings}/phone.svg (100%) rename assets/{svg => tagRenderings}/send_email.svg (100%) rename assets/{svg => tagRenderings}/smartphone.svg (100%) create mode 100644 assets/tagRenderings/smoking.svg diff --git a/Models/ThemeConfig/Conversion/Validation.ts b/Models/ThemeConfig/Conversion/Validation.ts index aa4d4d53a..a7d3a1e42 100644 --- a/Models/ThemeConfig/Conversion/Validation.ts +++ b/Models/ThemeConfig/Conversion/Validation.ts @@ -17,7 +17,7 @@ import {QuestionableTagRenderingConfigJson} from "../Json/QuestionableTagRenderi class ValidateLanguageCompleteness extends DesugaringStep { - + private readonly _languages: string[]; constructor(...languages: string[]) { @@ -98,8 +98,8 @@ class ValidateTheme extends DesugaringStep { continue } if (image.match(/[a-z]*/)) { - - if(Svg.All[image + ".svg"] !== undefined){ + + if (Svg.All[image + ".svg"] !== undefined) { // This is a builtin img, e.g. 'checkmark' or 'crosshair' continue;// => } @@ -121,18 +121,18 @@ class ValidateTheme extends DesugaringStep { ` Width = ${width} height = ${height}`; (json.hideFromOverview ? warnings : errors).push(e) } - + const w = parseInt(width); const h = parseInt(height) - if(w < 370 || h < 370){ - const e : string = [ + if (w < 370 || h < 370) { + const e: string = [ `the icon for theme ${json.id} is too small. Please rescale the icon at ${json.icon}`, `Even though an SVG is 'infinitely scaleable', the icon should be dimensioned bigger. One of the build steps of the theme does convert the image to a PNG (to serve as PWA-icon) and having a small dimension will cause blurry images.`, ` Width = ${width} height = ${height}; we recommend a size of at least 500px * 500px and to use a square aspect ratio.`, - ].join("\n"); + ].join("\n"); (json.hideFromOverview ? warnings : errors).push(e) } - + }) } catch (e) { console.error("Could not read " + json.icon + " due to " + e) @@ -186,7 +186,7 @@ export class ValidateThemeAndLayers extends Fuse { constructor(knownImagePaths: Set, path: string, isBuiltin: boolean, sharedTagRenderings: Map) { super("Validates a theme and the contained layers", new ValidateTheme(knownImagePaths, path, isBuiltin, sharedTagRenderings), - new On("layers", new Each(new ValidateLayer(undefined, false))) + new On("layers", new Each(new ValidateLayer(undefined, false, knownImagePaths))) ); } } @@ -222,22 +222,22 @@ class OverrideShadowingCheck extends DesugaringStep { } -class MiscThemeChecks extends DesugaringStep{ +class MiscThemeChecks extends DesugaringStep { constructor() { - super("Miscelleanous checks on the theme", [],"MiscThemesChecks"); + super("Miscelleanous checks on the theme", [], "MiscThemesChecks"); } - + convert(json: LayoutConfigJson, context: string): { result: LayoutConfigJson; errors?: string[]; warnings?: string[]; information?: string[] } { const warnings = [] const errors = [] - if(json.id !== "personal" && (json.layers === undefined || json.layers.length === 0)){ - errors.push("The theme "+json.id+" has no 'layers' defined ("+context+")") + if (json.id !== "personal" && (json.layers === undefined || json.layers.length === 0)) { + errors.push("The theme " + json.id + " has no 'layers' defined (" + context + ")") } - if(json.socialImage === ""){ - warnings.push("Social image for theme "+json.id+" is the emtpy string") + if (json.socialImage === "") { + warnings.push("Social image for theme " + json.id + " is the emtpy string") } return { - result :json, + result: json, warnings, errors }; @@ -258,28 +258,29 @@ export class PrevalidateTheme extends Fuse { export class DetectShadowedMappings extends DesugaringStep { private readonly _calculatedTagNames: string[]; + constructor(layerConfig?: LayerConfigJson) { super("Checks that the mappings don't shadow each other", [], "DetectShadowedMappings"); this._calculatedTagNames = DetectShadowedMappings.extractCalculatedTagNames(layerConfig); } /** - * + * * DetectShadowedMappings.extractCalculatedTagNames({calculatedTags: ["_abc:=js()"]}) // => ["_abc"] * DetectShadowedMappings.extractCalculatedTagNames({calculatedTags: ["_abc=js()"]}) // => ["_abc"] */ - private static extractCalculatedTagNames(layerConfig?: LayerConfigJson | {calculatedTags : string []}){ + private static extractCalculatedTagNames(layerConfig?: LayerConfigJson | { calculatedTags: string [] }) { return layerConfig?.calculatedTags?.map(ct => { - if(ct.indexOf(':=') >= 0){ + if (ct.indexOf(':=') >= 0) { return ct.split(':=')[0] } return ct.split("=")[0] }) ?? [] - + } /** - * + * * // should detect a simple shadowed mapping * const tr = {mappings: [ * { @@ -319,20 +320,20 @@ export class DetectShadowedMappings extends DesugaringStep { + const parsedConditions = json.mappings.map((m, i) => { const ctx = `${context}.mappings[${i}]` const ifTags = TagUtils.Tag(m.if, ctx); - if(m.hideInAnswer !== undefined && m.hideInAnswer !== false && m.hideInAnswer !== true){ - let conditionTags = TagUtils.Tag( m.hideInAnswer) + if (m.hideInAnswer !== undefined && m.hideInAnswer !== false && m.hideInAnswer !== true) { + let conditionTags = TagUtils.Tag(m.hideInAnswer) // Merge the condition too! return new And([conditionTags, ifTags]) } return ifTags }) for (let i = 0; i < json.mappings.length; i++) { - if(!parsedConditions[i].isUsableAsAnswer()){ + if (!parsedConditions[i].isUsableAsAnswer()) { // There is no straightforward way to convert this mapping.if into a properties-object, so we simply skip this one // Yes, it might be shadowed, but running this check is to difficult right now continue @@ -372,8 +373,10 @@ export class DetectShadowedMappings extends DesugaringStep { - constructor() { + private knownImagePaths: Set; + constructor(knownImagePaths: Set) { super("Checks that 'then'clauses in mappings don't have images, but use 'icon' instead", [], "DetectMappingsWithImages"); + this.knownImagePaths = knownImagePaths; } /** @@ -407,21 +410,29 @@ export class DetectMappingsWithImages extends DesugaringStep=0 + const ignore = mapping["#"]?.indexOf(ignoreToken) >= 0 const images = Utils.Dedup(Translations.T(mapping.then)?.ExtractImages() ?? []) const ctx = `${context}.mappings[${i}]` if (images.length > 0) { - if(!ignore){ + if (!ignore) { errors.push(`${ctx}: A mapping has an image in the 'then'-clause. Remove the image there and use \`"icon": \` instead. The images found are ${images.join(", ")}. (This check can be turned of by adding "#": "${ignoreToken}" in the mapping, but this is discouraged`) - }else{ + } else { information.push(`${ctx}: Ignored image ${images.join(", ")} in 'then'-clause of a mapping as this check has been disabled`) + + for (const image of images) { + if (this.knownImagePaths !== undefined && !this.knownImagePaths.has(image)) { + const ctx = context === undefined ? "" : ` in a layer defined in the theme ${context}` + errors.push(`Image with path ${image} not found or not attributed; it is used in ${json.id}${ctx}`) + } + } + } - }else if (ignore){ + } else if (ignore) { warnings.push(`${ctx}: unused '${ignoreToken}' - please remove this`) } } - return { + return { errors, warnings, information, @@ -431,10 +442,10 @@ export class DetectMappingsWithImages extends DesugaringStep { - constructor(layerConfig: LayerConfigJson) { + constructor(layerConfig?: LayerConfigJson, knownImagePaths?: Set) { super("Various validation on tagRenderingConfigs", - new DetectShadowedMappings( layerConfig), - new DetectMappingsWithImages() + new DetectShadowedMappings(layerConfig), + new DetectMappingsWithImages(knownImagePaths) ); } } @@ -446,11 +457,13 @@ export class ValidateLayer extends DesugaringStep { */ private readonly _path?: string; private readonly _isBuiltin: boolean; + private knownImagePaths: Set; - constructor(path: string, isBuiltin: boolean) { + constructor(path: string, isBuiltin: boolean, knownImagePaths: Set) { super("Doesn't change anything, but emits warnings and errors", [], "ValidateLayer"); this._path = path; this._isBuiltin = isBuiltin; + this.knownImagePaths = knownImagePaths } convert(json: LayerConfigJson, context: string): { result: LayerConfigJson; errors: string[]; warnings?: string[], information?: string[] } { @@ -475,13 +488,13 @@ export class ValidateLayer extends DesugaringStep { { // duplicate ids in tagrenderings check - const duplicates = Utils.Dedup(Utils.Dupiclates( Utils.NoNull((json.tagRenderings ?? []).map(tr => tr["id"])))) - .filter(dupl => dupl !== "questions") - if(duplicates.length > 0){ - errors.push("At "+context+": some tagrenderings have a duplicate id: "+duplicates.join(", ")) + const duplicates = Utils.Dedup(Utils.Dupiclates(Utils.NoNull((json.tagRenderings ?? []).map(tr => tr["id"])))) + .filter(dupl => dupl !== "questions") + if (duplicates.length > 0) { + errors.push("At " + context + ": some tagrenderings have a duplicate id: " + duplicates.join(", ")) } } - + try { { // Some checks for legacy elements @@ -538,10 +551,10 @@ export class ValidateLayer extends DesugaringStep { } } if (json.tagRenderings !== undefined) { - const r = new On("tagRenderings", new Each(new ValidateTagRenderings(json))).convert(json, context) - warnings.push(...(r.warnings??[])) - errors.push(...(r.errors??[])) - information.push(...(r.information??[])) + const r = new On("tagRenderings", new Each(new ValidateTagRenderings(json, this.knownImagePaths))).convert(json, context) + warnings.push(...(r.warnings ?? [])) + errors.push(...(r.errors ?? [])) + information.push(...(r.information ?? [])) } if (json.presets !== undefined) { diff --git a/assets/layers/cafe_pub/cafe_pub.json b/assets/layers/cafe_pub/cafe_pub.json index fbbcaab26..6d3e13e99 100644 --- a/assets/layers/cafe_pub/cafe_pub.json +++ b/assets/layers/cafe_pub/cafe_pub.json @@ -1,8 +1,8 @@ { "id": "cafe_pub", "name": { - "nl": "Cafés", - "en": "Cafés and pubs", + "nl": "Cafés en nachtclubs", + "en": "Cafés, pubs and nightclubs", "de": "Cafés und Kneipen", "fr": "Cafés et pubs", "zh_Hant": "咖啡廳與酒吧", @@ -16,7 +16,8 @@ "amenity=bar", "amenity=pub", "amenity=cafe", - "amenity=biergarten" + "amenity=biergarten", + "amenity=nightclub" ] } }, @@ -94,6 +95,22 @@ "preciseInput": { "preferredBackground": "map" } + }, + { + "tags": [ + "amenity=nightclub" + ], + "title": { + "en": "a nightclub or disco", + "nl": "een nachtclub of disco" + }, + "description": { + "en": "A nightclub or disco with a focus on dancing, music by a DJ with accompanying light show and a bar to get (alcoholic) drinks", + "nl": "Een nachtclub met dansvloer, DJ met bijhorende lichteffecten en bar waar men (alcoholische) dranken kan nuttigen" + }, + "preciseInput": { + "preferredBackground": "map" + } } ], "title": { @@ -137,8 +154,8 @@ "es": "¿Cual es el nombre de este pub?" }, "render": { - "nl": "De naam van dit café is {name}", - "en": "This pub is named {name}", + "nl": "De naam van deze zaak is {name}", + "en": "This place is named {name}", "de": "Diese Kneipe heißt {name}", "fr": "Ce pub se nomme {name}", "hu": "A kocsma neve: {name}", @@ -209,6 +226,14 @@ "es": "Un espacio abierto donde se sirve cerveza, típico de Alemania" }, "hideInAnswer": "_country!=de" + }, + { + "if": "amenity=nightclub", + "then": { + "en": "This is a nightclub or disco with a focus on dancing, music by a DJ with accompanying light show and a bar to get (alcoholic) drinks", + "nl": "Dit is een nachtclub met dansvloer, DJ met bijhorende lichteffecten en bar waar men (alcoholische) dranken kan nuttigen" + + } } ], "id": "Classification" @@ -219,6 +244,7 @@ "phone", "payment-options", "wheelchair-access", + "smoking", "service:electricity", "dog-access" ], @@ -271,6 +297,10 @@ { "if": "amenity=cafe", "then": "circle:white;./assets/layers/cafe_pub/cafe.svg" + }, + { + "if": "amenity=nightclub", + "then": "circle:white;./assets/layers/cafe_pub/nightclub.svg" } ] }, @@ -295,9 +325,9 @@ } ], "description": { - "en": "A layer showing cafés and pubs where one can gather around a drink. The layer asks for some relevant questions", + "en": "A layer showing cafés, pubs, biergartens and nightclubs where one can gather around a drink. The layer asks for some relevant questions", "hu": "Egy olyan réteg, amely kávézókat és kocsmákat jelenít meg, ahol össze lehet gyűlni egy ital köré. A réteg néhány lényeges kérdést tesz fel", - "nl": "Een laag die kroegen en koffiehuizen toont waar je iets kunt drinken. De laag zal je enkele vragen stellen", + "nl": "Een laag die kroegen, koffiehuizen, biergartens en nachtclubs toont waar je iets kunt drinken. De laag zal je enkele vragen stellen", "de": "Eine Ebene mit Cafés und Kneipen, in denen man sich auf ein Getränk treffen kann. Die Ebene fragt nach einigen relevanten Eigenschaften", "es": "Una capa que muestra cafeterías y bares donde uno se puede reunir con una bebida. La capa hace algunas preguntas relevantes", "da": "Et lag med caféer og pubber, hvor man kan samles omkring en drink. Laget stiller nogle relevante spørgsmål" diff --git a/assets/layers/cafe_pub/license_info.json b/assets/layers/cafe_pub/license_info.json index dd4798197..9ba0c8457 100644 --- a/assets/layers/cafe_pub/license_info.json +++ b/assets/layers/cafe_pub/license_info.json @@ -9,6 +9,16 @@ "https://wiki.openstreetmap.org/wiki/File:Cafe-16.svg" ] }, + { + "path": "nightclub.svg", + "license": "CC0", + "authors": [ + "Osm Carto" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Nightclub-16.svg" + ] + }, { "path": "pub.svg", "license": "CC0", diff --git a/assets/layers/cafe_pub/nightclub.svg b/assets/layers/cafe_pub/nightclub.svg new file mode 100644 index 000000000..5e34e5631 --- /dev/null +++ b/assets/layers/cafe_pub/nightclub.svg @@ -0,0 +1,27 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/assets/license_info.json b/assets/license_info.json index 3e657b34d..c4510d13a 100644 --- a/assets/license_info.json +++ b/assets/license_info.json @@ -17,6 +17,22 @@ ], "sources": [] }, + { + "path": "SocialImageBanner.png", + "license": "CC0", + "authors": [ + "Pieter Vander Vennet" + ], + "sources": [] + }, + { + "path": "SocialImageBanner.svg", + "license": "CC0", + "authors": [ + "Pieter Vander Vennet" + ], + "sources": [] + }, { "path": "SocialImageSmall.png", "license": "CC-BY-SA 4.0", diff --git a/assets/svg/license_info.json b/assets/svg/license_info.json index f992a5304..133544ecf 100644 --- a/assets/svg/license_info.json +++ b/assets/svg/license_info.json @@ -141,16 +141,6 @@ "https://commons.wikimedia.org/wiki/File:Camera_font_awesome.svg" ] }, - { - "path": "cash.svg", - "license": "CC-BY 3.0", - "authors": [ - "Online Web Fonts" - ], - "sources": [ - "https://www.onlinewebfonts.com/icon/464494" - ] - }, { "path": "checkbox-empty.svg", "license": "CC0", @@ -859,16 +849,6 @@ ], "sources": [] }, - { - "path": "nfc_card.svg", - "license": "CC0", - "authors": [ - "Stijn Wens" - ], - "sources": [ - "https://wens.be/free-antwerpenize-bicycle-font" - ] - }, { "path": "no_checkmark.svg", "license": "CC0; trivial", @@ -951,16 +931,6 @@ "https://github.com/twitter/twemoji" ] }, - { - "path": "payment_card.svg", - "license": "CC0", - "authors": [ - " \tMaxi Koichi (maxixam)" - ], - "sources": [ - "https://commons.wikimedia.org/wiki/File:Credit_Card_-_The_Noun_Project.svg" - ] - }, { "path": "pencil.svg", "license": "MIT", @@ -983,26 +953,6 @@ " https://commons.wikimedia.org/wiki/File:Octicons-pencil.svg" ] }, - { - "path": "phone.svg", - "license": "CC-BY 3.0", - "authors": [ - "@ tyskrat" - ], - "sources": [ - "https://www.onlinewebfonts.com/icon/1059" - ] - }, - { - "path": "phone.svg", - "license": "CC-BY 3.0", - "authors": [ - "@ tyskrat" - ], - "sources": [ - "https://www.onlinewebfonts.com/icon/1059" - ] - }, { "path": "pin.svg", "license": "CC0; trivial", @@ -1151,18 +1101,6 @@ "https://phabricator.wikimedia.org/diffusion/GOJU/browse/master/AUTHORS.txt" ] }, - { - "path": "send_email.svg", - "license": "CC0; trivial", - "authors": [], - "sources": [] - }, - { - "path": "send_email.svg", - "license": "CC0; trivial", - "authors": [], - "sources": [] - }, { "path": "share.svg", "license": "CC0; trivial", @@ -1175,16 +1113,6 @@ "authors": [], "sources": [] }, - { - "path": "smartphone.svg", - "license": "CC-BY 3.0", - "authors": [ - "To Uyen" - ], - "sources": [ - "https://commons.wikimedia.org/wiki/File:Smartphone_icon_-_Noun_Project_283536.svg" - ] - }, { "path": "speech_bubble.svg", "license": "CC-BY 4.0", diff --git a/assets/svg/cash.svg b/assets/tagRenderings/cash.svg similarity index 100% rename from assets/svg/cash.svg rename to assets/tagRenderings/cash.svg diff --git a/assets/tagRenderings/icons.json b/assets/tagRenderings/icons.json index 3abd31684..6a0d786d7 100644 --- a/assets/tagRenderings/icons.json +++ b/assets/tagRenderings/icons.json @@ -5,6 +5,7 @@ "phonelink", "emaillink", "wikipedialink", + "smokingicon", "osmlink", "sharelink" ], @@ -20,6 +21,7 @@ }, "mappings": [ { + "#": "ignore-image-in-then", "if": "wikipedia=", "then": "WD" } @@ -59,13 +61,27 @@ ] }, "phonelink": { - "render": "phone", + "render": "phone", "condition": "phone~*" }, "emaillink": { - "render": "email", + "render": "email", "condition": "email~*" }, + "smokingicon": { + "mappings": [ + { + "#": "ignore-image-in-then", + "if": "smoking=no", + "then": "no-smoking" + }, + { + "#": "ignore-image-in-then", + "if": "smoking=yes", + "then": "smoking-allowed" + } + ] + }, "osmlink": { "render": "on osm", "mappings": [ @@ -74,6 +90,7 @@ "then": "" }, { + "#": "ignore-image-in-then", "if": "_backend~*", "then": "" } diff --git a/assets/tagRenderings/license_info.json b/assets/tagRenderings/license_info.json new file mode 100644 index 000000000..c65bd6f93 --- /dev/null +++ b/assets/tagRenderings/license_info.json @@ -0,0 +1,96 @@ +[ + { + "path": "cash.svg", + "license": "CC-BY 3.0", + "authors": [ + "Online Web Fonts" + ], + "sources": [ + "https://www.onlinewebfonts.com/icon/464494" + ] + }, + { + "path": "nfc_card.svg", + "license": "CC0", + "authors": [ + "Stijn Wens" + ], + "sources": [ + "https://wens.be/free-antwerpenize-bicycle-font" + ] + }, + { + "path": "no_smoking.svg", + "license": "CC0", + "authors": [ + "AIGA" + ], + "sources": [ + "https://upload.wikimedia.org/wikipedia/commons/6/6b/No_Smoking.svg", + "https://www.aiga.org/content.cfm/symbol-signs" + ] + }, + { + "path": "payment_card.svg", + "license": "CC0", + "authors": [ + " \tMaxi Koichi (maxixam)" + ], + "sources": [ + "https://commons.wikimedia.org/wiki/File:Credit_Card_-_The_Noun_Project.svg" + ] + }, + { + "path": "phone.svg", + "license": "CC-BY 3.0", + "authors": [ + "@ tyskrat" + ], + "sources": [ + "https://www.onlinewebfonts.com/icon/1059" + ] + }, + { + "path": "phone.svg", + "license": "CC-BY 3.0", + "authors": [ + "@ tyskrat" + ], + "sources": [ + "https://www.onlinewebfonts.com/icon/1059" + ] + }, + { + "path": "send_email.svg", + "license": "CC0; trivial", + "authors": [], + "sources": [] + }, + { + "path": "send_email.svg", + "license": "CC0; trivial", + "authors": [], + "sources": [] + }, + { + "path": "smartphone.svg", + "license": "CC-BY 3.0", + "authors": [ + "To Uyen" + ], + "sources": [ + "https://commons.wikimedia.org/wiki/File:Smartphone_icon_-_Noun_Project_283536.svg" + ] + }, + { + "path": "smoking.svg", + "license": "CC0", + "authors": [ + "Wiki-User03", + "ZooFari" + ], + "sources": [ + "https://commons.wikimedia.org/wiki/File:Smoking_pictogram_(black).svg" + ] + } +] \ No newline at end of file diff --git a/assets/svg/nfc_card.svg b/assets/tagRenderings/nfc_card.svg similarity index 100% rename from assets/svg/nfc_card.svg rename to assets/tagRenderings/nfc_card.svg diff --git a/assets/tagRenderings/no_smoking.svg b/assets/tagRenderings/no_smoking.svg new file mode 100644 index 000000000..b0a116108 --- /dev/null +++ b/assets/tagRenderings/no_smoking.svg @@ -0,0 +1,160 @@ + + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/svg/payment_card.svg b/assets/tagRenderings/payment_card.svg similarity index 100% rename from assets/svg/payment_card.svg rename to assets/tagRenderings/payment_card.svg diff --git a/assets/svg/phone.svg b/assets/tagRenderings/phone.svg similarity index 100% rename from assets/svg/phone.svg rename to assets/tagRenderings/phone.svg diff --git a/assets/tagRenderings/questions.json b/assets/tagRenderings/questions.json index d1dd19d58..862a64043 100644 --- a/assets/tagRenderings/questions.json +++ b/assets/tagRenderings/questions.json @@ -745,7 +745,7 @@ { "if": "payment:cash=yes", "ifnot": "payment:cash=no", - "icon": "./assets/svg/cash.svg", + "icon": "./assets/tagRenderings/cash.svg", "then": { "en": "Cash is accepted here", "nl": "Cash geld wordt hier aanvaard", @@ -773,7 +773,7 @@ { "if": "payment:cards=yes", "ifnot": "payment:cards=no", - "icon": "./assets/svg/payment_card.svg", + "icon": "./assets/tagRenderings/payment_card.svg", "then": { "en": "Payment cards are accepted here", "nl": "Betalen met bankkaarten kan hier", @@ -807,7 +807,7 @@ { "if": "payment:app=yes", "ifnot": "payment:app=no", - "icon": "./assets/svg/smartphone.svg", + "icon": "./assets/tagRenderings/smartphone.svg", "then": { "en": "Payment is done using a dedicated app", "nl": "Betalen via een app van het netwerk", @@ -828,7 +828,7 @@ { "if": "payment:membership_card=yes", "ifnot": "payment:membership_card=no", - "icon": "./assets/svg/nfc_card.svg", + "icon": "./assets/tagRenderings/nfc_card.svg", "then": { "en": "Payment is done using a membership card", "nl": "Betalen via een lidkaart van het netwerk", @@ -1031,5 +1031,40 @@ } } ] + }, + "smoking": { + "question": { + "en": "Is smoking allowed at {title()}?" + }, + "#condition": "Based on https://en.wikipedia.org/wiki/List_of_smoking_bans", + "condition": "_country!~al|be", + "mappings": [ + { + "if": "smoking=yes", + "icon": { + "path": "./assets/tagRenderings/smoking.svg", + "size": "small" + }, + "then": { + "en": "Smoking is allowed" + } + }, + { + "if": "smoking=no", + "icon": { + "path": "./assets/tagRenderings/no_smoking.svg", + "size": "small" + }, + "then": { + "en": "Smoking is not allowed" + } + }, + { + "if": "smoking=outside", + "then": { + "en": "Smoking is allowed outside." + } + } + ] } } \ No newline at end of file diff --git a/assets/svg/send_email.svg b/assets/tagRenderings/send_email.svg similarity index 100% rename from assets/svg/send_email.svg rename to assets/tagRenderings/send_email.svg diff --git a/assets/svg/smartphone.svg b/assets/tagRenderings/smartphone.svg similarity index 100% rename from assets/svg/smartphone.svg rename to assets/tagRenderings/smartphone.svg diff --git a/assets/tagRenderings/smoking.svg b/assets/tagRenderings/smoking.svg new file mode 100644 index 000000000..f9d91d82b --- /dev/null +++ b/assets/tagRenderings/smoking.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/package.json b/package.json index 3f1505cd5..dfe653f92 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "main": "index.js", "scripts": { "start": "npm run generate:layeroverview && npm run strt", - "strt": "export NODE_OPTIONS=--max_old_space_size=8364 && parcel serve *.html UI/** Logic/** assets/*.json assets/svg/* assets/generated/* assets/layers/*/*.svg assets/layers/*/*/*/*.svg assets/layers/*/*.jpg assets/layers/*/*.png assets/layers/*/*.css assets/tagRenderings/*.json assets/themes/*/*.svg assets/themes/*/*.ttf assets/themes/*/*/*.ttf assets/themes/*/*.otf assets/themes/*/*/*.otf assets/themes/*/*.css assets/themes/*/*.jpg assets/themes/*/*.woff assets/themes/*/*.png vendor/* vendor/*/*", + "strt": "export NODE_OPTIONS=--max_old_space_size=8364 && parcel serve *.html UI/** Logic/** assets/*.json assets/svg/* assets/generated/* assets/layers/*/*.svg assets/layers/*/*/*/*.svg assets/layers/*/*.jpg assets/layers/*/*.png assets/layers/*/*.css assets/tagRenderings/*.json assets/themes/*/*.svg assets/themes/*/*.ttf assets/themes/*/*/*.ttf assets/themes/*/*.otf assets/themes/*/*/*.otf assets/themes/*/*.css assets/themes/*/*.jpg assets/themes/*/*.woff assets/themes/*/*.png vendor/* vendor/*/* assets/tagRenderings/*.svg", "strttest": "export NODE_OPTIONS=--max_old_space_size=8364 && parcel serve test.html", "watch:css": "tailwindcss -i index.css -o css/index-tailwind-output.css --watch", "generate:css": "tailwindcss -i index.css -o css/index-tailwind-output.css",