From 05e38696723347d9145426fdf12c35177f74c1f2 Mon Sep 17 00:00:00 2001 From: Robin van der Linde Date: Tue, 5 Jul 2022 15:22:11 +0200 Subject: [PATCH 01/24] Parking details, generate translations --- assets/layers/parking/parking.json | 157 ++++++++++++- langs/layers/en.json | 80 ++++++- langs/layers/it.json | 364 +++++++++++++++++++++++++++++ langs/layers/nl.json | 75 +++++- langs/themes/it.json | 4 + 5 files changed, 672 insertions(+), 8 deletions(-) diff --git a/assets/layers/parking/parking.json b/assets/layers/parking/parking.json index 3363bbc3c..94cbd7d8a 100644 --- a/assets/layers/parking/parking.json +++ b/assets/layers/parking/parking.json @@ -26,7 +26,160 @@ "es": "Una capa que muestra aparcamientos para coches" }, "tagRenderings": [ - "images" + "images", + { + "id": "parking-type", + "mappings": [ + { + "if": "parking=surface", + "then": { + "en": "This is a surface parking lot", + "nl": "Dit is een bovengronds parkeerterrein" + } + }, + { + "if": "parking=street_side", + "then": { + "en": "This is a parking bay next to a street", + "nl": "Dit is een parkeerplek langs een weg" + } + }, + { + "if": "parking=underground", + "then": { + "en": "This is an underground parking garage", + "nl": "Dit is een ondergrondse parkeergarage" + } + }, + { + "if": "parking=multi-storey", + "then": { + "en": "This is a multi-storey parking garage", + "nl": "Dit is een bovengrondse parkeergarage met meerdere verdiepingen" + } + }, + { + "if": "parking=rooftop", + "then": { + "en": "This is a rooftop parking deck", + "nl": "Dit is een parkeerdek op een dak" + } + }, + { + "if": "parking=lane", + "then": { + "en": "This is a lane for parking on the road", + "nl": "Dit is een strook voor parkeren op de weg" + } + }, + { + "if": "parking=carports", + "then": { + "en": "This is parking covered by carports", + "nl": "Dit is parking overdekt met carports" + } + }, + { + "if": "parking=garage_boxes", + "then": { + "en": "This a parking consisting of garage boxes", + "nl": "Dit is een parking bestaande uit garageboxen" + } + }, + { + "if": "parking=layby", + "then": { + "en": "This is a parking on a layby", + "nl": "Dit is een parkeerplek op een layby" + } + }, + { + "if": "parking=sheds", + "then": { + "en": "This is a parking consisting of sheds", + "nl": "Dit is een parking bestaande uit schuren" + } + } + ], + "question": { + "en": "What kind of parking is this?", + "nl": "Wat voor parking is dit?" + } + }, + { + "id": "capacity-disabled", + "freeform": { + "key": "capacity:disabled", + "type": "pnat", + "placeholder": { + "en": "Amount of parking spots reserved for disabled people", + "nl": "Aantal parkeerplaatsen voor gehandicapten" + } + }, + "mappings": [ + { + "if": "capacity:disabled=yes", + "then": { + "en": "There are disabled parking spots, but it is not known how many", + "nl": "Er zijn parkeerplaatsen voor gehandicapten, maar het is niet bekend hoeveel er zijn" + }, + "hideInAnswer": true + }, + { + "if": "capacity:disabled=no", + "then": { + "en": "There are no disabled parking spots", + "nl": "Er zijn geen parkeerplaatsen voor gehandicapten" + }, + "hideInAnswer": true + } + ], + "question": { + "en": "How many disabled parking spots are there at this parking?", + "nl": "Hoeveel parkeerplaatsen voor gehandicapten zijn er op deze parking?" + }, + "render": { + "en": "There are {{capacity:disabled}} disabled parking spots", + "nl": "Er zijn {{capacity:disabled}} parkeerplaatsen voor gehandicapten" + } + }, + { + "id": "capacity", + "freeform": { + "key": "capacity", + "type": "pnat", + "placeholder": { + "en": "Amount of parking spots", + "nl": "Aantal parkeerplaatsen" + } + }, + "mappings": [ + { + "if": "capacity=yes", + "then": { + "en": "There are parking spots, but it is not known how many", + "nl": "Er zijn parkeerplaatsen, maar het is niet bekend hoeveel er zijn" + }, + "hideInAnswer": true + }, + { + "if": "capacity=no", + "then": { + "en": "There are no parking spots", + "nl": "Er zijn geen parkeerplaatsen" + }, + "hideInAnswer": true + } + ], + "question": { + "en": "How many parking spots are there at this parking?", + "nl": "Hoeveel parkeerplaatsen zijn er op deze parking?" + }, + "render": { + "en": "There are {{capacity}} parking spots", + "nl": "Er zijn {{capacity}} parkeerplaatsen" + } + } ], "presets": [ { @@ -52,7 +205,7 @@ }, "allowMove": { "enableRelocation": false, - "enableImproveAccuraccy": true + "enableImproveAccuracy": true }, "mapRendering": [ { diff --git a/langs/layers/en.json b/langs/layers/en.json index 01aa1fabb..d175ca8b4 100644 --- a/langs/layers/en.json +++ b/langs/layers/en.json @@ -3568,6 +3568,11 @@ "0": { "explanation": "{title()} has closed down permanently" } + }, + "nonDeleteMappings": { + "0": { + "then": "This is actually a pub" + } } }, "description": "A layer showing restaurants and fast-food amenities (with a special rendering for friteries)", @@ -4616,6 +4621,73 @@ "title": "a car parking" } }, + "tagRenderings": { + "capacity": { + "freeform": { + "placeholder": "Amount of parking spots" + }, + "mappings": { + "0": { + "then": "There are parking spots, but it is not known how many" + }, + "1": { + "then": "There are no parking spots" + } + }, + "question": "How many parking spots are there at this parking?", + "render": "There are {{capacity}} parking spots" + }, + "capacity-disabled": { + "freeform": { + "placeholder": "Amount of parking spots reserved for disabled people" + }, + "mappings": { + "0": { + "then": "There are disabled parking spots, but it is not known how many" + }, + "1": { + "then": "There are no disabled parking spots" + } + }, + "question": "How many disabled parking spots are there at this parking?", + "render": "There are {{capacity:disabled}} disabled parking spots" + }, + "parking-type": { + "mappings": { + "0": { + "then": "This is a surface parking lot" + }, + "1": { + "then": "This is a parking bay next to a street" + }, + "2": { + "then": "This is an underground parking garage" + }, + "3": { + "then": "This is a multi-storey parking garage" + }, + "4": { + "then": "This is a rooftop parking deck" + }, + "5": { + "then": "This is a lane for parking on the road" + }, + "6": { + "then": "This is parking covered by carports" + }, + "7": { + "then": "This a parking consisting of garage boxes" + }, + "8": { + "then": "This is a parking on a layby" + }, + "9": { + "then": "This is a parking consisting of sheds" + } + }, + "question": "What kind of parking is this?" + } + }, "title": { "render": "Car parking" } @@ -5279,11 +5351,13 @@ } }, "tagRenderings": { + "2": { + "override": { + "question": "What kind of shop is this?" + } + }, "shops-name": { "question": "What is the name of this shop?" - }, - "shops-type-from-id": { - "question": "What kind of shop is this?" } }, "title": { diff --git a/langs/layers/it.json b/langs/layers/it.json index a76a3b1d8..09efa26b6 100644 --- a/langs/layers/it.json +++ b/langs/layers/it.json @@ -1756,6 +1756,218 @@ "render": "Microbiblioteca" } }, + "recycling": { + "description": "Un livello con i contenitori e centri per la raccolta rifiuti riciclabili", + "filter": { + "0": { + "options": { + "0": { + "question": "Aperto ora" + } + } + }, + "1": { + "options": { + "0": { + "question": "Tutti i tipi di rifiuti" + }, + "1": { + "question": "Riciclo di batterie" + }, + "2": { + "question": "Riciclo di confezioni per bevande" + }, + "3": { + "question": "Riciclo di lattine" + }, + "4": { + "question": "Riciclo di abiti" + }, + "5": { + "question": "Riciclo di olio da cucina" + }, + "6": { + "question": "Riciclo di olio da motore" + }, + "7": { + "question": "Riciclo di umido" + }, + "8": { + "question": "Riciclo di bottiglie di vetro" + }, + "9": { + "question": "Riciclo di vetro" + }, + "10": { + "question": "Riciclo di giornali" + }, + "11": { + "question": "Riciclo di carta" + }, + "12": { + "question": "Riciclo di bottiglie di plastica" + }, + "13": { + "question": "Riciclo di confezioni di plastica" + }, + "14": { + "question": "Riciclo di plastica" + }, + "15": { + "question": "Riciclo di rottami metallici" + }, + "16": { + "question": "Riciclo di piccoli elettrodomestici" + }, + "17": { + "question": "Riciclo di secco" + } + } + } + }, + "name": "Riciclo", + "presets": { + "0": { + "title": "un contenitore per il riciclo" + }, + "1": { + "title": "un centro di riciclo" + } + }, + "tagRenderings": { + "container-location": { + "mappings": { + "0": { + "then": "E' un contenitore sotterraneo" + }, + "1": { + "then": "Questo contenitore è al chiuso" + }, + "2": { + "then": "Questo contenitore è all'aperto" + } + }, + "question": "Dove si trova questo contenitore?" + }, + "opening_hours": { + "mappings": { + "0": { + "then": "24/7" + } + }, + "question": "Quali sono gli orari di apertura di questo impianto di raccolta e riciclo?" + }, + "operator": { + "question": "Quale azienda gestisce questo impianto di raccolta e riciclo?", + "render": "Questa struttura di raccola e riciclo è gestita da {operator}" + }, + "recycling-accepts": { + "mappings": { + "0": { + "then": "Batterie" + }, + "1": { + "then": "Cartoni per bevande" + }, + "2": { + "then": "Lattine" + }, + "3": { + "then": "Abiti" + }, + "4": { + "then": "Olio da cucina" + }, + "5": { + "then": "Olio di motore" + }, + "6": { + "then": "Verde" + }, + "7": { + "then": "Umido" + }, + "8": { + "then": "Bottiglie di vetro" + }, + "9": { + "then": "Vetro" + }, + "10": { + "then": "Giornali" + }, + "11": { + "then": "Carta" + }, + "12": { + "then": "Bottiglie di platica" + }, + "13": { + "then": "Confezioni di plastica" + }, + "14": { + "then": "Plastica" + }, + "15": { + "then": "Rottami metallici" + }, + "16": { + "then": "Scarpe" + }, + "17": { + "then": "Piccoli elettrodomestici" + }, + "18": { + "then": "Piccoli elettrodomestici" + }, + "19": { + "then": "Aghi e oggetti appuntiti" + }, + "20": { + "then": "Secco" + } + }, + "question": "Cosa si può riciclare qui?" + }, + "recycling-centre-name": { + "mappings": { + "0": { + "then": "Questo centro raccolta e riciclo rifiuti non ha un nome specifico" + } + }, + "question": "Come si chiama questo centro raccolta e riciclo rifiuti?", + "render": "Questo centro raccolta e riciclo rifiuti si chiama {name}" + }, + "recycling-type": { + "mappings": { + "0": { + "then": "Questo è un contenitore per il riciclo di rifiuti" + }, + "1": { + "then": "Questo è un centro per la raccola e riciclo di rifiuti" + }, + "2": { + "then": "Contenitore per lo smaltimento del secco" + } + }, + "question": "Che tipo di raccolta è questo?" + } + }, + "title": { + "mappings": { + "0": { + "then": "Centro di riciclo rifiuti" + }, + "1": { + "then": "Centro di riciclo rifiuti" + }, + "2": { + "then": "Contenitore per il riciclo" + } + }, + "render": "Impianti di riciclo" + } + }, "slow_roads": { "tagRenderings": { "slow_roads-surface": { @@ -2259,6 +2471,158 @@ "render": "Punto panoramico" } }, + "waste_basket": { + "description": "Questo è un cestino dei rifiuti pubblico, un bidone della spazzatura, dove puoi buttare via la tua spazzatura", + "filter": { + "0": { + "options": { + "0": { + "question": "Tutti i tipi" + }, + "1": { + "question": "Cestino per sigarette" + }, + "2": { + "question": "Cestino per medicinali" + }, + "3": { + "question": "Cestino per escrementi dei cani" + }, + "4": { + "question": "Cestino per la spazzatura" + }, + "5": { + "question": "Cestino dei rifiuti per oggetti taglienti" + }, + "6": { + "question": "Cestino per la plastica" + } + } + }, + "1": { + "options": { + "0": { + "question": "Cestino per rifiuti con dispenser per sacchetti per escrementi dei cani" + } + } + } + }, + "mapRendering": { + "0": { + "iconSize": { + "mappings": { + "0": { + "then": "Cestino dei rifiuti" + } + } + } + } + }, + "name": "Cestino dei rifiuti", + "presets": { + "0": { + "title": "un cestino dei rifiuti" + } + }, + "tagRenderings": { + "dispensing_dog_bags": { + "mappings": { + "0": { + "then": "Questo cestino ha un distributore di sacchetti per escrementi dei cani" + }, + "1": { + "then": "Questo cestino non ha un distributore di sacchetti per escrementi dei cani" + }, + "2": { + "then": "Questo cestino non ha un distributore di sacchetti per escrementi dei cani" + } + }, + "question": "Questo cestino ha un distributore di sacchetti per escrementi dei cani?" + }, + "waste-basket-waste-types": { + "mappings": { + "0": { + "then": "Un cestino rifiuti per uso generico" + }, + "1": { + "then": "Un cestino rifiuti per uso generico" + }, + "2": { + "then": "Un cestino rifiuti per escrementi di cani" + }, + "3": { + "then": "Un cestino rifiuti per sigarette" + }, + "4": { + "then": "Un cestino rifiuti per medicinali" + }, + "5": { + "then": "Un cestino rifiuti per aghi e altri oggetti appuntiti" + }, + "6": { + "then": "Un cestino rifiuti per la plastica" + } + }, + "question": "Che tipo di cestino dei rifiuti è questo?" + } + }, + "title": { + "render": "Cestino dei rifiuti" + } + }, + "waste_disposal": { + "description": "Cestino per lo smaltimento dei rifiuti, contenitore di dimensioni medio grandi per lo smaltimento dei rifiuti (domestici)", + "filter": { + "0": { + "options": { + "0": { + "question": "Solo accesso pubblico" + } + } + } + }, + "name": "Contenitori per la raccolta differenziata", + "presets": { + "0": { + "description": "Cestino di dimensioni medio-grandi per lo smaltimento dei rifiuti (domestici)", + "title": "un raccoglitore per lo smaltimento rifiuti" + } + }, + "tagRenderings": { + "access": { + "mappings": { + "0": { + "then": "Questo cestino può essere usato da chiunque" + }, + "1": { + "then": "Questo cestino è privato" + }, + "2": { + "then": "Questo cestino è solo per residenti" + } + }, + "question": "Chi può utilizzare questo cestino per lo smaltimento dei rifiuti?", + "render": "Accesso: {access}" + }, + "disposal-location": { + "mappings": { + "0": { + "then": "Questo è un contenitore sotterraneo" + }, + "1": { + "then": "Questo contenitore è al chiuso" + }, + "2": { + "then": "Questo contenitore è all'aperto" + } + }, + "question": "Dove si trova questo contenitore?" + } + }, + "title": { + "render": "Smaltimento rifiuti" + } + }, "windturbine": { "name": "pala eolica", "presets": { diff --git a/langs/layers/nl.json b/langs/layers/nl.json index 96d2abc4f..f46d4b970 100644 --- a/langs/layers/nl.json +++ b/langs/layers/nl.json @@ -4505,6 +4505,73 @@ "title": "een parking voor auto's" } }, + "tagRenderings": { + "capacity": { + "freeform": { + "placeholder": "Aantal parkeerplaatsen" + }, + "mappings": { + "0": { + "then": "Er zijn parkeerplaatsen, maar het is niet bekend hoeveel er zijn" + }, + "1": { + "then": "Er zijn geen parkeerplaatsen" + } + }, + "question": "Hoeveel parkeerplaatsen zijn er op deze parking?", + "render": "Er zijn {{capacity}} parkeerplaatsen" + }, + "capacity-disabled": { + "freeform": { + "placeholder": "Aantal parkeerplaatsen voor gehandicapten" + }, + "mappings": { + "0": { + "then": "Er zijn parkeerplaatsen voor gehandicapten, maar het is niet bekend hoeveel er zijn" + }, + "1": { + "then": "Er zijn geen parkeerplaatsen voor gehandicapten" + } + }, + "question": "Hoeveel parkeerplaatsen voor gehandicapten zijn er op deze parking?", + "render": "Er zijn {{capacity:disabled}} parkeerplaatsen voor gehandicapten" + }, + "parking-type": { + "mappings": { + "0": { + "then": "Dit is een bovengronds parkeerterrein" + }, + "1": { + "then": "Dit is een parkeerplek langs een weg" + }, + "2": { + "then": "Dit is een ondergrondse parkeergarage" + }, + "3": { + "then": "Dit is een bovengrondse parkeergarage met meerdere verdiepingen" + }, + "4": { + "then": "Dit is een parkeerdek op een dak" + }, + "5": { + "then": "Dit is een strook voor parkeren op de weg" + }, + "6": { + "then": "Dit is parking overdekt met carports" + }, + "7": { + "then": "Dit is een parking bestaande uit garageboxen" + }, + "8": { + "then": "Dit is een parkeerplek op een layby" + }, + "9": { + "then": "Dit is een parking bestaande uit schuren" + } + }, + "question": "Wat voor parking is dit?" + } + }, "title": { "render": "Parking voor auto's" } @@ -5183,11 +5250,13 @@ } }, "tagRenderings": { + "2": { + "override": { + "question": "Wat voor soort winkel is dit?" + } + }, "shops-name": { "question": "Wat is de naam van deze winkel?" - }, - "shops-type-from-id": { - "question": "Wat voor soort winkel is dit?" } }, "title": { diff --git a/langs/themes/it.json b/langs/themes/it.json index f9518d0d4..fbed99743 100644 --- a/langs/themes/it.json +++ b/langs/themes/it.json @@ -577,6 +577,10 @@ "shortDescription": "Mappa tutti gli alberi", "title": "Alberi" }, + "waste": { + "description": "Mappa dei cestini per i rifiuti e i centri di raccolta e riciclo rifiuti.", + "title": "Rifiuti" + }, "waste_basket": { "description": "In questa cartina troverai i cestini dei rifiuti nei tuoi paraggi. Se manca un cestino, puoi inserirlo tu stesso", "shortDescription": "Una cartina dei cestini dei rifiuti", From b477fdfee1553b357a9f93778d3f2bff5007a043 Mon Sep 17 00:00:00 2001 From: Robin van der Linde Date: Wed, 6 Jul 2022 09:33:27 +0000 Subject: [PATCH 02/24] Fix double braces --- assets/layers/kerbs/kerbs.json | 4 +- assets/layers/parking/parking.json | 8 ++-- .../mapcomplete-changes.json | 39 ++++++++++++------- langs/layers/en.json | 6 +-- langs/layers/nl.json | 6 +-- 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/assets/layers/kerbs/kerbs.json b/assets/layers/kerbs/kerbs.json index a9f20f6de..777555eb0 100644 --- a/assets/layers/kerbs/kerbs.json +++ b/assets/layers/kerbs/kerbs.json @@ -150,8 +150,8 @@ "nl": "Hoe hoog is deze stoeprand?" }, "render": { - "en": "Kerb height: {{kerb:height}}", - "nl": "Stoeprandhoogte: {{kerb:height}}" + "en": "Kerb height: {kerb:height}", + "nl": "Stoeprandhoogte: {kerb:height}" }, "freeform": { "key": "kerb:height", diff --git a/assets/layers/parking/parking.json b/assets/layers/parking/parking.json index 94cbd7d8a..c1b65b255 100644 --- a/assets/layers/parking/parking.json +++ b/assets/layers/parking/parking.json @@ -139,8 +139,8 @@ "nl": "Hoeveel parkeerplaatsen voor gehandicapten zijn er op deze parking?" }, "render": { - "en": "There are {{capacity:disabled}} disabled parking spots", - "nl": "Er zijn {{capacity:disabled}} parkeerplaatsen voor gehandicapten" + "en": "There are {capacity:disabled} disabled parking spots", + "nl": "Er zijn capacity:disabled} parkeerplaatsen voor gehandicapten" } }, { @@ -176,8 +176,8 @@ "nl": "Hoeveel parkeerplaatsen zijn er op deze parking?" }, "render": { - "en": "There are {{capacity}} parking spots", - "nl": "Er zijn {{capacity}} parkeerplaatsen" + "en": "There are {capacity} parking spots", + "nl": "Er zijn {capacity} parkeerplaatsen" } } ], diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index c21ef5df7..143288b53 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -1,13 +1,16 @@ { "id": "mapcomplete-changes", "title": { - "en": "Changes made with MapComplete" + "en": "Changes made with MapComplete", + "nl": "Wijzigingen gemaakt met MapComplete" }, "shortDescription": { - "en": "Shows changes made by MapComplete" + "en": "Shows changes made by MapComplete", + "nl": "Toont wijzigingen gemaakt met MapComplete" }, "description": { - "en": "This maps shows all the changes made with MapComplete" + "en": "This maps shows all the changes made with MapComplete", + "nl": "Deze kaart toont alle wijzigingen die met MapComplete werden gemaakt" }, "maintainer": "", "icon": "./assets/svg/logo.svg", @@ -36,35 +39,41 @@ ], "title": { "render": { - "en": "Changeset for {theme}" + "en": "Changeset for {theme}", + "nl": "Wijzigingset voor {theme}" } }, "description": { - "en": "Shows all MapComplete changes" + "en": "Shows all MapComplete changes", + "nl": "Toont alle wijzigingen met MapComplete" }, "tagRenderings": [ { "id": "render_id", "render": { - "en": "Changeset {id}" + "en": "Changeset {id}", + "nl": "Wijzigingset {id}" } }, { "id": "contributor", "render": { - "en": "Change made by {_last_edit:contributor}" + "en": "Change made by {_last_edit:contributor}", + "nl": "Wijziging gemaakt door {_last_edit:contributor}" } }, { "id": "theme", "render": { - "en": "Change with theme {theme}" + "en": "Change with theme {theme}", + "nl": "Wijziging met thema {theme}" }, "mappings": [ { "if": "theme~http.*", "then": { - "en": "Change with unofficial theme {theme}" + "en": "Change with unofficial theme {theme}", + "nl": "Wijziging met officieus thema {theme}" } } ] @@ -344,7 +353,8 @@ } ], "question": { - "en": "Themename contains {search}" + "en": "Themename contains {search}", + "nl": "Themanaam bevat {search}" } } ] @@ -360,7 +370,8 @@ } ], "question": { - "en": "Made by contributor {search}" + "en": "Made by contributor {search}", + "nl": "Gemaakt door bijdrager {search}" } } ] @@ -376,7 +387,8 @@ } ], "question": { - "en": "Not made by contributor {search}" + "en": "Not made by contributor {search}", + "nl": "Niet gemaakt door bijdrager {search}" } } ] @@ -391,7 +403,8 @@ { "id": "link_to_more", "render": { - "en": "More statistics can be found here" + "en": "More statistics can be found here", + "nl": "Meer statistieken kunnen hier gevonden worden" } }, { diff --git a/langs/layers/en.json b/langs/layers/en.json index d175ca8b4..72a6f6eaf 100644 --- a/langs/layers/en.json +++ b/langs/layers/en.json @@ -4127,7 +4127,7 @@ "placeholder": "Height of the kerb" }, "question": "What is the height of this kerb?", - "render": "Kerb height: {{kerb:height}}" + "render": "Kerb height: {kerb:height}" }, "kerb-type": { "mappings": { @@ -4635,7 +4635,7 @@ } }, "question": "How many parking spots are there at this parking?", - "render": "There are {{capacity}} parking spots" + "render": "There are {capacity} parking spots" }, "capacity-disabled": { "freeform": { @@ -4650,7 +4650,7 @@ } }, "question": "How many disabled parking spots are there at this parking?", - "render": "There are {{capacity:disabled}} disabled parking spots" + "render": "There are {capacity:disabled} disabled parking spots" }, "parking-type": { "mappings": { diff --git a/langs/layers/nl.json b/langs/layers/nl.json index f46d4b970..6d1f8c96d 100644 --- a/langs/layers/nl.json +++ b/langs/layers/nl.json @@ -4035,7 +4035,7 @@ "placeholder": "Hoogte van de stoeprand" }, "question": "Hoe hoog is deze stoeprand?", - "render": "Stoeprandhoogte: {{kerb:height}}" + "render": "Stoeprandhoogte: {kerb:height}" }, "kerb-type": { "mappings": { @@ -4519,7 +4519,7 @@ } }, "question": "Hoeveel parkeerplaatsen zijn er op deze parking?", - "render": "Er zijn {{capacity}} parkeerplaatsen" + "render": "Er zijn {capacity} parkeerplaatsen" }, "capacity-disabled": { "freeform": { @@ -4534,7 +4534,7 @@ } }, "question": "Hoeveel parkeerplaatsen voor gehandicapten zijn er op deze parking?", - "render": "Er zijn {{capacity:disabled}} parkeerplaatsen voor gehandicapten" + "render": "Er zijn capacity:disabled} parkeerplaatsen voor gehandicapten" }, "parking-type": { "mappings": { From aef6bece49fa1c8b2db2867d2b9bb34d9aad150d Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 11 Jul 2022 11:09:25 +0200 Subject: [PATCH 03/24] Attempt to fix import flow --- UI/ImportFlow/ConflationChecker.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UI/ImportFlow/ConflationChecker.ts b/UI/ImportFlow/ConflationChecker.ts index 88c394bf8..e64a75342 100644 --- a/UI/ImportFlow/ConflationChecker.ts +++ b/UI/ImportFlow/ConflationChecker.ts @@ -80,6 +80,8 @@ export default class ConflationChecker extends Combine implements FlowStep<{ fea if (v !== undefined && v !== null) { console.log("Loaded from local storage:", v) overpassStatus.setData("cached") + }else{ + loadDataFromOverpass() } } }); From a0096f9bd6fe5788aa2d491320f792db94c44a7d Mon Sep 17 00:00:00 2001 From: AlexanderRebai Date: Mon, 11 Jul 2022 09:34:46 +0000 Subject: [PATCH 04/24] able to add name of the doctors office --- assets/layers/doctors/doctors.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/assets/layers/doctors/doctors.json b/assets/layers/doctors/doctors.json index e69fb27a4..e1d2037ae 100644 --- a/assets/layers/doctors/doctors.json +++ b/assets/layers/doctors/doctors.json @@ -38,6 +38,16 @@ "phone", "email", "website", + { + "question": { + "en": "What is the name of this doctors place?" + }, + "render": "This doctors place is called {name}", + "freeform": { + "key": "name" + }, + "id": "name" + }, { "condition": "amenity=doctors", "id": "specialty", From a4bb29516a84228c3880d13e520df37df8fe5398 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 11 Jul 2022 12:00:55 +0200 Subject: [PATCH 05/24] Fix typing error in import flow --- UI/ImportFlow/CompareToAlreadyExistingNotes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/ImportFlow/CompareToAlreadyExistingNotes.ts b/UI/ImportFlow/CompareToAlreadyExistingNotes.ts index 3be0f1991..8cf334660 100644 --- a/UI/ImportFlow/CompareToAlreadyExistingNotes.ts +++ b/UI/ImportFlow/CompareToAlreadyExistingNotes.ts @@ -93,7 +93,7 @@ export class CompareToAlreadyExistingNotes extends Combine implements FlowStep<{ state, zoomToFeatures: true, leafletMap: comparisonMap.leafletMap, - features: new StaticFeatureSource(partitionedImportPoints.map(p => p.hasNearby)), + features: StaticFeatureSource.fromGeojsonStore(partitionedImportPoints.map(p => p.hasNearby)), popup: (tags, layer) => new FeatureInfoBox(tags, layer, state) }) From 3cf5bd8dc601d870d3578625803662531ba3475f Mon Sep 17 00:00:00 2001 From: AlexanderRebai Date: Mon, 11 Jul 2022 11:45:09 +0000 Subject: [PATCH 06/24] Created a first version for onWheels layer --- assets/layers/doctors/license_info.json | 10 +++++ .../mapcomplete-changes.json | 4 ++ assets/themes/onwheels/crest.svg | 12 ++++++ assets/themes/onwheels/license_info.json | 10 +++++ assets/themes/onwheels/onwheels.json | 40 +++++++++++++++++++ 5 files changed, 76 insertions(+) create mode 100644 assets/themes/onwheels/crest.svg create mode 100644 assets/themes/onwheels/license_info.json create mode 100644 assets/themes/onwheels/onwheels.json diff --git a/assets/layers/doctors/license_info.json b/assets/layers/doctors/license_info.json index 90889fdc6..cc0457d85 100644 --- a/assets/layers/doctors/license_info.json +++ b/assets/layers/doctors/license_info.json @@ -1,4 +1,14 @@ [ + { + "path": "dentist.svg", + "license": "CC0", + "authors": [ + "OSM Carto" + ], + "sources": [ + "https://wiki.openstreetmap.org/wiki/File:Dentist-14.svg" + ] + }, { "path": "doctors.svg", "license": "cc0", diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index 8fc630f67..e618af73b 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -243,6 +243,10 @@ "if": "theme=observation_towers", "then": "./assets/layers/observation_tower/Tower_observation.svg" }, + { + "if": "theme=onwheels", + "then": "./assets/themes/onwheels/crest.svg" + }, { "if": "theme=openwindpowermap", "then": "./assets/themes/openwindpowermap/logo.svg" diff --git a/assets/themes/onwheels/crest.svg b/assets/themes/onwheels/crest.svg new file mode 100644 index 000000000..5f23194f7 --- /dev/null +++ b/assets/themes/onwheels/crest.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/themes/onwheels/license_info.json b/assets/themes/onwheels/license_info.json new file mode 100644 index 000000000..9f2dcf81a --- /dev/null +++ b/assets/themes/onwheels/license_info.json @@ -0,0 +1,10 @@ +[ + { + "path": "crest.svg", + "license": "CC0", + "authors": [ + "Free Wheelies" + ], + "sources": [] + } +] \ No newline at end of file diff --git a/assets/themes/onwheels/onwheels.json b/assets/themes/onwheels/onwheels.json new file mode 100644 index 000000000..822a75349 --- /dev/null +++ b/assets/themes/onwheels/onwheels.json @@ -0,0 +1,40 @@ +{ + "id": "onwheels", + "title": { + "en": "OnWheels" + }, + "description": { + "en": "On this map, publicly weelchair accessible places are shown and can be easily added" + }, + "maintainer": "MapComplete", + "icon": "./assets/themes/onwheels/crest.svg", + "version": "0", + "startLat": 50.8465573, + "defaultBackgroundId": "CartoDB.Voyager", + "startLon": 4.351697, + "startZoom": 16, + "widenFactor": 2, + "layers": [ + "bike_repair_station", + "bike_shop", + "cafe_pub", + "entrance", + "food", + "kerbs", + "parking", + "picnic_table", + "school", + "shops", + "toilet", + "viewpoint", + "doctors" + ], + "overrideAll" : { + "minZoom" : "15", + "mapRendering" : [ + { + "label" : null + } + ] + } +} \ No newline at end of file From bfdc1056a0d8034f49e3a72c89769fefc8153ede Mon Sep 17 00:00:00 2001 From: AlexanderRebai Date: Mon, 11 Jul 2022 14:06:37 +0000 Subject: [PATCH 07/24] fixed language english and crest background --- assets/layers/doctors/doctors.json | 4 +++- assets/themes/onwheels/crest.svg | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/layers/doctors/doctors.json b/assets/layers/doctors/doctors.json index e1d2037ae..236d13c54 100644 --- a/assets/layers/doctors/doctors.json +++ b/assets/layers/doctors/doctors.json @@ -42,7 +42,9 @@ "question": { "en": "What is the name of this doctors place?" }, - "render": "This doctors place is called {name}", + "render": { + "en": "This doctors place is called {name}" + }, "freeform": { "key": "name" }, diff --git a/assets/themes/onwheels/crest.svg b/assets/themes/onwheels/crest.svg index 5f23194f7..383b543b1 100644 --- a/assets/themes/onwheels/crest.svg +++ b/assets/themes/onwheels/crest.svg @@ -1,5 +1,4 @@ - @@ -7,6 +6,6 @@ - + From 3a682970bfa4866fa53ef0c813f030cb21a032e1 Mon Sep 17 00:00:00 2001 From: bxl-forever Date: Mon, 11 Jul 2022 20:48:19 +0200 Subject: [PATCH 08/24] New feature request: rainbow-crossings --- .../rainbow_crossings/rainbow_crossings.json | 77 +++++++++++++++++++ .../rainbow_crossings/license_info.json | 10 +++ assets/themes/rainbow_crossings/logo.svg | 12 +++ .../rainbow_crossings/rainbow_crossings.json | 22 ++++++ 4 files changed, 121 insertions(+) create mode 100644 assets/layers/rainbow_crossings/rainbow_crossings.json create mode 100644 assets/themes/rainbow_crossings/license_info.json create mode 100644 assets/themes/rainbow_crossings/logo.svg create mode 100644 assets/themes/rainbow_crossings/rainbow_crossings.json diff --git a/assets/layers/rainbow_crossings/rainbow_crossings.json b/assets/layers/rainbow_crossings/rainbow_crossings.json new file mode 100644 index 000000000..9e8179c20 --- /dev/null +++ b/assets/layers/rainbow_crossings/rainbow_crossings.json @@ -0,0 +1,77 @@ +{ + "id": "rainbow_crossings", + "name": { + "en": "Crossings with rainbow paintings" + }, + "description": { + "en": "Crossings with decorative rainbow paintings" + }, + "source": { + "osmTags": { + "highway=crossing" + } + }, + "minzoom": 17, + "title": { + "render": { + "en": "Crossing" + } + }, + "presets": [ + { + "title": { + "en": "a crossing" + }, + "tags": [ + "highway=crossing" + ], + "description": { + "en": "Pedestrian crossing" + }, + "preciseInput": { + "preferredBackground": [ + "photo" + ], + "snapToLayer": "cycleways_and_roads", + "maxSnapDistance": 25 + } + }, + "tagRenderings": [ + { + "id": "crossing-with-rainbow", + "question": { + "en": "Does this crossing has rainbow paintings?" + }, + "condition": "highway=crossing", + "mappings": [ + { + "if": "crossing:marking=rainbow", + "then": { + "en": "This crossing has rainbow paintings" + } + }, + { + "if": "crossing:marking!=rainbow", + "then": { + "en": "No rainbow paintings here" + } + } + ] + } + ], + "mapRendering": [ + { + "icon": { + "render": "./assets/themes/rainbow_crossings/logo.svg" + }, + "iconSize": "40,40,bottom", + "location": [ + "point", + "centroid" + ] + } + ], + "description": { + "en": "A layer showing pedestrian crossings with rainbow paintings" + } +} diff --git a/assets/themes/rainbow_crossings/license_info.json b/assets/themes/rainbow_crossings/license_info.json new file mode 100644 index 000000000..1e701de22 --- /dev/null +++ b/assets/themes/rainbow_crossings/license_info.json @@ -0,0 +1,10 @@ +[ + { + "path": "logo.svg", + "license": "CC0", + "authors": [ + "bxl-forever" + ], + "sources": [] + } +] diff --git a/assets/themes/rainbow_crossings/logo.svg b/assets/themes/rainbow_crossings/logo.svg new file mode 100644 index 000000000..a5cd70668 --- /dev/null +++ b/assets/themes/rainbow_crossings/logo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/themes/rainbow_crossings/rainbow_crossings.json b/assets/themes/rainbow_crossings/rainbow_crossings.json new file mode 100644 index 000000000..84602a67f --- /dev/null +++ b/assets/themes/rainbow_crossings/rainbow_crossings.json @@ -0,0 +1,22 @@ +{ + "id": "rainbow_crossings", + "title": { + "en": "Rainbow pedestrian crossings" + }, + "description": { + "en": "On this map, rainbow-painted pedestrian crossings are shown and can be easily added" + }, + "maintainer": "", + "icon": "./assets/themes/rainbow_crossings/logo.svg", + "version": "0", + "startLat": 50.8465573, + "defaultBackgroundId": "CartoDB.Voyager", + "startLon": 4.351697, + "startZoom": 16, + "widenFactor": 2, + "layers": [ + "rainbow_crossings" + ] +} + + From 441d8467fe09f0ee4842c40965cd36cf676521f8 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 12 Jul 2022 10:23:45 +0200 Subject: [PATCH 09/24] Fix rainbox theme and add improvements --- Customizations/AllKnownLayouts.ts | 2 +- Models/ThemeConfig/LayerConfig.ts | 3 + Models/ThemeConfig/TagRenderingConfig.ts | 6 +- .../rainbow_crossings/rainbow_crossings.json | 39 +++++++---- .../mapcomplete-changes.json | 4 ++ assets/themes/rainbow_crossings/crossing.svg | 66 +++++++++++++++++++ .../rainbow_crossings/license_info.json | 10 ++- .../rainbow_crossings/rainbow_crossings.json | 23 ++++++- 8 files changed, 135 insertions(+), 18 deletions(-) create mode 100644 assets/themes/rainbow_crossings/crossing.svg diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts index 82e969564..3bfa56f93 100644 --- a/Customizations/AllKnownLayouts.ts +++ b/Customizations/AllKnownLayouts.ts @@ -19,7 +19,7 @@ export class AllKnownLayouts { public static AllPublicLayers(options?: { includeInlineLayers:true | boolean - }) { + }) : LayerConfig[] { const allLayers: LayerConfig[] = [] const seendIds = new Set() AllKnownLayouts.sharedLayers.forEach((layer, key) => { diff --git a/Models/ThemeConfig/LayerConfig.ts b/Models/ThemeConfig/LayerConfig.ts index 4779f5ebc..0582c57ac 100644 --- a/Models/ThemeConfig/LayerConfig.ts +++ b/Models/ThemeConfig/LayerConfig.ts @@ -191,6 +191,9 @@ export default class LayerConfig extends WithContextLoader { this.doNotDownload = json.doNotDownload ?? false; this.passAllFeatures = json.passAllFeatures ?? false; this.minzoom = json.minzoom ?? 0; + if(json["minZoom"] !== undefined){ + throw "At "+context+": minzoom is written all lowercase" + } this.minzoomVisible = json.minzoomVisible ?? this.minzoom; this.shownByDefault = json.shownByDefault ?? true; this.forceLoad = json.forceLoad ?? false; diff --git a/Models/ThemeConfig/TagRenderingConfig.ts b/Models/ThemeConfig/TagRenderingConfig.ts index 67141780b..656d880de 100644 --- a/Models/ThemeConfig/TagRenderingConfig.ts +++ b/Models/ThemeConfig/TagRenderingConfig.ts @@ -364,7 +364,7 @@ export default class TagRenderingConfig { * Returns true if it is known or not shown, false if the question should be asked * @constructor */ - public IsKnown(tags: any): boolean { + public IsKnown(tags: Record): boolean { if (this.condition && !this.condition.matchesProperties(tags)) { // Filtered away by the condition, so it is kindof known @@ -400,7 +400,7 @@ export default class TagRenderingConfig { * @param tags * @constructor */ - public GetRenderValues(tags: any): { then: Translation, icon?: string, iconClass?: string }[] { + public GetRenderValues(tags: Record): { then: Translation, icon?: string, iconClass?: string }[] { if (!this.multiAnswer) { return [this.GetRenderValueWithImage(tags)] } @@ -410,7 +410,7 @@ export default class TagRenderingConfig { let freeformKeyDefined = this.freeform?.key !== undefined; let usedFreeformValues = new Set() // We run over all the mappings first, to check if the mapping matches - const applicableMappings: { then: TypedTranslation, img?: string }[] = Utils.NoNull((this.mappings ?? [])?.map(mapping => { + const applicableMappings: { then: TypedTranslation>, img?: string }[] = Utils.NoNull((this.mappings ?? [])?.map(mapping => { if (mapping.if === undefined) { return mapping; } diff --git a/assets/layers/rainbow_crossings/rainbow_crossings.json b/assets/layers/rainbow_crossings/rainbow_crossings.json index 9e8179c20..35c99d8d9 100644 --- a/assets/layers/rainbow_crossings/rainbow_crossings.json +++ b/assets/layers/rainbow_crossings/rainbow_crossings.json @@ -4,12 +4,11 @@ "en": "Crossings with rainbow paintings" }, "description": { - "en": "Crossings with decorative rainbow paintings" + "en": "A layer showing pedestrian crossings with rainbow paintings" }, "source": { - "osmTags": { + "osmTags": "highway=crossing" - } }, "minzoom": 17, "title": { @@ -35,9 +34,11 @@ "snapToLayer": "cycleways_and_roads", "maxSnapDistance": 25 } - }, + } + ], "tagRenderings": [ - { + "images", + { "id": "crossing-with-rainbow", "question": { "en": "Does this crossing has rainbow paintings?" @@ -48,13 +49,26 @@ "if": "crossing:marking=rainbow", "then": { "en": "This crossing has rainbow paintings" + }, + "icon": { + "path": "./assets/themes/rainbow_crossings/logo.svg", + "class": "medium" } }, + { + "if": "not:crossing:marking=rainbow", + "then": { + "en": "No rainbow paintings here" + }, + "icon": "./assets/themes/rainbow_crossings/crossing.svg" + }, { "if": "crossing:marking!=rainbow", "then": { "en": "No rainbow paintings here" - } + }, + "icon": "./assets/themes/rainbow_crossings/crossing.svg", + "hideInAnswer": true } ] } @@ -62,16 +76,17 @@ "mapRendering": [ { "icon": { - "render": "./assets/themes/rainbow_crossings/logo.svg" + "render": "./assets/themes/rainbow_crossings/crossing.svg", + "mappings": [{ + "if": "crossing:marking=rainbow", + "then": "./assets/themes/rainbow_crossings/logo.svg" + }] }, - "iconSize": "40,40,bottom", + "iconSize": "40,40,center", "location": [ "point", "centroid" ] } - ], - "description": { - "en": "A layer showing pedestrian crossings with rainbow paintings" - } + ] } diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index db1b9bd23..60452cb5b 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -279,6 +279,10 @@ "if": "theme=postboxes", "then": "./assets/themes/postboxes/postbox.svg" }, + { + "if": "theme=rainbow_crossings", + "then": "./assets/themes/rainbow_crossings/logo.svg" + }, { "if": "theme=shops", "then": "./assets/themes/shops/shop.svg" diff --git a/assets/themes/rainbow_crossings/crossing.svg b/assets/themes/rainbow_crossings/crossing.svg new file mode 100644 index 000000000..37304af0f --- /dev/null +++ b/assets/themes/rainbow_crossings/crossing.svg @@ -0,0 +1,66 @@ + + + + + + + + + diff --git a/assets/themes/rainbow_crossings/license_info.json b/assets/themes/rainbow_crossings/license_info.json index 1e701de22..ff2acdfd7 100644 --- a/assets/themes/rainbow_crossings/license_info.json +++ b/assets/themes/rainbow_crossings/license_info.json @@ -1,4 +1,12 @@ [ + { + "path": "crossing.svg", + "license": "CC0", + "authors": [ + "bxl-forever" + ], + "sources": [] + }, { "path": "logo.svg", "license": "CC0", @@ -7,4 +15,4 @@ ], "sources": [] } -] +] \ No newline at end of file diff --git a/assets/themes/rainbow_crossings/rainbow_crossings.json b/assets/themes/rainbow_crossings/rainbow_crossings.json index 84602a67f..d05e6c5f6 100644 --- a/assets/themes/rainbow_crossings/rainbow_crossings.json +++ b/assets/themes/rainbow_crossings/rainbow_crossings.json @@ -15,7 +15,28 @@ "startZoom": 16, "widenFactor": 2, "layers": [ - "rainbow_crossings" + "rainbow_crossings", + { + "builtin": "rainbow_crossings", + "override": { + "minzoom": 10, + "id": "rainbow_crossing_high_zoom", + "name": null, + "=presets": [], + "source": { + "osmTags": { + "and+": ["crossing:marking=rainbow"] + } + } + } + }, + { + "builtin": "cycleways_and_roads", + "override": { + "minzoom": 18, + "name": null + } + } ] } From 755d34c16082b107106e03c641169fef256d1554 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 12 Jul 2022 10:30:43 +0200 Subject: [PATCH 10/24] s/minZoom/minzoom/g --- assets/layers/doctors/doctors.json | 3 +++ assets/layers/street_lamps/street_lamps.json | 2 +- assets/themes/bicyclelib/bicyclelib.json | 2 +- assets/themes/onwheels/onwheels.json | 2 +- assets/themes/street_lighting/street_lighting.json | 4 ++-- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/assets/layers/doctors/doctors.json b/assets/layers/doctors/doctors.json index 236d13c54..8979e43c0 100644 --- a/assets/layers/doctors/doctors.json +++ b/assets/layers/doctors/doctors.json @@ -3,6 +3,9 @@ "name": { "en": "doctors" }, + "description": { + "en": "This layer shows doctor offices, dentists and other healthcare facilities" + }, "source": { "osmTags": { "or": [ diff --git a/assets/layers/street_lamps/street_lamps.json b/assets/layers/street_lamps/street_lamps.json index d30882903..bcb15754a 100644 --- a/assets/layers/street_lamps/street_lamps.json +++ b/assets/layers/street_lamps/street_lamps.json @@ -9,7 +9,7 @@ "source": { "osmTags": "highway=street_lamp" }, - "minZoom": 16, + "minzoom": 16, "title": { "render": { "en": "Street Lamp", diff --git a/assets/themes/bicyclelib/bicyclelib.json b/assets/themes/bicyclelib/bicyclelib.json index 4e1db4886..9d2723f84 100644 --- a/assets/themes/bicyclelib/bicyclelib.json +++ b/assets/themes/bicyclelib/bicyclelib.json @@ -38,7 +38,7 @@ { "builtin": "bicycle_library", "override": { - "minZoom": 0 + "minzoom": 0 } } ] diff --git a/assets/themes/onwheels/onwheels.json b/assets/themes/onwheels/onwheels.json index 822a75349..881729e71 100644 --- a/assets/themes/onwheels/onwheels.json +++ b/assets/themes/onwheels/onwheels.json @@ -30,7 +30,7 @@ "doctors" ], "overrideAll" : { - "minZoom" : "15", + "minzoom" : "15", "mapRendering" : [ { "label" : null diff --git a/assets/themes/street_lighting/street_lighting.json b/assets/themes/street_lighting/street_lighting.json index 00d4f79b9..770668204 100644 --- a/assets/themes/street_lighting/street_lighting.json +++ b/assets/themes/street_lighting/street_lighting.json @@ -51,7 +51,7 @@ ] } }, - "minZoom": 16, + "minzoom": 16, "title": { "render": { "en": "Lit street", @@ -171,7 +171,7 @@ ] } }, - "minZoom": 19, + "minzoom": 19, "title": { "render": { "en": "Street", From fbe11d4a908ecc768e9d60bd690dad4fdcee640d Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 12 Jul 2022 10:45:08 +0200 Subject: [PATCH 11/24] Fix reset:layeroverview, improve rainbow map --- assets/themes/rainbow_crossings/rainbow_crossings.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/themes/rainbow_crossings/rainbow_crossings.json b/assets/themes/rainbow_crossings/rainbow_crossings.json index d05e6c5f6..32fe470a3 100644 --- a/assets/themes/rainbow_crossings/rainbow_crossings.json +++ b/assets/themes/rainbow_crossings/rainbow_crossings.json @@ -15,7 +15,6 @@ "startZoom": 16, "widenFactor": 2, "layers": [ - "rainbow_crossings", { "builtin": "rainbow_crossings", "override": { @@ -30,6 +29,7 @@ } } }, + "rainbow_crossings", { "builtin": "cycleways_and_roads", "override": { diff --git a/package.json b/package.json index 1d97a1908..78485fa28 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "generate:schemas": "ts2json-schema -p Models/ThemeConfig/Json/ -o Docs/Schemas/ -t tsconfig.json -R . -m \".*ConfigJson\" && ts-node scripts/fixSchemas.ts ", "generate:service-worker": "tsc service-worker.ts && git_hash=$(git rev-parse HEAD) && sed -i \"s/GITHUB-COMMIT/$git_hash/\" service-worker.js", "optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'", - "reset:layeroverview": "echo {\\\"layers\\\":[], \\\"themes\\\":[]} > ./assets/generated/known_layers_and_themes.json && echo {\\\"layers\\\": []} > ./assets/generated/known_layers.json && rm ./asssets/generated/layers/* && rm ./assets/generated/themes/*", + "reset:layeroverview": "echo {\\\"layers\\\":[], \\\"themes\\\":[]} > ./assets/generated/known_layers_and_themes.json && echo {\\\"layers\\\": []} > ./assets/generated/known_layers.json && rm -f ./asssets/generated/layers/*.json && rm -f ./assets/generated/themes/*.json && npm run generate:layeroverview && ts-node scripts/generateLayerOverview.ts --force", "generate": "mkdir -p ./assets/generated; npm run reset:layeroverview; npm run generate:images; npm run generate:charging-stations; npm run generate:translations; npm run generate:licenses; npm run generate:layeroverview; npm run generate:service-worker", "generate:charging-stations": "cd ./assets/layers/charging_station && ts-node csvToJson.ts && cd -", "prepare-deploy": "npm run generate:service-worker && ./scripts/build.sh", From 19aab0358b256d80e5872da1857841ee3d7de0af Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 12 Jul 2022 14:20:21 +0200 Subject: [PATCH 12/24] Fix #947 --- manifest.webmanifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.webmanifest b/manifest.webmanifest index 1e577af78..5679708fc 100644 --- a/manifest.webmanifest +++ b/manifest.webmanifest @@ -1,5 +1,5 @@ { - "name": "index", + "name": "MapComplete", "short_name": "MapComplete", "start_url": "index.html", "lang": "en", From a7b0db24161cacdcd5293529c6ede1fe48f57e5f Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 12 Jul 2022 14:20:40 +0200 Subject: [PATCH 13/24] Fix build, formatting --- assets/themes/rainbow_crossings/crossing.svg | 2 ++ assets/themes/rainbow_crossings/logo.svg | 2 +- assets/themes/rainbow_crossings/rainbow_crossings.json | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/assets/themes/rainbow_crossings/crossing.svg b/assets/themes/rainbow_crossings/crossing.svg index 37304af0f..468f421dd 100644 --- a/assets/themes/rainbow_crossings/crossing.svg +++ b/assets/themes/rainbow_crossings/crossing.svg @@ -1,6 +1,8 @@ - + diff --git a/assets/themes/rainbow_crossings/rainbow_crossings.json b/assets/themes/rainbow_crossings/rainbow_crossings.json index 32fe470a3..1a63df6fc 100644 --- a/assets/themes/rainbow_crossings/rainbow_crossings.json +++ b/assets/themes/rainbow_crossings/rainbow_crossings.json @@ -24,7 +24,9 @@ "=presets": [], "source": { "osmTags": { - "and+": ["crossing:marking=rainbow"] + "and+": [ + "crossing:marking=rainbow" + ] } } } @@ -38,6 +40,4 @@ } } ] -} - - +} \ No newline at end of file From d50b60f07a1cd7de2ed09c0d06ea3b91df32e42b Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 12 Jul 2022 14:21:14 +0200 Subject: [PATCH 14/24] Fix caching behaviour of service worker --- service-worker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service-worker.ts b/service-worker.ts index 56e006a4e..d50009104 100644 --- a/service-worker.ts +++ b/service-worker.ts @@ -71,7 +71,7 @@ self.addEventListener('fetch', event.respondWith(new Response(JSON.stringify({"service-worker-version": version}))); return } - const shouldBeCached = origin.host === requestUrl.host && origin.host !== "127.0.0.1:1234" && origin.host !== "localhost" && !origin.host.endsWith(".gitpod.io") + const shouldBeCached = origin.host === requestUrl.host && origin.hostname !== "127.0.0.1" && origin.hostname !== "localhost" && !origin.host.endsWith(".gitpod.io") if (!shouldBeCached) { console.log("Not intercepting ", requestUrl.toString(), origin.host, requestUrl.host) // We return _without_ calling event.respondWith, which signals the browser that it'll have to handle it himself From 02711c43c3166d4835257ad09a4d22c441af5e0f Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 12 Jul 2022 14:22:14 +0200 Subject: [PATCH 15/24] Actually use awaits where appropriate --- scripts/generateLayouts.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/generateLayouts.ts b/scripts/generateLayouts.ts index 546d26350..1272117c5 100644 --- a/scripts/generateLayouts.ts +++ b/scripts/generateLayouts.ts @@ -165,7 +165,7 @@ async function createManifest(layout: LayoutConfig, alreadyWritten: string[]): P const ogDescr = Translations.T(layout.description ?? "").txt; const manifest = { - name: name, + name: ogTitle, short_name: ogTitle, start_url: `${layout.id.toLowerCase()}.html`, lang: "en", @@ -257,7 +257,7 @@ async function createLandingPage(layout: LayoutConfig, manifest, whiteIcons, alr .replace(/.*/s, themeSpecific) .replace(/.*/s, layout.shortDescription.textFor(targetLanguage)) .replace("", ``); - +0 try { output = output .replace(/.*/s, ``) @@ -320,10 +320,9 @@ async function main(): Promise { writeFile(manifestLocation, manif, err); // Create a landing page for the given theme - createLandingPage(layout, manifest, whiteIcons, alreadyWritten).then(landing => { - writeFile(enc(layout.id) + ".html", landing, err) - }); - createIndexFor(layout) + const landing = await createLandingPage(layout, manifest, whiteIcons, alreadyWritten) + writeFile(enc(layout.id) + ".html", landing, err) + await createIndexFor(layout) } From 1c5e9426aac14a847fcd116d47e538c28556a184 Mon Sep 17 00:00:00 2001 From: Robin van der Linde Date: Wed, 13 Jul 2022 11:01:08 +0200 Subject: [PATCH 16/24] Remove useless mapping --- assets/layers/parking/parking.json | 18 ------------------ langs/layers/en.json | 8 -------- langs/layers/nl.json | 8 -------- 3 files changed, 34 deletions(-) diff --git a/assets/layers/parking/parking.json b/assets/layers/parking/parking.json index 94cbd7d8a..4490ad695 100644 --- a/assets/layers/parking/parking.json +++ b/assets/layers/parking/parking.json @@ -153,24 +153,6 @@ "nl": "Aantal parkeerplaatsen" } }, - "mappings": [ - { - "if": "capacity=yes", - "then": { - "en": "There are parking spots, but it is not known how many", - "nl": "Er zijn parkeerplaatsen, maar het is niet bekend hoeveel er zijn" - }, - "hideInAnswer": true - }, - { - "if": "capacity=no", - "then": { - "en": "There are no parking spots", - "nl": "Er zijn geen parkeerplaatsen" - }, - "hideInAnswer": true - } - ], "question": { "en": "How many parking spots are there at this parking?", "nl": "Hoeveel parkeerplaatsen zijn er op deze parking?" diff --git a/langs/layers/en.json b/langs/layers/en.json index d175ca8b4..893237ebd 100644 --- a/langs/layers/en.json +++ b/langs/layers/en.json @@ -4626,14 +4626,6 @@ "freeform": { "placeholder": "Amount of parking spots" }, - "mappings": { - "0": { - "then": "There are parking spots, but it is not known how many" - }, - "1": { - "then": "There are no parking spots" - } - }, "question": "How many parking spots are there at this parking?", "render": "There are {{capacity}} parking spots" }, diff --git a/langs/layers/nl.json b/langs/layers/nl.json index f46d4b970..66ad00a5d 100644 --- a/langs/layers/nl.json +++ b/langs/layers/nl.json @@ -4510,14 +4510,6 @@ "freeform": { "placeholder": "Aantal parkeerplaatsen" }, - "mappings": { - "0": { - "then": "Er zijn parkeerplaatsen, maar het is niet bekend hoeveel er zijn" - }, - "1": { - "then": "Er zijn geen parkeerplaatsen" - } - }, "question": "Hoeveel parkeerplaatsen zijn er op deze parking?", "render": "Er zijn {{capacity}} parkeerplaatsen" }, From ab7b6d9d469d8100e775452417f3ee650b9643ab Mon Sep 17 00:00:00 2001 From: Robin van der Linde Date: Wed, 13 Jul 2022 11:06:43 +0200 Subject: [PATCH 17/24] Generate translations --- assets/layers/doctors/doctors.json | 286 +++++++++--------- assets/layers/kerbs/kerbs.json | 6 +- .../rainbow_crossings/rainbow_crossings.json | 17 +- .../mapcomplete-changes.json | 42 ++- assets/themes/onwheels/onwheels.json | 12 +- langs/layers/de.json | 2 +- langs/layers/en.json | 34 +++ langs/themes/en.json | 8 + 8 files changed, 232 insertions(+), 175 deletions(-) diff --git a/assets/layers/doctors/doctors.json b/assets/layers/doctors/doctors.json index 8979e43c0..eefedaf8d 100644 --- a/assets/layers/doctors/doctors.json +++ b/assets/layers/doctors/doctors.json @@ -1,147 +1,147 @@ { - "id": "doctors", - "name": { - "en": "doctors" + "id": "doctors", + "name": { + "en": "doctors" + }, + "description": { + "en": "This layer shows doctor offices, dentists and other healthcare facilities" + }, + "source": { + "osmTags": { + "or": [ + "amenity=doctors", + "amenity=dentist", + "healthcare=physiotherapist" + ] + } + }, + "title": { + "render": { + "en": "Doctors Office {name}" }, - "description": { - "en": "This layer shows doctor offices, dentists and other healthcare facilities" - }, - "source": { - "osmTags": { - "or": [ - "amenity=doctors", - "amenity=dentist", - "healthcare=physiotherapist" - ] - } - }, - "title": { - "render": { - "en": "Doctors Office {name}" - }, - "mappings": [ - { - "if": "amenity=doctors", - "then": "Doctors Office {name}" - }, - { - "if": "amenity=dentist", - "then": "Dentists office {name}" - }, - { - "if": "healthcare=physiotherapist", - "then": "Physiotherapists office {name}" - } - ] - }, - "minzoom": 13, - "tagRenderings": [ - "images", - "opening_hours", - "phone", - "email", - "website", - { - "question": { - "en": "What is the name of this doctors place?" - }, - "render": { - "en": "This doctors place is called {name}" - }, - "freeform": { - "key": "name" - }, - "id": "name" - }, - { - "condition": "amenity=doctors", - "id": "specialty", - "render": { - "en": "This doctor is specialized in {healthcare:speciality}" - }, - "question": { - "en": "What is this doctor specialized in?" - }, - "freeform": { - "key": "healthcare:speciality" - }, - "mappings": [ - { - "if": "healthcare:speciality=general", - "then": { - "en": "This is a general practitioner" - } - }, - { - "if": "healthcare:speciality=gynaecology", - "then": { - "en": "This is a gynaecologist" - } - }, - { - "if": "healthcare:speciality=psychiatry", - "then": { - "en": "This is a psychiatrist" - } - }, - { - "if": "healthcare:speciality=paediatrics", - "then": { - "en": "This is a paediatrician" - } - } - ] - } - ], - "presets": [ - { - "title": { - "en": "a doctors office" - }, - "tags": [ - "amenity=doctors" - ] - }, - { - "title": { - "en": "a dentists office" - }, - "tags": [ - "amenity=dentist" - ] - }, - { - "title": { - "en": "a physiotherapists office" - }, - "tags": [ - "healthcare=physiotherapist" - ] - } - ], - "filter": [ - { - "id": "opened-now", - "options": [ - { - "question": { - "en": "Opened now" - }, - "osmTags": "_isOpen=yes" - } - ] - } - ], - "mapRendering": [ - { - "icon": { - "render": "circle:white;./assets/layers/doctors/doctors.svg" - }, - "iconSize": "40,40,center", - "location": [ - "point", - "centroid" - ] - } + "mappings": [ + { + "if": "amenity=doctors", + "then": "Doctors Office {name}" + }, + { + "if": "amenity=dentist", + "then": "Dentists office {name}" + }, + { + "if": "healthcare=physiotherapist", + "then": "Physiotherapists office {name}" + } ] + }, + "minzoom": 13, + "tagRenderings": [ + "images", + "opening_hours", + "phone", + "email", + "website", + { + "question": { + "en": "What is the name of this doctors place?" + }, + "render": { + "en": "This doctors place is called {name}" + }, + "freeform": { + "key": "name" + }, + "id": "name" + }, + { + "condition": "amenity=doctors", + "id": "specialty", + "render": { + "en": "This doctor is specialized in {healthcare:speciality}" + }, + "question": { + "en": "What is this doctor specialized in?" + }, + "freeform": { + "key": "healthcare:speciality" + }, + "mappings": [ + { + "if": "healthcare:speciality=general", + "then": { + "en": "This is a general practitioner" + } + }, + { + "if": "healthcare:speciality=gynaecology", + "then": { + "en": "This is a gynaecologist" + } + }, + { + "if": "healthcare:speciality=psychiatry", + "then": { + "en": "This is a psychiatrist" + } + }, + { + "if": "healthcare:speciality=paediatrics", + "then": { + "en": "This is a paediatrician" + } + } + ] + } + ], + "presets": [ + { + "title": { + "en": "a doctors office" + }, + "tags": [ + "amenity=doctors" + ] + }, + { + "title": { + "en": "a dentists office" + }, + "tags": [ + "amenity=dentist" + ] + }, + { + "title": { + "en": "a physiotherapists office" + }, + "tags": [ + "healthcare=physiotherapist" + ] + } + ], + "filter": [ + { + "id": "opened-now", + "options": [ + { + "question": { + "en": "Opened now" + }, + "osmTags": "_isOpen=yes" + } + ] + } + ], + "mapRendering": [ + { + "icon": { + "render": "circle:white;./assets/layers/doctors/doctors.svg" + }, + "iconSize": "40,40,center", + "location": [ + "point", + "centroid" + ] + } + ] } \ No newline at end of file diff --git a/assets/layers/kerbs/kerbs.json b/assets/layers/kerbs/kerbs.json index af185c4d4..ad441c8ec 100644 --- a/assets/layers/kerbs/kerbs.json +++ b/assets/layers/kerbs/kerbs.json @@ -164,9 +164,9 @@ "de": "Wie hoch ist der Bordstein?" }, "render": { - "en": "Kerb height: {{kerb:height}}", - "nl": "Stoeprandhoogte: {{kerb:height}}", - "de": "Bordsteinhöhe: {{kerb:height}}" + "en": "Kerb height: {kerb:height}", + "nl": "Stoeprandhoogte: {kerb:height}", + "de": "Bordsteinhöhe: {kerb:height}" }, "freeform": { "key": "kerb:height", diff --git a/assets/layers/rainbow_crossings/rainbow_crossings.json b/assets/layers/rainbow_crossings/rainbow_crossings.json index 35c99d8d9..d13fe3c03 100644 --- a/assets/layers/rainbow_crossings/rainbow_crossings.json +++ b/assets/layers/rainbow_crossings/rainbow_crossings.json @@ -7,8 +7,7 @@ "en": "A layer showing pedestrian crossings with rainbow paintings" }, "source": { - "osmTags": - "highway=crossing" + "osmTags": "highway=crossing" }, "minzoom": 17, "title": { @@ -38,7 +37,7 @@ ], "tagRenderings": [ "images", - { + { "id": "crossing-with-rainbow", "question": { "en": "Does this crossing has rainbow paintings?" @@ -77,10 +76,12 @@ { "icon": { "render": "./assets/themes/rainbow_crossings/crossing.svg", - "mappings": [{ - "if": "crossing:marking=rainbow", - "then": "./assets/themes/rainbow_crossings/logo.svg" - }] + "mappings": [ + { + "if": "crossing:marking=rainbow", + "then": "./assets/themes/rainbow_crossings/logo.svg" + } + ] }, "iconSize": "40,40,center", "location": [ @@ -89,4 +90,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index 4e43dc406..ab3cce9cd 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -2,15 +2,18 @@ "id": "mapcomplete-changes", "title": { "en": "Changes made with MapComplete", - "nl": "Wijzigingen gemaakt met MapComplete" + "nl": "Wijzigingen gemaakt met MapComplete", + "de": "Mit MapComplete vorgenommene Änderungen" }, "shortDescription": { "en": "Shows changes made by MapComplete", - "nl": "Toont wijzigingen gemaakt met MapComplete" + "nl": "Toont wijzigingen gemaakt met MapComplete", + "de": "Zeigt die mit MapComplete vorgenommenen Änderungen" }, "description": { "en": "This maps shows all the changes made with MapComplete", - "nl": "Deze kaart toont alle wijzigingen die met MapComplete werden gemaakt" + "nl": "Deze kaart toont alle wijzigingen die met MapComplete werden gemaakt", + "de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen" }, "maintainer": "", "icon": "./assets/svg/logo.svg", @@ -25,7 +28,8 @@ { "id": "mapcomplete-changes", "name": { - "en": "Changeset centers" + "en": "Changeset centers", + "de": "Zentrum der Änderungssätze" }, "minzoom": 0, "source": { @@ -40,40 +44,46 @@ "title": { "render": { "en": "Changeset for {theme}", - "nl": "Wijzigingset voor {theme}" + "nl": "Wijzigingset voor {theme}", + "de": "Änderungssatz für {theme}" } }, "description": { "en": "Shows all MapComplete changes", - "nl": "Toont alle wijzigingen met MapComplete" + "nl": "Toont alle wijzigingen met MapComplete", + "de": "Zeigt alle MapComplete Änderungen" }, "tagRenderings": [ { "id": "render_id", "render": { "en": "Changeset {id}", - "nl": "Wijzigingset {id}" + "nl": "Wijzigingset {id}", + "de": "Änderungssatz {id}" } }, { "id": "contributor", "render": { "en": "Change made by {_last_edit:contributor}", - "nl": "Wijziging gemaakt door {_last_edit:contributor}" + "nl": "Wijziging gemaakt door {_last_edit:contributor}", + "de": "Geändert von {_last_edit:contributor}" } }, { "id": "theme", "render": { "en": "Change with theme {theme}", - "nl": "Wijziging met thema {theme}" + "nl": "Wijziging met thema {theme}", + "de": "Änderung mit Thema {theme}" }, "mappings": [ { "if": "theme~http.*", "then": { "en": "Change with unofficial theme {theme}", - "nl": "Wijziging met officieus thema {theme}" + "nl": "Wijziging met officieus thema {theme}", + "de": "Änderung mit inoffiziellem Thema {theme}" } } ] @@ -370,7 +380,8 @@ ], "question": { "en": "Themename contains {search}", - "nl": "Themanaam bevat {search}" + "nl": "Themanaam bevat {search}", + "de": "Themenname enthält {search}" } } ] @@ -387,7 +398,8 @@ ], "question": { "en": "Made by contributor {search}", - "nl": "Gemaakt door bijdrager {search}" + "nl": "Gemaakt door bijdrager {search}", + "de": "Erstellt von {search}" } } ] @@ -404,7 +416,8 @@ ], "question": { "en": "Not made by contributor {search}", - "nl": "Niet gemaakt door bijdrager {search}" + "nl": "Niet gemaakt door bijdrager {search}", + "de": "Nicht erstellt von {search}" } } ] @@ -420,7 +433,8 @@ "id": "link_to_more", "render": { "en": "More statistics can be found here", - "nl": "Meer statistieken kunnen hier gevonden worden" + "nl": "Meer statistieken kunnen hier gevonden worden", + "de": "Weitere Statistiken finden Sie hier" } }, { diff --git a/assets/themes/onwheels/onwheels.json b/assets/themes/onwheels/onwheels.json index 881729e71..920ce1e1c 100644 --- a/assets/themes/onwheels/onwheels.json +++ b/assets/themes/onwheels/onwheels.json @@ -1,10 +1,10 @@ { "id": "onwheels", "title": { - "en": "OnWheels" + "en": "OnWheels" }, "description": { - "en": "On this map, publicly weelchair accessible places are shown and can be easily added" + "en": "On this map, publicly weelchair accessible places are shown and can be easily added" }, "maintainer": "MapComplete", "icon": "./assets/themes/onwheels/crest.svg", @@ -29,11 +29,11 @@ "viewpoint", "doctors" ], - "overrideAll" : { - "minzoom" : "15", - "mapRendering" : [ + "overrideAll": { + "minzoom": "15", + "mapRendering": [ { - "label" : null + "label": null } ] } diff --git a/langs/layers/de.json b/langs/layers/de.json index 2d686ca62..bfe2f47f8 100644 --- a/langs/layers/de.json +++ b/langs/layers/de.json @@ -4122,7 +4122,7 @@ "placeholder": "Höhe des Bordsteins" }, "question": "Wie hoch ist der Bordstein?", - "render": "Bordsteinhöhe: {{kerb:height}}" + "render": "Bordsteinhöhe: {kerb:height}" }, "kerb-type": { "mappings": { diff --git a/langs/layers/en.json b/langs/layers/en.json index 3b3642a7f..3e51d47e2 100644 --- a/langs/layers/en.json +++ b/langs/layers/en.json @@ -3256,6 +3256,7 @@ "name": "Direction visualization" }, "doctors": { + "description": "This layer shows doctor offices, dentists and other healthcare facilities", "filter": { "0": { "options": { @@ -3278,6 +3279,10 @@ } }, "tagRenderings": { + "name": { + "question": "What is the name of this doctors place?", + "render": "This doctors place is called {name}" + }, "specialty": { "mappings": { "0": { @@ -5049,6 +5054,35 @@ "render": "Bookcase" } }, + "rainbow_crossings": { + "description": "A layer showing pedestrian crossings with rainbow paintings", + "name": "Crossings with rainbow paintings", + "presets": { + "0": { + "description": "Pedestrian crossing", + "title": "a crossing" + } + }, + "tagRenderings": { + "crossing-with-rainbow": { + "mappings": { + "0": { + "then": "This crossing has rainbow paintings" + }, + "1": { + "then": "No rainbow paintings here" + }, + "2": { + "then": "No rainbow paintings here" + } + }, + "question": "Does this crossing has rainbow paintings?" + } + }, + "title": { + "render": "Crossing" + } + }, "recycling": { "description": "A layer with recycling containers and centres", "filter": { diff --git a/langs/themes/en.json b/langs/themes/en.json index b3e3d3a17..5dd1e80ae 100644 --- a/langs/themes/en.json +++ b/langs/themes/en.json @@ -741,6 +741,10 @@ "shortDescription": "Publicly accessible towers to enjoy the view", "title": "Observation towers" }, + "onwheels": { + "description": "On this map, publicly weelchair accessible places are shown and can be easily added", + "title": "OnWheels" + }, "openwindpowermap": { "description": "A map for showing and editing wind turbines.", "title": "OpenWindPowerMap" @@ -863,6 +867,10 @@ "shortDescription": "A map showing postboxes and post offices", "title": "Postbox and Post Office Map" }, + "rainbow_crossings": { + "description": "On this map, rainbow-painted pedestrian crossings are shown and can be easily added", + "title": "Rainbow pedestrian crossings" + }, "shops": { "description": "On this map, one can mark basic information about shops, add opening hours and phone numbers", "shortDescription": "An editable map with basic shop information", From cee384931e31636c7504134cede20cf3f62be16b Mon Sep 17 00:00:00 2001 From: Robin van der Linde Date: Wed, 13 Jul 2022 12:33:09 +0200 Subject: [PATCH 18/24] Update .gitpod.yml --- .gitpod.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index d53368529..d7253fb46 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -10,5 +10,5 @@ ports: vscode: extensions: - "esbenp.prettier-vscode" - - "eamodio.gitlens", - - "GitHub.vscode-pull-request-github" \ No newline at end of file + - "eamodio.gitlens" + - "GitHub.vscode-pull-request-github" From ac1e9608b30703ec5113406a149af40a7725d443 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 13 Jul 2022 12:48:46 +0200 Subject: [PATCH 19/24] Fix typo --- langs/layers/nl.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/langs/layers/nl.json b/langs/layers/nl.json index 987941506..cfba0ceeb 100644 --- a/langs/layers/nl.json +++ b/langs/layers/nl.json @@ -4556,7 +4556,7 @@ } }, "question": "Hoeveel parkeerplaatsen voor gehandicapten zijn er op deze parking?", - "render": "Er zijn capacity:disabled} parkeerplaatsen voor gehandicapten" + "render": "Er zijn {capacity:disabled} parkeerplaatsen voor gehandicapten" }, "parking-type": { "mappings": { @@ -6493,4 +6493,4 @@ } } } -} \ No newline at end of file +} From 24f090c92f7a370799513f8370079deda429938e Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 13 Jul 2022 17:56:10 +0200 Subject: [PATCH 20/24] Add OsmFeature type --- Logic/Actors/GeoLocationHandler.ts | 2 +- Logic/FeatureSource/FeaturePipeline.ts | 19 ++++++++++++++----- Logic/FeatureSource/FeatureSource.ts | 13 +++---------- .../TiledFeatureSource/TileHierarchy.ts | 2 +- Logic/GeoOperations.ts | 4 ++-- Logic/Osm/Changes.ts | 2 +- Models/OsmFeature.ts | 4 ++++ 7 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 Models/OsmFeature.ts diff --git a/Logic/Actors/GeoLocationHandler.ts b/Logic/Actors/GeoLocationHandler.ts index f000095d8..c7ca5ae56 100644 --- a/Logic/Actors/GeoLocationHandler.ts +++ b/Logic/Actors/GeoLocationHandler.ts @@ -8,7 +8,7 @@ import {BBox} from "../BBox"; import Constants from "../../Models/Constants"; import SimpleFeatureSource from "../FeatureSource/Sources/SimpleFeatureSource"; -export interface GeoLocationPointProperties { +export interface GeoLocationPointProperties { id: "gps", "user:location": "yes", "date": string, diff --git a/Logic/FeatureSource/FeaturePipeline.ts b/Logic/FeatureSource/FeaturePipeline.ts index ce1c28198..92c3c9999 100644 --- a/Logic/FeatureSource/FeaturePipeline.ts +++ b/Logic/FeatureSource/FeaturePipeline.ts @@ -24,6 +24,7 @@ import FullNodeDatabaseSource from "./TiledFeatureSource/FullNodeDatabaseSource" import MapState from "../State/MapState"; import {ElementStorage} from "../ElementStorage"; import {Feature, Geometry} from "@turf/turf"; +import {OsmFeature} from "../../Models/OsmFeature"; /** @@ -338,15 +339,19 @@ export default class FeaturePipeline { } - public GetAllFeaturesWithin(bbox: BBox): Feature[][] { + public GetAllFeaturesWithin(bbox: BBox): OsmFeature[][] { const self = this - const tiles = [] + const tiles: OsmFeature[][] = [] Array.from(this.perLayerHierarchy.keys()) - .forEach(key => tiles.push(...self.GetFeaturesWithin(key, bbox))) + .forEach(key => { + const fetched : OsmFeature[][] = self.GetFeaturesWithin(key, bbox) + tiles.push(...fetched); + }) return tiles; } - public GetAllFeaturesAndMetaWithin(bbox: BBox, layerIdWhitelist?: Set): {features: any[], layer: string}[] { + public GetAllFeaturesAndMetaWithin(bbox: BBox, layerIdWhitelist?: Set): + {features: OsmFeature[], layer: string}[] { const self = this const tiles :{features: any[], layer: string}[]= [] Array.from(this.perLayerHierarchy.keys()) @@ -362,7 +367,11 @@ export default class FeaturePipeline { return tiles; } - public GetFeaturesWithin(layerId: string, bbox: BBox): any[][] { + /** + * Gets all the tiles which overlap with the given BBOX. + * This might imply that extra features might be shown + */ + public GetFeaturesWithin(layerId: string, bbox: BBox): OsmFeature[][] { if (layerId === "*") { return this.GetAllFeaturesWithin(bbox) } diff --git a/Logic/FeatureSource/FeatureSource.ts b/Logic/FeatureSource/FeatureSource.ts index a686377fc..f28d2cde9 100644 --- a/Logic/FeatureSource/FeatureSource.ts +++ b/Logic/FeatureSource/FeatureSource.ts @@ -1,9 +1,11 @@ import {Store, UIEventSource} from "../UIEventSource"; import FilteredLayer from "../../Models/FilteredLayer"; import {BBox} from "../BBox"; +import {Feature, Geometry} from "@turf/turf"; +import {OsmFeature} from "../../Models/OsmFeature"; export default interface FeatureSource { - features: Store<{ feature: any, freshness: Date }[]>; + features: Store<{ feature: OsmFeature, freshness: Date }[]>; /** * Mainly used for debuging */ @@ -28,12 +30,3 @@ export interface FeatureSourceForLayer extends FeatureSource { export interface IndexedFeatureSource extends FeatureSource { readonly containedIds: Store> } - -/** - * A feature source which has some extra data about it's state - */ -export interface FeatureSourceState { - readonly sufficientlyZoomed: Store; - readonly runningQuery: Store; - readonly timeout: Store; -} diff --git a/Logic/FeatureSource/TiledFeatureSource/TileHierarchy.ts b/Logic/FeatureSource/TiledFeatureSource/TileHierarchy.ts index f2e43069d..cd6b3dda7 100644 --- a/Logic/FeatureSource/TiledFeatureSource/TileHierarchy.ts +++ b/Logic/FeatureSource/TiledFeatureSource/TileHierarchy.ts @@ -13,7 +13,7 @@ export default interface TileHierarchy { export class TileHierarchyTools { public static getTiles(hierarchy: TileHierarchy, bbox: BBox): T[] { - const result = [] + const result: T[] = [] hierarchy.loadedTiles.forEach((tile) => { if (tile.bbox.overlapsWith(bbox)) { result.push(tile) diff --git a/Logic/GeoOperations.ts b/Logic/GeoOperations.ts index 240312a9b..e758d5546 100644 --- a/Logic/GeoOperations.ts +++ b/Logic/GeoOperations.ts @@ -3,7 +3,7 @@ import {BBox} from "./BBox"; import togpx from "togpx" import Constants from "../Models/Constants"; import LayerConfig from "../Models/ThemeConfig/LayerConfig"; -import {booleanWithin, Coord, Feature, Geometry, MultiPolygon, Polygon, Properties} from "@turf/turf"; +import {AllGeoJSON, booleanWithin, Coord, Feature, Geometry, MultiPolygon, Polygon, Properties} from "@turf/turf"; export class GeoOperations { @@ -29,7 +29,7 @@ export class GeoOperations { * Returns [lon,lat] coordinates * @param feature */ - static centerpointCoordinates(feature: any): [number, number] { + static centerpointCoordinates(feature: AllGeoJSON): [number, number] { return <[number, number]>turf.center(feature).geometry.coordinates; } diff --git a/Logic/Osm/Changes.ts b/Logic/Osm/Changes.ts index 0b887bdf7..ff0cde50b 100644 --- a/Logic/Osm/Changes.ts +++ b/Logic/Osm/Changes.ts @@ -159,7 +159,7 @@ export class Changes { const recentLocationPoints = locations.map(ff => ff.feature) .filter(feat => feat.geometry.type === "Point") .filter(feat => { - const visitTime = new Date((feat.properties).date) + const visitTime = new Date((feat.properties).date) // In seconds const diff = (now.getTime() - visitTime.getTime()) / 1000 return diff < Constants.nearbyVisitTime; diff --git a/Models/OsmFeature.ts b/Models/OsmFeature.ts new file mode 100644 index 000000000..4753287ca --- /dev/null +++ b/Models/OsmFeature.ts @@ -0,0 +1,4 @@ +import {Feature, Geometry} from "@turf/turf"; + +export type OsmTags = Record & {id: string} +export type OsmFeature = Feature \ No newline at end of file From 584594e31940a4c968da35419f81c76a90e8f077 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 13 Jul 2022 17:58:23 +0200 Subject: [PATCH 21/24] Add some dependencies that need to be installed --- Docs/Development_deployment.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Docs/Development_deployment.md b/Docs/Development_deployment.md index ab29c60d3..ed18b9625 100644 --- a/Docs/Development_deployment.md +++ b/Docs/Development_deployment.md @@ -72,6 +72,12 @@ To use the WSL in Visual Studio Code: or `userlayout=true#` as [Query parameter](URL_Parameters.md). Note that the shorter URLs ( e.g. `bookcases.html`, `aed.html`, ...) _don't_ exist on the development version. +### Dependencie + +`make` , `python3` `g++` + +(run `nix-env -iA nixos.gnumake nixos.gdc nixos.python3`) + Automatic deployment -------------------- From f805178b9b4469d7b99ddcbcaf4988edbc1934c1 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 13 Jul 2022 17:59:10 +0200 Subject: [PATCH 22/24] Update libphonenumber --- package-lock.json | 188 ++-------------------------------------------- package.json | 2 +- 2 files changed, 8 insertions(+), 182 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4558b57eb..a7c3cdf0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "leaflet-providers": "^1.13.0", "leaflet-simple-map-screenshoter": "^0.4.4", "libphonenumber": "^0.0.9", - "libphonenumber-js": "^1.7.55", + "libphonenumber-js": "^1.10.8", "lz-string": "^1.4.4", "mangrove-reviews": "^0.1.3", "moment": "^2.29.2", @@ -54,7 +54,6 @@ "papaparse": "^5.3.1", "parcel": "^1.2.4", "prompt-sync": "^4.2.0", - "svg-resizer": "github:vieron/svg-resizer", "tailwindcss": "^2.2.15", "togpx": "^0.5.4", "tslint": "^6.1.3", @@ -4772,14 +4771,6 @@ "simple-swizzle": "^0.2.2" } }, - "node_modules/colors": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.5.1.tgz", - "integrity": "sha1-fQAj6usVTo7p/Oddy5I9DtFmd3Q=", - "engines": { - "node": ">=0.1.90" - } - }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -7024,36 +7015,6 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true }, - "node_modules/fs-extra": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.8.1.tgz", - "integrity": "sha1-Dld5/7/t9RG8dVWVx/A8BtS0Po0=", - "dependencies": { - "jsonfile": "~1.1.0", - "mkdirp": "0.3.x", - "ncp": "~0.4.2", - "rimraf": "~2.2.0" - } - }, - "node_modules/fs-extra/node_modules/jsonfile": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-1.1.1.tgz", - "integrity": "sha1-2k/WrXfxolUgPqY8e8Mtwx72RDM=" - }, - "node_modules/fs-extra/node_modules/mkdirp": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz", - "integrity": "sha1-3j5fiWHIjHh+4TaN+EmsRBPsqNc=", - "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)" - }, - "node_modules/fs-extra/node_modules/rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", - "bin": { - "rimraf": "bin.js" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -9177,9 +9138,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.9.17", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.9.17.tgz", - "integrity": "sha512-ElJki901OynMg1l+evooPH1VyHrECuLqpgc12z2BkK25dFU5lUKTuMHEYV2jXxvtns/PIuJax56cBeoSK7ANow==" + "version": "1.10.8", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.8.tgz", + "integrity": "sha512-MGgHrKRGE7sg7y0DikHybRDgTXcYv4HL+WwhDm5UAiChCNb5tcy5OEaU8XTTt5bDBwhZGCJNxoGMVBpZ4RfhIg==" }, "node_modules/lilconfig": { "version": "2.0.3", @@ -9947,14 +9908,6 @@ "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", "dev": true }, - "node_modules/ncp": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/ncp/-/ncp-0.4.2.tgz", - "integrity": "sha1-q8xsvT7C7Spyn/bnwfqPAXhKhXQ=", - "bin": { - "ncp": "bin/ncp" - } - }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -10076,21 +10029,6 @@ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.76.tgz", "integrity": "sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA==" }, - "node_modules/nomnom": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.6.2.tgz", - "integrity": "sha1-hKZqJgF0QI/Ft3oY+IjszET7aXE=", - "deprecated": "Package no longer supported. Contact support@npmjs.com for more info.", - "dependencies": { - "colors": "0.5.x", - "underscore": "~1.4.4" - } - }, - "node_modules/nomnom/node_modules/underscore": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz", - "integrity": "sha1-YaajIBBiKvoHljvzJSA88SI51gQ=" - }, "node_modules/normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -13582,17 +13520,6 @@ "node": ">=0.10.0" } }, - "node_modules/shelljs": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.2.6.tgz", - "integrity": "sha1-kEktcv/MgVmXa6umL7D2iE8MM3g=", - "bin": { - "shjs": "bin/shjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -14314,30 +14241,6 @@ "node": ">=6.9.5" } }, - "node_modules/svg-resizer": { - "version": "0.0.1", - "resolved": "git+ssh://git@github.com/vieron/svg-resizer.git#00968cb3e7248533ab9451ce7dffa8af288e4f4a", - "license": "MIT", - "dependencies": { - "fs-extra": "~0.8.1", - "lodash": "~2.4.1", - "nomnom": "~1.6.2", - "shelljs": "~0.2.6", - "xml2js": "~0.4.2" - }, - "bin": { - "svg-resizer": "svg-resizer.js" - } - }, - "node_modules/svg-resizer/node_modules/lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "engines": [ - "node", - "rhino" - ] - }, "node_modules/svgo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/svgo/-/svgo-1.3.2.tgz", @@ -20595,11 +20498,6 @@ "simple-swizzle": "^0.2.2" } }, - "colors": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.5.1.tgz", - "integrity": "sha1-fQAj6usVTo7p/Oddy5I9DtFmd3Q=" - }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -22391,34 +22289,6 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true }, - "fs-extra": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.8.1.tgz", - "integrity": "sha1-Dld5/7/t9RG8dVWVx/A8BtS0Po0=", - "requires": { - "jsonfile": "~1.1.0", - "mkdirp": "0.3.x", - "ncp": "~0.4.2", - "rimraf": "~2.2.0" - }, - "dependencies": { - "jsonfile": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-1.1.1.tgz", - "integrity": "sha1-2k/WrXfxolUgPqY8e8Mtwx72RDM=" - }, - "mkdirp": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz", - "integrity": "sha1-3j5fiWHIjHh+4TaN+EmsRBPsqNc=" - }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=" - } - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -24042,9 +23912,9 @@ } }, "libphonenumber-js": { - "version": "1.9.17", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.9.17.tgz", - "integrity": "sha512-ElJki901OynMg1l+evooPH1VyHrECuLqpgc12z2BkK25dFU5lUKTuMHEYV2jXxvtns/PIuJax56cBeoSK7ANow==" + "version": "1.10.8", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.8.tgz", + "integrity": "sha512-MGgHrKRGE7sg7y0DikHybRDgTXcYv4HL+WwhDm5UAiChCNb5tcy5OEaU8XTTt5bDBwhZGCJNxoGMVBpZ4RfhIg==" }, "lilconfig": { "version": "2.0.3", @@ -24635,11 +24505,6 @@ "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", "dev": true }, - "ncp": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/ncp/-/ncp-0.4.2.tgz", - "integrity": "sha1-q8xsvT7C7Spyn/bnwfqPAXhKhXQ=" - }, "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -24755,22 +24620,6 @@ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.76.tgz", "integrity": "sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA==" }, - "nomnom": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.6.2.tgz", - "integrity": "sha1-hKZqJgF0QI/Ft3oY+IjszET7aXE=", - "requires": { - "colors": "0.5.x", - "underscore": "~1.4.4" - }, - "dependencies": { - "underscore": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz", - "integrity": "sha1-YaajIBBiKvoHljvzJSA88SI51gQ=" - } - } - }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -27471,11 +27320,6 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, - "shelljs": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.2.6.tgz", - "integrity": "sha1-kEktcv/MgVmXa6umL7D2iE8MM3g=" - }, "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -28038,24 +27882,6 @@ "integrity": "sha512-TAAvLNSE3fEhyl/Da19JWfMAdhSXTYeviXsLSoDT1UM76ADj5ndwAPX1FKQEgB/gFMPavOy6tOqfalXKUiXrow==", "optional": true }, - "svg-resizer": { - "version": "git+ssh://git@github.com/vieron/svg-resizer.git#00968cb3e7248533ab9451ce7dffa8af288e4f4a", - "from": "svg-resizer@github:vieron/svg-resizer", - "requires": { - "fs-extra": "~0.8.1", - "lodash": "~2.4.1", - "nomnom": "~1.6.2", - "shelljs": "~0.2.6", - "xml2js": "~0.4.2" - }, - "dependencies": { - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - } - } - }, "svgo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/svgo/-/svgo-1.3.2.tgz", diff --git a/package.json b/package.json index 78485fa28..6d91d1aa2 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "leaflet-providers": "^1.13.0", "leaflet-simple-map-screenshoter": "^0.4.4", "libphonenumber": "^0.0.9", - "libphonenumber-js": "^1.7.55", + "libphonenumber-js": "^1.10.8", "lz-string": "^1.4.4", "mangrove-reviews": "^0.1.3", "moment": "^2.29.2", From 9327d96550391113f2b648ba2604c50acd738ac4 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 13 Jul 2022 23:05:50 +0200 Subject: [PATCH 23/24] Fix ability to add a freeform tag when using the searchableMappings element, add test --- Logic/Tags/Tag.ts | 2 +- Models/ThemeConfig/TagRenderingConfig.ts | 2 +- UI/Input/SearchableMappingsSelector.ts | 16 ++- UI/Popup/TagRenderingQuestion.ts | 108 ++++++++++++++---- assets/layers/parking/parking.json | 2 +- .../mapcomplete-changes.json | 55 +++------ langs/layers/nl.json | 2 +- 7 files changed, 115 insertions(+), 72 deletions(-) diff --git a/Logic/Tags/Tag.ts b/Logic/Tags/Tag.ts index 92f470b4f..803b79390 100644 --- a/Logic/Tags/Tag.ts +++ b/Logic/Tags/Tag.ts @@ -13,7 +13,7 @@ export class Tag extends TagsFilter { throw "Invalid key: undefined or empty"; } if (value === undefined) { - throw "Invalid value: value is undefined"; + throw `Invalid value while constructing a Tag with key '${key}': value is undefined`; } if (value === "*") { console.warn(`Got suspicious tag ${key}=* ; did you mean ${key}~* ?`) diff --git a/Models/ThemeConfig/TagRenderingConfig.ts b/Models/ThemeConfig/TagRenderingConfig.ts index 656d880de..0328a9106 100644 --- a/Models/ThemeConfig/TagRenderingConfig.ts +++ b/Models/ThemeConfig/TagRenderingConfig.ts @@ -20,7 +20,7 @@ export interface Mapping { readonly ifnot?: TagsFilter, readonly then: TypedTranslation, readonly icon: string, - readonly iconClass: string + readonly iconClass: string | "small" | "medium" | "large" | "small-height" | "medium-height" | "large-height", readonly hideInAnswer: boolean | TagsFilter readonly addExtraTags: Tag[], readonly searchTerms?: Record diff --git a/UI/Input/SearchableMappingsSelector.ts b/UI/Input/SearchableMappingsSelector.ts index 191230ece..8a414a879 100644 --- a/UI/Input/SearchableMappingsSelector.ts +++ b/UI/Input/SearchableMappingsSelector.ts @@ -57,7 +57,7 @@ class SelfHidingToggle extends UIElement implements InputElement { return true } s = s?.trim()?.toLowerCase() - return searchTerms[Locale.language.data].some(t => t.indexOf(s) >= 0); + return searchTerms[Locale.language.data]?.some(t => t.indexOf(s) >= 0) ?? false; }, [selected, Locale.language]) const self = this; @@ -121,10 +121,15 @@ class SelfHidingToggle extends UIElement implements InputElement { * A searchfield can be used to filter the values */ export class SearchablePillsSelector extends Combine implements InputElement { - private selectedElements: UIEventSource; + private readonly selectedElements: UIEventSource; public readonly someMatchFound: Store; + /** + * + * @param values + * @param options + */ constructor( values: { show: BaseUIElement, value: T, mainTerm: Record, searchTerms?: Record }[], options?: { @@ -188,7 +193,6 @@ export class SearchablePillsSelector extends Combine implements InputElement< }; }) - let somethingShown: Store if (options.selectIfSingle) { let forcedSelection : { value: T, show: SelfHidingToggle } = undefined @@ -203,15 +207,15 @@ export class SearchablePillsSelector extends Combine implements InputElement< } } if (totalShown == 1) { - if (this.selectedElements.data.indexOf(lastShownValue.value) < 0) { - this.selectedElements.setData([lastShownValue.value]) + if (selectedElements.data?.indexOf(lastShownValue.value) < 0) { + selectedElements.setData([lastShownValue.value]) lastShownValue.show.forceSelected.setData(true) forcedSelection = lastShownValue } } else if (forcedSelection != undefined) { forcedSelection?.show?.forceSelected?.setData(false) forcedSelection = undefined; - this.selectedElements.setData([]) + selectedElements.setData([]) } return totalShown > 0 diff --git a/UI/Popup/TagRenderingQuestion.ts b/UI/Popup/TagRenderingQuestion.ts index ed00ceb82..60dab8ab9 100644 --- a/UI/Popup/TagRenderingQuestion.ts +++ b/UI/Popup/TagRenderingQuestion.ts @@ -22,7 +22,7 @@ import BaseUIElement from "../BaseUIElement"; import {DropDown} from "../Input/DropDown"; import InputElementWrapper from "../Input/InputElementWrapper"; import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction"; -import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"; +import TagRenderingConfig, {Mapping} from "../../Models/ThemeConfig/TagRenderingConfig"; import {Unit} from "../../Models/Unit"; import VariableInputElement from "../Input/VariableInputElement"; import Toggle from "../Input/Toggle"; @@ -32,6 +32,7 @@ import Title from "../Base/Title"; import {OsmConnection} from "../../Logic/Osm/OsmConnection"; import {GeoOperations} from "../../Logic/GeoOperations"; import {SearchablePillsSelector} from "../Input/SearchableMappingsSelector"; +import {OsmTags} from "../../Models/OsmFeature"; /** * Shows the question element. @@ -39,7 +40,7 @@ import {SearchablePillsSelector} from "../Input/SearchableMappingsSelector"; */ export default class TagRenderingQuestion extends Combine { - constructor(tags: UIEventSource & {id: string}>, + constructor(tags: UIEventSource & { id: string }>, configuration: TagRenderingConfig, state?: FeaturePipelineState, options?: { @@ -53,7 +54,7 @@ export default class TagRenderingQuestion extends Combine { const applicableMappingsSrc = Stores.ListStabilized(tags.map(tags => { - const applicableMappings: { if: TagsFilter, icon?: string, then: TypedTranslation, ifnot?: TagsFilter, addExtraTags: Tag[] }[] = [] + const applicableMappings: Mapping[] = [] for (const mapping of configuration.mappings ?? []) { if (mapping.hideInAnswer === true) { continue @@ -142,7 +143,7 @@ export default class TagRenderingQuestion extends Combine { private static GenerateInputElement( state: FeaturePipelineState, configuration: TagRenderingConfig, - applicableMappings: { if: TagsFilter, then: TypedTranslation, icon?: string, ifnot?: TagsFilter, addExtraTags: Tag[], searchTerms?: Record }[], + applicableMappings: Mapping[], applicableUnit: Unit, tagsSource: UIEventSource, feedback: UIEventSource @@ -231,15 +232,84 @@ export default class TagRenderingQuestion extends Combine { } + /** + * + * // Should return the search as freeform value + * const source = new UIEventSource({id: "1234"}) + * const tr = new TagRenderingConfig({ + * id:"test", + * render:"The value is {key}", + * freeform: { + * key:"key" + * }, + * + * mappings: [ + * { + * if:"x=y", + * then:"z", + * searchTerms: { + * "en" : ["z"] + * } + * } + * ] + * }, "test"); + * const selector = TagRenderingQuestion.GenerateSearchableSelector( + * undefined, + * tr, + * tr.mappings, + * source, + * { + * search: new UIEventSource("value") + * } + * ); + * selector.GetValue().data // => new And([new Tag("key","value")]) + * + * // Should return the search as freeform value, even if a previous search matched + * const source = new UIEventSource({id: "1234"}) + * const search = new UIEventSource("") + * const tr = new TagRenderingConfig({ + * id:"test", + * render:"The value is {key}", + * freeform: { + * key:"key" + * }, + * + * mappings: [ + * { + * if:"x=y", + * then:"z", + * searchTerms: { + * "en" : ["z"] + * } + * } + * ] + * }, "test"); + * const selector = TagRenderingQuestion.GenerateSearchableSelector( + * undefined, + * tr, + * tr.mappings, + * source, + * { + * search + * } + * ); + * search.setData("z") + * search.setData("zx") + * selector.GetValue().data // => new And([new Tag("key","zx")]) + */ private static GenerateSearchableSelector( state: FeaturePipelineState, configuration: TagRenderingConfig, - applicableMappings: { if: TagsFilter; ifnot?: TagsFilter, then: TypedTranslation; icon?: string; iconClass?: string, addExtraTags: Tag[], searchTerms?: Record }[], tagsSource: UIEventSource): InputElement { + applicableMappings: Mapping[], + tagsSource: UIEventSource, + options?: { + search: UIEventSource + }): InputElement { const values: { show: BaseUIElement, value: number, mainTerm: Record, searchTerms?: Record }[] = [] for (let i = 0; i < applicableMappings.length; i++) { const mapping = applicableMappings[i]; const tr = mapping.then.Subs(tagsSource.data) - const patchedMapping = <{ iconClass: "small-height", then: TypedTranslation }>{ + const patchedMapping = { ...mapping, iconClass: `small-height`, icon: mapping.icon ?? "./assets/svg/none.svg" @@ -253,7 +323,7 @@ export default class TagRenderingQuestion extends Combine { }) } - const searchValue: UIEventSource = new UIEventSource(undefined) + const searchValue: UIEventSource = options?.search ?? new UIEventSource(undefined) const ff = configuration.freeform let onEmpty: BaseUIElement = undefined if (ff !== undefined) { @@ -266,8 +336,14 @@ export default class TagRenderingQuestion extends Combine { mode: configuration.multiAnswer ? "select-many" : "select-one", searchValue, onNoMatches: onEmpty?.SetClass(classes).SetClass("flex justify-center items-center"), - searchAreaClass: classes + searchAreaClass: classes, }) + const fallbackTag = searchValue.map(s => { + if (s === undefined || ff?.key === undefined) { + return undefined + } + return new Tag(ff.key, s) + }); return new InputElementMap(presetSearch, (x0, x1) => { if (x0 == x1) { @@ -288,7 +364,7 @@ export default class TagRenderingQuestion extends Combine { }, (selected) => { if (ff !== undefined && searchValue.data?.length > 0 && !presetSearch.someMatchFound.data) { - const t = new Tag(ff.key, searchValue.data) + const t = fallbackTag.data; if (ff.addExtraTags) { return new And([t, ...ff.addExtraTags]) } @@ -436,13 +512,7 @@ export default class TagRenderingQuestion extends Combine { private static GenerateMappingElement( state, tagsSource: UIEventSource, - mapping: { - if: TagsFilter, - then: Translation, - addExtraTags: Tag[], - icon?: string, - iconClass?: "small" | "medium" | "large" | "small-height" - }, ifNot?: TagsFilter[]): InputElement { + mapping: Mapping, ifNot?: TagsFilter[]): InputElement { let tagging: TagsFilter = mapping.if; if (ifNot !== undefined) { @@ -459,11 +529,7 @@ export default class TagRenderingQuestion extends Combine { (t0, t1) => t1.shadows(t0)); } - private static GenerateMappingContent(mapping: { - then: Translation, - icon?: string, - iconClass?: "small" | "medium" | "large" | "small-height" | "medium-height" | "large-height" - }, tagsSource: UIEventSource, state: FeaturePipelineState): BaseUIElement { + private static GenerateMappingContent(mapping: Mapping, tagsSource: UIEventSource, state: FeaturePipelineState): BaseUIElement { const text = new SubstitutedTranslation(mapping.then, tagsSource, state) if (mapping.icon === undefined) { return text; diff --git a/assets/layers/parking/parking.json b/assets/layers/parking/parking.json index 27159a450..0e7d24f8c 100644 --- a/assets/layers/parking/parking.json +++ b/assets/layers/parking/parking.json @@ -140,7 +140,7 @@ }, "render": { "en": "There are {capacity:disabled} disabled parking spots", - "nl": "Er zijn capacity:disabled} parkeerplaatsen voor gehandicapten" + "nl": "Er zijn {capacity:disabled} parkeerplaatsen voor gehandicapten" } }, { diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index ab3cce9cd..60452cb5b 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -1,19 +1,13 @@ { "id": "mapcomplete-changes", "title": { - "en": "Changes made with MapComplete", - "nl": "Wijzigingen gemaakt met MapComplete", - "de": "Mit MapComplete vorgenommene Änderungen" + "en": "Changes made with MapComplete" }, "shortDescription": { - "en": "Shows changes made by MapComplete", - "nl": "Toont wijzigingen gemaakt met MapComplete", - "de": "Zeigt die mit MapComplete vorgenommenen Änderungen" + "en": "Shows changes made by MapComplete" }, "description": { - "en": "This maps shows all the changes made with MapComplete", - "nl": "Deze kaart toont alle wijzigingen die met MapComplete werden gemaakt", - "de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen" + "en": "This maps shows all the changes made with MapComplete" }, "maintainer": "", "icon": "./assets/svg/logo.svg", @@ -28,8 +22,7 @@ { "id": "mapcomplete-changes", "name": { - "en": "Changeset centers", - "de": "Zentrum der Änderungssätze" + "en": "Changeset centers" }, "minzoom": 0, "source": { @@ -43,47 +36,35 @@ ], "title": { "render": { - "en": "Changeset for {theme}", - "nl": "Wijzigingset voor {theme}", - "de": "Änderungssatz für {theme}" + "en": "Changeset for {theme}" } }, "description": { - "en": "Shows all MapComplete changes", - "nl": "Toont alle wijzigingen met MapComplete", - "de": "Zeigt alle MapComplete Änderungen" + "en": "Shows all MapComplete changes" }, "tagRenderings": [ { "id": "render_id", "render": { - "en": "Changeset {id}", - "nl": "Wijzigingset {id}", - "de": "Änderungssatz {id}" + "en": "Changeset {id}" } }, { "id": "contributor", "render": { - "en": "Change made by {_last_edit:contributor}", - "nl": "Wijziging gemaakt door {_last_edit:contributor}", - "de": "Geändert von {_last_edit:contributor}" + "en": "Change made by {_last_edit:contributor}" } }, { "id": "theme", "render": { - "en": "Change with theme {theme}", - "nl": "Wijziging met thema {theme}", - "de": "Änderung mit Thema {theme}" + "en": "Change with theme {theme}" }, "mappings": [ { "if": "theme~http.*", "then": { - "en": "Change with unofficial theme {theme}", - "nl": "Wijziging met officieus thema {theme}", - "de": "Änderung mit inoffiziellem Thema {theme}" + "en": "Change with unofficial theme {theme}" } } ] @@ -379,9 +360,7 @@ } ], "question": { - "en": "Themename contains {search}", - "nl": "Themanaam bevat {search}", - "de": "Themenname enthält {search}" + "en": "Themename contains {search}" } } ] @@ -397,9 +376,7 @@ } ], "question": { - "en": "Made by contributor {search}", - "nl": "Gemaakt door bijdrager {search}", - "de": "Erstellt von {search}" + "en": "Made by contributor {search}" } } ] @@ -415,9 +392,7 @@ } ], "question": { - "en": "Not made by contributor {search}", - "nl": "Niet gemaakt door bijdrager {search}", - "de": "Nicht erstellt von {search}" + "en": "Not made by contributor {search}" } } ] @@ -432,9 +407,7 @@ { "id": "link_to_more", "render": { - "en": "More statistics can be found here", - "nl": "Meer statistieken kunnen hier gevonden worden", - "de": "Weitere Statistiken finden Sie hier" + "en": "More statistics can be found here" } }, { diff --git a/langs/layers/nl.json b/langs/layers/nl.json index cfba0ceeb..11d154dcd 100644 --- a/langs/layers/nl.json +++ b/langs/layers/nl.json @@ -6493,4 +6493,4 @@ } } } -} +} \ No newline at end of file From 4a2bc533ee8ce04571174379be46d1b0cc35da9e Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 13 Jul 2022 23:10:56 +0200 Subject: [PATCH 24/24] Add safeguard as not to show too much mappings in the searchableMappingSelector --- UI/Input/SearchableMappingsSelector.ts | 21 ++++++++++++++------- langs/en.json | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/UI/Input/SearchableMappingsSelector.ts b/UI/Input/SearchableMappingsSelector.ts index 8a414a879..1c6f17e99 100644 --- a/UI/Input/SearchableMappingsSelector.ts +++ b/UI/Input/SearchableMappingsSelector.ts @@ -138,6 +138,10 @@ export class SearchablePillsSelector extends Combine implements InputElement< searchValue?: UIEventSource, onNoMatches?: BaseUIElement, onNoSearchMade?: BaseUIElement, + /** + * Shows this if there are many (>200) possible mappings + */ + onManyElements?: BaseUIElement, selectIfSingle?: false | boolean, searchAreaClass?: string }) { @@ -193,10 +197,10 @@ export class SearchablePillsSelector extends Combine implements InputElement< }; }) - let somethingShown: Store + let totalShown: Store if (options.selectIfSingle) { let forcedSelection : { value: T, show: SelfHidingToggle } = undefined - somethingShown = searchValue.map(_ => { + totalShown = searchValue.map(_ => { let totalShown = 0; let lastShownValue: { value: T, show: SelfHidingToggle } for (const mv of mappedValues) { @@ -218,10 +222,10 @@ export class SearchablePillsSelector extends Combine implements InputElement< selectedElements.setData([]) } - return totalShown > 0 + return totalShown }, mappedValues.map(mv => mv.show.GetValue())) } else { - somethingShown = searchValue.map(_ => mappedValues.some(mv => mv.show.isShown.data), mappedValues.map(mv => mv.show.GetValue())) + totalShown = searchValue.map(_ => mappedValues.filter(mv => mv.show.isShown.data).length, mappedValues.map(mv => mv.show.GetValue())) } @@ -231,18 +235,21 @@ export class SearchablePillsSelector extends Combine implements InputElement< if (options?.onNoSearchMade !== undefined && (searchValue.data === undefined || searchValue.data.length === 0)) { return options?.onNoSearchMade } - if (!somethingShown.data) { + if (totalShown.data == 0) { return onEmpty } + if(totalShown.data >= 200){ + return options?.onManyElements ?? Translations.t.general.useSearch; + } mappedValues.sort((a, b) => a.mainTerm[lng] < b.mainTerm[lng] ? -1 : 1) return new Combine(mappedValues.map(e => e.show)) .SetClass("flex flex-wrap w-full content-start") .SetClass(options?.searchAreaClass ?? "") - }, [somethingShown, searchValue])) + }, [totalShown, searchValue])) ]) this.selectedElements = selectedElements; - this.someMatchFound = somethingShown; + this.someMatchFound = totalShown.map(t => t > 0); } diff --git a/langs/en.json b/langs/en.json index e893fb262..8c8c8fa58 100644 --- a/langs/en.json +++ b/langs/en.json @@ -235,6 +235,7 @@ "skip": "Skip this question", "skippedQuestions": "Some questions are skipped", "testing": "Testing - changes won't be saved", + "useSearch": "Use the search above to see presets", "weekdays": { "abbreviations": { "friday": "Fri",