Add feature switches to layouts, add option to remove a layout from more-screen

This commit is contained in:
Pieter Vander Vennet 2020-07-29 16:05:02 +02:00
parent 21dd38c3c7
commit 7882747424
7 changed files with 19 additions and 8 deletions

View file

@ -32,6 +32,13 @@ export class Layout {
public locationContains: string[];
public enableAdd: boolean = true;
public enableUserBadge: boolean = true;
public enableSearch: boolean = true;
public enableLayers: boolean = true;
public hideFromOverview : boolean = false;
/**
*
* @param name: The name used in the query string. If in the query "quests=<name>" is defined, it will select this layout

View file

@ -15,5 +15,6 @@ export class All extends Layout{
"Please log in",
""
);
this.hideFromOverview = true;
}
}

View file

@ -18,5 +18,6 @@ export class GRB extends Layout {
,
"", "");
this.hideFromOverview = true;
}
}

View file

@ -87,6 +87,10 @@ export class StreetWidth extends Layout{
"<li>Voorzie in elke straat enkele parkeerplaatsen voor kortparkeren. Zo kunnen leveringen, iemand afzetten,... gebeuren zonder dat er een fietspad of een straat geblokkeerd wordt</li>" +
"</ul>");
this.icon = "assets/bug.svg";
this.enableSearch = false;
this.enableUserBadge = false;
this.enableAdd = false;
this.hideFromOverview = true;
}
}

View file

@ -70,6 +70,7 @@ export class InitUiElements {
fullScreenMessage.setData(fullOptions2)
}).AttachTo("help-button-mobile");
}
}

View file

@ -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}

View file

@ -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");