Fix build

This commit is contained in:
Pieter Vander Vennet 2024-08-26 20:43:31 +02:00
parent 8915345550
commit d9ab9f1c8f
3 changed files with 15 additions and 14 deletions

View file

@ -257,7 +257,6 @@
{ {
"builtin": "id_presets.shop_types", "builtin": "id_presets.shop_types",
"override": { "override": {
"id": "shop_types",
"labels": [ "labels": [
"description" "description"
], ],
@ -308,7 +307,8 @@
} }
], ],
"condition": "craft=", "condition": "craft=",
"invalidValues": "shop=yes" "invalidValues": "shop=yes",
"filter": true
} }
}, },
{ {
@ -1175,7 +1175,6 @@
], ],
"filter": [ "filter": [
"open_now", "open_now",
"shop_types",
{ {
"id": "second_hand", "id": "second_hand",
"options": [ "options": [

View file

@ -2,8 +2,9 @@
# Creates various empty (stub) version of files # Creates various empty (stub) version of files
mkdir -p ./src/assets/generated/layers; echo {\\\"themes\\\":[]} > ./src/assets/generated/known_themes.json mkdir -p ./src/assets/generated/layers;
echo {\\\"layers\\\": []} > ./src/assets/generated/known_layers.json echo '{"themes":[]}' > ./src/assets/generated/known_themes.json
echo '{"layers": []}' > ./src/assets/generated/known_layers.json
rm -f ./src/assets/generated/layers/*.json rm -f ./src/assets/generated/layers/*.json
rm -f ./src/assets/generated/themes/*.json rm -f ./src/assets/generated/themes/*.json
cp ./assets/layers/usersettings/usersettings.json ./src/assets/generated/layers/usersettings.json cp ./assets/layers/usersettings/usersettings.json ./src/assets/generated/layers/usersettings.json
@ -11,4 +12,4 @@ mkdir -p ./src/assets/generated/layers; echo {\\\"themes\\\":[]} > ./src/assets/
echo '{}' > ./src/assets/generated/layers/summary.json echo '{}' > ./src/assets/generated/layers/summary.json
echo '{}' > ./src/assets/generated/layers/last_click.json echo '{}' > ./src/assets/generated/layers/last_click.json
echo '{}' > ./src/assets/generated/layers/search.json echo '{}' > ./src/assets/generated/layers/search.json
echo '[]' > ./src/assets/generated/theme_overview.json /theme_overview.json echo '[]' > ./src/assets/generated/theme_overview.json

View file

@ -62,9 +62,9 @@ class ExpandFilter extends DesugaringStep<LayerConfigJson> {
) )
} }
const options = (<QuestionableTagRenderingConfigJson>tr).mappings.map((mapping) => { const options = (<QuestionableTagRenderingConfigJson>tr).mappings.map((mapping) => {
let icon : string= mapping.icon?.["path"] ?? mapping.icon let icon: string = mapping.icon?.["path"] ?? mapping.icon
let emoji: string = undefined let emoji: string = undefined
if(Utils.isEmoji(icon)){ if (Utils.isEmoji(icon)) {
emoji = icon emoji = icon
icon = undefined icon = undefined
} }
@ -72,7 +72,7 @@ class ExpandFilter extends DesugaringStep<LayerConfigJson> {
question: mapping.then, question: mapping.then,
osmTags: mapping.if, osmTags: mapping.if,
searchTerms: mapping.searchTerms, searchTerms: mapping.searchTerms,
icon, emoji icon, emoji,
}) })
}) })
// Add default option // Add default option
@ -99,8 +99,8 @@ class ExpandFilter extends DesugaringStep<LayerConfigJson> {
const newFilters: FilterConfigJson[] = [] const newFilters: FilterConfigJson[] = []
const filters = <(FilterConfigJson | string)[]>json.filter const filters = <(FilterConfigJson | string)[]>json.filter
function filterExists(filterName: string): boolean{ function filterExists(filterName: string): boolean {
return filters.some((existing) => { return filters.some((existing) => {
const id: string = existing["id"] ?? existing const id: string = existing["id"] ?? existing
return ( return (
filterName === id || filterName === id ||
@ -118,10 +118,10 @@ class ExpandFilter extends DesugaringStep<LayerConfigJson> {
continue continue
} }
if (tagRendering.filter === true) { if (tagRendering.filter === true) {
if(filterExists(tagRendering["id"])){ if (filterExists(tagRendering["id"])) {
continue continue
} }
filters.push(ExpandFilter.buildFilterFromTagRendering(tagRendering, context.enters("tagRenderings", i, "filter"))) filters.push(ExpandFilter.buildFilterFromTagRendering(tagRendering, context.enters("tagRenderings", i, "filter")))
continue continue
} }
for (const filterName of tagRendering.filter ?? []) { for (const filterName of tagRendering.filter ?? []) {
@ -129,6 +129,7 @@ class ExpandFilter extends DesugaringStep<LayerConfigJson> {
context.enters("tagRenderings", i, "filter").err("Not a string: " + filterName) context.enters("tagRenderings", i, "filter").err("Not a string: " + filterName)
} }
if (filterExists(filterName)) { if (filterExists(filterName)) {
// This filter has already been added
continue continue
} }
if (!filterName) { if (!filterName) {