Fix: improve typing and probably fix broken settings (MapComplete/MapComplete#2281)

This commit is contained in:
Pieter Vander Vennet 2024-12-09 16:12:20 +01:00
parent e2d4afdab4
commit 4b121e474c
2 changed files with 6 additions and 5 deletions

View file

@ -3,15 +3,17 @@
import { Stores } from "../../Logic/UIEventSource" import { Stores } from "../../Logic/UIEventSource"
import Tr from "../Base/Tr.svelte" import Tr from "../Base/Tr.svelte"
import Translations from "../i18n/Translations" import Translations from "../i18n/Translations"
import type { SpecialVisualizationState } from "../SpecialVisualization"
import ThemeViewState from "../../Models/ThemeViewState"
/** /**
* Shows _all_ disabled questions * Shows _all_ disabled questions
*/ */
export let state export let state: ThemeViewState
let layers = state.layout.layers.filter((l) => l.isNormal()) let layers = state.theme.layers.filter((l) => l.isNormal())
let allDisabled = Stores.concat<string>( let allDisabled = Stores.concat<string>(
layers.map((l) => state.userRelatedState.getThemeDisabled(state.layout.id, l.id)) layers.map((l) => state.userRelatedState.getThemeDisabled(state.theme.id, l.id))
).map((l) => [].concat(...l)) ).map((l) => [].concat(...l))
const t = Translations.t.general.questions const t = Translations.t.general.questions
</script> </script>

View file

@ -2,7 +2,6 @@
/** /**
* Gives an overview of questions which are disabled for the given theme * Gives an overview of questions which are disabled for the given theme
*/ */
import UserRelatedState from "../../Logic/State/UserRelatedState"
import LayerConfig from "../../Models/ThemeConfig/LayerConfig" import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
import ThemeViewState from "../../Models/ThemeViewState" import ThemeViewState from "../../Models/ThemeViewState"
import Tr from "../Base/Tr.svelte" import Tr from "../Base/Tr.svelte"
@ -13,7 +12,7 @@
export let layer: LayerConfig export let layer: LayerConfig
export let state: ThemeViewState export let state: ThemeViewState
let disabledQuestions = state.userRelatedState.getThemeDisabled(state.layout.id, layer.id) let disabledQuestions = state.userRelatedState.getThemeDisabled(state.theme.id, layer.id)
function getQuestion(id: string): Translation { function getQuestion(id: string): Translation {
return layer.tagRenderings.find((q) => q.id === id).question.Subs({}) return layer.tagRenderings.find((q) => q.id === id).question.Subs({})