From 9e9d80c045990b3450f05de3fbd72a10e229cc73 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sat, 5 Sep 2020 17:43:30 +0200 Subject: [PATCH] Porting repair_station to JSON configuration file --- Customizations/JSON/FromJSON.ts | 2 + Customizations/Layers/BikeStations.ts | 117 ----- Customizations/Layouts/Cyclofix.ts | 5 +- .../Questions/bike/PumpManometer.ts | 18 - Customizations/Questions/bike/PumpManual.ts | 18 - .../Questions/bike/PumpOperational.ts | 17 - Customizations/Questions/bike/PumpValves.ts | 29 -- Customizations/Questions/bike/StationChain.ts | 18 - .../Questions/bike/StationOperator.ts | 27 -- .../Questions/bike/StationPumpTools.ts | 19 - Customizations/Questions/bike/StationStand.ts | 18 - UI/CustomGenerator/GenerateEmpty.ts | 22 +- UI/CustomGenerator/LayerPanel.ts | 16 +- UI/CustomGenerator/TagRenderingPanel.ts | 14 +- UI/SimpleAddUI.ts | 2 +- UI/i18n/Translations.ts | 197 +-------- .../bike_repair_station.json | 413 +++++++++++++++++- index.ts | 6 +- 18 files changed, 455 insertions(+), 503 deletions(-) delete mode 100644 Customizations/Layers/BikeStations.ts delete mode 100644 Customizations/Questions/bike/PumpManometer.ts delete mode 100644 Customizations/Questions/bike/PumpManual.ts delete mode 100644 Customizations/Questions/bike/PumpOperational.ts delete mode 100644 Customizations/Questions/bike/PumpValves.ts delete mode 100644 Customizations/Questions/bike/StationChain.ts delete mode 100644 Customizations/Questions/bike/StationOperator.ts delete mode 100644 Customizations/Questions/bike/StationPumpTools.ts delete mode 100644 Customizations/Questions/bike/StationStand.ts diff --git a/Customizations/JSON/FromJSON.ts b/Customizations/JSON/FromJSON.ts index aa32d6a..22fb08c 100644 --- a/Customizations/JSON/FromJSON.ts +++ b/Customizations/JSON/FromJSON.ts @@ -15,6 +15,7 @@ import * as drinkingWater from "../../assets/layers/drinking_water/drinking_wate import * as ghostbikes from "../../assets/layers/ghost_bike/ghost_bike.json" import * as viewpoint from "../../assets/layers/viewpoint/viewpoint.json" import * as bike_parking from "../../assets/layers/bike_parking/bike_parking.json" +import * as bike_repair_station from "../../assets/layers/bike_repair_station/bike_repair_station.json" import * as birdhides from "../../assets/layers/bird_hide/birdhides.json" import {Utils} from "../../Utils"; @@ -31,6 +32,7 @@ export class FromJSON { FromJSON.Layer(ghostbikes), FromJSON.Layer(viewpoint), FromJSON.Layer(bike_parking), + FromJSON.Layer(bike_repair_station), FromJSON.Layer(birdhides), ]; diff --git a/Customizations/Layers/BikeStations.ts b/Customizations/Layers/BikeStations.ts deleted file mode 100644 index 13a36ab..0000000 --- a/Customizations/Layers/BikeStations.ts +++ /dev/null @@ -1,117 +0,0 @@ -import {LayerDefinition} from "../LayerDefinition"; -import {And, Or, Tag} from "../../Logic/Tags"; -import BikeStationChain from "../Questions/bike/StationChain"; -import BikeStationPumpTools from "../Questions/bike/StationPumpTools"; -import BikeStationStand from "../Questions/bike/StationStand"; -import PumpManual from "../Questions/bike/PumpManual"; -import PumpManometer from "../Questions/bike/PumpManometer"; -import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; -import PumpOperational from "../Questions/bike/PumpOperational"; -import PumpValves from "../Questions/bike/PumpValves"; -import Translations from "../../UI/i18n/Translations"; -import {TagRenderingOptions} from "../TagRenderingOptions"; - - -export default class BikeStations extends LayerDefinition { - private readonly repairStation = new Tag("amenity", "bicycle_repair_station"); - private readonly pump = new Tag("service:bicycle:pump", "yes"); - private readonly nopump = new Tag("service:bicycle:pump", "no"); - private readonly pumpOperationalOk = new Or([new Tag("service:bicycle:pump:operational_status", "yes"), new Tag("service:bicycle:pump:operational_status", "operational"), new Tag("service:bicycle:pump:operational_status", "ok"), new Tag("service:bicycle:pump:operational_status", "")]); - private readonly tools = new Tag("service:bicycle:tools", "yes"); - private readonly notools = new Tag("service:bicycle:tools", "no"); - - private readonly to = Translations.t.cyclofix.station - - constructor() { - super("bikestation"); - this.name = Translations.t.cyclofix.station.name; - this.icon = "./assets/bike/repair_station_pump.svg"; - - const tr = Translations.t.cyclofix.station - this.overpassFilter = this.repairStation; - this.presets = [ - { - title: tr.titlePump, - description: tr.services.pump, - tags: [this.repairStation, this.pump, this.notools] - }, - { - title: tr.titleRepair, - description: tr.services.tools, - tags: [this.repairStation, this.tools, this.nopump] - }, - { - title: tr.titlePumpAndRepair, - description: tr.services.both, - tags: [this.repairStation, this.tools, this.pump] - }, - - ] - - this.maxAllowedOverlapPercentage = 10; - - this.minzoom = 13; - this.style = this.generateStyleFunction(); - this.title = new TagRenderingOptions({ - mappings: [ - { - k: new And([this.pump, this.tools]), - txt: this.to.titlePumpAndRepair - }, - { - k: new And([this.pump]), - txt: this.to.titlePump - }, - {k: null, txt: this.to.titleRepair}, - ] - }) - this.wayHandling = LayerDefinition.WAYHANDLING_CENTER_AND_WAY - - this.elementsToShow = [ - new ImageCarouselWithUploadConstructor(), - - new BikeStationPumpTools(), - new BikeStationChain().OnlyShowIf(this.tools), - new BikeStationStand().OnlyShowIf(this.tools), - - new PumpManual().OnlyShowIf(this.pump), - new PumpManometer().OnlyShowIf(this.pump), - new PumpValves().OnlyShowIf(this.pump), - new PumpOperational().OnlyShowIf(this.pump), - - // new BikeStationOperator(), - // new BikeStationBrand() DISABLED - ]; - } - - private generateStyleFunction() { - const self = this; - return function (properties: any) { - const hasPump = self.pump.matchesProperties(properties) - const isOperational = self.pumpOperationalOk.matchesProperties(properties) - const hasTools = self.tools.matchesProperties(properties) - let iconName = "repair_station.svg"; - if (hasTools && hasPump && isOperational) { - iconName = "repair_station_pump.svg" - } else if(hasTools) { - iconName = "repair_station.svg" - } else if(hasPump) { - if (isOperational) { - iconName = "pump.svg" - } else { - iconName = "broken_pump_2.svg" - } - } - - const iconUrl = `./assets/bike/${iconName}` - return { - color: "#00bb00", - icon: { - iconUrl: iconUrl, - iconSize: [50, 50], - iconAnchor: [25, 50] - } - }; - }; - } -} diff --git a/Customizations/Layouts/Cyclofix.ts b/Customizations/Layouts/Cyclofix.ts index 945590d..f70e971 100644 --- a/Customizations/Layouts/Cyclofix.ts +++ b/Customizations/Layouts/Cyclofix.ts @@ -1,5 +1,4 @@ import {Layout} from "../Layout"; -import BikeServices from "../Layers/BikeStations"; import BikeShops from "../Layers/BikeShops"; import Translations from "../../UI/i18n/Translations"; import Combine from "../../UI/Base/Combine"; @@ -13,7 +12,9 @@ export default class Cyclofix extends Layout { "cyclofix", ["en", "nl", "fr","gl"], Translations.t.cyclofix.title, - [new BikeServices(), new BikeShops(), "drinking_water", "bike_parking", new BikeOtherShops(), new BikeCafes()], + ["bike_repair_station", new BikeShops(), "drinking_water", "bike_parking", new BikeOtherShops(), new BikeCafes(), + // The first of november, we remember our dead + ...(new Date().getMonth() + 1 == 11 && new Date().getDay() + 1 == 1 ? ["ghost_bike"] : [])], 16, 50.8465573, 4.3516970, diff --git a/Customizations/Questions/bike/PumpManometer.ts b/Customizations/Questions/bike/PumpManometer.ts deleted file mode 100644 index 4b5db8f..0000000 --- a/Customizations/Questions/bike/PumpManometer.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {Tag} from "../../../Logic/Tags"; -import Translations from "../../../UI/i18n/Translations"; -import {TagRenderingOptions} from "../../TagRenderingOptions"; - - -export default class PumpManometer extends TagRenderingOptions { - constructor() { - const to = Translations.t.cyclofix.station.manometer - super({ - question: to.question, - mappings: [ - {k: new Tag("manometer", "yes"), txt: to.yes}, - {k: new Tag("manometer", "no"), txt: to.no}, - {k: new Tag("manometer", "broken"), txt: to.broken} - ] - }); - } -} diff --git a/Customizations/Questions/bike/PumpManual.ts b/Customizations/Questions/bike/PumpManual.ts deleted file mode 100644 index 26ba4e6..0000000 --- a/Customizations/Questions/bike/PumpManual.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {Tag} from "../../../Logic/Tags"; -import Translations from "../../../UI/i18n/Translations"; -import {TagRenderingOptions} from "../../TagRenderingOptions"; - - -export default class PumpManual extends TagRenderingOptions { - constructor() { - const to = Translations.t.cyclofix.station.electric - super({ - priority: 5, - question: to.question, - mappings: [ - {k: new Tag("manual", "yes"), txt: to.manual}, - {k: new Tag("manual", "no"), txt: to.electric} - ] - }); - } -} diff --git a/Customizations/Questions/bike/PumpOperational.ts b/Customizations/Questions/bike/PumpOperational.ts deleted file mode 100644 index 045e8bc..0000000 --- a/Customizations/Questions/bike/PumpOperational.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {Tag} from "../../../Logic/Tags"; -import Translations from "../../../UI/i18n/Translations"; -import {TagRenderingOptions} from "../../TagRenderingOptions"; - - -export default class PumpOperational extends TagRenderingOptions { - constructor() { - const to = Translations.t.cyclofix.station.operational - super({ - question: to.question, - mappings: [ - {k: new Tag("service:bicycle:pump:operational_status","broken"), txt: to.broken}, - {k: new Tag("service:bicycle:pump:operational_status",""), txt: to.operational} - ] - }); - } -} diff --git a/Customizations/Questions/bike/PumpValves.ts b/Customizations/Questions/bike/PumpValves.ts deleted file mode 100644 index c41d415..0000000 --- a/Customizations/Questions/bike/PumpValves.ts +++ /dev/null @@ -1,29 +0,0 @@ -import {Tag} from "../../../Logic/Tags"; -import Translations from "../../../UI/i18n/Translations"; -import {TagRenderingOptions} from "../../TagRenderingOptions"; - - -export default class -PumpValves extends TagRenderingOptions{ - constructor() { - const to = Translations.t.cyclofix.station.valves - super({ - question: to.question, - mappings: [ - { - k: new Tag("valves", "sclaverand;schrader;dunlop"), - txt: to.default - }, - {k: new Tag("valves", "dunlop"), txt: to.dunlop}, - {k: new Tag("valves", "sclaverand"), txt: to.sclaverand}, - {k: new Tag("valves", "auto"), txt: to.auto}, - ], - freeform: { - extraTags: new Tag("fixme", "Freeform valves= tag used: possibly a wrong value"), - key: "valves", - template: to.template, - renderTemplate: to.render - } - }); - } -} diff --git a/Customizations/Questions/bike/StationChain.ts b/Customizations/Questions/bike/StationChain.ts deleted file mode 100644 index 730a907..0000000 --- a/Customizations/Questions/bike/StationChain.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {Tag} from "../../../Logic/Tags"; -import Translations from "../../../UI/i18n/Translations"; -import {TagRenderingOptions} from "../../TagRenderingOptions"; - - -export default class StationChain extends TagRenderingOptions { - constructor() { - const to = Translations.t.cyclofix.station.chain - super({ - priority: 5, - question: to.question, - mappings: [ - {k: new Tag("service:bicycle:chain_tool", "yes"), txt: to.yes}, - {k: new Tag("service:bicycle:chain_tool", "no"), txt: to.no}, - ] - }); - } -} diff --git a/Customizations/Questions/bike/StationOperator.ts b/Customizations/Questions/bike/StationOperator.ts deleted file mode 100644 index 43de41b..0000000 --- a/Customizations/Questions/bike/StationOperator.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {Tag} from "../../../Logic/Tags"; -import Translations from "../../../UI/i18n/Translations"; -import {TagRenderingOptions} from "../../TagRenderingOptions"; - - -export default class BikeStationOperator extends TagRenderingOptions { - constructor() { - const to = Translations.t.cyclofix.station.operator - super({ - priority: 15, - question: to.question, - mappings: [ - {k: new Tag("operator", "KU Leuven"), txt: "KU Leuven"}, - {k: new Tag("operator", "Stad Halle"), txt: "Stad Halle"}, - {k: new Tag("operator", "Saint Gilles - Sint Gillis"), txt: "Saint Gilles - Sint Gillis"}, - {k: new Tag("operator", "Jette"), txt: "Jette"}, - {k: new Tag("operator", "private"), txt: to.private} - ], - freeform: { - key: "operator", - template: to.template, - renderTemplate: to.render, - placeholder: "organisatie" - } - }); - } -} diff --git a/Customizations/Questions/bike/StationPumpTools.ts b/Customizations/Questions/bike/StationPumpTools.ts deleted file mode 100644 index 8919912..0000000 --- a/Customizations/Questions/bike/StationPumpTools.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {Tag, And} from "../../../Logic/Tags"; -import Translations from "../../../UI/i18n/Translations"; -import {TagRenderingOptions} from "../../TagRenderingOptions"; - - -export default class BikeStationPumpTools extends TagRenderingOptions { - constructor() { - const to = Translations.t.cyclofix.station.services - super({ - priority: 15, - question: to.question, - mappings: [ - {k: new And([new Tag("service:bicycle:tools", "no"), new Tag("service:bicycle:pump", "yes")]), txt: to.pump}, - {k: new And([new Tag("service:bicycle:tools", "yes"), new Tag("service:bicycle:pump", "no")]), txt: to.tools}, - {k: new And([new Tag("service:bicycle:tools", "yes"), new Tag("service:bicycle:pump", "yes")]), txt: to.both} - ] - }); - } -} diff --git a/Customizations/Questions/bike/StationStand.ts b/Customizations/Questions/bike/StationStand.ts deleted file mode 100644 index cb38e90..0000000 --- a/Customizations/Questions/bike/StationStand.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {Tag} from "../../../Logic/Tags"; -import Translations from "../../../UI/i18n/Translations"; -import {TagRenderingOptions} from "../../TagRenderingOptions"; - - -export default class BikeStationStand extends TagRenderingOptions { - constructor() { - const to = Translations.t.cyclofix.station.stand; - super({ - priority: 10, - question: to.question, - mappings: [ - {k: new Tag("service:bicycle:stand", "yes"), txt: to.yes}, - {k: new Tag("service:bicycle:stand", "no"), txt: to.no}, - ] - }); - } -} diff --git a/UI/CustomGenerator/GenerateEmpty.ts b/UI/CustomGenerator/GenerateEmpty.ts index fc02f44..ce87faf 100644 --- a/UI/CustomGenerator/GenerateEmpty.ts +++ b/UI/CustomGenerator/GenerateEmpty.ts @@ -5,19 +5,31 @@ import {TagRenderingConfigJson} from "../../Customizations/JSON/TagRenderingConf export class GenerateEmpty { public static createEmptyLayer(): LayerConfigJson { return { - id: undefined, - name: undefined, - minzoom: 0, + id: "yourlayer", + name: "Layer", + minzoom: 12, overpassTags: {and: [""]}, - title: undefined, + title: "Layer", description: {}, tagRenderings: [], + icon: { + render: "./assets/bug.svg" + }, + width: { + render: "8" + }, + iconSize:{ + render: "40,40,center" + }, + color:{ + render: "#00f" + } } } public static createEmptyLayout(): LayoutConfigJson { return { - id: "", + id: "id", title: {}, description: {}, language: [], diff --git a/UI/CustomGenerator/LayerPanel.ts b/UI/CustomGenerator/LayerPanel.ts index 9568362..97a8edd 100644 --- a/UI/CustomGenerator/LayerPanel.ts +++ b/UI/CustomGenerator/LayerPanel.ts @@ -170,25 +170,29 @@ export default class LayerPanel extends UIElement { { title: "Icon", description: "A visual representation for this layer and for the points on the map.", - disableQuestions: true + disableQuestions: true, + noLanguage: true }); const size = new TagRenderingPanel(languages, currentlySelected, userDetails, { title: "Icon Size", description: "The size of the icons on the map in pixels. Can vary based on the tagging", - disableQuestions: true + disableQuestions: true, + noLanguage: true }); const color = new TagRenderingPanel(languages, currentlySelected, userDetails, { title: "Way and area color", description: "The color or a shown way or area. Can vary based on the tagging", - disableQuestions: true + disableQuestions: true, + noLanguage: true }); const stroke = new TagRenderingPanel(languages, currentlySelected, userDetails, { title: "Stroke width", description: "The width of lines representing ways and the outline of areas. Can vary based on the tags", - disableQuestions: true + disableQuestions: true, + noLanguage: true }); this.registerTagRendering(iconSelect); this.registerTagRendering(size); @@ -201,9 +205,9 @@ export default class LayerPanel extends UIElement { return new SettingsTable([ setting(iconSelect, "icon"), - setting(size, "size"), + setting(size, "iconSize"), setting(color, "color"), - setting(stroke, "stroke") + setting(stroke, "width") ], currentlySelected); } diff --git a/UI/CustomGenerator/TagRenderingPanel.ts b/UI/CustomGenerator/TagRenderingPanel.ts index 99ebe7e..b92b9d9 100644 --- a/UI/CustomGenerator/TagRenderingPanel.ts +++ b/UI/CustomGenerator/TagRenderingPanel.ts @@ -31,7 +31,8 @@ export default class TagRenderingPanel extends InputElementNote that the Overpass-tags are already always included in this object"), @@ -76,7 +78,9 @@ export default class TagRenderingPanel extends InputElement)[] = [ - setting(new MultiLingualTextFields(languages), "render", "Value to show", " Renders this value. Note that {key}-parts are substituted by the corresponding values of the element. If neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value."), + setting( + options?.noLanguage ? TextField.StringInput() : + new MultiLingualTextFields(languages), "render", "Value to show", " Renders this value. Note that {key}-parts are substituted by the corresponding values of the element. If neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value."), questionsNotUnlocked ? `You need at least ${State.userJourney.themeGeneratorFullUnlock} changesets to unlock the 'question'-field and to use your theme to edit OSM data`: "", ...(options?.disableQuestions ? [] : questionSettings), @@ -85,7 +89,7 @@ export default class TagRenderingPanel extends InputElement("Add a mapping", () => ({if: undefined, then: undefined}), () => new MappingInput(languages, options?.disableQuestions ?? false)), "mappings", - "Mappings", "") + "If a tag matches, then show the respective text", "") ]; diff --git a/UI/SimpleAddUI.ts b/UI/SimpleAddUI.ts index 001e3c8..a3a9a89 100644 --- a/UI/SimpleAddUI.ts +++ b/UI/SimpleAddUI.ts @@ -37,7 +37,7 @@ export class SimpleAddUI extends UIElement { this.ListenTo(State.state.osmConnection.userDetails); this.ListenTo(State.state.layerUpdater.runningQuery); this.ListenTo(this._confirmPreset); - + this.ListenTo(State.state.locationControl); this._loginButton = Translations.t.general.add.pleaseLogin.Clone().onClick(() => State.state.osmConnection.AttemptLogin()); diff --git a/UI/i18n/Translations.ts b/UI/i18n/Translations.ts index eb051be..06b57d4 100644 --- a/UI/i18n/Translations.ts +++ b/UI/i18n/Translations.ts @@ -51,7 +51,9 @@ export default class Translations { gl: 'estación de bicicletas (arranxo, bomba de ar ou ambos)' }), // title: new T({en: 'Bike station', nl: 'Fietsstation', fr: 'Station vélo', gl: 'Estación de bicicletas'}), Old, non-dynamic title - titlePump: new T({en: 'Bike pump', nl: 'Fietspomp', fr: 'TODO: fr', gl: 'Bomba de ar'}), + titlePump: new T({ + + }), titleRepair: new T({ en: 'Bike repair station', nl: 'Herstelpunt', @@ -64,104 +66,16 @@ export default class Translations { fr: 'Point station velo avec pompe', gl: 'Estación de bicicletas (arranxo e bomba de ar)' }), - manometer: { - question: new T({ - en: 'Does the pump have a pressure indicator or manometer?', - nl: 'Heeft deze pomp een luchtdrukmeter?', - fr: 'Est-ce que la pompe à un manomètre integré?', - gl: 'Ten a bomba de ar un indicador de presión ou un manómetro?' - }), - yes: new T({ - en: 'There is a manometer', - nl: 'Er is een luchtdrukmeter', - fr: 'Il y a un manomètre', - gl: 'Hai manómetro' - }), - no: new T({ - en: 'There is no manometer', - nl: 'Er is geen luchtdrukmeter', - fr: 'Il n\'y a pas de manomètre', - gl: 'Non hai manómetro' - }), - broken: new T({ - en: 'There is manometer but it is broken', - nl: 'Er is een luchtdrukmeter maar die is momenteel defect', - fr: 'Il y a un manomètre mais il est cassé', - gl: 'Hai manómetro pero está estragado' - }) - }, - electric: { - question: new T({ - en: 'Is this an electric bike pump?', - nl: 'Is dit een electrische fietspomp?', - fr: 'Est-ce que cette pompe est électrique?', - gl: 'Esta é unha bomba de ar eléctrica?' - }), - manual: new T({ - en: 'Manual pump', - nl: 'Manuele pomp', - fr: 'Pompe manuelle', - gl: 'Bomba de ar manual' - }), - electric: new T({ - en: 'Electrical pump', - nl: 'Electrische pomp', - fr: 'Pompe électrique', - gl: 'Bomba de ar eléctrica' - }) - }, - operational: { - question: new T({ - en: 'Is the bike pump still operational?', - nl: 'Werkt de fietspomp nog?', - fr: 'Est-ce que cette pompe marche t\'elle toujours?', - gl: 'Segue a funcionar a bomba de ar?' - }), - operational: new T({ - en: 'The bike pump is operational', - nl: 'De fietspomp werkt nog', - fr: 'La pompe est opérationnelle', - gl: 'A bomba de ar está operativa' - }), - broken: new T({ - en: 'The bike pump is broken', - nl: 'De fietspomp is kapot', - fr: 'La pompe est cassé', - gl: 'A bomba de ar está estragada' - }) - }, + valves: { - question: new T({ - en: 'What valves are supported?', - nl: 'Welke ventielen werken er met de pomp?', - fr: 'Quelles valves sont compatibles?', - gl: 'Que válvulas son compatíbeis?' - }), + default: new T({ - en: 'There is a default head, so Dunlop, Sclaverand and auto', - nl: 'Er is een standaard aansluiting, die dus voor Dunlop, Sclaverand en auto\'s werkt', - fr: 'Il y a une valve par défaut, fonctionnant sur les valves Dunlop, Sclaverand et les valves de voitures', - gl: 'Hai un cabezal predeterminado que é compatíbel con Dunlop, Sclaverand e automóbil' - }), - dunlop: new T({en: 'Only Dunlop', nl: 'Enkel Dunlop', fr: 'TODO: fr', gl: 'Só Dunlop'}), + }), + dunlop: new T({}), sclaverand: new T({ - en: 'Only Sclaverand (also known as Presta)', - nl: 'Enkel Sclaverand (ook gekend als Presta)', - fr: 'Seulement Sclaverand (aussi appelé Presta)', - gl: 'Só Sclaverand (tamén coñecido como Presta)' - }), - auto: new T({ - en: 'Only for cars', - nl: 'Enkel voor auto\'s', - fr: 'TODO: fr', - gl: 'Só para automóbiles' - }), - render: new T({ - en: 'This pump supports the following valves: {valves}', - nl: 'Deze pomp werkt met de volgende ventielen: {valves}', - fr: 'Cette pompe est compatible avec les valves suivantes: {valves}', - gl: 'Esta bomba de ar admite as seguintes válvulas: {valves}' + }), + template: new T({ en: 'Some other valve(s): $$$', nl: 'Een ander type ventiel(en): $$$', @@ -169,99 +83,6 @@ export default class Translations { gl: 'Algunha outra válvula: $$$' }) }, - chain: { - question: new T({ - en: 'Does this bike repair station have a special tool to repair your bike chain?', - nl: 'Heeft dit herstelpunt een speciale reparatieset voor je ketting?', - fr: 'Est-ce que cette station vélo a un outils specifique pour réparer la chaîne du velo?', - gl: 'Esta estación de arranxo de bicicletas ten unha ferramenta especial para arranxar a cadea da túa bicicleta?' - }), - yes: new T({ - en: 'There is a chain tool', - nl: 'Er is een reparatieset voor je ketting', - fr: 'Il y a un outil pour réparer la chaine', - gl: 'Hai unha ferramenta para a cadea' - }), - no: new T({ - en: 'There is no chain tool', - nl: 'Er is geen reparatieset voor je ketting', - fr: 'Il n\'y a pas d\'outil pour réparer la chaine', - gl: 'Non hai unha ferramenta para a cadea' - }), - }, - operator: { - render: new T({ - en: 'This bike station is operated by {operator}', - nl: 'Dit fietspunt wordt beheerd door {operator}', - fr: 'Cette station vélo est opéré par {operator}', - gl: 'Esta estación de bicicletas es operada por {operator}' - }), - template: new T({ - en: 'A different operator: $$$', - nl: 'Een andere beheerder: $$$', - fr: 'TODO: fr', - gl: 'Un operador diferente: $$$' - }), - question: new T({ - en: 'Who operates this bike station (name of university, shop, city...)?', - nl: 'Wie beheert dit fietsstation (naam universiteit, winkel, stad...)?', - fr: 'Qui opére cette station vélo (nom de l\'université, magasin, ville...)?', - gl: 'Quen opera esta estación de bicicletas (nome da universidade, tenda, concello...)?' - }), - private: new T({ - en: 'Operated by a private person', - nl: 'Wordt beheerd door een privépersoon', - fr: 'Operé par un tier privé', - gl: 'Operado por unha persoa privada' - }), - }, - services: { - question: new T({ - en: "Which services are available at this bike station?", - nl: "Welke functies biedt dit fietspunt?", - fr: "Quels services sont valables à cette station vélo?", - gl: "Que servizos están dispoñíbeis nesta estación de bicicletas?" - }), - pump: new T({ - // Note: this previously read: a pump is available. It is not because the pump is present, that it is available (e.g. broken) - en: "There is only a pump present", - nl: "Er is enkel een pomp aanwezig", - fr: "Il y a seulement une pompe", - gl: "Só hai unha bomba de ar presente" - }), - tools: new T({ - en: "There are only tools (screwdrivers, pliers...) present", - nl: "Er is enkel gereedschap aanwezig (schroevendraaier, tang...)", - fr: "Il y a seulement des outils (tournevis, pinces...)", - gl: "Só hai ferramentas (desaparafusadores, alicates...) presentes" - }), - both: new T({ - en: "There are both tools and a pump present", - nl: "Er is zowel een pomp als gereedschap aanwezig", - fr: "IL y a des outils et une pompe", - gl: "Hai ferramentas e unha bomba de ar presentes" - }), - }, - stand: { - question: new T({ - en: "Does this bike station have a hook to suspend your bike with or a stand to elevate it?", - nl: "Heeft dit herstelpunt een haak of standaard om je fiets op te hangen/zetten?", - fr: "Est-ce que cette station vélo à un crochet pour suspendre son velo ou une accroche pour l'élevé?", - gl: "Esta estación de bicicletas ten un guindastre para pendurar a túa bicicleta ou un soporte para elevala?" - }), - yes: new T({ - en: "There is a hook or stand", - nl: "Er is een haak of standaard", - fr: "Oui il y a un crochet ou une accroche", - gl: "Hai un guindastre ou soporte" - }), - no: new T({ - en: "There is no hook or stand", - nl: "Er is geen haak of standaard", - fr: "Non il n'y pas de crochet ou d'accroche", - gl: "Non hai un guindastre ou soporte" - }), - }, }, shop: { name: new T({ diff --git a/assets/layers/bike_repair_station/bike_repair_station.json b/assets/layers/bike_repair_station/bike_repair_station.json index 85cfb7b..12d7698 100644 --- a/assets/layers/bike_repair_station/bike_repair_station.json +++ b/assets/layers/bike_repair_station/bike_repair_station.json @@ -6,12 +6,345 @@ "fr": "Station velo (réparation, pompe à vélo)", "gl": "Estación de bicicletas (arranxo, bomba de ar ou ambos)" }, - "minzoom": 12, + "minzoom": 13, "overpassTags": { "and": [ "amenity=bicycle_repair_station" ] }, + "title": { + "render": { + "en": "Bike station (pump & repair)", + "nl": "Herstelpunt met pomp", + "fr": "Point station velo avec pompe", + "gl": "Estación de bicicletas (arranxo e bomba de ar)" + }, + "mappings": [ + { + "if": { + "or": [ + "service:bicycle:pump=no", + "service:bicycle:pump:operational_status=broken" + ] + }, + "then": { + "en": "Bike repair station", + "nl": "Herstelpunt", + "fr": "Point de réparation velo", + "gl": "Estación de arranxo de bicicletas" + } + }, + { + "if": { + "and": [ + "service:bicycle:pump=yes", + "service:bicycle:tools=yes" + ] + }, + "then": { + "en": "Bike repair station", + "nl": "Herstelpunt", + "fr": "Point de réparation", + "gl": "Estación de arranxo de bicicletas" + } + }, + { + "if": { + "and": [ + "service:bicycle:pump:operational_status=broken", + "service:bicycle:tools=no" + ] + }, + "then": { + "en": "Broken pump", + "nl": "Kapotte fietspomp", + "fr": "Pompe cassée", + "gl": "Bomba de ar estragada" + } + }, + { + "if": { + "and": [ + "service:bicycle:pump=yes", + "service:bicycle:tools=no" + ] + }, + "then": { + "en": "Bicycle pump", + "nl": "Fietspomp", + "fr": "Pompe de vélo", + "gl": "Bomba de ar" + } + } + ] + }, + "tagRenderings": [ + "images", + { + "question": { + "en": "Which services are available at this bike station?", + "nl": "Welke functies biedt dit fietspunt?", + "fr": "Quels services sont valables à cette station vélo?", + "gl": "Que servizos están dispoñíbeis nesta estación de bicicletas?" + }, + "mappings": [ + { + "if": { + "and": [ + "service:bicycle:tools=no", + "service:bicycle:pump=yes" + ] + }, + "then": { + "en": "There is only a pump present", + "nl": "Er is enkel een pomp aanwezig", + "fr": "Il y a seulement une pompe", + "gl": "Só hai unha bomba de ar presente" + } + }, + { + "if": { + "and": [ + "service:bicycle:tools=yes", + "service:bicycle:pump=no" + ] + }, + "then": { + "en": "There are only tools (screwdrivers, pliers...) present", + "nl": "Er is enkel gereedschap aanwezig (schroevendraaier, tang...)", + "fr": "Il y a seulement des outils (tournevis, pinces...)", + "gl": "Só hai ferramentas (desaparafusadores, alicates...) presentes" + } + }, + { + "if": { + "and": [ + "service:bicycle:tools=yes", + "service:bicycle:pump=yes" + ] + }, + "then": { + "en": "There are both tools and a pump present", + "nl": "Er is zowel een pomp als gereedschap aanwezig", + "fr": "IL y a des outils et une pompe", + "gl": "Hai ferramentas e unha bomba de ar presentes" + } + } + ] + }, + { + "question": { + "en": "Does this bike repair station have a special tool to repair your bike chain?", + "nl": "Heeft dit herstelpunt een speciale reparatieset voor je ketting?", + "fr": "Est-ce que cette station vélo a un outils specifique pour réparer la chaîne du velo?", + "gl": "Esta estación de arranxo de bicicletas ten unha ferramenta especial para arranxar a cadea da túa bicicleta?" + }, + "condition": "service:bicycle:tools=yes", + "mappings": [ + { + "if": "service:bicycle:chain_tool=yes", + "then": { + "en": "There is a chain tool", + "nl": "Er is een reparatieset voor je ketting", + "fr": "Il y a un outil pour réparer la chaine", + "gl": "Hai unha ferramenta para a cadea" + } + }, + { + "if": "service:bicycle:chain_tool=no", + "then": { + "en": "There is no chain tool", + "nl": "Er is geen reparatieset voor je ketting", + "fr": "Il n'y a pas d'outil pour réparer la chaine", + "gl": "Non hai unha ferramenta para a cadea" + } + } + ] + }, + { + "question": { + "en": "Does this bike station have a hook to suspend your bike with or a stand to elevate it?", + "nl": "Heeft dit herstelpunt een haak of standaard om je fiets op te hangen/zetten?", + "fr": "Est-ce que cette station vélo à un crochet pour suspendre son velo ou une accroche pour l'élevé?", + "gl": "Esta estación de bicicletas ten un guindastre para pendurar a túa bicicleta ou un soporte para elevala?" + }, + "condition": "service:bicycle:tools=yes", + "mappings": [ + { + "if": "service:bicycle:stand=yes", + "then": { + "en": "There is a hook or stand", + "nl": "Er is een haak of standaard", + "fr": "Il y a un crochet ou une accroche", + "gl": "Hai un guindastre ou soporte" + } + }, + { + "if": "service:bicycle:stand=no", + "then": { + "en": "There is no hook or stand", + "nl": "Er is geen haak of standaard", + "fr": "Il n'y pas de crochet ou d'accroche", + "gl": "Non hai un guindastre ou soporte" + } + } + ] + }, + { + "question": { + "en": "Is the bike pump still operational?", + "nl": "Werkt de fietspomp nog?", + "fr": "Est-ce que cette pompe marche t'elle toujours?", + "gl": "Segue a funcionar a bomba de ar?" + }, + "condition": "service:bicycle:pump=yes", + "mappings": [ + { + "if": "service:bicycle:pump:operational_status=broken", + "then": { + "en": "The bike pump is broken", + "nl": "De fietspomp is kapot", + "fr": "La pompe est cassé", + "gl": "A bomba de ar está estragada" + } + }, + { + "if": "service:bicycle:pump:operational_status=", + "then": { + "en": "The bike pump is operational", + "nl": "De fietspomp werkt nog", + "fr": "La pompe est opérationnelle", + "gl": "A bomba de ar está operativa" + } + } + ] + }, + { + "question": { + "en": "What valves are supported?", + "nl": "Welke ventielen werken er met de pomp?", + "fr": "Quelles valves sont compatibles?", + "gl": "Que válvulas son compatíbeis?" + }, + "render": { + "en": "This pump supports the following valves: {valves}", + "nl": "Deze pomp werkt met de volgende ventielen: {valves}", + "fr": "Cette pompe est compatible avec les valves suivantes: {valves}", + "gl": "Esta bomba de ar admite as seguintes válvulas: {valves}" + }, + "freeform": { + "addExtraTags": [ + "fixme=Freeform 'valves'-tag used: possibly a wrong value" + ], + "key": "valves" + }, + "mappings": [ + { + "if": "valves=sclaverand;schrader;dunlop", + "then": { + "en": "There is a default head, so Dunlop, Sclaverand and auto", + "nl": "Er is een standaard aansluiting, die dus voor Dunlop, Sclaverand en auto's", + "fr": "Il y a une valve par défaut, fonctionnant sur les valves Dunlop, Sclaverand et les valves de voitures", + "gl": "Hai un cabezal predeterminado que é compatíbel con Dunlop, Sclaverand e automóbil" + } + }, + { + "if": "valves=sclaverand", + "then": { + "en": "Only Sclaverand (also known as Presta)", + "nl": "Enkel Sclaverand (ook gekend als Presta)", + "fr": "Seulement Sclaverand (aussi appelé Presta)", + "gl": "Só Sclaverand (tamén coñecido como Presta)" + } + }, + { + "if": "valves=dunlop", + "then": { + "en": "Only Dunlop", + "nl": "Enkel Dunlop", + "fr": "Seulement Dunlop", + "gl": "Só Dunlop" + } + }, + { + "if": "valves=schrader", + "then": { + "en": "Only for cars", + "nl": "Enkel voor auto's", + "fr": "Seuelement les valves de voitures", + "gl": "Só para automóbiles" + } + } + ] + }, + { + "question": { + "en": "Is this an electric bike pump?", + "nl": "Is dit een electrische fietspomp?", + "fr": "Est-ce que cette pompe est électrique?", + "gl": "Esta é unha bomba de ar eléctrica?" + }, + "condition": "service:bicycle:pump=yes", + "mappings": [ + { + "if": "manual=yes", + "then": { + "en": "Manual pump", + "nl": "Manuele pomp", + "fr": "Pompe manuelle", + "gl": "Bomba de ar manual" + } + }, + { + "if": "manual=no", + "then": { + "en": "Electrical pump", + "nl": "Electrische pomp", + "fr": "Pompe électrique", + "gl": "Bomba de ar eléctrica" + } + } + ] + }, + { + "question": { + "en": "Does the pump have a pressure indicator or manometer?", + "nl": "Heeft deze pomp een luchtdrukmeter?", + "fr": "Est-ce que la pompe à un manomètre integré?", + "gl": "Ten a bomba de ar un indicador de presión ou un manómetro?" + }, + "condition": "service:bicycle:pump=yes", + "mappings": [ + { + "if": "manometer=yes", + "then": { + "en": "There is a manometer", + "nl": "Er is een luchtdrukmeter", + "fr": "Il y a un manomètre", + "gl": "Hai manómetro" + } + }, + { + "if": "manometer=no", + "then": { + "en": "There is no manometer", + "nl": "Er is geen luchtdrukmeter", + "fr": "Il n'y a pas de manomètre", + "gl": "Non hai manómetro" + } + }, + { + "if": "manometer=broken", + "then": { + "en": "There is manometer but it is broken", + "nl": "Er is een luchtdrukmeter maar die is momenteel defect", + "fr": "Il y a un manomètre mais il est cassé", + "gl": "Hai manómetro pero está estragado" + } + } + ] + } + ], "icon": { "render": { "en": "./assets/layers/bike_repair_station/repair_station.svg" @@ -19,13 +352,43 @@ "mappings": [ { "if": { - "and": "service:bicycle:pump:operational_status=broken" + "and": [ + "service:bicycle:pump=no", + "service:bicycle:pump:operational_status=broken" + ] + }, + "then": "./assets/layers/bike_repair_station/repair_station.svg" + }, + { + "if": { + "and": [ + "service:bicycle:pump=yes", + "service:bicycle:tools=yes" + ] + }, + "then": "./assets/layers/bike_repair_station/repair_station_pump.svg" + }, + { + "if": { + "and": [ + "service:bicycle:pump:operational_status=broken", + "service:bicycle:tools=no" + ] }, "then": "./assets/layers/bike_repair_station/broken_pump_2.svg" + }, + { + "if": { + "and": [ + "service:bicycle:pump=yes", + "service:bicycle:tools=no" + ] + }, + "then": "./assets/layers/bike_repair_station/pump.svg" } ] }, - "size": { + "iconSize": { "render": { "en": "50,50,bottom" } @@ -44,20 +407,42 @@ "presets": [ { "title": { - "en": "Bike parking", - "nl": "Fietsparking", - "fr": "Parking à vélo", - "gl": "Aparcadoiro de bicicletas" + "en": "Bike pump", + "nl": "Fietspomp", + "fr": "Pompe à vélo", + "gl": "Bomba de ar" }, "tags": [ - "amenity=bicycle_parking" + "amenity=bicycle_repair_station", + "service:bicycle:tools=no", + "service:bicycle:pump=yes" + ] + }, + { + "title": { + "en": "Bike repair station and pump", + "nl": "Herstelpunt en pomp", + "fr": "Point de réparation vélo avec pompe", + "gl": "Estación de arranxo de bicicletas con bomba de ar" + }, + "tags": [ + "amenity=bicycle_repair_station", + "service:bicycle:tools=yes", + "service:bicycle:pump=yes" + ] + }, + { + "title": { + "en": "Bike repair station without pump", + "nl": "Herstelpunt zonder pomp", + "fr": "Point de réparation vélo sans pompe", + "gl": "Estación de arranxo de bicicletas sin bomba de ar" + }, + "tags": [ + "amenity=bicycle_repair_station", + "service:bicycle:tools=yes", + "service:bicycle:pump=no" ] } - ], - "title": { - "render": { - } - }, - "tagRenderings": [ ] } \ No newline at end of file diff --git a/index.ts b/index.ts index dc01460..bcedad6 100644 --- a/index.ts +++ b/index.ts @@ -17,6 +17,7 @@ import {LocalStorageSource} from "./Logic/Web/LocalStorageSource"; import {PersonalLayout} from "./Logic/PersonalLayout"; import {FromJSON} from "./Customizations/JSON/FromJSON"; import {FullScreenMessageBox} from "./UI/FullScreenMessageBoxHandler"; +import {UIEventSource} from "./Logic/UIEventSource"; TagRendering.injectFunction(); @@ -28,13 +29,16 @@ if (location.href.startsWith("http://buurtnatuur.be")) { window.location.replace("https://buurtnatuur.be"); } -let testing = QueryParameters.GetQueryParameter("test", "false"); +let testing: UIEventSource; if (location.hostname === "localhost" || location.hostname === "127.0.0.1") { + testing = QueryParameters.GetQueryParameter("test", "true"); // Set to true if testing and changes should NOT be saved testing.setData(testing.data ?? "true") // If you have a testfile somewhere, enable this to spoof overpass // This should be hosted independantly, e.g. with `cd assets; webfsd -p 8080` + a CORS plugin to disable cors rules //Overpass.testUrl = "http://127.0.0.1:8080/streetwidths.geojson"; +} else { + testing = QueryParameters.GetQueryParameter("test", "false"); }