From 4a6457f146761a309d1b577265c8ebcc8958c14e Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 20 Jun 2023 03:49:12 +0200 Subject: [PATCH] Refactoring: More fixes to the themes --- Models/ThemeConfig/Conversion/PrepareTheme.ts | 6 ++++++ UI/i18n/Translation.ts | 7 ++++++- assets/layers/gps_track/gps_track.json | 3 ++- assets/themes/grb/grb.json | 10 +++------- assets/themes/onwheels/onwheels.json | 4 ++-- assets/themes/stations/stations.json | 18 +++++------------- .../toerisme_vlaanderen.json | 18 +++++------------- 7 files changed, 29 insertions(+), 37 deletions(-) diff --git a/Models/ThemeConfig/Conversion/PrepareTheme.ts b/Models/ThemeConfig/Conversion/PrepareTheme.ts index 8ef58830aa..33246cd550 100644 --- a/Models/ThemeConfig/Conversion/PrepareTheme.ts +++ b/Models/ThemeConfig/Conversion/PrepareTheme.ts @@ -586,6 +586,7 @@ class WarnForUnsubstitutedLayersInTheme extends DesugaringStep } export class PrepareTheme extends Fuse { + private state: DesugaringContext constructor( state: DesugaringContext, options?: { @@ -612,6 +613,7 @@ export class PrepareTheme extends Fuse { new AddDependencyLayersToTheme(state), new AddImportLayers() ) + this.state = state } convert( @@ -619,6 +621,10 @@ export class PrepareTheme extends Fuse { context: string ): { result: LayoutConfigJson; errors: string[]; warnings: string[]; information: string[] } { const result = super.convert(json, context) + if (this.state.publicLayers.size === 0) { + // THis is a bootstrapping run, no need to already set this flag + return result + } const needsNodeDatabase = result.result.layers?.some((l: LayerConfigJson) => l.tagRenderings?.some((tr: TagRenderingConfigJson) => diff --git a/UI/i18n/Translation.ts b/UI/i18n/Translation.ts index 147b00611f..d55fb96045 100644 --- a/UI/i18n/Translation.ts +++ b/UI/i18n/Translation.ts @@ -26,9 +26,14 @@ export class Translation extends BaseUIElement { if (!translations.hasOwnProperty(translationsKey)) { continue } - if (translationsKey === "_context" || translationsKey === "_meta") { + if ( + translationsKey === "_context" || + translationsKey === "_meta" || + translationsKey === "special" + ) { continue } + count++ if (typeof translations[translationsKey] != "string") { console.error( diff --git a/assets/layers/gps_track/gps_track.json b/assets/layers/gps_track/gps_track.json index 4a3b15c31d..e70233149a 100644 --- a/assets/layers/gps_track/gps_track.json +++ b/assets/layers/gps_track/gps_track.json @@ -5,7 +5,8 @@ "source": "special", "title": { "render": { - "en": "Your travelled path" + "en": "Your travelled path", + "nl": "Jouw traject" } }, "shownByDefault": false, diff --git a/assets/themes/grb/grb.json b/assets/themes/grb/grb.json index 9351d5b301..fe27f9c253 100644 --- a/assets/themes/grb/grb.json +++ b/assets/themes/grb/grb.json @@ -542,9 +542,7 @@ "color": "#888888" } ], - "title": { - "render": "Service road" - }, + "title": "Service road", "tagRenderings": [] }, { @@ -759,9 +757,7 @@ "location": [ "point" ], - "icon": { - "render": "./assets/svg/robot.svg" - }, + "icon":"./assets/svg/robot.svg", "iconSize": "15,15" } ] @@ -773,4 +769,4 @@ "overpassMaxZoom": 15, "osmApiTileSize": 17, "credits": "Pieter Vander Vennet" -} \ No newline at end of file +} diff --git a/assets/themes/onwheels/onwheels.json b/assets/themes/onwheels/onwheels.json index 114b8cae55..9403967a2c 100644 --- a/assets/themes/onwheels/onwheels.json +++ b/assets/themes/onwheels/onwheels.json @@ -207,7 +207,7 @@ { "icon": "./assets/themes/onwheels/parking.svg", "anchor": "bottom", - "iconSize": { + "=iconSize": { "render": "20,20", "mappings": [ { @@ -514,4 +514,4 @@ ] }, "enableDownload": true -} \ No newline at end of file +} diff --git a/assets/themes/stations/stations.json b/assets/themes/stations/stations.json index b7fb2a69f8..a698ba6f14 100644 --- a/assets/themes/stations/stations.json +++ b/assets/themes/stations/stations.json @@ -191,12 +191,8 @@ "minzoom": 19, "mapRendering+": [ { - "color": { - "render": "#00f" - }, - "width": { - "render": "8" - } + "color": "#00f", + "width": "8" } ] } @@ -214,12 +210,8 @@ "minzoom": 19, "mapRendering+": [ { - "color": { - "render": "yellow" - }, - "width": { - "render": "8" - } + "color": "yellow", + "width": "8" } ] } @@ -404,4 +396,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/assets/themes/toerisme_vlaanderen/toerisme_vlaanderen.json b/assets/themes/toerisme_vlaanderen/toerisme_vlaanderen.json index fef357360e..f506d50afe 100644 --- a/assets/themes/toerisme_vlaanderen/toerisme_vlaanderen.json +++ b/assets/themes/toerisme_vlaanderen/toerisme_vlaanderen.json @@ -109,9 +109,7 @@ "minzoom": 14, "mapRendering": [ { - "icon": { - "render": "./assets/themes/toerisme_vlaanderen/bench.svg" - } + "icon": "./assets/themes/toerisme_vlaanderen/bench.svg" } ] } @@ -122,9 +120,7 @@ "minzoom": 14, "mapRendering": [ { - "icon": { - "render": "./assets/themes/toerisme_vlaanderen/picnic_table.svg" - } + "icon": "./assets/themes/toerisme_vlaanderen/picnic_table.svg" } ] } @@ -135,9 +131,7 @@ "minzoom": 14, "mapRendering": [ { - "icon": { - "render": "./assets/themes/toerisme_vlaanderen/observation_tower.svg" - } + "icon": "./assets/themes/toerisme_vlaanderen/observation_tower.svg" } ] } @@ -232,9 +226,7 @@ "minzoom": 14, "mapRendering": [ { - "icon": { - "render": "./assets/themes/toerisme_vlaanderen/playground.svg" - } + "icon": "./assets/themes/toerisme_vlaanderen/playground.svg" } ] }, @@ -247,4 +239,4 @@ "hideFromOverview": true, "enableMoreQuests": false, "enableShareScreen": false -} \ No newline at end of file +}