diff --git a/Models/Constants.ts b/Models/Constants.ts index 0a048b138..f4fc0ba69 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -2,7 +2,7 @@ import { Utils } from "../Utils"; export default class Constants { - public static vNumber = "0.8.3"; + public static vNumber = "0.8.3a"; // The user journey states thresholds when a new feature gets unlocked public static userJourney = { diff --git a/UI/BigComponents/LayerSelection.ts b/UI/BigComponents/LayerSelection.ts index bb82a18a5..e28294709 100644 --- a/UI/BigComponents/LayerSelection.ts +++ b/UI/BigComponents/LayerSelection.ts @@ -6,6 +6,7 @@ import Combine from "../Base/Combine"; import Translations from "../i18n/Translations"; import LayerConfig from "../../Customizations/JSON/LayerConfig"; import BaseUIElement from "../BaseUIElement"; +import {Translation} from "../i18n/Translation"; /** * Shows the panel with all layers and a toggle for each of them @@ -29,18 +30,21 @@ export default class LayerSelection extends Combine { const leafletStyle = layer.layerDef.GenerateLeafletStyle( new UIEventSource({id: "node/-1"}), false) + const leafletStyleNa = layer.layerDef.GenerateLeafletStyle( + new UIEventSource({id: "node/-1"}), + false) const icon = new Combine([leafletStyle.icon.html]).SetClass("single-layer-selection-toggle") - let iconUnselected: BaseUIElement = new Combine([leafletStyle.icon.html]) + let iconUnselected: BaseUIElement = new Combine([leafletStyleNa.icon.html]) .SetClass("single-layer-selection-toggle") .SetStyle("opacity:0.2;"); - const name = Translations.WT(layer.layerDef.name)?.Clone() - ?.SetStyle("font-size:large;margin-left: 0.5em;"); - - if ((name ?? "") === "") { - continue + if (layer.layerDef.name === undefined) { + continue; } + const name: Translation = Translations.WT(layer.layerDef.name)?.Clone() + name.SetStyle("font-size:large;margin-left: 0.5em;"); + const zoomStatus = new VariableUiElement(State.state.locationControl.map(location => { if (location.zoom < layer.layerDef.minzoom) { return Translations.t.general.layerSelection.zoomInToSeeThisLayer.Clone() @@ -49,12 +53,21 @@ export default class LayerSelection extends Combine { } return "" })) + const zoomStatusNonActive = new VariableUiElement(State.state.locationControl.map(location => { + if (location.zoom < layer.layerDef.minzoom) { + return Translations.t.general.layerSelection.zoomInToSeeThisLayer.Clone() + .SetClass("alert") + .SetStyle("display: block ruby;width:min-content;") + } + return "" + })) + const style = "display:flex;align-items:center;" const styleWhole = "display:flex; flex-wrap: wrap" checkboxes.push(new Toggle( - new Combine([new Combine([icon, name]).SetStyle(style), zoomStatus]) + new Combine([new Combine([icon, name.Clone()]).SetStyle(style), zoomStatus]) .SetStyle(styleWhole), - new Combine([new Combine([iconUnselected, "", name, ""]).SetStyle(style), zoomStatus]) + new Combine([new Combine([iconUnselected, "", name.Clone(), ""]).SetStyle(style), zoomStatusNonActive]) .SetStyle(styleWhole), layer.isDisplayed).ToggleOnClick() .SetStyle("margin:0.3em;")