Fix questions: applicable mappings are now calculated dynamically; charging station theme now only shows applicable plugs based on the allowed vehicle types

This commit is contained in:
Pieter Vander Vennet 2021-10-02 15:16:41 +02:00
parent bedc576313
commit df34239256
14 changed files with 3677 additions and 3359 deletions

31
test.ts
View file

@ -1,2 +1,31 @@
import {AllKnownLayouts} from "./Customizations/AllKnownLayouts";
import {Translation} from "./UI/i18n/Translation";
import TagRenderingQuestion from "./UI/Popup/TagRenderingQuestion";
import {UIEventSource} from "./Logic/UIEventSource";
import {VariableUiElement} from "./UI/Base/VariableUIElement";
const theme = AllKnownLayouts.allKnownLayouts.get("charging_stations")
const tagRendering = theme.layers[0].tagRenderings.filter(tr => tr.id === "Available_charging_stations (generated)")[0]
const tag = new UIEventSource({
id: "node/42",
amenity:"charging_station",
bicycle:"yes",
car:"no",
"motorcar":"no",
"hgv":"no",
bus:"no"
})
window.tags = tag
//const q =
new VariableUiElement(tag.map(_ => new TagRenderingQuestion(tag, tagRendering) ))
.SetStyle("width: 100px")
.AttachTo("maindiv")
window.setTimeout(_ => {
tag.data.bicycle="no"
tag.data.car = "yes"
tag.ping()
console.log("Pinged")
}, 2500)