(
str => isNaN(Number(str)) ? 0 : Number(str), [], n => "" + n
);
diff --git a/UI/BackgroundSelector.ts b/UI/BackgroundSelector.ts
index 7a0df8c..b9344cd 100644
--- a/UI/BackgroundSelector.ts
+++ b/UI/BackgroundSelector.ts
@@ -3,7 +3,7 @@ import {DropDown} from "./Input/DropDown";
import Translations from "./i18n/Translations";
import State from "../State";
import {UIEventSource} from "../Logic/UIEventSource";
-import {BaseLayer} from "../Logic/BaseLayer";
+import {BaseLayer} from "../Models/BaseLayer";
export default class BackgroundSelector extends UIElement {
@@ -28,7 +28,7 @@ export default class BackgroundSelector extends UIElement {
baseLayers.push({value: layer, shown: layer.name ?? "id:" + layer.id});
}
- this._dropdown = new DropDown(Translations.t.general.backgroundMap, baseLayers, State.state.bm.CurrentLayer);
+ this._dropdown = new DropDown(Translations.t.general.backgroundMap, baseLayers, State.state.backgroundLayer);
}
InnerRender(): string {
diff --git a/UI/CustomGenerator/CustomGeneratorPanel.ts b/UI/CustomGenerator/CustomGeneratorPanel.ts
index a7c1189..2d5f1a2 100644
--- a/UI/CustomGenerator/CustomGeneratorPanel.ts
+++ b/UI/CustomGenerator/CustomGeneratorPanel.ts
@@ -17,6 +17,7 @@ import SavePanel from "./SavePanel";
import {LocalStorageSource} from "../../Logic/Web/LocalStorageSource";
import HelpText from "./HelpText";
import Svg from "../../Svg";
+import Constants from "../../Models/Constants";
export default class CustomGeneratorPanel extends UIElement {
@@ -103,11 +104,12 @@ export default class CustomGeneratorPanel extends UIElement {
this.loginButton
]).Render();
}
- if (ud.csCount <= State.userJourney.themeGeneratorReadOnlyUnlock) {
+ const journey = Constants.userJourney;
+ if (ud.csCount <= journey.themeGeneratorReadOnlyUnlock) {
return new Combine([
"Too little experience
",
- `Creating your own (readonly) themes can only be done if you have more then ${State.userJourney.themeGeneratorReadOnlyUnlock} changesets made
`,
- `Making a theme including survey options can be done at ${State.userJourney.themeGeneratorFullUnlock} changesets
`
+ `Creating your own (readonly) themes can only be done if you have more then ${journey.themeGeneratorReadOnlyUnlock} changesets made
`,
+ `Making a theme including survey options can be done at ${journey.themeGeneratorFullUnlock} changesets
`
]).Render();
}
return this.mainPanel.Render()
diff --git a/UI/CustomGenerator/LayerPanel.ts b/UI/CustomGenerator/LayerPanel.ts
index 6b89bca..7591040 100644
--- a/UI/CustomGenerator/LayerPanel.ts
+++ b/UI/CustomGenerator/LayerPanel.ts
@@ -21,6 +21,7 @@ import State from "../../State";
import {FixedUiElement} from "../Base/FixedUiElement";
import ValidatedTextField from "../Input/ValidatedTextField";
import Svg from "../../Svg";
+import Constants from "../../Models/Constants";
/**
* Shows the configuration for a single layer
@@ -142,7 +143,7 @@ export default class LayerPanel extends UIElement {
}
)
- if (userDetails.csCount >= State.userJourney.themeGeneratorFullUnlock) {
+ if (userDetails.csCount >= Constants.userJourney.themeGeneratorFullUnlock) {
const presetPanel = new MultiInput("Add a preset",
() => ({tags: [], title: {}}),
@@ -151,7 +152,7 @@ export default class LayerPanel extends UIElement {
new SingleSetting(config, presetPanel, ["layers", index, "presets"], "Presets", "")
this.presetsPanel = presetPanel;
} else {
- this.presetsPanel = new FixedUiElement(`Creating a custom theme which also edits OSM is only unlocked after ${State.userJourney.themeGeneratorFullUnlock} changesets`).SetClass("alert");
+ this.presetsPanel = new FixedUiElement(`Creating a custom theme which also edits OSM is only unlocked after ${Constants.userJourney.themeGeneratorFullUnlock} changesets`).SetClass("alert");
}
function loadTagRenderings() {
diff --git a/UI/CustomGenerator/TagRenderingPanel.ts b/UI/CustomGenerator/TagRenderingPanel.ts
index 096f2d5..bc52462 100644
--- a/UI/CustomGenerator/TagRenderingPanel.ts
+++ b/UI/CustomGenerator/TagRenderingPanel.ts
@@ -18,6 +18,7 @@ import {VariableUiElement} from "../Base/VariableUIElement";
import ValidatedTextField from "../Input/ValidatedTextField";
import SpecialVisualizations from "../SpecialVisualizations";
import TagRenderingConfig from "../../Customizations/JSON/TagRenderingConfig";
+import Constants from "../../Models/Constants";
export default class TagRenderingPanel extends InputElement {
@@ -46,7 +47,7 @@ export default class TagRenderingPanel extends InputElement
" +
"Furhtermore, some special functions are supported:"+SpecialVisualizations.HelpMessage.Render()),
- questionsNotUnlocked ? `You need at least ${State.userJourney.themeGeneratorFullUnlock} changesets to unlock the 'question'-field and to use your theme to edit OSM data` : "",
+ questionsNotUnlocked ? `You need at least ${Constants.userJourney.themeGeneratorFullUnlock} changesets to unlock the 'question'-field and to use your theme to edit OSM data` : "",
...(options?.disableQuestions ? [] : questionSettings),
"Mappings
",
diff --git a/UI/MoreScreen.ts b/UI/MoreScreen.ts
index ba3ce28..c4d0939 100644
--- a/UI/MoreScreen.ts
+++ b/UI/MoreScreen.ts
@@ -9,6 +9,7 @@ import {VariableUiElement} from "./Base/VariableUIElement";
import Svg from "../Svg";
import LayoutConfig from "../Customizations/JSON/LayoutConfig";
import * as personal from "../assets/themes/personalLayout/personalLayout.json"
+import Constants from "../Models/Constants";
export class MoreScreen extends UIElement {
@@ -74,7 +75,7 @@ export class MoreScreen extends UIElement {
els.push(new VariableUiElement(
State.state.osmConnection.userDetails.map(userDetails => {
- if (userDetails.csCount < State.userJourney.themeGeneratorReadOnlyUnlock) {
+ if (userDetails.csCount < Constants.userJourney.themeGeneratorReadOnlyUnlock) {
return tr.requestATheme.Render();
}
return new SubtleButton(Svg.pencil_ui(), tr.createYourOwnTheme, {
@@ -88,7 +89,7 @@ export class MoreScreen extends UIElement {
for (const k in AllKnownLayouts.allSets) {
const layout : LayoutConfig = AllKnownLayouts.allSets[k];
if (k === personal.id) {
- if (State.state.osmConnection.userDetails.data.csCount < State.userJourney.personalLayoutUnlock) {
+ if (State.state.osmConnection.userDetails.data.csCount < Constants.userJourney.personalLayoutUnlock) {
continue;
}
}
diff --git a/UI/OpeningHours/OhVisualization.ts b/UI/OpeningHours/OhVisualization.ts
index 13a6146..2b604af 100644
--- a/UI/OpeningHours/OhVisualization.ts
+++ b/UI/OpeningHours/OhVisualization.ts
@@ -5,6 +5,7 @@ import State from "../../State";
import {FixedUiElement} from "../Base/FixedUiElement";
import {OH} from "./OpeningHours";
import Translations from "../i18n/Translations";
+import Constants from "../../Models/Constants";
export default class OpeningHoursVisualization extends UIElement {
private readonly _key: string;
@@ -166,7 +167,7 @@ export default class OpeningHoursVisualization extends UIElement {
} catch (e) {
console.log(e);
const msg = new Combine([Translations.t.general.opening_hours.error_loading,
- State.state?.osmConnection?.userDetails?.data?.csCount >= State.userJourney.tagsVisibleAndWikiLinked ?
+ State.state?.osmConnection?.userDetails?.data?.csCount >= Constants.userJourney.tagsVisibleAndWikiLinked ?
`${e}`
: ""
]);
diff --git a/UI/Popup/TagRenderingQuestion.ts b/UI/Popup/TagRenderingQuestion.ts
index f387123..c6420f5 100644
--- a/UI/Popup/TagRenderingQuestion.ts
+++ b/UI/Popup/TagRenderingQuestion.ts
@@ -18,6 +18,7 @@ import {VariableUiElement} from "../Base/VariableUIElement";
import Translations from "../i18n/Translations";
import {FixedUiElement} from "../Base/FixedUiElement";
import {Translation} from "../i18n/Translation";
+import Constants from "../../Models/Constants";
/**
* Shows the question element.
@@ -72,14 +73,14 @@ export default class TagRenderingQuestion extends UIElement {
self._inputElement.GetValue().map(
(tags: TagsFilter) => {
const csCount = State.state?.osmConnection?.userDetails?.data?.csCount ?? 1000;
- if (csCount < State.userJourney.tagsVisibleAt) {
+ if (csCount < Constants.userJourney.tagsVisibleAt) {
return "";
}
if (tags === undefined) {
return Translations.t.general.noTagsSelected.SetClass("subtle").Render();
}
- if (csCount < State.userJourney.tagsVisibleAndWikiLinked) {
+ if (csCount < Constants.userJourney.tagsVisibleAndWikiLinked) {
const tagsStr = tags.asHumanString(false, true);
return new FixedUiElement(tagsStr).SetClass("subtle").Render();
}
diff --git a/UI/ShareScreen.ts b/UI/ShareScreen.ts
index 4a2b519..b76b28f 100644
--- a/UI/ShareScreen.ts
+++ b/UI/ShareScreen.ts
@@ -14,6 +14,7 @@ import {SubtleButton} from "./Base/SubtleButton";
import Svg from "../Svg";
import {Translation} from "./i18n/Translation";
import LayoutConfig from "../Customizations/JSON/LayoutConfig";
+import Constants from "../Models/Constants";
export class ShareScreen extends UIElement {
private readonly _options: UIElement;
@@ -71,7 +72,7 @@ export class ShareScreen extends UIElement {
if (State.state !== undefined) {
- const currentLayer: UIEventSource<{ id: string, name: string, layer: any }> = (State.state.bm as Basemap).CurrentLayer;
+ const currentLayer: UIEventSource<{ id: string, name: string, layer: any }> = State.state.backgroundLayer;
const currentBackground = new VariableUiElement(currentLayer.map(layer => {
return tr.fsIncludeCurrentBackgroundMap.Subs({name: layer?.name ?? ""}).Render();
}));
@@ -190,7 +191,7 @@ export class ShareScreen extends UIElement {
new VariableUiElement(
State.state.osmConnection.userDetails.map(
userDetails => {
- if (userDetails.csCount <= State.userJourney.themeGeneratorReadOnlyUnlock) {
+ if (userDetails.csCount <= Constants.userJourney.themeGeneratorReadOnlyUnlock) {
return "";
}
diff --git a/UI/SimpleAddUI.ts b/UI/SimpleAddUI.ts
index 22339d5..2946080 100644
--- a/UI/SimpleAddUI.ts
+++ b/UI/SimpleAddUI.ts
@@ -10,6 +10,7 @@ import State from "../State";
import {UIEventSource} from "../Logic/UIEventSource";
import Svg from "../Svg";
import {FixedUiElement} from "./Base/FixedUiElement";
+import Constants from "../Models/Constants";
/**
* Asks to add a feature at the last clicked location, at least if zoom is sufficient
@@ -59,7 +60,7 @@ export class SimpleAddUI extends UIElement {
const csCount = State.state.osmConnection.userDetails.data.csCount;
let tagInfo = "";
- if (csCount > State.userJourney.tagsVisibleAt) {
+ if (csCount > Constants.userJourney.tagsVisibleAt) {
tagInfo = preset.tags.map(t => t.asHumanString(false, true)).join("&");
tagInfo = `
${tagInfo}`
}
@@ -139,8 +140,8 @@ export class SimpleAddUI extends UIElement {
let tagInfo = "";
const csCount = State.state.osmConnection.userDetails.data.csCount;
- if (csCount > State.userJourney.tagsVisibleAt) {
- tagInfo = this._confirmPreset.data .tags.map(t => t.asHumanString(csCount > State.userJourney.tagsVisibleAndWikiLinked, true)).join("&");
+ if (csCount > Constants.userJourney.tagsVisibleAt) {
+ tagInfo = this._confirmPreset.data .tags.map(t => t.asHumanString(csCount > Constants.userJourney.tagsVisibleAndWikiLinked, true)).join("&");
tagInfo = `
More information about the preset: ${tagInfo}`
}
@@ -169,7 +170,7 @@ export class SimpleAddUI extends UIElement {
return new Combine([header, this._loginButton]).Render()
}
- if (userDetails.data.unreadMessages > 0 && userDetails.data.csCount < State.userJourney.addNewPointWithUnreadMessagesUnlock) {
+ if (userDetails.data.unreadMessages > 0 && userDetails.data.csCount < Constants.userJourney.addNewPointWithUnreadMessagesUnlock) {
return new Combine([header,
Translations.t.general.readYourMessages.Clone().SetClass("alert"),
this.goToInboxButton
@@ -185,13 +186,13 @@ export class SimpleAddUI extends UIElement {
]);
}
- if (userDetails.data.csCount < State.userJourney.addNewPointsUnlock) {
+ if (userDetails.data.csCount < Constants.userJourney.addNewPointsUnlock) {
return new Combine([header, "",
Translations.t.general.fewChangesBefore,
""]).Render();
}
- if (State.state.locationControl.data.zoom < State.userJourney.minZoomLevelToAddNewPoints) {
+ if (State.state.locationControl.data.zoom < Constants.userJourney.minZoomLevelToAddNewPoints) {
return new Combine([header, Translations.t.general.add.zoomInFurther.SetClass("alert")]).Render()
}