forked from MapComplete/MapComplete
Refactoring: remove selectedLayer from titleHandler
This commit is contained in:
parent
790399f8a5
commit
b0d394797b
2 changed files with 7 additions and 6 deletions
|
@ -12,20 +12,21 @@ import { SpecialVisualizationState } from "../../UI/SpecialVisualization"
|
|||
export default class TitleHandler {
|
||||
constructor(
|
||||
selectedElement: Store<Feature>,
|
||||
selectedLayer: Store<LayerConfig>,
|
||||
allElements: FeaturePropertiesStore,
|
||||
state: SpecialVisualizationState
|
||||
) {
|
||||
const currentTitle: Store<string> = selectedElement.map(
|
||||
(selected) => {
|
||||
const defaultTitle = state.layout?.title?.txt ?? "MapComplete"
|
||||
|
||||
if (selected === undefined || selectedLayer.data === undefined) {
|
||||
if (selected === undefined) {
|
||||
return defaultTitle
|
||||
}
|
||||
const layer = state.layout.getMatchingLayer(selected.properties)
|
||||
if (layer === undefined) {
|
||||
return defaultTitle
|
||||
}
|
||||
|
||||
const tags = selected.properties
|
||||
const layer = selectedLayer.data
|
||||
if (layer.title === undefined) {
|
||||
return defaultTitle
|
||||
}
|
||||
|
@ -43,7 +44,7 @@ export default class TitleHandler {
|
|||
defaultTitle
|
||||
)
|
||||
},
|
||||
[Locale.language, selectedLayer]
|
||||
[Locale.language]
|
||||
)
|
||||
|
||||
currentTitle.addCallbackAndRunD((title) => {
|
||||
|
|
|
@ -790,7 +790,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
})
|
||||
new ThemeViewStateHashActor(this)
|
||||
new MetaTagging(this)
|
||||
new TitleHandler(this.selectedElement, this.selectedLayer, this.featureProperties, this)
|
||||
new TitleHandler(this.selectedElement, this.featureProperties, this)
|
||||
new ChangeToElementsActor(this.changes, this.featureProperties)
|
||||
new PendingChangesUploader(this.changes, this.selectedElement)
|
||||
new SelectedElementTagsUpdater(this)
|
||||
|
|
Loading…
Reference in a new issue