forked from MapComplete/MapComplete
Add textmode icons
This commit is contained in:
parent
48953cf266
commit
890e555d87
4 changed files with 23 additions and 17 deletions
|
@ -414,8 +414,8 @@ export default class TagRenderingConfig {
|
|||
return applicableMappings
|
||||
}
|
||||
|
||||
public GetRenderValue(tags: any, defltValue: any = undefined): TypedTranslation<any> {
|
||||
return this.GetRenderValueWithImage(tags, defltValue).then
|
||||
public GetRenderValue(tags: any, defltValue: any = undefined): TypedTranslation<any> | 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<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) {
|
||||
for (const mapping of this.mappings) {
|
||||
if (mapping.if === undefined) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"override": {}
|
||||
},
|
||||
"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": {
|
||||
"or": [
|
||||
"wikipedia~*",
|
||||
|
@ -59,15 +59,15 @@
|
|||
]
|
||||
},
|
||||
"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~*"
|
||||
},
|
||||
"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~*"
|
||||
},
|
||||
"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": [
|
||||
{
|
||||
"if": "id~.*/-.*",
|
||||
|
|
16
package-lock.json
generated
16
package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue