2023-04-20 17:42:07 +02:00
|
|
|
import { UIEventSource } from "../../Logic/UIEventSource"
|
2020-10-27 01:01:34 +01:00
|
|
|
import Combine from "../Base/Combine"
|
2021-01-08 02:13:44 +01:00
|
|
|
import ScrollableFullScreen from "../Base/ScrollableFullScreen"
|
2021-06-14 02:39:23 +02:00
|
|
|
import BaseUIElement from "../BaseUIElement"
|
2021-08-07 23:11:34 +02:00
|
|
|
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
2021-11-10 18:42:31 +01:00
|
|
|
import Toggle from "../Input/Toggle"
|
2022-05-01 04:17:40 +02:00
|
|
|
import FeaturePipelineState from "../../Logic/State/FeaturePipelineState"
|
2022-11-08 14:37:48 +01:00
|
|
|
import Svg from "../../Svg"
|
|
|
|
import Translations from "../i18n/Translations"
|
2020-06-27 03:06:51 +02:00
|
|
|
|
2021-02-25 02:23:26 +01:00
|
|
|
export default class FeatureInfoBox extends ScrollableFullScreen {
|
2021-06-14 02:39:23 +02:00
|
|
|
public constructor(
|
2020-10-27 01:01:34 +01:00
|
|
|
tags: UIEventSource<any>,
|
2021-06-22 03:16:45 +02:00
|
|
|
layerConfig: LayerConfig,
|
2022-05-01 04:17:40 +02:00
|
|
|
state: FeaturePipelineState,
|
2022-07-08 03:14:55 +02:00
|
|
|
options?: {
|
|
|
|
hashToShow?: string
|
|
|
|
isShown?: UIEventSource<boolean>
|
|
|
|
setHash?: true | boolean
|
|
|
|
}
|
2020-06-27 03:06:51 +02:00
|
|
|
) {
|
2023-03-08 01:36:27 +01:00
|
|
|
const showAllQuestions = state.featureSwitchShowAllQuestions.map(
|
|
|
|
(fsShow) => fsShow || state.showAllQuestionsAtOnce.data,
|
|
|
|
[state.showAllQuestionsAtOnce]
|
|
|
|
)
|
2022-01-19 20:34:04 +01:00
|
|
|
super(
|
2023-04-14 04:34:13 +02:00
|
|
|
() => undefined,
|
2023-04-20 17:42:07 +02:00
|
|
|
() => FeatureInfoBox.GenerateContent(tags, layerConfig),
|
2022-07-08 03:14:55 +02:00
|
|
|
options?.hashToShow ?? tags.data.id ?? "item",
|
|
|
|
options?.isShown,
|
|
|
|
options
|
2022-09-08 21:40:48 +02:00
|
|
|
)
|
2021-04-17 23:36:46 +02:00
|
|
|
|
2020-11-17 16:29:51 +01:00
|
|
|
if (layerConfig === undefined) {
|
2021-02-25 02:23:26 +01:00
|
|
|
throw "Undefined layerconfig"
|
2020-11-02 18:59:21 +01:00
|
|
|
}
|
2021-01-25 03:12:09 +01:00
|
|
|
}
|
2021-02-20 02:25:29 +01:00
|
|
|
|
2023-04-20 17:42:07 +02:00
|
|
|
public static GenerateContent(tags: UIEventSource<any>): BaseUIElement {
|
2022-12-16 01:09:18 +01:00
|
|
|
return new Toggle(
|
2022-12-16 13:45:07 +01:00
|
|
|
new Combine([
|
|
|
|
Svg.delete_icon_svg().SetClass("w-8 h-8"),
|
|
|
|
Translations.t.delete.isDeleted,
|
|
|
|
]).SetClass("flex justify-center font-bold items-center"),
|
2023-04-20 17:42:07 +02:00
|
|
|
new Combine([]).SetClass("block"),
|
2022-12-16 13:45:07 +01:00
|
|
|
tags.map((t) => t["_deleted"] == "yes")
|
2022-12-16 01:09:18 +01:00
|
|
|
)
|
|
|
|
}
|
2020-06-27 03:06:51 +02:00
|
|
|
}
|