forked from MapComplete/MapComplete
Add cycle_highways theme, add configurable overpass backend as feature switch (settable via theme and URL)
This commit is contained in:
parent
f4ea36de9a
commit
ef0826ebb6
21 changed files with 377 additions and 48 deletions
48
test.ts
48
test.ts
|
@ -1,29 +1,31 @@
|
|||
import {UIEventSource} from "./Logic/UIEventSource";
|
||||
import AllKnownLayers from "./Customizations/AllKnownLayers";
|
||||
import {FixedUiElement} from "./UI/Base/FixedUiElement";
|
||||
import {VariableUiElement} from "./UI/Base/VariableUIElement";
|
||||
import {TagUtils} from "./Logic/Tags/TagUtils";
|
||||
import Hash from "./Logic/Web/Hash";
|
||||
import {InitUiElements} from "./InitUiElements";
|
||||
import {Utils} from "./Utils";
|
||||
import {UIEventSource} from "./Logic/UIEventSource";
|
||||
import {LocalStorageSource} from "./Logic/Web/LocalStorageSource";
|
||||
import LZString from "lz-string";
|
||||
import {LayoutConfigJson} from "./Models/ThemeConfig/Json/LayoutConfigJson";
|
||||
import Combine from "./UI/Base/Combine";
|
||||
import Svg from "./Svg";
|
||||
import Translations from "./UI/i18n/Translations";
|
||||
import LayerConfig from "./Models/ThemeConfig/LayerConfig";
|
||||
import AddNewMarker from "./UI/BigComponents/AddNewMarker";
|
||||
|
||||
|
||||
function genMarker(filteredLayers: UIEventSource<{ appliedFilters: undefined; isDisplayed: UIEventSource<boolean>; layerDef: LayerConfig }[]>) {
|
||||
return new AddNewMarker(filteredLayers)
|
||||
|
||||
}
|
||||
|
||||
let filteredLayers = new UIEventSource([
|
||||
{
|
||||
layerDef: AllKnownLayers.sharedLayers.get("toilet"),
|
||||
isDisplayed: new UIEventSource<boolean>(true),
|
||||
appliedFilters: undefined
|
||||
new VariableUiElement(Hash.hash.map(
|
||||
hash => {
|
||||
let json: {};
|
||||
try {
|
||||
json = atob(hash);
|
||||
} catch (e) {
|
||||
// We try to decode with lz-string
|
||||
json =
|
||||
Utils.UnMinify(LZString.decompressFromBase64(hash))
|
||||
}
|
||||
return new Combine([
|
||||
new FixedUiElement("Base64 decoded: " + atob(hash)),
|
||||
new FixedUiElement("LZ: " + LZString.decompressFromBase64(hash)),
|
||||
new FixedUiElement("Base64 + unminify: " + Utils.UnMinify(atob(hash))),
|
||||
new FixedUiElement("LZ + unminify: " + Utils.UnMinify(LZString.decompressFromBase64(hash)))
|
||||
]).SetClass("flex flex-col m-1")
|
||||
}
|
||||
])
|
||||
genMarker(filteredLayers).SetStyle("width: 50px; height: 70px")
|
||||
.SetClass("block border-black border")
|
||||
.AttachTo("maindiv")
|
||||
|
||||
new FixedUiElement("").AttachTo("extradiv")
|
||||
))
|
||||
.AttachTo("maindiv")
|
Loading…
Add table
Add a link
Reference in a new issue