mapcomplete/UI/BigComponents/LayerControlPanel.ts

53 lines
1.6 KiB
TypeScript
Raw Normal View History

import State from "../../State";
import BackgroundSelector from "./BackgroundSelector";
import Combine from "../Base/Combine";
2021-01-08 02:13:44 +01:00
import ScrollableFullScreen from "../Base/ScrollableFullScreen";
import Translations from "../i18n/Translations";
import {UIEventSource} from "../../Logic/UIEventSource";
2021-06-10 14:05:26 +02:00
import BaseUIElement from "../BaseUIElement";
import Toggle from "../Input/Toggle";
2021-07-26 21:03:27 +02:00
import {DownloadPanel} from "./DownloadPanel";
export default class LayerControlPanel extends ScrollableFullScreen {
2021-07-26 12:26:41 +02:00
constructor(isShown: UIEventSource<boolean>) {
super(LayerControlPanel.GenTitle, LayerControlPanel.GeneratePanel, "layers", isShown);
}
2021-07-26 12:26:41 +02:00
private static GenTitle(): BaseUIElement {
2021-07-27 19:59:41 +02:00
return Translations.t.general.layerSelection.title
.Clone()
.SetClass("text-2xl break-words font-bold p-2");
}
private static GeneratePanel(): BaseUIElement {
2021-07-27 19:59:41 +02:00
const elements: BaseUIElement[] = [];
if (State.state.layoutToUse.data.enableBackgroundLayerSelection) {
const backgroundSelector = new BackgroundSelector();
backgroundSelector.SetStyle("margin:1em");
backgroundSelector.onClick(() => {
});
elements.push(backgroundSelector)
}
elements.push(new Toggle(
2021-07-26 21:03:27 +02:00
new DownloadPanel(),
undefined,
State.state.featureSwitchEnableExport
))
2021-07-27 19:59:41 +02:00
2021-07-26 12:26:41 +02:00
elements.push(
new Toggle(
2021-07-27 19:59:41 +02:00
new DownloadPanel(),
2021-07-26 12:26:41 +02:00
undefined,
State.state.featureSwitchEnableExport
)
);
return new Combine(elements).SetClass("flex flex-col");
}
}