Refactoring: More fixes to the themes

This commit is contained in:
Pieter Vander Vennet 2023-06-20 03:49:12 +02:00
parent c260d16159
commit 4a6457f146
7 changed files with 29 additions and 37 deletions

View file

@ -586,6 +586,7 @@ class WarnForUnsubstitutedLayersInTheme extends DesugaringStep<LayoutConfigJson>
} }
export class PrepareTheme extends Fuse<LayoutConfigJson> { export class PrepareTheme extends Fuse<LayoutConfigJson> {
private state: DesugaringContext
constructor( constructor(
state: DesugaringContext, state: DesugaringContext,
options?: { options?: {
@ -612,6 +613,7 @@ export class PrepareTheme extends Fuse<LayoutConfigJson> {
new AddDependencyLayersToTheme(state), new AddDependencyLayersToTheme(state),
new AddImportLayers() new AddImportLayers()
) )
this.state = state
} }
convert( convert(
@ -619,6 +621,10 @@ export class PrepareTheme extends Fuse<LayoutConfigJson> {
context: string context: string
): { result: LayoutConfigJson; errors: string[]; warnings: string[]; information: string[] } { ): { result: LayoutConfigJson; errors: string[]; warnings: string[]; information: string[] } {
const result = super.convert(json, context) 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) => const needsNodeDatabase = result.result.layers?.some((l: LayerConfigJson) =>
l.tagRenderings?.some((tr: TagRenderingConfigJson) => l.tagRenderings?.some((tr: TagRenderingConfigJson) =>

View file

@ -26,9 +26,14 @@ export class Translation extends BaseUIElement {
if (!translations.hasOwnProperty(translationsKey)) { if (!translations.hasOwnProperty(translationsKey)) {
continue continue
} }
if (translationsKey === "_context" || translationsKey === "_meta") { if (
translationsKey === "_context" ||
translationsKey === "_meta" ||
translationsKey === "special"
) {
continue continue
} }
count++ count++
if (typeof translations[translationsKey] != "string") { if (typeof translations[translationsKey] != "string") {
console.error( console.error(

View file

@ -5,7 +5,8 @@
"source": "special", "source": "special",
"title": { "title": {
"render": { "render": {
"en": "Your travelled path" "en": "Your travelled path",
"nl": "Jouw traject"
} }
}, },
"shownByDefault": false, "shownByDefault": false,

View file

@ -542,9 +542,7 @@
"color": "#888888" "color": "#888888"
} }
], ],
"title": { "title": "Service road",
"render": "Service road"
},
"tagRenderings": [] "tagRenderings": []
}, },
{ {
@ -759,9 +757,7 @@
"location": [ "location": [
"point" "point"
], ],
"icon": { "icon":"./assets/svg/robot.svg",
"render": "./assets/svg/robot.svg"
},
"iconSize": "15,15" "iconSize": "15,15"
} }
] ]
@ -773,4 +769,4 @@
"overpassMaxZoom": 15, "overpassMaxZoom": 15,
"osmApiTileSize": 17, "osmApiTileSize": 17,
"credits": "Pieter Vander Vennet" "credits": "Pieter Vander Vennet"
} }

View file

@ -207,7 +207,7 @@
{ {
"icon": "./assets/themes/onwheels/parking.svg", "icon": "./assets/themes/onwheels/parking.svg",
"anchor": "bottom", "anchor": "bottom",
"iconSize": { "=iconSize": {
"render": "20,20", "render": "20,20",
"mappings": [ "mappings": [
{ {
@ -514,4 +514,4 @@
] ]
}, },
"enableDownload": true "enableDownload": true
} }

View file

@ -191,12 +191,8 @@
"minzoom": 19, "minzoom": 19,
"mapRendering+": [ "mapRendering+": [
{ {
"color": { "color": "#00f",
"render": "#00f" "width": "8"
},
"width": {
"render": "8"
}
} }
] ]
} }
@ -214,12 +210,8 @@
"minzoom": 19, "minzoom": 19,
"mapRendering+": [ "mapRendering+": [
{ {
"color": { "color": "yellow",
"render": "yellow" "width": "8"
},
"width": {
"render": "8"
}
} }
] ]
} }
@ -404,4 +396,4 @@
] ]
} }
] ]
} }

View file

@ -109,9 +109,7 @@
"minzoom": 14, "minzoom": 14,
"mapRendering": [ "mapRendering": [
{ {
"icon": { "icon": "./assets/themes/toerisme_vlaanderen/bench.svg"
"render": "./assets/themes/toerisme_vlaanderen/bench.svg"
}
} }
] ]
} }
@ -122,9 +120,7 @@
"minzoom": 14, "minzoom": 14,
"mapRendering": [ "mapRendering": [
{ {
"icon": { "icon": "./assets/themes/toerisme_vlaanderen/picnic_table.svg"
"render": "./assets/themes/toerisme_vlaanderen/picnic_table.svg"
}
} }
] ]
} }
@ -135,9 +131,7 @@
"minzoom": 14, "minzoom": 14,
"mapRendering": [ "mapRendering": [
{ {
"icon": { "icon": "./assets/themes/toerisme_vlaanderen/observation_tower.svg"
"render": "./assets/themes/toerisme_vlaanderen/observation_tower.svg"
}
} }
] ]
} }
@ -232,9 +226,7 @@
"minzoom": 14, "minzoom": 14,
"mapRendering": [ "mapRendering": [
{ {
"icon": { "icon": "./assets/themes/toerisme_vlaanderen/playground.svg"
"render": "./assets/themes/toerisme_vlaanderen/playground.svg"
}
} }
] ]
}, },
@ -247,4 +239,4 @@
"hideFromOverview": true, "hideFromOverview": true,
"enableMoreQuests": false, "enableMoreQuests": false,
"enableShareScreen": false "enableShareScreen": false
} }