diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts index 6a08c9336..8d04ef78a 100644 --- a/Customizations/AllKnownLayouts.ts +++ b/Customizations/AllKnownLayouts.ts @@ -15,6 +15,7 @@ import {GhostBikes} from "./Layouts/GhostBikes"; import {CustomLayoutFromJSON} from "./JSON/CustomLayoutFromJSON"; import * as bookcases from "../assets/themes/bookcases/Bookcases.json"; import * as aed from "../assets/themes/aed/aed.json"; +import * as toilets from "../assets/themes/toilets/toilets.json"; export class AllKnownLayouts { @@ -28,6 +29,7 @@ export class AllKnownLayouts { new GhostBikes(), CustomLayoutFromJSON.LayoutFromJSON(bookcases), CustomLayoutFromJSON.LayoutFromJSON(aed), + CustomLayoutFromJSON.LayoutFromJSON(toilets), new MetaMap(), new StreetWidth(), diff --git a/Customizations/Layers/Toilets.ts b/Customizations/Layers/Toilets.ts deleted file mode 100644 index af41d6cfd..000000000 --- a/Customizations/Layers/Toilets.ts +++ /dev/null @@ -1,84 +0,0 @@ -import {LayerDefinition} from "../LayerDefinition"; -import {FixedUiElement} from "../../UI/Base/FixedUiElement"; -import L from "leaflet"; -import {Tag} from "../../Logic/TagsFilter"; - -export class Toilets extends LayerDefinition{ - - constructor() { - super("toilets"); - - this.name="toilet"; - this.newElementTags = [new Tag( "amenity", "toilets")]; - this.icon = "./assets/toilets.svg"; - this.overpassFilter = new Tag("amenity","toilets"); - this.minzoom = 13; - this.questions = [Quests.hasFee, - Quests.toiletsWheelChairs, - Quests.toiletsChangingTable, - Quests.toiletsChangingTableLocation, - Quests.toiletsPosition]; - - this.style = function(tags){ - if(tags.wheelchair == "yes"){ - - return {icon : new L.icon({ - iconUrl: "assets/wheelchair.svg", - iconSize: [40, 40] - })}; - } - return {icon : new L.icon({ - iconUrl: "assets/toilets.svg", - iconSize: [40, 40] - })}; - } - - this.elementsToShow = [ - new FixedUiElement("Toiletten"), - - new TagMappingOptions({ - key: "access", - mapping: { - yes: "Toegankelijk", - no: "Niet toegankelijk", - private: "Niet toegankelijk", - customers: "Enkel voor klanten", - } - }), - - new TagMappingOptions({ - key: "fee", - mapping: { - yes: "Betalend", - no: "Gratis", - ["0"]: "Gratis" - }, - template: "Betalend, men vraagt {fee}" - }), - - new TagMappingOptions({ - key: "toilets:position", - mapping: { - seated: 'Gewone zittoiletten', - urinal: 'Een enkele urinoir', - urinals: 'Urinoirs', - ['urinals;seated']: "Urinoirs en gewone toiletten", - ['seated;urinals']: "Urinoirs en gewone toiletten", - - } - }), - - new TagMappingOptions({ - key: "wheelchair", - mapping: { - yes: "Rolstoeltoegankelijk", - no: "Niet Rolstoeltoegankelijk", - limited: "Beperkt rolstoeltoegankelijk", - - } - }), - ]; - } - - -} \ No newline at end of file diff --git a/Customizations/Layouts/Toilets.ts b/Customizations/Layouts/Toilets.ts deleted file mode 100644 index 1598c0f5a..000000000 --- a/Customizations/Layouts/Toilets.ts +++ /dev/null @@ -1,25 +0,0 @@ -import {Layout} from "../Layout"; -import * as Layer from "../Layers/Toilets"; - -export class Toilets extends Layout{ - constructor() { - super( "toilets", - ["en"], - "Open Toilet Map", - [new Layer.Toilets()], - 12, - 51.2, - 3.2, - - - " <h3>Open Toilet Map</h3>\n" + - "\n" + - "<p>Help us to create the most complete map about <i>all</i> the toilets in the world, based on openStreetMap." + - "One can answer questions here, which help users all over the world to find an accessible toilet, close to them.</p>" - , - " <p>Start by <a href=\"https://www.openstreetmap.org/user/new\" target=\"_blank\">creating an account\n" + - " </a> or by " + - " <span onclick=\"authOsm()\" class=\"activate-osm-authentication\">logging in</span>.</p>", - "Start by clicking a pin and answering the questions"); - } -} \ No newline at end of file diff --git a/State.ts b/State.ts index 137603c4f..6a6f565a5 100644 --- a/State.ts +++ b/State.ts @@ -24,7 +24,7 @@ export class State { // The singleton of the global state public static state: State; - public static vNumber = "0.0.5b"; + public static vNumber = "0.0.5c"; public static runningFromConsole: boolean = false; @@ -47,7 +47,7 @@ export class State { */ public bm; /** - The user crednetials + The user credentials */ public osmConnection: OsmConnection; diff --git a/UI/MoreScreen.ts b/UI/MoreScreen.ts index 66d071d2c..e1dc2c947 100644 --- a/UI/MoreScreen.ts +++ b/UI/MoreScreen.ts @@ -44,14 +44,17 @@ export class MoreScreen extends UIElement { const currentLocation = State.state.locationControl.data; const linkText = `https://pietervdvn.github.io/MapComplete/${layout.name}.html?z=${currentLocation.zoom}&lat=${currentLocation.lat}&lon=${currentLocation.lon}` + let description = Translations.W(layout.description); + if(description !== undefined){ + description = new Combine(["<br/>", description]); + } const link = new SubtleButton(layout.icon, new Combine([ "<b>", Translations.W(layout.title), "</b>", - "<br/>", - Translations.W(layout.description), + description ?? "", ]), {url: linkText, newTab: false}); els.push(link) diff --git a/assets/bookcase.svg b/assets/bookcase.svg deleted file mode 100644 index d6feeeb74..000000000 --- a/assets/bookcase.svg +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - viewBox="0 0 64 64" - height="64" - width="64" - id="svg109" - version="1.1" - sodipodi:docname="Public_bookcase-14.svg" - inkscape:version="0.92.4 (5da689c313, 2019-01-14)"> - <sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1001" - id="namedview6" - showgrid="false" - inkscape:zoom="8.4285714" - inkscape:cx="21.124627" - inkscape:cy="25.918314" - inkscape:window-x="0" - inkscape:window-y="0" - inkscape:window-maximized="1" - inkscape:current-layer="layer2" /> - <metadata - id="metadata115"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs - id="defs113" /> - <g - inkscape:groupmode="layer" - id="layer1" - inkscape:label="background"> - <ellipse - style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.49738699;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="path819" - cx="31.967007" - cy="32.109043" - rx="32.00938" - ry="31.946436" /> - </g> - <g - inkscape:groupmode="layer" - id="layer2" - inkscape:label="icon"> - <path - id="path4176" - d="M 32.123859,10.440678 8.6779661,17.139504 v 3.349413 L 32.123859,13.79009 55.569753,20.488917 v -3.349413 z m -11.59865,11.964995 c -0.522431,0.02077 -1.041409,0.124297 -1.556954,0.320538 v 20.835706 c 0,0 8.38755,-0.322013 10.525792,7.817477 V 29.497007 c -1.631616,-3.400613 -5.311804,-7.237191 -8.968838,-7.091334 z m 8.968838,28.973731 C 24.066203,47.228261 16.331902,46.172115 16.331902,46.172115 V 26.376556 l -2.629816,-1.046692 v 23.445893 l 15.791961,5.207293 h 5.259628 L 50.545632,48.775757 V 25.329864 l -2.629812,1.046692 v 20.835709 l -13.162145,4.167139 c -1.754454,-0.663351 -3.795938,-0.545319 -5.259628,0 z M 45.279464,22.726221 C 40.03579,22.448689 33.986193,25.566152 30.808953,28.247518 v 22.045945 c 2.933724,-2.408355 8.190227,-5.573982 14.470511,-6.208191 z" - style="fill:#734a08;fill-opacity:1;stroke:none;stroke-width:3.34941339" - inkscape:connector-curvature="0" /> - </g> -</svg> diff --git a/assets/themes/toilets/toilets.json b/assets/themes/toilets/toilets.json new file mode 100644 index 000000000..b8d522055 --- /dev/null +++ b/assets/themes/toilets/toilets.json @@ -0,0 +1,169 @@ +{ + "layers": [ + { + "id": "Toilet", + "title": { + "key": "*", + "render": "Toilet" + }, + "icon": { + "key": "*", + "render": "./assets/themes/toilets/toilets.svg", + "mappings": [ + { + "then": "./assets/themes/toilets/wheelchair.svg", + "if": "wheelchair=yes" + } + ] + }, + "color": { + "key": "*", + "render": "#0000ff" + }, + "description": "A toilet", + "minzoom": "14", + "wayHandling": 2, + "presets": [ + { + "title": "Toilet", + "tags": "amenity=toilets", + "description": "Only add public toilets" + } + ], + "tagRenderings": [ + { + "key": "access", + "mappings": [ + { + "then": "Public access", + "if": "access=yes" + }, + { + "then": "Only access to customers", + "if": "access=customers" + }, + { + "if": "access=no", + "then": "Not accessible" + }, + { + "then": "Accessible, but one has to ask a key to enter", + "if": "access=key" + } + ], + "question": "Are these toilets publicly accessible?", + "type": "text", + "addExtraTags": "fixme=the tag access was filled out by the user and might need refinement", + "render": "Access is {access}" + }, + { + "mappings": [ + { + "then": "These are paid toilets", + "if": "fee=yes" + }, + { + "if": "fee=no", + "then": "Free to use" + } + ], + "type": "text", + "question": "Are these toilets free to use?" + }, + { + "key": "charge", + "mappings": [], + "question": "How much does one have to pay for these toilets?", + "type": "string", + "render": "The fee is {charge}", + "condition": "fee=yes" + }, + { + "mappings": [ + { + "then": "There is a dedicated toilet for wheelchair users", + "if": "wheelchair=yes" + }, + { + "if": "wheelchair=no", + "then": "No wheelchair access" + } + ], + "type": "text", + "question": "Is there a dedicated toilet for wheelchair users" + }, + { + "mappings": [ + { + "if": "toilets:position=seated", + "then": "There are only seated toilets" + }, + { + "if": "toilets:position=urinals", + "then": "There are only urinals here" + }, + { + "if": "toilets:position=squat", + "then": "There are only squat toilets here" + }, + { + "if": "toilets:position=seated;urinals", + "then": "Both seated toilets and urinals are available here" + } + ], + "question": "Which kind of toilets are this?", + "type": "text" + }, + { + "mappings": [ + { + "then": "A changing table is available", + "if": "changing_table=yes" + }, + { + "if": "changing_table=no", + "then": "No changing table is available" + } + ], + "question": "Is a changing table (to change diapers) available?", + "type": "text" + }, + { + "key": "changing_table:location", + "mappings": [ + { + "then": "The changing table is in the toilet for women. ", + "if": "changing_table:location=female_toilet" + }, + { + "then": "The changing table is in the toilet for men. ", + "if": "changing_table:location=male_toilet" + }, + { + "if": "changing_table:location=wheelchair_toilet", + "then": "The changing table is in the toilet for wheelchair users. " + }, + { + "if": "changing_table:location=dedicated_room", + "then": "The changing table is in a dedicated room. " + } + ], + "type": "text", + "question": "Where is the changing table located?", + "condition": "changing_table=yes", + "render": "The changing table is located at {changing_table:location}" + } + ], + "overpassTags": "amenity=toilets" + } + ], + "startLat": "51.2095", + "startZoom": "12", + "maintainer": "Pieter Vander Vennet", + "title": "Open Toilet Map", + "startLon": "3.2222", + "icon": "./assets/themes/toilets/toilets.svg", + "description": "A map of public toilets", + "language": "en", + "name": "toilets" +} \ No newline at end of file diff --git a/assets/toilets.svg b/assets/themes/toilets/toilets.svg similarity index 100% rename from assets/toilets.svg rename to assets/themes/toilets/toilets.svg diff --git a/assets/wheelchair.svg b/assets/themes/toilets/wheelchair.svg similarity index 100% rename from assets/wheelchair.svg rename to assets/themes/toilets/wheelchair.svg diff --git a/customGenerator.ts b/customGenerator.ts index d4caf42d7..cdb6102ed 100644 --- a/customGenerator.ts +++ b/customGenerator.ts @@ -7,6 +7,8 @@ import {LocalStorageSource} from "./Logic/Web/LocalStorageSource"; import {createHash} from "crypto"; import Combine from "./UI/Base/Combine"; import {Button} from "./UI/Base/Button"; +import {FixedUiElement} from "./UI/Base/FixedUiElement"; +import {State} from "./State"; const connection = new OsmConnection(true, new UIEventSource<string>(undefined), false); connection.AttemptLogin(); @@ -16,7 +18,7 @@ const localStorage = LocalStorageSource.Get("last-custom-save"); console.log("hash", hash) console.log("Saved: ", localStorage.data) -if (hash === undefined || hash === "") { +if (hash === undefined || hash === "" && localStorage.data !== undefined) { const previous = localStorage.data.split("#"); hash = previous[1]; console.log("Using previously saved data ", hash) @@ -41,4 +43,9 @@ new Combine([ themeGenerator.themeObject.data.maintainer = connection.userDetails.data.name; themeGenerator.themeObject.data.layers = []; themeGenerator.themeObject.ping(); - })]).AttachTo("preview"); + }), + "<br/>", + "Version: ", + State.vNumber + +]).AttachTo("preview"); diff --git a/index.css b/index.css index 80d05f706..670d4eb76 100644 --- a/index.css +++ b/index.css @@ -1193,6 +1193,7 @@ form { border-right:1px solid gray; border-top: 1px solid gray; border-bottom: 1px solid lightgray; + min-width: 4em; }