Add textmode icons

This commit is contained in:
Pieter Vander Vennet 2022-05-26 14:22:48 +02:00
parent 48953cf266
commit 890e555d87
4 changed files with 23 additions and 17 deletions

View file

@ -414,8 +414,8 @@ export default class TagRenderingConfig {
return applicableMappings return applicableMappings
} }
public GetRenderValue(tags: any, defltValue: any = undefined): TypedTranslation<any> { public GetRenderValue(tags: any, defltValue: any = undefined): TypedTranslation<any> | undefined {
return this.GetRenderValueWithImage(tags, defltValue).then return this.GetRenderValueWithImage(tags, defltValue)?.then
} }
/** /**
@ -423,7 +423,13 @@ export default class TagRenderingConfig {
* Not compatible with multiAnswer - use GetRenderValueS instead in that case * Not compatible with multiAnswer - use GetRenderValueS instead in that case
* @constructor * @constructor
*/ */
public GetRenderValueWithImage(tags: any, defltValue: any = undefined): { then: TypedTranslation<any>, icon?: string } { public GetRenderValueWithImage(tags: any, defltValue: any = undefined): { then: TypedTranslation<any>, icon?: string } | undefined {
if(this.condition !== undefined){
if(!this.condition.matchesProperties(tags)){
return undefined
}
}
if (this.mappings !== undefined && !this.multiAnswer) { if (this.mappings !== undefined && !this.multiAnswer) {
for (const mapping of this.mappings) { for (const mapping of this.mappings) {
if (mapping.if === undefined) { if (mapping.if === undefined) {

View file

@ -11,7 +11,7 @@
"override": {} "override": {}
}, },
"wikipedialink": { "wikipedialink": {
"render": "<a href='https://wikipedia.org/wiki/{wikipedia}' target='_blank'><img src='./assets/svg/wikipedia.svg' alt='WP'/></a>", "render": "<a href='https://wikipedia.org/wiki/{wikipedia}' target='_blank'><img src='./assets/svg/wikipedia.svg' textmode='\uD83D\uDCD6' alt='Wikipedia'/></a>",
"condition": { "condition": {
"or": [ "or": [
"wikipedia~*", "wikipedia~*",
@ -59,15 +59,15 @@
] ]
}, },
"phonelink": { "phonelink": {
"render": "<a href='tel:{phone}'><img src='./assets/svg/phone.svg'/></a>", "render": "<a href='tel:{phone}'><img textmode='\uD83D\uDCDE' alt='phone' src='./assets/svg/phone.svg'/></a>",
"condition": "phone~*" "condition": "phone~*"
}, },
"emaillink": { "emaillink": {
"render": "<a href='mailto:{email}'><img src='./assets/svg/send_email.svg'/></a>", "render": "<a href='mailto:{email}'><img textmode='✉️' alt='email' src='./assets/svg/send_email.svg'/></a>",
"condition": "email~*" "condition": "email~*"
}, },
"osmlink": { "osmlink": {
"render": "<a href='https://openstreetmap.org/{id}' target='_blank'><img src='./assets/svg/osm-logo-us.svg'/></a>", "render": "<a href='https://openstreetmap.org/{id}' target='_blank'><img alt='on osm' textmode='\uD83D\uDDFA' src='./assets/svg/osm-logo-us.svg'/></a>",
"mappings": [ "mappings": [
{ {
"if": "id~.*/-.*", "if": "id~.*/-.*",

16
package-lock.json generated
View file

@ -10,7 +10,7 @@
"license": "GPL", "license": "GPL",
"dependencies": { "dependencies": {
"@babel/preset-env": "7.13.8", "@babel/preset-env": "7.13.8",
"@parcel/service-worker": "^2.5.0", "@parcel/service-worker": "^2.6.0",
"@turf/buffer": "^6.5.0", "@turf/buffer": "^6.5.0",
"@turf/collect": "^6.5.0", "@turf/collect": "^6.5.0",
"@turf/distance": "^6.5.0", "@turf/distance": "^6.5.0",
@ -1395,12 +1395,12 @@
} }
}, },
"node_modules/@parcel/service-worker": { "node_modules/@parcel/service-worker": {
"version": "2.5.0", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.5.0.tgz", "resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.6.0.tgz",
"integrity": "sha512-4kcY3uG/ureZqWf89N2QcW0MjBtNxvZrJEp3uTbaRaNgwYfyqebXW2eKtgKixsGLFMOV2rvEUoiDScMAZSBXOg==", "integrity": "sha512-rOKRPoipOsg5XsYbag0mQ0WtVTscHjblL/zc0VA6O3ju5hgLAPVM4UmfdljuRVgRoMHSCV7wz1qAh9okvNqdjw==",
"engines": { "engines": {
"node": ">= 12.0.0", "node": ">= 12.0.0",
"parcel": "^2.5.0" "parcel": "^2.6.0"
}, },
"funding": { "funding": {
"type": "opencollective", "type": "opencollective",
@ -17731,9 +17731,9 @@
} }
}, },
"@parcel/service-worker": { "@parcel/service-worker": {
"version": "2.5.0", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.5.0.tgz", "resolved": "https://registry.npmjs.org/@parcel/service-worker/-/service-worker-2.6.0.tgz",
"integrity": "sha512-4kcY3uG/ureZqWf89N2QcW0MjBtNxvZrJEp3uTbaRaNgwYfyqebXW2eKtgKixsGLFMOV2rvEUoiDScMAZSBXOg==" "integrity": "sha512-rOKRPoipOsg5XsYbag0mQ0WtVTscHjblL/zc0VA6O3ju5hgLAPVM4UmfdljuRVgRoMHSCV7wz1qAh9okvNqdjw=="
}, },
"@parcel/utils": { "@parcel/utils": {
"version": "1.11.0", "version": "1.11.0",

View file

@ -57,7 +57,7 @@
"license": "GPL", "license": "GPL",
"dependencies": { "dependencies": {
"@babel/preset-env": "7.13.8", "@babel/preset-env": "7.13.8",
"@parcel/service-worker": "^2.5.0", "@parcel/service-worker": "^2.6.0",
"@turf/buffer": "^6.5.0", "@turf/buffer": "^6.5.0",
"@turf/collect": "^6.5.0", "@turf/collect": "^6.5.0",
"@turf/distance": "^6.5.0", "@turf/distance": "^6.5.0",