Merge branch 'master' of github.com:pietervdvn/MapComplete

This commit is contained in:
Pieter Fiers 2020-07-29 17:17:05 +02:00
commit 4c46c953e6
10 changed files with 81 additions and 27 deletions

View file

@ -32,6 +32,13 @@ export class Layout {
public locationContains: string[]; 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 * @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", "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>" + "<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>"); "</ul>");
this.icon = "assets/bug.svg"; 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) fullScreenMessage.setData(fullOptions2)
}).AttachTo("help-button-mobile"); }).AttachTo("help-button-mobile");
} }
} }

27
UI/Base/SubtleButton.ts Normal file
View file

@ -0,0 +1,27 @@
import {UIElement} from "../UIElement";
import Translations from "../i18n/Translations";
import Combine from "./Combine";
export class SubtleButton extends UIElement{
private imageUrl: string;
private message: UIElement;
constructor(imageUrl: string, message: string | UIElement) {
super(undefined);
this.message = Translations.W(message);
this.imageUrl = imageUrl;
}
InnerRender(): string {
return new Combine([
'<span class="subtle-button">',
`<img src='${this.imageUrl}'>`,
this.message,
'</span>'
]).Render();
}
}

View file

@ -7,6 +7,8 @@ import {Utils} from "../Utils";
import {link} from "fs"; import {link} from "fs";
import {UIEventSource} from "./UIEventSource"; import {UIEventSource} from "./UIEventSource";
import {VariableUiElement} from "./Base/VariableUIElement"; import {VariableUiElement} from "./Base/VariableUIElement";
import Combine from "./Base/Combine";
import {SubtleButton} from "./Base/SubtleButton";
export class MoreScreen extends UIElement { export class MoreScreen extends UIElement {
@ -22,29 +24,28 @@ export class MoreScreen extends UIElement {
const els: UIElement[] = [] const els: UIElement[] = []
for (const k in AllKnownLayouts.allSets) { for (const k in AllKnownLayouts.allSets) {
if (k === "all") {
continue;
}
const layout = AllKnownLayouts.allSets[k] const layout = AllKnownLayouts.allSets[k]
if (layout.hideFromOverview) {
continue
}
const linkText = 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} `https://pietervdvn.github.io/MapComplete/${layout.name}.html?z=${this.currentLocation.data.zoom}&lat=${this.currentLocation.data.lat}&lon=${this.currentLocation.data.lon}`
` const link =
const link = new FixedUiElement( new SubtleButton(layout.icon,
` new Combine([
<span class="switch-layout"> `<a href="${linkText}" target="_blank">`,
<a href="${linkText}" target="_blank"> "<div>",
<img src='${layout.icon}'> "<b>",
<div><b>${Utils.Upper(layout.name)}</b><br/> Translations.W(layout.title),
${Translations.W(layout.description).Render()}</div> "</b>",
</a> "<br/>",
</span> Translations.W(layout.description),
` "</div>",
); "</a>"
]));
els.push(link) els.push(link)
} }

7
assets/pop-out.svg Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g><g><path d="M485,379.5l130.6,130.6l245.8-245.8l126.9,126.9l0.2-379L607.1,10l123.8,123.7L485,379.5L485,379.5z M986.4,546.3l-94.1-95.4l1.7,441.3l-784.7,0.4l0.8-782.7l438.9-2l-98-98H108C53.9,10,10,54,10,108v784c0,54.1,43.9,98,98,98h784c54.1,0,98-43.9,98-98L986.4,546.3z"/></g></g>
</svg>

After

Width:  |  Height:  |  Size: 768 B

View file

@ -4,6 +4,11 @@ html, body {
padding: 0; padding: 0;
} }
a {
text-decoration: unset;
color:unset;
}
body { body {
font-family: 'Helvetica Neue', Arial, sans-serif; font-family: 'Helvetica Neue', Arial, sans-serif;
} }
@ -1187,7 +1192,7 @@ form {
/** Switch layout **/ /** Switch layout **/
.switch-layout a{ .subtle-button{
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
flex-direction: row; flex-direction: row;
@ -1201,7 +1206,7 @@ form {
} }
.switch-layout a img{ .subtle-button img{
width: 3em; width: 3em;
max-height: 3em; max-height: 3em;
margin-right: 0.5em; margin-right: 0.5em;

View file

@ -112,12 +112,11 @@ const lat = QueryParameters.GetQueryParameter("lat", "" + layoutToUse.startLat)
const lon = QueryParameters.GetQueryParameter("lon", "" + layoutToUse.startLon) const lon = QueryParameters.GetQueryParameter("lon", "" + layoutToUse.startLon)
.syncWith(LocalStorageSource.Get("lon")); .syncWith(LocalStorageSource.Get("lon"));
const featureSwitchUserbadge = QueryParameters.GetQueryParameter("fs-userbadge", "true"); const featureSwitchUserbadge = QueryParameters.GetQueryParameter("fs-userbadge", ""+layoutToUse.enableUserBadge);
const featureSwitchSearch = QueryParameters.GetQueryParameter("fs-search", "true"); const featureSwitchSearch = QueryParameters.GetQueryParameter("fs-search", ""+layoutToUse.enableSearch);
const featureSwitchWelcomeMessage = QueryParameters.GetQueryParameter("fs-welcome-message", "true"); const featureSwitchWelcomeMessage = QueryParameters.GetQueryParameter("fs-welcome-message", "true");
const featureSwitchLayers = QueryParameters.GetQueryParameter("fs-layers", "true"); const featureSwitchLayers = QueryParameters.GetQueryParameter("fs-layers", ""+layoutToUse.enableLayers);
const featureSwitchEmbedded = QueryParameters.GetQueryParameter("fs-embedded", "true"); const featureSwitchAddNew = QueryParameters.GetQueryParameter("fs-add-new", ""+layoutToUse.enableAdd);
const featureSwitchAddNew = QueryParameters.GetQueryParameter("fs-add-new", "true");
const featureSwitchIframe = QueryParameters.GetQueryParameter("fs-iframe", "false"); const featureSwitchIframe = QueryParameters.GetQueryParameter("fs-iframe", "false");
@ -321,8 +320,9 @@ InitUiElements.OnlyIf(featureSwitchWelcomeMessage, () => {
InitUiElements.InitWelcomeMessage(layoutToUse, osmConnection, bm, fullScreenMessage) InitUiElements.InitWelcomeMessage(layoutToUse, osmConnection, bm, fullScreenMessage)
}); });
if (window != window.top || featureSwitchIframe.data !== "false") { if ((window != window.top && featureSwitchWelcomeMessage.data === "false") || featureSwitchIframe.data !== "false") {
new FixedUiElement(`<a href='${window.location}' target='_blank'><span class='iframe-escape'><img src='assets/pencil.svg'></span></a>`).AttachTo("top-right") console.log("WELCOME? ",featureSwitchWelcomeMessage.data)
new FixedUiElement(`<a href='${window.location}' target='_blank'><span class='iframe-escape'><img src='assets/pop-out.svg'></span></a>`).AttachTo("top-right")
} }