From 78827474243e3b01cde94085f5b8661bf7ae03b3 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 29 Jul 2020 16:05:02 +0200 Subject: [PATCH] Add feature switches to layouts, add option to remove a layout from more-screen --- Customizations/Layout.ts | 7 +++++++ Customizations/Layouts/All.ts | 1 + Customizations/Layouts/GRB.ts | 1 + Customizations/Layouts/StreetWidth.ts | 4 ++++ InitUiElements.ts | 1 + UI/MoreScreen.ts | 4 +--- index.ts | 9 ++++----- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Customizations/Layout.ts b/Customizations/Layout.ts index 2062787e02..e4a6f7596a 100644 --- a/Customizations/Layout.ts +++ b/Customizations/Layout.ts @@ -31,6 +31,13 @@ export class Layout { public startLat: number; public locationContains: string[]; + + public enableAdd: boolean = true; + public enableUserBadge: boolean = true; + public enableSearch: boolean = true; + public enableLayers: boolean = true; + + public hideFromOverview : boolean = false; /** * diff --git a/Customizations/Layouts/All.ts b/Customizations/Layouts/All.ts index 54065b4b63..a3e0aeb06f 100644 --- a/Customizations/Layouts/All.ts +++ b/Customizations/Layouts/All.ts @@ -15,5 +15,6 @@ export class All extends Layout{ "Please log in", "" ); + this.hideFromOverview = true; } } \ No newline at end of file diff --git a/Customizations/Layouts/GRB.ts b/Customizations/Layouts/GRB.ts index 21ba2ab4b9..9efafb9845 100644 --- a/Customizations/Layouts/GRB.ts +++ b/Customizations/Layouts/GRB.ts @@ -18,5 +18,6 @@ export class GRB extends Layout { , "", ""); + this.hideFromOverview = true; } } \ No newline at end of file diff --git a/Customizations/Layouts/StreetWidth.ts b/Customizations/Layouts/StreetWidth.ts index 7ad592c2c1..da09971003 100644 --- a/Customizations/Layouts/StreetWidth.ts +++ b/Customizations/Layouts/StreetWidth.ts @@ -87,6 +87,10 @@ export class StreetWidth extends Layout{ "
  • Voorzie in elke straat enkele parkeerplaatsen voor kortparkeren. Zo kunnen leveringen, iemand afzetten,... gebeuren zonder dat er een fietspad of een straat geblokkeerd wordt
  • " + ""); this.icon = "assets/bug.svg"; + this.enableSearch = false; + this.enableUserBadge = false; + this.enableAdd = false; + this.hideFromOverview = true; } } \ No newline at end of file diff --git a/InitUiElements.ts b/InitUiElements.ts index e878540e0e..7d20c4c07c 100644 --- a/InitUiElements.ts +++ b/InitUiElements.ts @@ -69,6 +69,7 @@ export class InitUiElements { new FixedUiElement(`
    help
    `).onClick(() => { fullScreenMessage.setData(fullOptions2) }).AttachTo("help-button-mobile"); + } diff --git a/UI/MoreScreen.ts b/UI/MoreScreen.ts index fab85f8689..81d6ad0db4 100644 --- a/UI/MoreScreen.ts +++ b/UI/MoreScreen.ts @@ -22,10 +22,8 @@ export class MoreScreen extends UIElement { const els: UIElement[] = [] for (const k in AllKnownLayouts.allSets) { - if (k === "all") { - continue; - } const layout = AllKnownLayouts.allSets[k] + if(layout.hideFromOverview){continue} const linkText = `https://pietervdvn.github.io/MapComplete/${layout.name}.html?z=${this.currentLocation.data.zoom}&lat=${this.currentLocation.data.lat}&lon=${this.currentLocation.data.lon} diff --git a/index.ts b/index.ts index fdd57fce8c..ac9fc58528 100644 --- a/index.ts +++ b/index.ts @@ -112,12 +112,11 @@ const lat = QueryParameters.GetQueryParameter("lat", "" + layoutToUse.startLat) const lon = QueryParameters.GetQueryParameter("lon", "" + layoutToUse.startLon) .syncWith(LocalStorageSource.Get("lon")); -const featureSwitchUserbadge = QueryParameters.GetQueryParameter("fs-userbadge", "true"); -const featureSwitchSearch = QueryParameters.GetQueryParameter("fs-search", "true"); +const featureSwitchUserbadge = QueryParameters.GetQueryParameter("fs-userbadge", ""+layoutToUse.enableUserBadge); +const featureSwitchSearch = QueryParameters.GetQueryParameter("fs-search", ""+layoutToUse.enableSearch); const featureSwitchWelcomeMessage = QueryParameters.GetQueryParameter("fs-welcome-message", "true"); -const featureSwitchLayers = QueryParameters.GetQueryParameter("fs-layers", "true"); -const featureSwitchEmbedded = QueryParameters.GetQueryParameter("fs-embedded", "true"); -const featureSwitchAddNew = QueryParameters.GetQueryParameter("fs-add-new", "true"); +const featureSwitchLayers = QueryParameters.GetQueryParameter("fs-layers", ""+layoutToUse.enableLayers); +const featureSwitchAddNew = QueryParameters.GetQueryParameter("fs-add-new", ""+layoutToUse.enableAdd); const featureSwitchIframe = QueryParameters.GetQueryParameter("fs-iframe", "false");