mapcomplete/UI/AllThemesGui.ts

46 lines
1.9 KiB
TypeScript
Raw Normal View History

2022-09-08 21:40:48 +02:00
import UserRelatedState from "../Logic/State/UserRelatedState"
import { FixedUiElement } from "./Base/FixedUiElement"
import Combine from "./Base/Combine"
import MoreScreen from "./BigComponents/MoreScreen"
import Translations from "./i18n/Translations"
import Constants from "../Models/Constants"
import LanguagePicker from "./LanguagePicker"
2022-09-08 21:40:48 +02:00
import IndexText from "./BigComponents/IndexText"
2023-01-06 04:21:34 +01:00
import { LoginToggle } from "./Popup/LoginButton"
import { ImmutableStore } from "../Logic/UIEventSource"
import { OsmConnection } from "../Logic/Osm/OsmConnection"
export default class AllThemesGui {
2022-04-08 04:36:00 +02:00
setup() {
2021-11-07 16:34:51 +01:00
try {
const osmConnection = new OsmConnection()
const state = new UserRelatedState(osmConnection)
2021-11-07 16:34:51 +01:00
const intro = new Combine([
new LanguagePicker(Translations.t.index.title.SupportedLanguages(), "").SetClass(
2022-09-08 21:40:48 +02:00
"flex absolute top-2 right-3"
),
new IndexText(),
])
2021-11-07 16:34:51 +01:00
new Combine([
intro,
new MoreScreen(state, true),
new LoginToggle(undefined, Translations.t.index.logIn, {
osmConnection,
featureSwitchUserbadge: new ImmutableStore(true),
}),
Translations.t.general.aboutMapComplete.intro.SetClass("link-underline"),
new FixedUiElement("v" + Constants.vNumber).SetClass("block"),
2022-09-08 21:40:48 +02:00
])
.SetClass("block m-5 lg:w-3/4 lg:ml-40")
2023-03-29 17:21:20 +02:00
.AttachTo("main")
2021-11-07 16:34:51 +01:00
} catch (e) {
2021-12-21 18:35:31 +01:00
console.error(">>>> CRITICAL", e)
2022-09-08 21:40:48 +02:00
new FixedUiElement(
"Seems like no layers are compiled - check the output of `npm run generate:layeroverview`. Is this visible online? Contact pietervdvn immediately!"
)
.SetClass("alert")
2023-03-29 17:21:20 +02:00
.AttachTo("main")
}
}
}