Refactoring: LayoutToUse is a simple value now

This commit is contained in:
Pieter Vander Vennet 2021-09-28 18:00:44 +02:00
parent 41a2a79fe9
commit a78d33112b
22 changed files with 133 additions and 153 deletions

View file

@ -3,12 +3,18 @@ import Translations from "../../UI/i18n/Translations";
import Locale from "../../UI/i18n/Locale";
import TagRenderingAnswer from "../../UI/Popup/TagRenderingAnswer";
import Combine from "../../UI/Base/Combine";
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig";
import {ElementStorage} from "../ElementStorage";
export default class TitleHandler {
constructor(state) {
constructor(state : {
selectedElement: UIEventSource<any>,
layoutToUse: LayoutConfig,
allElements: ElementStorage
}) {
const currentTitle: UIEventSource<string> = state.selectedElement.map(
selected => {
const layout = state.layoutToUse.data
const layout = state.layoutToUse
const defaultTitle = Translations.WT(layout?.title)?.txt ?? "MapComplete"
if (selected === undefined) {
@ -27,7 +33,7 @@ export default class TitleHandler {
}
}
return defaultTitle
}, [Locale.language, state.layoutToUse]
}, [Locale.language]
)