From b8a168319131c2f2dc12bd4fb0ca4b3c193552e0 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sat, 10 Oct 2020 13:44:10 +0200 Subject: [PATCH] Small fix to custom generator, add shopping map --- Customizations/AllKnownLayouts.ts | 2 + State.ts | 2 +- UI/Input/ValidatedTextField.ts | 2 +- assets/themes/shops/shop.svg | 16 +++ assets/themes/shops/shops.json | 228 ++++++++++++++++++++++++++++++ 5 files changed, 248 insertions(+), 2 deletions(-) create mode 100644 assets/themes/shops/shop.svg create mode 100644 assets/themes/shops/shops.json diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts index 785fa1f81..b5af747da 100644 --- a/Customizations/AllKnownLayouts.ts +++ b/Customizations/AllKnownLayouts.ts @@ -11,6 +11,7 @@ import * as cyclofix from "../assets/themes/cyclofix/cyclofix.json" import * as buurtnatuur from "../assets/themes/buurtnatuur/buurtnatuur.json" import * as nature from "../assets/themes/nature/nature.json" import * as maps from "../assets/themes/maps/maps.json" +import * as shops from "../assets/themes/shops/shops.json" import {PersonalLayout} from "../Logic/PersonalLayout"; import {StreetWidth} from "./StreetWidth/StreetWidth"; @@ -46,6 +47,7 @@ export class AllKnownLayouts { public static layoutsList: Layout[] = [ new PersonalLayout(), + FromJSON.LayoutFromJSON(shops), FromJSON.LayoutFromJSON(bookcases), FromJSON.LayoutFromJSON(aed), FromJSON.LayoutFromJSON(toilets), diff --git a/State.ts b/State.ts index b40bd5e62..66250a881 100644 --- a/State.ts +++ b/State.ts @@ -23,7 +23,7 @@ export default class State { // The singleton of the global state public static state: State; - public static vNumber = "0.1.0b"; + public static vNumber = "0.1.0c"; // The user journey states thresholds when a new feature gets unlocked public static userJourney = { diff --git a/UI/Input/ValidatedTextField.ts b/UI/Input/ValidatedTextField.ts index 0bcd90a37..dafacd3e1 100644 --- a/UI/Input/ValidatedTextField.ts +++ b/UI/Input/ValidatedTextField.ts @@ -166,7 +166,7 @@ export default class ValidatedTextField { const values: { value: string, shown: string }[] = []; const expl = ValidatedTextField.tpList; for (const key in expl) { - values.push({value: key, shown: `${expl[key].name} - ${expl[key].explanation}`}) + values.push({value: expl[key].name, shown: `${expl[key].name} - ${expl[key].explanation}`}) } return new DropDown("", values) } diff --git a/assets/themes/shops/shop.svg b/assets/themes/shops/shop.svg new file mode 100644 index 000000000..8a2e8d451 --- /dev/null +++ b/assets/themes/shops/shop.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/themes/shops/shops.json b/assets/themes/shops/shops.json new file mode 100644 index 000000000..1e4bf1845 --- /dev/null +++ b/assets/themes/shops/shops.json @@ -0,0 +1,228 @@ +{ + "id": "shops", + "title": { + "en": "Open Shop Map" + }, + "shortDescription": { + "en": "An editable map with basic shop information" + }, + "description": { + "en": "On this map, one can mark basic information about shops, add opening hours and phone numbers" + }, + "language": [ + "en" + ], + "maintainer": "MapComplete", + "icon": "./assets/themes/shops/shop.svg", + "version": "0", + "startLat": 0, + "startLon": 0, + "startZoom": 1, + "widenFactor": 0.05, + "socialImage": "", + "layers": [ + { + "id": "shops", + "name": { + "en": "Shop" + }, + "minzoom": 14, + "overpassTags": { + "and": [ + "shop~*" + ] + }, + "title": { + "render": { + "en": "Shop" + }, + "mappings": [ + { + "if": { + "and": [ + "name~*" + ] + }, + "then": { + "en": "{name}" + } + }, + { + "if": { + "and": [ + "shop!~yes" + ] + }, + "then": { + "en": "{shop}" + } + } + ] + }, + "description": { + "en": "A shop" + }, + "tagRenderings": [ + { + "render": { + "en": "This shop sellse {shop}" + }, + "question": { + "en": "What does this shop sell?" + }, + "freeform": { + "key": "shop" + }, + "mappings": [ + { + "if": { + "and": [ + "shop=convenience" + ] + }, + "then": { + "en": "Convenience store" + } + }, + { + "if": { + "and": [ + "shop=supermarket" + ] + }, + "then": { + "en": "Supermarket" + } + }, + { + "if": { + "and": [ + "shop=clothes" + ] + }, + "then": { + "en": "Clothing store" + } + }, + { + "if": { + "and": [ + "shop=hairdresser" + ] + }, + "then": { + "en": "Hairdresser" + } + }, + { + "if": { + "and": [ + "shop=bakery" + ] + }, + "then": { + "en": "Bakery" + } + }, + { + "if": { + "and": [ + "shop=car_repair" + ] + }, + "then": { + "en": "Car repair (garage)" + } + }, + { + "if": { + "and": [ + "shop=car" + ] + }, + "then": { + "en": "Car dealer" + } + } + ] + }, + { + "render": { + "en": "{phone}" + }, + "question": { + "en": "What is the phone number?" + }, + "freeform": { + "key": "phone", + "type": "phone" + } + }, + { + "render": { + "en": "{website}" + }, + "question": { + "en": "What is the website of this shop?" + }, + "freeform": { + "key": "website", + "type": "url" + } + }, + { + "render": { + "en": "{email}" + }, + "question": { + "en": "What is the email address of this shop?" + }, + "freeform": { + "key": "email", + "type": "email" + } + }, + { + "render": { + "en": "{opening_hours_table(opening_hours)}" + }, + "question": { + "en": "What are the opening hours of this shop?" + }, + "freeform": { + "key": "opening_hours", + "type": "opening_hours" + } + } + ], + "hideUnderlayingFeaturesMinPercentage": 0, + "icon": { + "render": "./assets/themes/shops/shop.svg" + }, + "width": { + "render": "8" + }, + "iconSize": { + "render": "40,40,center" + }, + "color": { + "render": "#00f" + }, + "presets": [ + { + "tags": [ + "shop=yes" + ], + "title": { + "en": "Shop" + }, + "description": { + "en": "Add a new shop" + } + } + ], + "wayHandling": 2 + } + ], + "roamingRenderings": [] +} \ No newline at end of file