From 890e555d872d674fadca1cc5020b4d772e1aadb9 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Thu, 26 May 2022 14:22:48 +0200 Subject: [PATCH] Add textmode icons --- Models/ThemeConfig/TagRenderingConfig.ts | 12 +++++++++--- assets/tagRenderings/icons.json | 8 ++++---- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Models/ThemeConfig/TagRenderingConfig.ts b/Models/ThemeConfig/TagRenderingConfig.ts index 5b95f6e54..95076cff7 100644 --- a/Models/ThemeConfig/TagRenderingConfig.ts +++ b/Models/ThemeConfig/TagRenderingConfig.ts @@ -414,8 +414,8 @@ export default class TagRenderingConfig { return applicableMappings } - public GetRenderValue(tags: any, defltValue: any = undefined): TypedTranslation { - return this.GetRenderValueWithImage(tags, defltValue).then + public GetRenderValue(tags: any, defltValue: any = undefined): TypedTranslation | undefined { + return this.GetRenderValueWithImage(tags, defltValue)?.then } /** @@ -423,7 +423,13 @@ export default class TagRenderingConfig { * Not compatible with multiAnswer - use GetRenderValueS instead in that case * @constructor */ - public GetRenderValueWithImage(tags: any, defltValue: any = undefined): { then: TypedTranslation, icon?: string } { + public GetRenderValueWithImage(tags: any, defltValue: any = undefined): { then: TypedTranslation, icon?: string } | undefined { + if(this.condition !== undefined){ + if(!this.condition.matchesProperties(tags)){ + return undefined + } + } + if (this.mappings !== undefined && !this.multiAnswer) { for (const mapping of this.mappings) { if (mapping.if === undefined) { diff --git a/assets/tagRenderings/icons.json b/assets/tagRenderings/icons.json index 7851a80ac..3abd31684 100644 --- a/assets/tagRenderings/icons.json +++ b/assets/tagRenderings/icons.json @@ -11,7 +11,7 @@ "override": {} }, "wikipedialink": { - "render": "WP", + "render": "Wikipedia", "condition": { "or": [ "wikipedia~*", @@ -59,15 +59,15 @@ ] }, "phonelink": { - "render": "", + "render": "phone", "condition": "phone~*" }, "emaillink": { - "render": "", + "render": "email", "condition": "email~*" }, "osmlink": { - "render": "", + "render": "on osm", "mappings": [ { "if": "id~.*/-.*", diff --git a/package-lock.json b/package-lock.json index 9dda0520c..2464b5b75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "GPL", "dependencies": { "@babel/preset-env": "7.13.8", - "@parcel/service-worker": "^2.5.0", + "@parcel/service-worker": "^2.6.0", "@turf/buffer": "^6.5.0", "@turf/collect": "^6.5.0", "@turf/distance": "^6.5.0", @@ -1395,12 +1395,12 @@ } }, "node_modules/@parcel/service-worker": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.5.0.tgz", - "integrity": "sha512-4kcY3uG/ureZqWf89N2QcW0MjBtNxvZrJEp3uTbaRaNgwYfyqebXW2eKtgKixsGLFMOV2rvEUoiDScMAZSBXOg==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.6.0.tgz", + "integrity": "sha512-rOKRPoipOsg5XsYbag0mQ0WtVTscHjblL/zc0VA6O3ju5hgLAPVM4UmfdljuRVgRoMHSCV7wz1qAh9okvNqdjw==", "engines": { "node": ">= 12.0.0", - "parcel": "^2.5.0" + "parcel": "^2.6.0" }, "funding": { "type": "opencollective", @@ -17731,9 +17731,9 @@ } }, "@parcel/service-worker": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.5.0.tgz", - "integrity": "sha512-4kcY3uG/ureZqWf89N2QcW0MjBtNxvZrJEp3uTbaRaNgwYfyqebXW2eKtgKixsGLFMOV2rvEUoiDScMAZSBXOg==" + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.6.0.tgz", + "integrity": "sha512-rOKRPoipOsg5XsYbag0mQ0WtVTscHjblL/zc0VA6O3ju5hgLAPVM4UmfdljuRVgRoMHSCV7wz1qAh9okvNqdjw==" }, "@parcel/utils": { "version": "1.11.0", diff --git a/package.json b/package.json index a0c5a2826..d165cedaa 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "test:run-only": "mocha --require ts-node/register --require test/testhooks.ts \"./**/*.doctest.ts\" \"test/*\" \"test/**/*.ts\"", "test": "(npm run generate:doctests 2>&1 | grep -v \"No doctests found in\") && npm run test:run-only && npm run clean:tests", "init": "npm ci && npm run generate && npm run generate:editor-layer-index && npm run generate:layouts && npm run clean", - "generate:editor-layer-index": "ts-node scripts/downloadFile.ts https://osmlab.github.io/editor-layer-index/imagery.geojson assets/editor-layer-index.json", + "generate:editor-layer-index": "ts-node scripts/downloadFile.ts https://osmlab.github.io/editor-layer-index/imagery.geojson assets/editor-layer-index.json", "generate:polygon-features": "ts-node scripts/downloadFile.ts https://raw.githubusercontent.com/tyrasd/osm-polygon-features/master/polygon-features.json assets/polygon-features.json", "generate:images": "ts-node scripts/generateIncludedImages.ts", "generate:translations": "ts-node scripts/generateTranslations.ts", @@ -57,7 +57,7 @@ "license": "GPL", "dependencies": { "@babel/preset-env": "7.13.8", - "@parcel/service-worker": "^2.5.0", + "@parcel/service-worker": "^2.6.0", "@turf/buffer": "^6.5.0", "@turf/collect": "^6.5.0", "@turf/distance": "^6.5.0",