2021-01-04 04:06:21 +01:00
|
|
|
import State from "../../State";
|
|
|
|
import Combine from "../Base/Combine";
|
|
|
|
import LanguagePicker from "../LanguagePicker";
|
|
|
|
import Translations from "../i18n/Translations";
|
2021-01-07 04:50:12 +01:00
|
|
|
import {VariableUiElement} from "../Base/VariableUIElement";
|
2021-06-12 02:58:32 +02:00
|
|
|
import Toggle from "../Input/Toggle";
|
2020-07-31 01:45:54 +02:00
|
|
|
|
2021-06-12 02:58:32 +02:00
|
|
|
export default class ThemeIntroductionPanel extends VariableUiElement {
|
2020-07-31 01:45:54 +02:00
|
|
|
|
|
|
|
constructor() {
|
2021-06-12 02:58:32 +02:00
|
|
|
|
|
|
|
const languagePicker =
|
|
|
|
new VariableUiElement(
|
2021-06-13 15:04:55 +02:00
|
|
|
State.state.layoutToUse.map(layout => LanguagePicker.CreateLanguagePicker(layout.language, Translations.t.general.pickLanguage.Clone()))
|
2021-06-12 02:58:32 +02:00
|
|
|
)
|
|
|
|
;
|
2020-09-03 16:44:48 +02:00
|
|
|
|
2021-03-24 01:25:57 +01:00
|
|
|
const plzLogIn =
|
2020-11-11 16:23:49 +01:00
|
|
|
Translations.t.general.loginWithOpenStreetMap
|
2021-06-13 15:04:55 +02:00
|
|
|
.Clone()
|
2020-09-03 16:44:48 +02:00
|
|
|
.onClick(() => {
|
|
|
|
State.state.osmConnection.AttemptLogin()
|
|
|
|
});
|
2021-06-12 02:58:32 +02:00
|
|
|
|
|
|
|
|
2021-06-13 15:04:55 +02:00
|
|
|
const welcomeBack = Translations.t.general.welcomeBack.Clone();
|
2021-06-12 02:58:32 +02:00
|
|
|
|
|
|
|
const loginStatus =
|
|
|
|
new Toggle(
|
|
|
|
new Toggle(
|
|
|
|
welcomeBack,
|
|
|
|
plzLogIn,
|
|
|
|
State.state.osmConnection.isLoggedIn
|
|
|
|
),
|
|
|
|
undefined,
|
|
|
|
State.state.featureSwitchUserbadge
|
2021-01-07 04:50:12 +01:00
|
|
|
)
|
2020-08-27 18:44:16 +02:00
|
|
|
|
2021-06-12 02:58:32 +02:00
|
|
|
|
|
|
|
super(State.state.layoutToUse.map (layout => new Combine([
|
2021-06-13 15:04:55 +02:00
|
|
|
layout.description.Clone(),
|
2020-09-05 15:27:35 +02:00
|
|
|
"<br/><br/>",
|
2021-06-12 02:58:32 +02:00
|
|
|
loginStatus,
|
2021-06-13 15:04:55 +02:00
|
|
|
layout.descriptionTail.Clone(),
|
2020-08-27 18:44:16 +02:00
|
|
|
"<br/>",
|
2021-06-12 02:58:32 +02:00
|
|
|
languagePicker,
|
2021-03-24 01:25:57 +01:00
|
|
|
...layout.CustomCodeSnippets()
|
2021-06-12 02:58:32 +02:00
|
|
|
])))
|
2020-07-31 01:45:54 +02:00
|
|
|
|
2021-06-12 02:58:32 +02:00
|
|
|
this.SetClass("link-underline")
|
|
|
|
}
|
2020-11-24 14:36:43 +01:00
|
|
|
}
|