From 6557c514930bd89e72bba745115f79ff26ba626d Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 5 Jan 2021 03:33:41 +0100 Subject: [PATCH] Better OH viz --- AllTranslationAssets.ts | 1 + UI/OpeningHours/OhVisualization.ts | 8 ++++++++ assets/tagRenderings/questions.json | 16 +--------------- assets/translations.json | 4 ++++ 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/AllTranslationAssets.ts b/AllTranslationAssets.ts index 7eadd6a9b..da4822734 100644 --- a/AllTranslationAssets.ts +++ b/AllTranslationAssets.ts @@ -116,6 +116,7 @@ export default class AllTranslationAssets { not_all_rules_parsed: new Translation( {"en":"The opening hours of this shop are complicated. The following rules are ignored in the input element:","fr":"Les heures d'ouvertures de ce magasin sont trop compliquées. Les heures suivantes ont été ignorées:","ca":"L'horari d'aquesta botiga és complicat. Les normes següents seran ignorades en l'entrada:","es":"El horario de esta tienda es complejo. Las normas siguientes serán ignoradas en la entrada:"} ), closed_until: new Translation( {"en":"Closed until {date}","ca":"Tancat fins {date}","es":"Cerrado hasta {date}","nl":"Gesloten - open op {date}","fr":"Fermé jusqu'à"} ), closed_permanently: new Translation( {"en":"Closed for an unkown duration","ca":"Tancat - sense dia d'obertura conegut","es":"Cerrado - sin día de apertura conocido","nl":"Gesloten voor onbepaalde tijd","fr":"Fermé"} ), + open_24_7: new Translation( {"en":"Opened around the clock","nl":"Dag en nacht open"} ), ph_not_known: new Translation( {"en":" ","ca":" ","es":" ","nl":" "} ), ph_closed: new Translation( {"en":"closed","ca":"tancat","es":"cerrado","nl":"gesloten","fr":"fermé"} ), ph_open: new Translation( {"en":"opened","ca":"tancat","es":"abierto","nl":"open","fr":"ouvert"} ), diff --git a/UI/OpeningHours/OhVisualization.ts b/UI/OpeningHours/OhVisualization.ts index e58e70cb2..6e368791c 100644 --- a/UI/OpeningHours/OhVisualization.ts +++ b/UI/OpeningHours/OhVisualization.ts @@ -196,6 +196,14 @@ export default class OpeningHoursVisualization extends UIElement { // Closed! const opensAtDate = oh.getNextChange(); if(opensAtDate === undefined){ + const comm = oh.getComment(); + if(comm !== undefined){ + return new FixedUiElement(comm).SetClass("ohviz-closed").Render(); + } + + if(oh.getState()){ + return Translations.t.general.opening_hours.open_24_7.SetClass("ohviz-closed").Render() + } return Translations.t.general.opening_hours.closed_permanently.SetClass("ohviz-closed").Render() } const moment = `${opensAtDate.getDay()}/${opensAtDate.getMonth() + 1} ${OH.hhmm(opensAtDate.getHours(), opensAtDate.getMinutes())}` diff --git a/assets/tagRenderings/questions.json b/assets/tagRenderings/questions.json index 27011c061..16265f668 100644 --- a/assets/tagRenderings/questions.json +++ b/assets/tagRenderings/questions.json @@ -71,20 +71,6 @@ "freeform": { "key": "opening_hours", "type": "opening_hours" - }, - "mappings": [ - { - "if": { - "or": ["opening_hours=by appointment", - "opening_hours=by_appointment", - "opening_hours=\"by appointment\""] - }, - "then": { - "en": "Only by appointment", - "nl": "Enkel op afspraak" - }, - "hideInAnswer": true - } - ] + } } } \ No newline at end of file diff --git a/assets/translations.json b/assets/translations.json index 6218edbc1..b5be39a60 100644 --- a/assets/translations.json +++ b/assets/translations.json @@ -900,6 +900,10 @@ "nl": "Gesloten voor onbepaalde tijd", "fr": "Fermé" }, + "open_24_7": { + "en": "Opened around the clock", + "nl": "Dag en nacht open" + }, "ph_not_known": { "en": " ", "ca": " ",