diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts index 77307bd72..1d92316f3 100644 --- a/Customizations/AllKnownLayouts.ts +++ b/Customizations/AllKnownLayouts.ts @@ -13,6 +13,8 @@ import {MetaMap} from "./Layouts/MetaMap"; import {Natuurpunt} from "./Layouts/Natuurpunt"; import {Bookcases} from "./Layouts/Bookcases"; import {GhostBikes} from "./Layouts/GhostBikes"; +import * as bookcases from "../assets/themes/bookcases/Bookcases.json"; +import {CustomLayoutFromJSON} from "./JSON/CustomLayoutFromJSON"; export class AllKnownLayouts { @@ -24,22 +26,26 @@ export class AllKnownLayouts { new GRB(), new Cyclofix(), new GhostBikes(), - new Bookcases(), + // new Bookcases(), + CustomLayoutFromJSON.LayoutFromJSON(bookcases), new MetaMap(), new StreetWidth(), new ClimbingTrees(), new Artworks(), new Smoothness(), new Groen(), + /* new Toilets(), */ ]; + public static allSets: Map = AllKnownLayouts.AllLayouts(); private static AllLayouts(): Map { + const all = new All(); this.allLayers = new Map(); for (const layout of this.layoutsList) { diff --git a/Customizations/JSON/CustomLayoutFromJSON.ts b/Customizations/JSON/CustomLayoutFromJSON.ts index 0eea13478..4b79baa7a 100644 --- a/Customizations/JSON/CustomLayoutFromJSON.ts +++ b/Customizations/JSON/CustomLayoutFromJSON.ts @@ -127,7 +127,6 @@ export class CustomLayoutFromJSON { icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgaWQ9InN2ZzExMzgyIgogICBoZWlnaHQ9IjkwMCIKICAgd2lkdGg9IjkwMCIKICAgdmVyc2lvbj0iMS4wIj4KICA8bWV0YWRhdGEKICAgICBpZD0ibWV0YWRhdGExMCI+CiAgICA8cmRmOlJERj4KICAgICAgPGNjOldvcmsKICAgICAgICAgcmRmOmFib3V0PSIiPgogICAgICAgIDxkYzpmb3JtYXQ+aW1hZ2Uvc3ZnK3htbDwvZGM6Zm9ybWF0PgogICAgICAgIDxkYzp0eXBlCiAgICAgICAgICAgcmRmOnJlc291cmNlPSJodHRwOi8vcHVybC5vcmcvZGMvZGNtaXR5cGUvU3RpbGxJbWFnZSIgLz4KICAgICAgICA8ZGM6dGl0bGU+PC9kYzp0aXRsZT4KICAgICAgPC9jYzpXb3JrPgogICAgPC9yZGY6UkRGPgogIDwvbWV0YWRhdGE+CiAgPGRlZnMKICAgICBpZD0iZGVmczExMzg0IiAvPgogIDxnCiAgICAgaWQ9ImxheWVyMSIKICAgICB0cmFuc2Zvcm09Im1hdHJpeCgwLjkwMTAzMjU4LDAsMCwwLjkwMTAzMjU4LDExMi44NDA1OCwtMS45MDYwMTc3KSI+CiAgICA8ZwogICAgICAgaWQ9ImcxMTQ3NiI+CiAgICAgIDxwYXRoCiAgICAgICAgIGlkPSJwYXRoMTE0NzIiCiAgICAgICAgIHN0eWxlPSJmb250LXN0eWxlOm5vcm1hbDtmb250LXdlaWdodDpub3JtYWw7Zm9udC1zaXplOjEyMDEuOTI0OTI2NzZweDtmb250LWZhbWlseTonQml0c3RyZWFtIFZlcmEgU2Fucyc7dGV4dC1hbGlnbjpjZW50ZXI7dGV4dC1hbmNob3I6bWlkZGxlO2ZpbGw6IzAwMDAwMDtmaWxsLW9wYWNpdHk6MTtzdHJva2U6bm9uZTtzdHJva2Utd2lkdGg6MXB4O3N0cm9rZS1saW5lY2FwOmJ1dHQ7c3Ryb2tlLWxpbmVqb2luOm1pdGVyO3N0cm9rZS1vcGFjaXR5OjEiCiAgICAgICAgIGQ9Ik0gNDc0LjUwODg4LDcxOC4yMjg0MSBIIDMwMy40OTU0NyB2IC0yMi4zMDEzNCBjIC0yLjRlLTQsLTM3Ljk1MTA4IDQuMzAzNTIsLTY4Ljc2MjExIDEyLjkxMTMsLTkyLjQzMzE5IDguNjA3MjgsLTIzLjY3MDMyIDIzLjYzMzUyLC00NS4yODY5NSA0MC42NTMyNCwtNjQuODQ5OTYgMTcuMDE5MTQsLTE5LjU2MjExIDQxLjk4NzM0LC0yNi4zMzI2NCAxMDEuNDU3OTMsLTc1LjYzMDg1IDMxLjY5MDk1LC0yNS44MjIwMyA1NS4yODEzLC03Ny4xNTIzIDU1LjI4MTc1LC05OC42NzE3NCAyLjIxMjMyLC01Ni45MjI0NSAtMTMuOTM5ODMsLTc5LjM0MjIgLTM0LjU2Mjg3LC05OS45NjUyNCAtMjIuNjczNTUsLTE5LjY3NzE3IC02MC42NzAyNywtMzAuMDY5OTggLTkwLjk5ODkyLC0zMC4wNjk5OCAtMjcuNzc5MjEsNi45ZS00IC02OC40NjczNSw4LjA4ODcxIC04Ny43NjY2LDI1LjM3MDQ3IC0yNS45MzgxNywxNy4yODMwOCAtNjUuMjM3NDcsNzMuNzA2MTEgLTU3LjA0Njg3LDEzMC41NDU3NyBsIC0xOTQuNTE2OTQzLDEuNzAyMjIgYyAwLC0xNTcuMjEzOTkgMjkuMzkzNjk5LC0xOTguNjk0NjUgOTkuMDA0MTEzLC0yNjMuMDMwMzIgNjcuMzk3MzksLTU0LjM3NjY0MyAxMjYuNTMxMjgsLTczLjI2ODM2NSAyNDMuODQ3NTcsLTczLjI2ODM2NSA4OS43MTc5MSwwIDE2MS44OTcyOCwxNy44MDI4MSAyMTQuMzI1NTIsNTMuNDA1ODU1IDcxLjIwNzE0LDQ4LjEyNDcyIDEyMi4zMDEwNSwxMTEuMTgzNTQgMTIyLjMwMTA1LDIzMC4xMTI4MSAtNi45ZS00LDQ0LjMyMDgxIC0xOS4xNTI1Myw5MC43ODYzOCAtNDMuMDcyNiwxMjguMzMyOTkgLTE4LjM4OTQ3LDMwLjkwOTM4IC02MC4zNzUxMSw2Ni40NTIzNiAtMTE4LjIxMjM3LDEwNC40MTYyOCAtNDIuODM2MDcsMjUuNzY4NiAtNjYuNjcxOTYsNTMuMTE5MjYgLTc3LjAzOTY0LDcyLjA5NDYgLTEwLjM2ODYzLDE4Ljk3NjAzIC0xNS41NTI3MSw0My43MjI2NyAtMTUuNTUyMjUsNzQuMjM5OTkgeiIgLz4KICAgICAgPHBhdGgKICAgICAgICAgaWQ9InBhdGgxMTQ3NCIKICAgICAgICAgc3R5bGU9ImZpbGw6IzAwMDAwMDtmaWxsLW9wYWNpdHk6MTtzdHJva2U6bm9uZTtzdHJva2Utd2lkdGg6MztzdHJva2UtbGluZWNhcDpzcXVhcmU7c3Ryb2tlLWxpbmVqb2luOm1pdGVyO3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lO3N0cm9rZS1kYXNob2Zmc2V0OjA7c3Ryb2tlLW9wYWNpdHk6MSIKICAgICAgICAgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMS4xMDYzODMsLTUuNTMxOTE0OSkiCiAgICAgICAgIGQ9Im0gNDgyLjM4Mjk4LDg2OS44MDkwMiBhIDk0LjA0MjU1Nyw3My4wMjEyNzggMCAxIDEgLTE4OC4wODUxMSwwIDk0LjA0MjU1Nyw3My4wMjEyNzggMCAxIDEgMTg4LjA4NTExLDAgeiIgLz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPgo=" } - public static FromQueryParam(layoutFromBase64: string): Layout { if(layoutFromBase64 === "test"){ console.log(btoa(JSON.stringify(CustomLayoutFromJSON.exampleLayout))); @@ -259,7 +258,7 @@ export class CustomLayoutFromJSON { return new Translation(json); } - private static LayoutFromJSON(json: any) { + public static LayoutFromJSON(json: any) { const t = CustomLayoutFromJSON.MaybeTranslation; const layout = new Layout(json.name, [json.language], @@ -274,9 +273,4 @@ export class CustomLayoutFromJSON { return layout; } - - public static TagRenderingOptionsFromJson(spec: any): TagRenderingOptions { - return new TagRenderingOptions(spec); - } - } \ No newline at end of file diff --git a/Customizations/Layers/Widths.ts b/Customizations/Layers/Widths.ts index 8447b9ba2..3a196f695 100644 --- a/Customizations/Layers/Widths.ts +++ b/Customizations/Layers/Widths.ts @@ -1,6 +1,5 @@ import {LayerDefinition} from "../LayerDefinition"; import {And, Not, Or, Tag} from "../../Logic/TagsFilter"; -import {UIEventSource} from "../../UI/UIEventSource"; import {Park} from "./Park"; import {TagRenderingOptions} from "../TagRenderingOptions"; diff --git a/Customizations/Layouts/StreetWidth.ts b/Customizations/Layouts/StreetWidth.ts index bf64236c7..9ae9573e1 100644 --- a/Customizations/Layouts/StreetWidth.ts +++ b/Customizations/Layouts/StreetWidth.ts @@ -1,7 +1,6 @@ import {Layout} from "../Layout"; import * as Layer from "../Layers/Bookcases"; import {Widths} from "../Layers/Widths"; -import {UIEventSource} from "../../UI/UIEventSource"; export class StreetWidth extends Layout{ diff --git a/Customizations/OnlyShowIf.ts b/Customizations/OnlyShowIf.ts index 53811e510..99783ec74 100644 --- a/Customizations/OnlyShowIf.ts +++ b/Customizations/OnlyShowIf.ts @@ -4,7 +4,7 @@ import {TagDependantUIElement, TagDependantUIElementConstructor} from "./UIElementConstructor"; import {TagsFilter, TagUtils} from "../Logic/TagsFilter"; import {UIElement} from "../UI/UIElement"; -import {UIEventSource} from "../UI/UIEventSource"; +import {UIEventSource} from "../Logic/UIEventSource"; import {Changes} from "../Logic/Osm/Changes"; diff --git a/Customizations/Questions/AccessTag.ts b/Customizations/Questions/AccessTag.ts index 7ed7ed05a..866b36f49 100644 --- a/Customizations/Questions/AccessTag.ts +++ b/Customizations/Questions/AccessTag.ts @@ -1,4 +1,3 @@ -import {UIEventSource} from "../../UI/UIEventSource"; import {Changes} from "../../Logic/Osm/Changes"; import {And, Tag} from "../../Logic/TagsFilter"; import {TagRenderingOptions} from "../TagRenderingOptions"; diff --git a/Customizations/Questions/OperatorTag.ts b/Customizations/Questions/OperatorTag.ts index 2d293f7e9..e26440bb3 100644 --- a/Customizations/Questions/OperatorTag.ts +++ b/Customizations/Questions/OperatorTag.ts @@ -1,4 +1,3 @@ -import {UIEventSource} from "../../UI/UIEventSource"; import {Changes} from "../../Logic/Osm/Changes"; import {Tag} from "../../Logic/TagsFilter"; import {TagRenderingOptions} from "../TagRenderingOptions"; diff --git a/Customizations/TagRendering.ts b/Customizations/TagRendering.ts index 5b6eb17bd..6dc136a08 100644 --- a/Customizations/TagRendering.ts +++ b/Customizations/TagRendering.ts @@ -1,5 +1,5 @@ import {UIElement} from "../UI/UIElement"; -import {UIEventSource} from "../UI/UIEventSource"; +import {UIEventSource} from "../Logic/UIEventSource"; import {And, Tag, TagsFilter, TagUtils} from "../Logic/TagsFilter"; import {FixedUiElement} from "../UI/Base/FixedUiElement"; import {SaveButton} from "../UI/SaveButton"; diff --git a/Customizations/TagRenderingOptions.ts b/Customizations/TagRenderingOptions.ts index 7aeb72388..148e20faa 100644 --- a/Customizations/TagRenderingOptions.ts +++ b/Customizations/TagRenderingOptions.ts @@ -4,7 +4,7 @@ import {parsePhoneNumberFromString} from "libphonenumber-js"; import {UIElement} from "../UI/UIElement"; import {TagsFilter, TagUtils} from "../Logic/TagsFilter"; import {OnlyShowIfConstructor} from "./OnlyShowIf"; -import {UIEventSource} from "../UI/UIEventSource"; +import {UIEventSource} from "../Logic/UIEventSource"; export class TagRenderingOptions implements TagDependantUIElementConstructor { diff --git a/Customizations/UIElementConstructor.ts b/Customizations/UIElementConstructor.ts index 0920c129f..f5380cf32 100644 --- a/Customizations/UIElementConstructor.ts +++ b/Customizations/UIElementConstructor.ts @@ -1,5 +1,5 @@ -import {UIEventSource} from "../UI/UIEventSource"; import {UIElement} from "../UI/UIElement"; +import {UIEventSource} from "../Logic/UIEventSource"; export interface Dependencies { diff --git a/Customizations/tsconfig.json b/Customizations/tsconfig.json new file mode 100644 index 000000000..66d328895 --- /dev/null +++ b/Customizations/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "sourceMap": true, + "resolveJsonModule": true, + }, + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/InitUiElements.ts b/InitUiElements.ts index d78213112..a8e0976c1 100644 --- a/InitUiElements.ts +++ b/InitUiElements.ts @@ -6,7 +6,6 @@ import {ShareScreen} from "./UI/ShareScreen"; import {FixedUiElement} from "./UI/Base/FixedUiElement"; import {CheckBox} from "./UI/Input/CheckBox"; import Combine from "./UI/Base/Combine"; -import {UIEventSource} from "./UI/UIEventSource"; import {UIElement} from "./UI/UIElement"; import {MoreScreen} from "./UI/MoreScreen"; import {Tag} from "./Logic/TagsFilter"; @@ -26,7 +25,8 @@ import {CustomLayout} from "./Logic/CustomLayers"; import {Preset} from "./Customizations/LayerDefinition"; import {VariableUiElement} from "./UI/Base/VariableUIElement"; import {LayerUpdater} from "./Logic/LayerUpdater"; -import {QueryParameters} from "./Logic/QueryParameters"; +import {UIEventSource} from "./Logic/UIEventSource"; +import {QueryParameters} from "./Logic/Web/QueryParameters"; export class InitUiElements { diff --git a/Logic/CustomLayersPanel.ts b/Logic/CustomLayersPanel.ts index 087b95e14..e36cc58bd 100644 --- a/Logic/CustomLayersPanel.ts +++ b/Logic/CustomLayersPanel.ts @@ -1,7 +1,7 @@ import {UIElement} from "../UI/UIElement"; import {State} from "../State"; import Translations from "../UI/i18n/Translations"; -import {UIEventSource} from "../UI/UIEventSource"; +import {UIEventSource} from "./UIEventSource"; import {AllKnownLayouts} from "../Customizations/AllKnownLayouts"; import Combine from "../UI/Base/Combine"; import {Img} from "../UI/Img"; diff --git a/Logic/ElementStorage.ts b/Logic/ElementStorage.ts index 368179a94..a8e52f1a3 100644 --- a/Logic/ElementStorage.ts +++ b/Logic/ElementStorage.ts @@ -1,7 +1,7 @@ /** * Keeps track of a dictionary 'elementID' -> element */ -import {UIEventSource} from "../UI/UIEventSource"; +import {UIEventSource} from "./UIEventSource"; export class ElementStorage { diff --git a/Logic/FilteredLayer.ts b/Logic/FilteredLayer.ts index c1406553c..dffbfef77 100644 --- a/Logic/FilteredLayer.ts +++ b/Logic/FilteredLayer.ts @@ -1,5 +1,5 @@ import {TagsFilter, TagUtils} from "./TagsFilter"; -import {UIEventSource} from "../UI/UIEventSource"; +import {UIEventSource} from "./UIEventSource"; import L from "leaflet" import {GeoOperations} from "./GeoOperations"; import {UIElement} from "../UI/UIElement"; diff --git a/Logic/ImageSearcher.ts b/Logic/ImageSearcher.ts index b53a73d82..cd6be2ea0 100644 --- a/Logic/ImageSearcher.ts +++ b/Logic/ImageSearcher.ts @@ -1,11 +1,11 @@ -import {UIEventSource} from "../UI/UIEventSource"; -import {ImagesInCategory, Wikidata, Wikimedia} from "./Wikimedia"; import {WikimediaImage} from "../UI/Image/WikimediaImage"; import {SimpleImageElement} from "../UI/Image/SimpleImageElement"; import {UIElement} from "../UI/UIElement"; import {Changes} from "./Osm/Changes"; import {ImgurImage} from "../UI/Image/ImgurImage"; import {State} from "../State"; +import {ImagesInCategory, Wikidata, Wikimedia} from "./Web/Wikimedia"; +import {UIEventSource} from "./UIEventSource"; /** * There are multiple way to fetch images for an object diff --git a/Logic/LayerUpdater.ts b/Logic/LayerUpdater.ts index dcb510f31..ee2171290 100644 --- a/Logic/LayerUpdater.ts +++ b/Logic/LayerUpdater.ts @@ -1,5 +1,5 @@ import {Or, TagsFilter} from "./TagsFilter"; -import {UIEventSource} from "../UI/UIEventSource"; +import {UIEventSource} from "./UIEventSource"; import {FilteredLayer} from "./FilteredLayer"; import {Bounds} from "./Bounds"; import {Overpass} from "./Osm/Overpass"; diff --git a/Logic/Leaflet/Basemap.ts b/Logic/Leaflet/Basemap.ts index a4ce2bd26..94e70020e 100644 --- a/Logic/Leaflet/Basemap.ts +++ b/Logic/Leaflet/Basemap.ts @@ -1,5 +1,5 @@ import L from "leaflet" -import {UIEventSource} from "../../UI/UIEventSource"; +import {UIEventSource} from "../UIEventSource"; import {UIElement} from "../../UI/UIElement"; diff --git a/Logic/Leaflet/GeoLocationHandler.ts b/Logic/Leaflet/GeoLocationHandler.ts index 413832656..745b3a514 100644 --- a/Logic/Leaflet/GeoLocationHandler.ts +++ b/Logic/Leaflet/GeoLocationHandler.ts @@ -1,5 +1,5 @@ import L from "leaflet"; -import {UIEventSource} from "../../UI/UIEventSource"; +import {UIEventSource} from "../UIEventSource"; import {UIElement} from "../../UI/UIElement"; import {State} from "../../State"; import {Utils} from "../../Utils"; diff --git a/Logic/Leaflet/StrayClickHandler.ts b/Logic/Leaflet/StrayClickHandler.ts index fefc1817d..576c08a07 100644 --- a/Logic/Leaflet/StrayClickHandler.ts +++ b/Logic/Leaflet/StrayClickHandler.ts @@ -1,6 +1,6 @@ import {Basemap} from "./Basemap"; import L from "leaflet"; -import {UIEventSource} from "../../UI/UIEventSource"; +import {UIEventSource} from "../UIEventSource"; import {UIElement} from "../../UI/UIElement"; import {State} from "../../State"; diff --git a/Logic/Osm/Changes.ts b/Logic/Osm/Changes.ts index c967e20a6..75bf40b4d 100644 --- a/Logic/Osm/Changes.ts +++ b/Logic/Osm/Changes.ts @@ -2,7 +2,7 @@ * Handles all changes made to OSM. * Needs an authenticator via OsmConnection */ -import {UIEventSource} from "../../UI/UIEventSource"; +import {UIEventSource} from "../UIEventSource"; import {OsmConnection} from "./OsmConnection"; import {OsmNode, OsmObject} from "./OsmObject"; import {And, Tag, TagsFilter} from "../TagsFilter"; diff --git a/Logic/Osm/OsmConnection.ts b/Logic/Osm/OsmConnection.ts index f8a922e86..db9a504c0 100644 --- a/Logic/Osm/OsmConnection.ts +++ b/Logic/Osm/OsmConnection.ts @@ -1,6 +1,6 @@ // @ts-ignore import osmAuth from "osm-auth"; -import {UIEventSource} from "../../UI/UIEventSource"; +import {UIEventSource} from "../UIEventSource"; import {CustomLayersState} from "../CustomLayersState"; export class UserDetails { diff --git a/Logic/Osm/OsmImageUploadHandler.ts b/Logic/Osm/OsmImageUploadHandler.ts index 935a97c28..b3262d5b0 100644 --- a/Logic/Osm/OsmImageUploadHandler.ts +++ b/Logic/Osm/OsmImageUploadHandler.ts @@ -2,7 +2,7 @@ * Helps in uplaoding, by generating the rigth title, decription and by adding the tag to the changeset */ import {Changes} from "./Changes"; -import {UIEventSource} from "../../UI/UIEventSource"; +import {UIEventSource} from "../UIEventSource"; import {ImageUploadFlow} from "../../UI/ImageUploadFlow"; import {UserDetails} from "./OsmConnection"; import {SlideShow} from "../../UI/SlideShow"; diff --git a/UI/UIEventSource.ts b/Logic/UIEventSource.ts similarity index 100% rename from UI/UIEventSource.ts rename to Logic/UIEventSource.ts diff --git a/Logic/Imgur.ts b/Logic/Web/Imgur.ts similarity index 100% rename from Logic/Imgur.ts rename to Logic/Web/Imgur.ts diff --git a/Logic/LocalStorageSource.ts b/Logic/Web/LocalStorageSource.ts similarity index 90% rename from Logic/LocalStorageSource.ts rename to Logic/Web/LocalStorageSource.ts index f1b589660..ee604c89b 100644 --- a/Logic/LocalStorageSource.ts +++ b/Logic/Web/LocalStorageSource.ts @@ -1,4 +1,4 @@ -import {UIEventSource} from "../UI/UIEventSource"; +import {UIEventSource} from "../UIEventSource"; export class LocalStorageSource { diff --git a/Logic/QueryParameters.ts b/Logic/Web/QueryParameters.ts similarity index 96% rename from Logic/QueryParameters.ts rename to Logic/Web/QueryParameters.ts index b769258cd..279b1c8c6 100644 --- a/Logic/QueryParameters.ts +++ b/Logic/Web/QueryParameters.ts @@ -1,8 +1,7 @@ /** * Wraps the query parameters into UIEventSources */ -import {UIEventSource} from "../UI/UIEventSource"; -import {UIElement} from "../UI/UIElement"; +import {UIEventSource} from "../UIEventSource"; export class QueryParameters { diff --git a/Logic/Wikimedia.ts b/Logic/Web/Wikimedia.ts similarity index 100% rename from Logic/Wikimedia.ts rename to Logic/Web/Wikimedia.ts diff --git a/README.md b/README.md index 6193a6ad9..e6c065d6c 100644 --- a/README.md +++ b/README.md @@ -3,17 +3,19 @@ > Let a thousand flowers bloom -MapComplete attempts to be a webversion of StreetComplete. However, we focus on 'themes', a bit similar as mapcontrib. +MapComplete attempts to be a webversion crossover of StreetComplete and MapContrib. It tries to be just as easy to use as StreetComplete, but it allows to focus on one single theme per instance (e.g. nature, bicycle infrastructure, ...) The design goals of MapComplete are to be: -- Easy to use -- Easy to deploy +- Easy to use, both on web and on mobile +- Easy to deploy (by not having a backand) - Easy to modify -The basic functionality is to download some map features with overpass and then ask certain questions. An answer is sent back to OpenStreetMap. +The basic functionality is to download some map features from Overpass and then ask certain questions. An answer is sent back to directly to OpenStreetMap. -Furthermore, it shows images present in the `image` tag or, if a `wikidata` or `wikimedia_commons`-tag is present, it follows those to get these images too +Furthermore, it shows images present in the `image` tag or, if a `wikidata` or `wikimedia_commons`-tag is present, it follows those to get these images too. + +An explicit non-goal of MapComplete is to modify geometries of ways. Although adding a point to a way or splitting a way in two parts might be added one day. ## Examples diff --git a/State.ts b/State.ts index 734873d0e..4cd5c8290 100644 --- a/State.ts +++ b/State.ts @@ -1,7 +1,4 @@ -import {UIEventSource} from "./UI/UIEventSource"; import {UIElement} from "./UI/UIElement"; -import {QueryParameters} from "./Logic/QueryParameters"; -import {LocalStorageSource} from "./Logic/LocalStorageSource"; import {Layout} from "./Customizations/Layout"; import {Utils} from "./Utils"; import {LayerDefinition, Preset} from "./Customizations/LayerDefinition"; @@ -14,6 +11,9 @@ import Translations from "./UI/i18n/Translations"; import {CustomLayersState} from "./Logic/CustomLayersState"; import {FilteredLayer} from "./Logic/FilteredLayer"; import {LayerUpdater} from "./Logic/LayerUpdater"; +import {UIEventSource} from "./Logic/UIEventSource"; +import {LocalStorageSource} from "./Logic/Web/LocalStorageSource"; +import {QueryParameters} from "./Logic/Web/QueryParameters"; /** * Contains the global state: a bunch of UI-event sources diff --git a/UI/Base/SubtleButton.ts b/UI/Base/SubtleButton.ts index 0234d6acb..b13f1b81a 100644 --- a/UI/Base/SubtleButton.ts +++ b/UI/Base/SubtleButton.ts @@ -1,7 +1,6 @@ import {UIElement} from "../UIElement"; import Translations from "../i18n/Translations"; import Combine from "./Combine"; -import {link} from "fs"; export class SubtleButton extends UIElement{ diff --git a/UI/Base/TabbedComponent.ts b/UI/Base/TabbedComponent.ts index b7a0f96a9..b79f28e12 100644 --- a/UI/Base/TabbedComponent.ts +++ b/UI/Base/TabbedComponent.ts @@ -1,7 +1,6 @@ import {UIElement} from "../UIElement"; -import {UIEventSource} from "../UIEventSource"; import Translations from "../i18n/Translations"; - +import {UIEventSource} from "../../Logic/UIEventSource"; export class TabbedComponent extends UIElement { diff --git a/UI/Base/VariableUIElement.ts b/UI/Base/VariableUIElement.ts index 8afab13b2..3b2474983 100644 --- a/UI/Base/VariableUIElement.ts +++ b/UI/Base/VariableUIElement.ts @@ -1,5 +1,5 @@ import {UIElement} from "../UIElement"; -import {UIEventSource} from "../UIEventSource"; +import {UIEventSource} from "../../Logic/UIEventSource"; export class VariableUiElement extends UIElement { private _html: UIEventSource; diff --git a/UI/CenterMessageBox.ts b/UI/CenterMessageBox.ts index 9656f437c..7f44aa56d 100644 --- a/UI/CenterMessageBox.ts +++ b/UI/CenterMessageBox.ts @@ -1,8 +1,8 @@ import {UIElement} from "./UIElement"; -import {UIEventSource} from "./UIEventSource"; import {OsmConnection} from "../Logic/Osm/OsmConnection"; import Translations from "./i18n/Translations"; import {State} from "../State"; +import {UIEventSource} from "../Logic/UIEventSource"; export class CenterMessageBox extends UIElement { @@ -46,7 +46,6 @@ export class CenterMessageBox extends UIElement { if (State.state.centerMessage.data != "") { pstyle.opacity = "1"; pstyle.pointerEvents = "all"; - State.state.osmConnection.registerActivateOsmAUthenticationClass(); return; } pstyle.pointerEvents = "none"; diff --git a/UI/ConfirmDialog.ts b/UI/ConfirmDialog.ts index a4159f424..79a2b331b 100644 --- a/UI/ConfirmDialog.ts +++ b/UI/ConfirmDialog.ts @@ -1,7 +1,7 @@ import {UIElement} from "./UIElement"; -import {UIEventSource} from "./UIEventSource"; import {FixedUiElement} from "./Base/FixedUiElement"; import {VariableUiElement} from "./Base/VariableUIElement"; +import {UIEventSource} from "../Logic/UIEventSource"; export class ConfirmDialog extends UIElement { diff --git a/UI/CustomThemeGenerator/Preview.ts b/UI/CustomThemeGenerator/Preview.ts new file mode 100644 index 000000000..9b69cc0eb --- /dev/null +++ b/UI/CustomThemeGenerator/Preview.ts @@ -0,0 +1,34 @@ +import {LayoutConfigJson} from "../../Customizations/JSON/CustomLayoutFromJSON"; +import {UIEventSource} from "../../Logic/UIEventSource"; +import {UIElement} from "../UIElement"; +import Combine from "../Base/Combine"; + +export class Preview extends UIElement { + private url: UIEventSource; + private config: UIEventSource; + + constructor(url: UIEventSource, config: UIEventSource) { + super(url); + this.config = config; + this.url = url; + } + + InnerRender(): string { + const url = this.url.data; + return new Combine([ + ``, + '

The above preview is in testmode. Changes will not be sent to OSM, so feel free to add points and answer questions

', + `

Your link

`, + 'Bookmark the link below
', + 'MapComplete has no backend. The entire theme configuration is saved in the following URL. This means that this URL is needed to revive and change your MapComplete instance.
', + `${this.url.data}
`, + '

JSON-configuration

', + 'You can see the configuration in JSON format below.
', + '', + JSON.stringify(this.config.data, null, 2).replace(/\n/g, "
").replace(/ /g, " "), + '
' + + ]).Render(); + } + +} \ No newline at end of file diff --git a/themeGenerator.ts b/UI/CustomThemeGenerator/ThemeGenerator.ts similarity index 59% rename from themeGenerator.ts rename to UI/CustomThemeGenerator/ThemeGenerator.ts index 0152ce44b..de8ab7262 100644 --- a/themeGenerator.ts +++ b/UI/CustomThemeGenerator/ThemeGenerator.ts @@ -1,16 +1,19 @@ -import {UIElement} from "./UI/UIElement"; -import {OsmConnection, UserDetails} from "./Logic/Osm/OsmConnection"; -import {UIEventSource} from "./UI/UIEventSource"; -import Combine from "./UI/Base/Combine"; -import {TextField} from "./UI/Input/TextField"; -import {VariableUiElement} from "./UI/Base/VariableUIElement"; -import {VerticalCombine} from "./UI/Base/VerticalCombine"; -import {FixedUiElement} from "./UI/Base/FixedUiElement"; -import {TabbedComponent} from "./UI/Base/TabbedComponent"; -import {LayerConfigJson, LayoutConfigJson, TagRenderingConfigJson} from "./Customizations/JSON/CustomLayoutFromJSON"; -import {Button} from "./UI/Base/Button"; -import {type} from "os"; -import {Tag} from "./Logic/TagsFilter"; +import {UIElement} from "../UIElement"; +import {VerticalCombine} from "../Base/VerticalCombine"; +import {VariableUiElement} from "../Base/VariableUIElement"; +import Combine from "../Base/Combine"; +import { + LayerConfigJson, + LayoutConfigJson, + TagRenderingConfigJson +} from "../../Customizations/JSON/CustomLayoutFromJSON"; +import {TabbedComponent} from "../Base/TabbedComponent"; +import {UIEventSource} from "../../Logic/UIEventSource"; +import {OsmConnection, UserDetails} from "../../Logic/Osm/OsmConnection"; +import {Button} from "../Base/Button"; +import {FixedUiElement} from "../Base/FixedUiElement"; +import {TextField} from "../Input/TextField"; + function TagsToString(tags: string | string [] | { k: string, v: string }[]) { if (tags === undefined) { @@ -31,27 +34,9 @@ function TagsToString(tags: string | string [] | { k: string, v: string }[]) { return newTags.join(","); } -export class Preview extends UIElement { - private url: UIEventSource; - private config: UIEventSource; - constructor(url: UIEventSource, config: UIEventSource) { - super(url); - this.config = config; - this.url = url; - } +let createFieldUI: (label: string, key: string, root: any, options?: { deflt?: string }) => UIElement; - InnerRender(): string { - const url = this.url.data; - return new Combine([ - ``, - `

Save this link below:

${this.url.data}`, - JSON.stringify(this.config.data, null, 2).replace(/\n/g, "
").replace(/ /g, " "), - - ]).Render(); - } - -} class MappingGenerator extends UIElement { @@ -60,21 +45,19 @@ class MappingGenerator extends UIElement { constructor(fullConfig: UIEventSource, layerConfig: LayerConfigJson, tagRendering: TagRenderingConfigJson, - mapping: { if: string | string[] | { k: string, v: string }[] }, - generateField: (src: UIEventSource, label: string, key: string, root: any, deflt?: string) => UIElement) { + mapping: { if: string | string[] | { k: string, v: string }[] }) { super(undefined); - this.CreateElements(fullConfig, layerConfig, tagRendering, mapping, generateField) + this.CreateElements(fullConfig, layerConfig, tagRendering, mapping) } private CreateElements(fullConfig: UIEventSource, layerConfig: LayerConfigJson, tagRendering: TagRenderingConfigJson, - mapping, - generateField: (src: UIEventSource, label: string, key: string, root: any, deflt?: string) => UIElement) { + mapping) { { const self = this; this.elements = [ - generateField(fullConfig, "If these tags apply", "if", mapping), - generateField(fullConfig, "Then: show this text", "then", mapping), + createFieldUI("If these tags apply", "if", mapping), + createFieldUI("Then: show this text", "then", mapping), new Button("Remove this mapping", () => { for (let i = 0; i < tagRendering.mappings.length; i++) { if (tagRendering.mappings[i] === mapping) { @@ -106,34 +89,32 @@ class TagRenderingGenerator constructor(fullConfig: UIEventSource, layerConfig: LayerConfigJson, tagRendering: TagRenderingConfigJson, - generateField: (src: UIEventSource, label: string, key: string, root: any, deflt?: string) => UIElement, isTitle: boolean = false) { super(undefined); - this.CreateElements(fullConfig, layerConfig, tagRendering, generateField, isTitle) + this.CreateElements(fullConfig, layerConfig, tagRendering, isTitle) } - private CreateElements(fullConfig: UIEventSource, layerConfig: LayerConfigJson, tagRendering: TagRenderingConfigJson, generateField: (src: UIEventSource, label: string, key: string, root: any, deflt?: string) => UIElement, isTitle: boolean) { + private CreateElements(fullConfig: UIEventSource, layerConfig: LayerConfigJson, tagRendering: TagRenderingConfigJson, isTitle: boolean) { const self = this; this.elements = [ new FixedUiElement(isTitle ? "

Popup title

" : "

TagRendering/TagQuestion

"), - generateField(fullConfig, "Key", "key", tagRendering), - generateField(fullConfig, "Rendering", "render", tagRendering), - generateField(fullConfig, "Type", "type", tagRendering), - generateField(fullConfig, "Question", "question", tagRendering), - generateField(fullConfig, "Extra tags", "addExtraTags", tagRendering), + createFieldUI("Key", "key", tagRendering), + createFieldUI("Rendering", "render", tagRendering), + createFieldUI("Type", "type", tagRendering), + createFieldUI("Question", "question", tagRendering), + createFieldUI("Extra tags", "addExtraTags", tagRendering), ...(tagRendering.mappings ?? []).map((mapping) => { - return new MappingGenerator(fullConfig, layerConfig, tagRendering, mapping, - generateField) + return new MappingGenerator(fullConfig, layerConfig, tagRendering, mapping) }), new Button("Add mapping", () => { - if(tagRendering.mappings === undefined){ + if (tagRendering.mappings === undefined) { tagRendering.mappings = [] } tagRendering.mappings.push({if: "", then: ""}); - self.CreateElements(fullConfig, layerConfig, tagRendering, generateField, isTitle); + self.CreateElements(fullConfig, layerConfig, tagRendering, isTitle); self.Update(); }) @@ -169,16 +150,15 @@ class PresetGenerator extends UIElement { private elements: UIElement[]; constructor(fullConfig: UIEventSource, layerConfig: LayerConfigJson, - preset0: { title?: string, description?: string, icon?: string, tags?: string | string[] | { k: string, v: string }[] }, - generateField: (src: UIEventSource, label: string, key: string, root: any, deflt?: string) => UIElement) { + preset0: { title?: string, description?: string, icon?: string, tags?: string | string[] | { k: string, v: string }[] }) { super(undefined); const self = this; this.elements = [ new FixedUiElement("

Preset

"), - generateField(fullConfig, "Title", "title", preset0), - generateField(fullConfig, "Description", "description", preset0, layerConfig.description), - generateField(fullConfig, "icon", "icon", preset0, layerConfig.icon), - generateField(fullConfig, "tags", "tags", preset0, TagsToString(layerConfig.overpassTags)), + createFieldUI("Title", "title", preset0), + createFieldUI("Description", "description", preset0, {deflt: layerConfig.description}), + createFieldUI("icon", "icon", preset0, {deflt: layerConfig.icon}), + createFieldUI("tags", "tags", preset0, {deflt: TagsToString(layerConfig.overpassTags)}), new Button("Remove this preset", () => { for (let i = 0; i < layerConfig.presets.length; i++) { if (layerConfig.presets[i] === preset0) { @@ -210,25 +190,24 @@ class LayerGenerator extends UIElement { private uielements: UIElement[]; constructor(fullConfig: UIEventSource, - layerConfig: LayerConfigJson, - generateField: ((src: UIEventSource, label: string, key: string, root: any, deflt?: string) => UIElement)) { + layerConfig: LayerConfigJson) { super(undefined); this.layerConfig = new UIEventSource(layerConfig); this.fullConfig = fullConfig; - this.CreateElements(fullConfig, layerConfig, generateField) + this.CreateElements(fullConfig, layerConfig) } - private CreateElements(fullConfig: UIEventSource, layerConfig: LayerConfigJson, generateField: (src: UIEventSource, label: string, key: string, root: any, deflt?: string) => UIElement) { + private CreateElements(fullConfig: UIEventSource, layerConfig: LayerConfigJson) { const self = this; this.uielements = [ - generateField(fullConfig, "The name of this layer", "id", layerConfig), - generateField(fullConfig, "A description of objects for this layer", "description", layerConfig), - generateField(fullConfig, "The icon of this layer, either a URL or a base64-encoded svg", "icon", layerConfig), - generateField(fullConfig, "The default stroke color", "color", layerConfig), - generateField(fullConfig, "The minimal needed zoom to start loading", "minzoom", layerConfig), - generateField(fullConfig, "The tags to load from overpass", "overpassTags", layerConfig), - ...layerConfig.presets.map(preset => new PresetGenerator(fullConfig, layerConfig, preset, generateField)), + createFieldUI("The name of this layer", "id", layerConfig), + createFieldUI("A description of objects for this layer", "description", layerConfig), + createFieldUI("The icon of this layer, either a URL or a base64-encoded svg", "icon", layerConfig), + createFieldUI("The default stroke color", "color", layerConfig), + createFieldUI("The minimal needed zoom to start loading", "minzoom", layerConfig), + createFieldUI("The tags to load from overpass", "overpassTags", layerConfig), + ...layerConfig.presets.map(preset => new PresetGenerator(fullConfig, layerConfig, preset)), new Button("Add a preset", () => { layerConfig.presets.push({ icon: undefined, @@ -236,7 +215,7 @@ class LayerGenerator extends UIElement { description: "", tags: TagsToString(layerConfig.overpassTags) }); - self.CreateElements(fullConfig, layerConfig, generateField); + self.CreateElements(fullConfig, layerConfig); self.Update(); }), new TagRenderingGenerator(fullConfig, layerConfig, layerConfig.title ?? { @@ -246,8 +225,8 @@ class LayerGenerator extends UIElement { question: "", render: "Title", type: "text" - }, generateField, true), - ...layerConfig.tagRenderings.map(tr => new TagRenderingGenerator(fullConfig, layerConfig, tr, generateField)), + }, true), + ...layerConfig.tagRenderings.map(tr => new TagRenderingGenerator(fullConfig, layerConfig, tr)), new Button("Add a tag rendering", () => { layerConfig.tagRenderings.push({ key: "", @@ -257,7 +236,7 @@ class LayerGenerator extends UIElement { render: "", type: "text" }); - self.CreateElements(fullConfig, layerConfig, generateField); + self.CreateElements(fullConfig, layerConfig); self.Update(); }), @@ -274,11 +253,9 @@ class AllLayerComponent extends UIElement { private tabs: TabbedComponent; private config: UIEventSource; - private generateField: ((src: UIEventSource, label: string, key: string, root: any, deflt?: string) => UIElement); - constructor(config: UIEventSource, generateField: ((src: UIEventSource, label: string, key: string, root: any, deflt?: string) => UIElement)) { + constructor(config: UIEventSource) { super(undefined); - this.generateField = generateField; this.config = config; const self = this; let previousLayerAmount = config.data.layers.length; @@ -302,7 +279,7 @@ class AllLayerComponent extends UIElement { }); layerPanes.push({ header: new VariableUiElement(header), - content: new LayerGenerator(config, layer, this.generateField) + content: new LayerGenerator(config, layer) }) } @@ -360,53 +337,54 @@ export class ThemeGenerator extends UIElement { const jsonObjectRoot = this.themeObject.data; const base64 = this.themeObject.map(JSON.stringify).map(btoa); - this.url = base64.map((data) => `https://pietervdvn.github.io/MapComplete/index.html?userlayout=true#` + data); + this.url = base64.map((data) => `https://pietervdvn.github.io/MapComplete/index.html?test=true&userlayout=true#` + data); const self = this; - this.allQuestionFields = [ - this.JsonField(this.themeObject, "Name of this theme", "name", jsonObjectRoot), - this.JsonField(this.themeObject, "Title (shown in the window and in the welcome message)", "title", jsonObjectRoot), - this.JsonField(this.themeObject, "Description (shown in the welcome message and various other places)", "description", jsonObjectRoot), - this.JsonField(this.themeObject, "The supported language", "language", jsonObjectRoot), - this.JsonField(this.themeObject, "startLat", "startLat", jsonObjectRoot), - this.JsonField(this.themeObject, "startLon", "startLon", jsonObjectRoot), - this.JsonField(this.themeObject, "startzoom", "startZoom", jsonObjectRoot), - this.JsonField(this.themeObject, "icon: either a URL to an image file, a relative url to a MapComplete asset ('./asset/help.svg') or a base64-encoded value (including 'data:image/svg+xml;base64,'", "icon", jsonObjectRoot, "./assets/bug.svg"), - new AllLayerComponent(this.themeObject, self.JsonField) + createFieldUI = (label, key, root, options) => { + + const value = new UIEventSource(TagsToString(root[key]) ?? options?.deflt); + value.addCallback((v) => { + root[key] = v; + self.themeObject.ping(); // We assume the root is a part of the themeObject + }) + return new Combine([ + label, + new TextField({ + fromString: (str) => str, + toString: (str) => str, + value: value + })]); + } + + this.allQuestionFields = [ + createFieldUI("Name of this theme", "name", jsonObjectRoot), + createFieldUI("Title (shown in the window and in the welcome message)", "title", jsonObjectRoot), + createFieldUI("Description (shown in the welcome message and various other places)", "description", jsonObjectRoot), + createFieldUI("The supported language", "language", jsonObjectRoot), + createFieldUI("startLat", "startLat", jsonObjectRoot), + createFieldUI("startLon", "startLon", jsonObjectRoot), + createFieldUI("startzoom", "startZoom", jsonObjectRoot), + createFieldUI("icon: either a URL to an image file, a relative url to a MapComplete asset ('./asset/help.svg') or a base64-encoded value (including 'data:image/svg+xml;base64,'", "icon", jsonObjectRoot, {deflt: "./assets/bug.svg"}), + + new AllLayerComponent(this.themeObject) ] } - - private JsonField(themeObject: UIEventSource, label: string, key: string, root: any, deflt: string = "") { - const value = new UIEventSource(TagsToString(root[key]) ?? deflt); - value.addCallback((v) => { - root[key] = v; - themeObject.ping(); // We assume the root is a part of the themeObject - }) - return new Combine([ - label, - new TextField({ - fromString: (str) => str, - toString: (str) => str, - value: value - })]); - } - InnerRender(): string { if (!this.userDetails.data.loggedIn) { - return "Not logged in" + return "Not logged in. You need to be logged in to create a theme." } if (this.userDetails.data.csCount < 500) { - return "You need at least 500 changesets to create your own theme"; + return "You need at least 500 changesets to create your own theme."; } return new VerticalCombine([ // new VariableUiElement(this.themeObject.map(JSON.stringify)), - new VariableUiElement(this.url.map((url) => `Current URL: Click here to open`)), + // new VariableUiElement(this.url.map((url) => `Current URL: Click here to open`)), ...this.allQuestionFields, ]).Render(); } diff --git a/UI/FeatureInfoBox.ts b/UI/FeatureInfoBox.ts index a1d8690da..26b4e2d5b 100644 --- a/UI/FeatureInfoBox.ts +++ b/UI/FeatureInfoBox.ts @@ -1,5 +1,4 @@ import {UIElement} from "./UIElement"; -import {UIEventSource} from "./UIEventSource"; import {ImageCarousel} from "./Image/ImageCarousel"; import {VerticalCombine} from "./Base/VerticalCombine"; import {OsmLink} from "../Customizations/Questions/OsmLink"; diff --git a/UI/FullScreenMessageBoxHandler.ts b/UI/FullScreenMessageBoxHandler.ts index 1f0a97b7c..b7f09f18b 100644 --- a/UI/FullScreenMessageBoxHandler.ts +++ b/UI/FullScreenMessageBoxHandler.ts @@ -1,8 +1,8 @@ -import {UIEventSource} from "./UIEventSource"; import {UIElement} from "./UIElement"; import {VariableUiElement} from "./Base/VariableUIElement"; import Translations from "./i18n/Translations"; import {State} from "../State"; +import {UIEventSource} from "../Logic/UIEventSource"; /** * Handles the full screen popup on mobile diff --git a/UI/Image/ImageCarousel.ts b/UI/Image/ImageCarousel.ts index dc2033c6f..0f9f19c4a 100644 --- a/UI/Image/ImageCarousel.ts +++ b/UI/Image/ImageCarousel.ts @@ -1,16 +1,15 @@ import {UIElement} from "../UIElement"; import {ImageSearcher} from "../../Logic/ImageSearcher"; -import {UIEventSource} from "../UIEventSource"; import {SlideShow} from "../SlideShow"; import {FixedUiElement} from "../Base/FixedUiElement"; import {VariableUiElement} from "../Base/VariableUIElement"; import {ConfirmDialog} from "../ConfirmDialog"; +import {UIEventSource} from "../../Logic/UIEventSource"; import { Dependencies, TagDependantUIElement, TagDependantUIElementConstructor } from "../../Customizations/UIElementConstructor"; -import {Changes} from "../../Logic/Osm/Changes"; import {State} from "../../State"; export class ImageCarouselConstructor implements TagDependantUIElementConstructor{ diff --git a/UI/Image/ImgurImage.ts b/UI/Image/ImgurImage.ts index 01dd4798a..e54ab8cb6 100644 --- a/UI/Image/ImgurImage.ts +++ b/UI/Image/ImgurImage.ts @@ -1,7 +1,7 @@ -import {UIEventSource} from "../UIEventSource"; import {UIElement} from "../UIElement"; -import {LicenseInfo} from "../../Logic/Wikimedia"; -import {Imgur} from "../../Logic/Imgur"; +import {UIEventSource} from "../../Logic/UIEventSource"; +import {LicenseInfo} from "../../Logic/Web/Wikimedia"; +import {Imgur} from "../../Logic/Web/Imgur"; export class ImgurImage extends UIElement { diff --git a/UI/Image/SimpleImageElement.ts b/UI/Image/SimpleImageElement.ts index 1509ac18c..c17f0fa49 100644 --- a/UI/Image/SimpleImageElement.ts +++ b/UI/Image/SimpleImageElement.ts @@ -1,5 +1,5 @@ import {UIElement} from "../UIElement"; -import {UIEventSource} from "../UIEventSource"; +import {UIEventSource} from "../../Logic/UIEventSource"; export class SimpleImageElement extends UIElement { diff --git a/UI/Image/WikimediaImage.ts b/UI/Image/WikimediaImage.ts index ed71b3c2e..6354716c5 100644 --- a/UI/Image/WikimediaImage.ts +++ b/UI/Image/WikimediaImage.ts @@ -1,6 +1,6 @@ -import {UIEventSource} from "../UIEventSource"; import {UIElement} from "../UIElement"; -import {LicenseInfo, Wikimedia} from "../../Logic/Wikimedia"; +import {LicenseInfo, Wikimedia} from "../../Logic/Web/Wikimedia"; +import {UIEventSource} from "../../Logic/UIEventSource"; export class WikimediaImage extends UIElement { diff --git a/UI/ImageUploadFlow.ts b/UI/ImageUploadFlow.ts index 7f1b3401e..1852381e4 100644 --- a/UI/ImageUploadFlow.ts +++ b/UI/ImageUploadFlow.ts @@ -1,7 +1,5 @@ import {UIElement} from "./UIElement"; -import {UIEventSource} from "./UIEventSource"; import $ from "jquery" -import {Imgur} from "../Logic/Imgur"; import {UserDetails} from "../Logic/Osm/OsmConnection"; import {DropDown} from "./Input/DropDown"; import {VariableUiElement} from "./Base/VariableUIElement"; @@ -10,6 +8,8 @@ import {fail} from "assert"; import Combine from "./Base/Combine"; import {VerticalCombine} from "./Base/VerticalCombine"; import {State} from "../State"; +import {UIEventSource} from "../Logic/UIEventSource"; +import {Imgur} from "../Logic/Web/Imgur"; export class ImageUploadFlow extends UIElement { private _licensePicker: UIElement; diff --git a/UI/Input/CheckBox.ts b/UI/Input/CheckBox.ts index f2da2e7bb..20357e6b5 100644 --- a/UI/Input/CheckBox.ts +++ b/UI/Input/CheckBox.ts @@ -1,9 +1,7 @@ import {UIElement} from "../UIElement"; -import {UIEventSource} from "../UIEventSource"; import { FilteredLayer } from "../../Logic/FilteredLayer"; import Translations from "../../UI/i18n/Translations"; -import instantiate = WebAssembly.instantiate; - +import {UIEventSource} from "../../Logic/UIEventSource"; export class CheckBox extends UIElement{ public readonly isEnabled: UIEventSource; diff --git a/UI/Input/DropDown.ts b/UI/Input/DropDown.ts index 7e0db2aa6..3d71c0ccf 100644 --- a/UI/Input/DropDown.ts +++ b/UI/Input/DropDown.ts @@ -1,9 +1,7 @@ -import {UIEventSource} from "../UIEventSource"; import {UIElement} from "../UIElement"; import {InputElement} from "./InputElement"; -import instantiate = WebAssembly.instantiate; -import {FixedUiElement} from "../Base/FixedUiElement"; import Translations from "../i18n/Translations"; +import {UIEventSource} from "../../Logic/UIEventSource"; export class DropDown extends InputElement { diff --git a/UI/Input/FixedInputElement.ts b/UI/Input/FixedInputElement.ts index 0cada259e..8ce465748 100644 --- a/UI/Input/FixedInputElement.ts +++ b/UI/Input/FixedInputElement.ts @@ -1,8 +1,7 @@ import {InputElement} from "./InputElement"; -import {UIEventSource} from "../UIEventSource"; import {UIElement} from "../UIElement"; import {FixedUiElement} from "../Base/FixedUiElement"; - +import {UIEventSource} from "../../Logic/UIEventSource"; export class FixedInputElement extends InputElement { private rendering: UIElement; diff --git a/UI/Input/InputElement.ts b/UI/Input/InputElement.ts index f1e4bb7f1..e9f750797 100644 --- a/UI/Input/InputElement.ts +++ b/UI/Input/InputElement.ts @@ -1,7 +1,6 @@ import {UIElement} from "../UIElement"; -import {UIEventSource} from "../UIEventSource"; import {FixedUiElement} from "../Base/FixedUiElement"; - +import {UIEventSource} from "../../Logic/UIEventSource"; export abstract class InputElement extends UIElement{ abstract GetValue() : UIEventSource; diff --git a/UI/Input/InputElementWrapper.ts b/UI/Input/InputElementWrapper.ts index 60f7416ff..7128a961a 100644 --- a/UI/Input/InputElementWrapper.ts +++ b/UI/Input/InputElementWrapper.ts @@ -1,9 +1,8 @@ import {InputElement} from "./InputElement"; -import {UIEventSource} from "../UIEventSource"; import {UIElement} from "../UIElement"; import {FixedUiElement} from "../Base/FixedUiElement"; import Translations from "../i18n/Translations"; - +import {UIEventSource} from "../../Logic/UIEventSource"; export class InputElementWrapper extends InputElement{ private pre: UIElement ; diff --git a/UI/Input/RadioButton.ts b/UI/Input/RadioButton.ts index 8d8b5cc5e..1338af502 100644 --- a/UI/Input/RadioButton.ts +++ b/UI/Input/RadioButton.ts @@ -1,6 +1,5 @@ -import {UIElement} from "../UIElement"; -import {UIEventSource} from "../UIEventSource"; import {InputElement} from "./InputElement"; +import {UIEventSource} from "../../Logic/UIEventSource"; export class RadioButton extends InputElement { diff --git a/UI/Input/TextField.ts b/UI/Input/TextField.ts index 4074ee526..140216c8c 100644 --- a/UI/Input/TextField.ts +++ b/UI/Input/TextField.ts @@ -1,8 +1,7 @@ import {UIElement} from "../UIElement"; -import {UIEventSource} from "../UIEventSource"; import {InputElement} from "./InputElement"; import Translations from "../i18n/Translations"; - +import {UIEventSource} from "../../Logic/UIEventSource"; export class TextField extends InputElement { diff --git a/UI/MoreScreen.ts b/UI/MoreScreen.ts index c876d7474..66d071d2c 100644 --- a/UI/MoreScreen.ts +++ b/UI/MoreScreen.ts @@ -62,8 +62,7 @@ export class MoreScreen extends UIElement { tr.intro, tr.requestATheme, new VerticalCombine(els), - tr.streetcomplete, - new FixedUiElement(State.vNumber) + tr.streetcomplete ]).Render(); } diff --git a/UI/PendingChanges.ts b/UI/PendingChanges.ts index 1c6c981e2..68f114be6 100644 --- a/UI/PendingChanges.ts +++ b/UI/PendingChanges.ts @@ -1,7 +1,6 @@ import {UIElement} from "./UIElement"; -import {UIEventSource} from "./UIEventSource"; -import {Changes} from "../Logic/Osm/Changes"; import {State} from "../State"; +import {UIEventSource} from "../Logic/UIEventSource"; export class PendingChanges extends UIElement { private _pendingChangesCount: UIEventSource; diff --git a/UI/SaveButton.ts b/UI/SaveButton.ts index a2728c41f..a9b9b7e3f 100644 --- a/UI/SaveButton.ts +++ b/UI/SaveButton.ts @@ -1,6 +1,6 @@ -import {UIEventSource} from "./UIEventSource"; import {UIElement} from "./UIElement"; import Translations from "./i18n/Translations"; +import {UIEventSource} from "../Logic/UIEventSource"; export class SaveButton extends UIElement { private _value: UIEventSource; diff --git a/UI/SearchAndGo.ts b/UI/SearchAndGo.ts index 23d9ee504..56ffdaea1 100644 --- a/UI/SearchAndGo.ts +++ b/UI/SearchAndGo.ts @@ -1,5 +1,4 @@ import Locale from "./i18n/Locale"; -import {UIEventSource} from "./UIEventSource"; import {UIElement} from "./UIElement"; import Translation from "./i18n/Translation"; import {VariableUiElement} from "./Base/VariableUIElement"; @@ -7,9 +6,9 @@ import {FixedUiElement} from "./Base/FixedUiElement"; import {TextField} from "./Input/TextField"; import {Geocoding} from "../Logic/Osm/Geocoding"; import Translations from "./i18n/Translations"; -import {Basemap} from "../Logic/Leaflet/Basemap"; import {State} from "../State"; +import {UIEventSource} from "../Logic/UIEventSource"; export class SearchAndGo extends UIElement { diff --git a/UI/ShareScreen.ts b/UI/ShareScreen.ts index 97a69ea79..831c7f337 100644 --- a/UI/ShareScreen.ts +++ b/UI/ShareScreen.ts @@ -1,18 +1,16 @@ import {UIElement} from "./UIElement"; -import {Layout} from "../Customizations/Layout"; import Translations from "./i18n/Translations"; import {FixedUiElement} from "./Base/FixedUiElement"; import Combine from "./Base/Combine"; import {VariableUiElement} from "./Base/VariableUIElement"; -import {UIEventSource} from "./UIEventSource"; import {CheckBox} from "./Input/CheckBox"; import {VerticalCombine} from "./Base/VerticalCombine"; -import {QueryParameters} from "../Logic/QueryParameters"; import {Img} from "./Img"; import {State} from "../State"; import {Basemap} from "../Logic/Leaflet/Basemap"; import {FilteredLayer} from "../Logic/FilteredLayer"; import {Utils} from "../Utils"; +import {UIEventSource} from "../Logic/UIEventSource"; export class ShareScreen extends UIElement { @@ -147,7 +145,7 @@ export class ShareScreen extends UIElement { this._iframeCode = new VariableUiElement( url.map((url) => { return ` - <iframe src="${url}" width="100%" height="100%" title="${layout.name} with MapComplete"></iframe> + <iframe src="${url}" width="100%" height="100%" title="${layout.title.InnerRender()} with MapComplete"></iframe> ` }) ); diff --git a/UI/SimpleAddUI.ts b/UI/SimpleAddUI.ts index eb63c05fc..8d1b8985d 100644 --- a/UI/SimpleAddUI.ts +++ b/UI/SimpleAddUI.ts @@ -1,18 +1,13 @@ import {UIElement} from "./UIElement"; -import {UIEventSource} from "./UIEventSource"; import {Tag} from "../Logic/TagsFilter"; import {FilteredLayer} from "../Logic/FilteredLayer"; -import {FixedUiElement} from "./Base/FixedUiElement"; -import {Button} from "./Base/Button"; import Translations from "./i18n/Translations"; import Combine from "./Base/Combine"; import {SubtleButton} from "./Base/SubtleButton"; -import {VerticalCombine} from "./Base/VerticalCombine"; import Locale from "./i18n/Locale"; -import {Changes} from "../Logic/Osm/Changes"; -import {UserDetails} from "../Logic/Osm/OsmConnection"; import {State} from "../State"; +import {UIEventSource} from "../Logic/UIEventSource"; /** * Asks to add a feature at the last clicked location, at least if zoom is sufficient diff --git a/UI/SlideShow.ts b/UI/SlideShow.ts index 254c03a9f..c6fc1bf4d 100644 --- a/UI/SlideShow.ts +++ b/UI/SlideShow.ts @@ -1,6 +1,6 @@ import {UIElement} from "./UIElement"; -import {UIEventSource} from "./UIEventSource"; import {FixedUiElement} from "./Base/FixedUiElement"; +import {UIEventSource} from "../Logic/UIEventSource"; export class SlideShow extends UIElement { diff --git a/UI/UIElement.ts b/UI/UIElement.ts index 96016b834..6df394a5d 100644 --- a/UI/UIElement.ts +++ b/UI/UIElement.ts @@ -1,5 +1,4 @@ -import {UIEventSource} from "./UIEventSource"; -import {TagDependantUIElement} from "../Customizations/UIElementConstructor"; +import {UIEventSource} from "../Logic/UIEventSource"; export abstract class UIElement extends UIEventSource{ @@ -11,7 +10,11 @@ export abstract class UIElement extends UIEventSource{ private _hideIfEmpty = false; - // WOrkaround as document is not defined + /** + * In the 'deploy'-step, some code needs to be run by ts-node. + * However, ts-node crashes when it sees 'document'. When running from console, we flag this and disable all code where document is needed. + * This is a workaround and yet another hack + */ public static runningFromConsole = false; protected constructor(source: UIEventSource) { diff --git a/UI/UserBadge.ts b/UI/UserBadge.ts index 757cc440a..07c077a11 100644 --- a/UI/UserBadge.ts +++ b/UI/UserBadge.ts @@ -5,11 +5,11 @@ import {FixedUiElement} from "./Base/FixedUiElement"; import {VariableUiElement} from "./Base/VariableUIElement"; import Translations from "./i18n/Translations"; import {UserDetails} from "../Logic/Osm/OsmConnection"; -import {Basemap} from "../Logic/Leaflet/Basemap"; import {State} from "../State"; import {PendingChanges} from "./PendingChanges"; -import Locale from "./i18n/Locale"; import {Utils} from "../Utils"; +// @ts-ignore +import {UIEventSource} from "../Logic/UIEventSource"; /** * Handles and updates the user badge diff --git a/UI/WelcomeMessage.ts b/UI/WelcomeMessage.ts index 1f1529e13..0263cfef6 100644 --- a/UI/WelcomeMessage.ts +++ b/UI/WelcomeMessage.ts @@ -1,5 +1,4 @@ import {UIElement} from "../UI/UIElement"; -import {UIEventSource} from "../UI/UIEventSource"; import {OsmConnection, UserDetails} from "../Logic/Osm/OsmConnection"; import Locale from "../UI/i18n/Locale"; import {State} from "../State"; @@ -7,6 +6,8 @@ import {Layout} from "../Customizations/Layout"; import Translations from "./i18n/Translations"; import {VariableUiElement} from "./Base/VariableUIElement"; import {Utils} from "../Utils"; +import {UIEventSource} from "../Logic/UIEventSource"; + export class WelcomeMessage extends UIElement { private readonly layout: Layout; diff --git a/UI/i18n/Locale.ts b/UI/i18n/Locale.ts index 9a40fb323..1b4a34384 100644 --- a/UI/i18n/Locale.ts +++ b/UI/i18n/Locale.ts @@ -1,6 +1,6 @@ -import {UIEventSource} from "../UIEventSource"; -import {LocalStorageSource} from "../../Logic/LocalStorageSource"; +import {UIEventSource} from "../../Logic/UIEventSource"; import {UIElement} from "../UIElement"; +import {LocalStorageSource} from "../../Logic/Web/LocalStorageSource"; export default class Locale { diff --git a/assets/themes/bookcases/Bookcases.json b/assets/themes/bookcases/Bookcases.json new file mode 100644 index 000000000..4df83324d --- /dev/null +++ b/assets/themes/bookcases/Bookcases.json @@ -0,0 +1,67 @@ +{ + "layers": [ + { + "id": "bookcases", + "title": { + "render": "Bookcase" + }, + "icon": "./assets/themes/bookcases/bookcase.svg", + "color": "#000000", + "description": "A public bookcase", + "minzoom": "12", + "overpassTags": "amenity=public_bookcase", + "presets": [ + { + "title": "Bookcase", + "description": "A bookcase is a small cabinet where everyone can take or leave a book", + "icon": "./assets/bookcase.svg", + "tags": "amenity=public_bookcase" + } + ], + "tagRenderings": [ + { + "key": "brand", + "addExtraTags": "", + "mappings": [ + { + "if": "brand=Little Free Library", + "then": "Part of the network Little Free Library" + } + ], + "question": "Is this bookcase part of a network?", + "render": "Part of {brand}", + "type": "text" + }, + { + "key": "", + "addExtraTags": "", + "mappings": [ + { + "if": "books=children", + "then": "Mainly books for kids" + }, + { + "if": "books=adult", + "then": "Mainly books for adults" + }, + { + "if": "books=adult;children", + "then": "Books for both adults and children" + } + ], + "question": "Which books can be found here?", + "render": "", + "type": "text" + } + ] + } + ], + "icon": "./assets/bookcase.svg", + "name": "bookcases", + "title": "Bookcases", + "description": "Welcome to open Bookcase Map", + "language": "en", + "startLat": "0", + "startLon": "0", + "startZoom": "12" +} \ No newline at end of file diff --git a/assets/themes/bookcases/bookcase.svg b/assets/themes/bookcases/bookcase.svg new file mode 100644 index 000000000..d6feeeb74 --- /dev/null +++ b/assets/themes/bookcases/bookcase.svg @@ -0,0 +1,73 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/assets/walkbybrussels/artwork.svg b/assets/walkbybrussels/artwork.svg deleted file mode 100644 index fba5612f6..000000000 --- a/assets/walkbybrussels/artwork.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/bench_black.svg b/assets/walkbybrussels/bench_black.svg deleted file mode 100644 index e13b399d1..000000000 --- a/assets/walkbybrussels/bench_black.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/building.svg b/assets/walkbybrussels/building.svg deleted file mode 100644 index 333d222a0..000000000 --- a/assets/walkbybrussels/building.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - diff --git a/assets/walkbybrussels/bus_black.svg b/assets/walkbybrussels/bus_black.svg deleted file mode 100644 index 4b19aef52..000000000 --- a/assets/walkbybrussels/bus_black.svg +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-02.svg b/assets/walkbybrussels/icons_wbb-02.svg deleted file mode 100644 index 56d7eb4fc..000000000 --- a/assets/walkbybrussels/icons_wbb-02.svg +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-03.svg b/assets/walkbybrussels/icons_wbb-03.svg deleted file mode 100644 index 333d222a0..000000000 --- a/assets/walkbybrussels/icons_wbb-03.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-04.svg b/assets/walkbybrussels/icons_wbb-04.svg deleted file mode 100644 index a0f490e49..000000000 --- a/assets/walkbybrussels/icons_wbb-04.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-05.svg b/assets/walkbybrussels/icons_wbb-05.svg deleted file mode 100644 index 2d2d57d82..000000000 --- a/assets/walkbybrussels/icons_wbb-05.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-06.svg b/assets/walkbybrussels/icons_wbb-06.svg deleted file mode 100644 index ad76c80ee..000000000 --- a/assets/walkbybrussels/icons_wbb-06.svg +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-07.svg b/assets/walkbybrussels/icons_wbb-07.svg deleted file mode 100644 index 6ffdd62a4..000000000 --- a/assets/walkbybrussels/icons_wbb-07.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-08.svg b/assets/walkbybrussels/icons_wbb-08.svg deleted file mode 100644 index a9fa40301..000000000 --- a/assets/walkbybrussels/icons_wbb-08.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-09.svg b/assets/walkbybrussels/icons_wbb-09.svg deleted file mode 100644 index ae5f0fb6e..000000000 --- a/assets/walkbybrussels/icons_wbb-09.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-10.svg b/assets/walkbybrussels/icons_wbb-10.svg deleted file mode 100644 index 8eba3245e..000000000 --- a/assets/walkbybrussels/icons_wbb-10.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-11.svg b/assets/walkbybrussels/icons_wbb-11.svg deleted file mode 100644 index 3023f6a6b..000000000 --- a/assets/walkbybrussels/icons_wbb-11.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-12.svg b/assets/walkbybrussels/icons_wbb-12.svg deleted file mode 100644 index 46d447f3d..000000000 --- a/assets/walkbybrussels/icons_wbb-12.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-13.svg b/assets/walkbybrussels/icons_wbb-13.svg deleted file mode 100644 index ac73497a6..000000000 --- a/assets/walkbybrussels/icons_wbb-13.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-14.svg b/assets/walkbybrussels/icons_wbb-14.svg deleted file mode 100644 index aa08bad59..000000000 --- a/assets/walkbybrussels/icons_wbb-14.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-15.svg b/assets/walkbybrussels/icons_wbb-15.svg deleted file mode 100644 index 03964b8c3..000000000 --- a/assets/walkbybrussels/icons_wbb-15.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-16.svg b/assets/walkbybrussels/icons_wbb-16.svg deleted file mode 100644 index 773759e06..000000000 --- a/assets/walkbybrussels/icons_wbb-16.svg +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-17.svg b/assets/walkbybrussels/icons_wbb-17.svg deleted file mode 100644 index 94a9ac144..000000000 --- a/assets/walkbybrussels/icons_wbb-17.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-18.svg b/assets/walkbybrussels/icons_wbb-18.svg deleted file mode 100644 index 273cf422f..000000000 --- a/assets/walkbybrussels/icons_wbb-18.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-19.svg b/assets/walkbybrussels/icons_wbb-19.svg deleted file mode 100644 index b5302e68c..000000000 --- a/assets/walkbybrussels/icons_wbb-19.svg +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb-20.svg b/assets/walkbybrussels/icons_wbb-20.svg deleted file mode 100644 index 34b8da898..000000000 --- a/assets/walkbybrussels/icons_wbb-20.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - diff --git a/assets/walkbybrussels/icons_wbb_Tekengebied 1.svg b/assets/walkbybrussels/icons_wbb_Tekengebied 1.svg deleted file mode 100644 index fba5612f6..000000000 --- a/assets/walkbybrussels/icons_wbb_Tekengebied 1.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/park.svg b/assets/walkbybrussels/park.svg deleted file mode 100644 index 2d2d57d82..000000000 --- a/assets/walkbybrussels/park.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - diff --git a/assets/walkbybrussels/playground_black.svg b/assets/walkbybrussels/playground_black.svg deleted file mode 100644 index 19d7ad715..000000000 --- a/assets/walkbybrussels/playground_black.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/streetart.svg b/assets/walkbybrussels/streetart.svg deleted file mode 100644 index 56d7eb4fc..000000000 --- a/assets/walkbybrussels/streetart.svg +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/assets/walkbybrussels/tree.svg b/assets/walkbybrussels/tree.svg deleted file mode 100644 index ad76c80ee..000000000 --- a/assets/walkbybrussels/tree.svg +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - diff --git a/assets/walkbybrussels/viewpoint.svg b/assets/walkbybrussels/viewpoint.svg deleted file mode 100644 index a0f490e49..000000000 --- a/assets/walkbybrussels/viewpoint.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - diff --git a/assets/walkbybrussels/waterpoint_black.svg b/assets/walkbybrussels/waterpoint_black.svg deleted file mode 100644 index 4bb57e98d..000000000 --- a/assets/walkbybrussels/waterpoint_black.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/clean.sh b/clean.sh deleted file mode 100755 index 08cf074d9..000000000 --- a/clean.sh +++ /dev/null @@ -1,25 +0,0 @@ -#! /bin/bash -rm *.js -rm Logic/*.js -rm Logic/*.js -rm Logic/*/*.js -rm Logic/*/*/*.js -rm UI/*.js -rm UI/*/*.js -rm UI/*/*/*.js -rm Customizations/*.js -rm Customizations/*/*.js -rm Customizations/*/*/*.js - -rm *.webmanifest -rm q*.html -rm assets/generated/* - -for f in ./*.html; do - if [[ "$f" == "./index.html" ]] || [[ "$f" == "./land.html" ]] || [[ "$f" == "./test.html" ]] || [[ "$f" == "./preferences.html" ]] || [[ "$f" == "./customGenerator.html" ]] - then - echo "Not removing $f" - else - rm $f - fi -done \ No newline at end of file diff --git a/createLayouts.ts b/createLayouts.ts index 36560c995..55db89ad5 100644 --- a/createLayouts.ts +++ b/createLayouts.ts @@ -1,5 +1,5 @@ - import {UIElement} from "./UI/UIElement"; +// We HAVE to mark this while importing UIElement.runningFromConsole = true; import {AllKnownLayouts} from "./Customizations/AllKnownLayouts"; import {Layout} from "./Customizations/Layout"; diff --git a/customGenerator.html b/customGenerator.html index e012f4208..65daad980 100644 --- a/customGenerator.html +++ b/customGenerator.html @@ -40,19 +40,7 @@
-

Custom theme generator

- - Welcome to the custom theme creator.
- - In order to use this theme generator, you need at least 500 changesets.
- - As the spirit of mapcomplete is to not have any kind of hosted backend, the custom themes are encoded in the - URL: - the full configuration is saved in a JSON, which is base64-encoded and appended to the hash of the URL.
- - This means that closing this page removes your theme.
- -
'loggedIn' not attached
+

Create your own theme

'preview' not attached
diff --git a/customGenerator.ts b/customGenerator.ts index 0e657379b..8ec6f50e1 100644 --- a/customGenerator.ts +++ b/customGenerator.ts @@ -1,18 +1,12 @@ import {OsmConnection, UserDetails} from "./Logic/Osm/OsmConnection"; -import {UIEventSource} from "./UI/UIEventSource"; import {VariableUiElement} from "./UI/Base/VariableUIElement"; -import {Preview, ThemeGenerator} from "./themeGenerator"; +import {UIEventSource} from "./Logic/UIEventSource"; +import {ThemeGenerator} from "./UI/CustomThemeGenerator/ThemeGenerator"; +import {Preview} from "./UI/CustomThemeGenerator/Preview"; const connection = new OsmConnection(true, new UIEventSource(undefined), false); connection.AttemptLogin(); -new VariableUiElement(connection.userDetails.map((userdetails : UserDetails) => { - if(userdetails.loggedIn){ - return "Logged in as "+userdetails.name - }else{ - return "Not logged in" - } -})).AttachTo("loggedIn").onClick(() => connection.LogOut()); const themeGenerator = new ThemeGenerator(connection, window.location.hash?.substr(1)); themeGenerator.AttachTo("layoutCreator") diff --git a/deploy.sh b/deploy.sh index 479966352..cc8a8db92 100755 --- a/deploy.sh +++ b/deploy.sh @@ -9,3 +9,29 @@ cd /home/pietervdvn/git/pietervdvn.github.io/MapComplete/ git add . git commit -m "New mapcomplete version" git push + + +# clean up the mess we made + # rm *.js + # rm Logic/*.js + # rm Logic/*.js + # rm Logic/*/*.js + # rm Logic/*/*/*.js + # rm UI/*.js + # rm UI/*/*.js + # rm UI/*/*/*.js + # rm Customizations/*.js + # rm Customizations/*/*.js + # rm Customizations/*/*/*.js + +rm *.webmanifest +rm assets/generated/* + +for f in ./*.html; do + if [[ "$f" == "./index.html" ]] || [[ "$f" == "./land.html" ]] || [[ "$f" == "./test.html" ]] || [[ "$f" == "./preferences.html" ]] || [[ "$f" == "./customGenerator.html" ]] + then + echo "Not removing $f" + else + rm $f + fi +done \ No newline at end of file diff --git a/docs/Create a theme.md b/docs/Create a theme.md deleted file mode 100644 index 778b98a2b..000000000 --- a/docs/Create a theme.md +++ /dev/null @@ -1,14 +0,0 @@ -# Create a theme - - - -A _layer_ is a set of features of a single kind, e.g. 'bookcases'. -A _layout_ is a set of layers, e.g. 'bookcases' + 'nature reserves'. They are shown together with some text on the left. They can be switched with the query parameter 'layout' in the url (thus by going to 'index.html?layout=bookcases') - -If you want to make your own version of MapComplete, you create your own layout - -- Clone the repo -- Build it -- Go into 'Customazations/Layouts' and copy a file there (e.g. bookcases) -- Change the text and layer selection -- Create you layers \ No newline at end of file diff --git a/index.ts b/index.ts index a562dde82..eea940b36 100644 --- a/index.ts +++ b/index.ts @@ -8,7 +8,6 @@ import {SearchAndGo} from "./UI/SearchAndGo"; import {AllKnownLayouts} from "./Customizations/AllKnownLayouts"; import {Layout} from "./Customizations/Layout"; import {FixedUiElement} from "./UI/Base/FixedUiElement"; -import {QueryParameters} from "./Logic/QueryParameters"; import {InitUiElements} from "./InitUiElements"; import {StrayClickHandler} from "./Logic/Leaflet/StrayClickHandler"; import {GeoLocationHandler} from "./Logic/Leaflet/GeoLocationHandler"; @@ -19,6 +18,7 @@ import {TagRendering} from "./Customizations/TagRendering"; import {Img} from "./UI/Img"; import Combine from "./UI/Base/Combine"; import {CustomLayoutFromJSON} from "./Customizations/JSON/CustomLayoutFromJSON"; +import {QueryParameters} from "./Logic/Web/QueryParameters"; // --------------------- Special actions based on the parameters ----------------- diff --git a/package.json b/package.json index 5dfe76da6..084ca8c59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mapcomplete", - "version": "0.0.1", + "version": "0.0.5", "description": "A small website to edit OSM easily", "main": "index.js", "staticFiles": { diff --git a/preferences.ts b/preferences.ts index 18e879a25..f6f46d53c 100644 --- a/preferences.ts +++ b/preferences.ts @@ -1,7 +1,6 @@ import {OsmConnection} from "./Logic/Osm/OsmConnection"; import {VerticalCombine} from "./UI/Base/VerticalCombine"; import Combine from "./UI/Base/Combine"; -import {UIEventSource} from "./UI/UIEventSource"; import {SubtleButton} from "./UI/Base/SubtleButton"; import {Button} from "./UI/Base/Button"; import {VariableUiElement} from "./UI/Base/VariableUIElement"; @@ -9,6 +8,7 @@ import {All} from "./Customizations/Layouts/All"; import {TextField} from "./UI/Input/TextField"; import {FixedUiElement} from "./UI/Base/FixedUiElement"; import {UIElement} from "./UI/UIElement"; +import {UIEventSource} from "./Logic/UIEventSource"; const connection = new OsmConnection(false, new UIEventSource(undefined)); diff --git a/test.ts b/test.ts index 8abf879d6..e69de29bb 100644 --- a/test.ts +++ b/test.ts @@ -1,11 +0,0 @@ -import {State} from "./State"; -import Cyclofix from "./Customizations/Layouts/Cyclofix"; -import {CustomLayersPanel} from "./Logic/CustomLayersPanel"; - -State.state= new State(new Cyclofix()); - -new CustomLayersPanel().AttachTo("maindiv"); - -State.state.osmConnection.GetPreference("mapcomplete-custom-layer-count").addCallback((count) => console.log("Count: ", count)) - -State.state.favourteLayers.addCallback(console.log) \ No newline at end of file