forked from MapComplete/MapComplete
Fix: apply refactoring
This commit is contained in:
parent
4f05f0bc05
commit
140e966de1
2 changed files with 24 additions and 22 deletions
|
@ -53,7 +53,7 @@
|
||||||
* Ids of skipped questions
|
* Ids of skipped questions
|
||||||
*/
|
*/
|
||||||
let skippedQuestions = new UIEventSource<Set<string>>(new Set<string>())
|
let skippedQuestions = new UIEventSource<Set<string>>(new Set<string>())
|
||||||
let layerDisabledForTheme = state.userRelatedState.getThemeDisabled(state.layout.id, layer.id)
|
let layerDisabledForTheme = state.userRelatedState.getThemeDisabled(state.theme.id, layer.id)
|
||||||
layerDisabledForTheme.addCallbackAndRunD(disabled => {
|
layerDisabledForTheme.addCallbackAndRunD(disabled => {
|
||||||
skippedQuestions.set(new Set(disabled.concat(Array.from(skippedQuestions.data))))
|
skippedQuestions.set(new Set(disabled.concat(Array.from(skippedQuestions.data))))
|
||||||
})
|
})
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
return !m.hideInAnswer.matchesProperties(tgs)
|
return !m.hideInAnswer.matchesProperties(tgs)
|
||||||
})
|
})
|
||||||
selectedMapping = mappings?.findIndex(
|
selectedMapping = mappings?.findIndex(
|
||||||
(mapping) => mapping.if.matchesProperties(tgs) || mapping.alsoShowIf?.matchesProperties(tgs)
|
(mapping) => mapping.if.matchesProperties(tgs) || mapping.alsoShowIf?.matchesProperties(tgs),
|
||||||
)
|
)
|
||||||
if (selectedMapping < 0) {
|
if (selectedMapping < 0) {
|
||||||
selectedMapping = undefined
|
selectedMapping = undefined
|
||||||
|
@ -201,7 +201,7 @@
|
||||||
if (freeformValue?.length > 0) {
|
if (freeformValue?.length > 0) {
|
||||||
selectedMapping = config.mappings.length
|
selectedMapping = config.mappings.length
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
|
@ -219,7 +219,7 @@
|
||||||
$freeformInput,
|
$freeformInput,
|
||||||
selectedMapping,
|
selectedMapping,
|
||||||
checkedMappings,
|
checkedMappings,
|
||||||
tags.data
|
tags.data,
|
||||||
)
|
)
|
||||||
if (featureSwitchIsDebugging?.data) {
|
if (featureSwitchIsDebugging?.data) {
|
||||||
console.log(
|
console.log(
|
||||||
|
@ -231,7 +231,7 @@
|
||||||
currentTags: tags.data,
|
currentTags: tags.data,
|
||||||
},
|
},
|
||||||
" --> ",
|
" --> ",
|
||||||
selectedTags
|
selectedTags,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -253,7 +253,7 @@
|
||||||
selectedTags = new And([...selectedTags.and, ...extraTagsArray])
|
selectedTags = new And([...selectedTags.and, ...extraTagsArray])
|
||||||
} else {
|
} else {
|
||||||
console.error(
|
console.error(
|
||||||
"selectedTags is not of type Tag or And, it is a " + JSON.stringify(selectedTags)
|
"selectedTags is not of type Tag or And, it is a " + JSON.stringify(selectedTags),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@
|
||||||
onDestroy(
|
onDestroy(
|
||||||
state.osmConnection?.userDetails?.addCallbackAndRun((ud) => {
|
state.osmConnection?.userDetails?.addCallbackAndRun((ud) => {
|
||||||
numberOfCs = ud.csCount
|
numberOfCs = ud.csCount
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
}
|
}
|
||||||
|
|
||||||
let disabledInTheme = state.userRelatedState.getThemeDisabled(state.layout.id, layer?.id)
|
let disabledInTheme = state.userRelatedState.getThemeDisabled(state.theme.id, layer?.id)
|
||||||
let menuIsOpened = new UIEventSource(false)
|
let menuIsOpened = new UIEventSource(false)
|
||||||
|
|
||||||
function disableQuestion() {
|
function disableQuestion() {
|
||||||
|
@ -361,20 +361,22 @@
|
||||||
<div class={clss}>
|
<div class={clss}>
|
||||||
|
|
||||||
{#if layer.isNormal()}
|
{#if layer.isNormal()}
|
||||||
<DotMenu hideBackground={true} open={menuIsOpened}>
|
<LoginToggle {state}>
|
||||||
<SidebarUnit>
|
<DotMenu hideBackground={true} open={menuIsOpened}>
|
||||||
{#if $disabledInTheme.indexOf(config.id) >= 0}
|
<SidebarUnit>
|
||||||
<button on:click={() => enableQuestion()}>
|
{#if $disabledInTheme.indexOf(config.id) >= 0}
|
||||||
<Tr t={Translations.t.general.questions.enable}/>
|
<button on:click={() => enableQuestion()}>
|
||||||
</button>
|
<Tr t={Translations.t.general.questions.enable} />
|
||||||
{:else}
|
</button>
|
||||||
<button on:click={() => disableQuestion()}>
|
{:else}
|
||||||
<Tr t={Translations.t.general.questions.disable}/>
|
<button on:click={() => disableQuestion()}>
|
||||||
</button>
|
<Tr t={Translations.t.general.questions.disable} />
|
||||||
{/if}
|
</button>
|
||||||
</SidebarUnit>
|
{/if}
|
||||||
</DotMenu>
|
</SidebarUnit>
|
||||||
{/if}
|
</DotMenu>
|
||||||
|
</LoginToggle>
|
||||||
|
{/if}
|
||||||
<form
|
<form
|
||||||
class="relative flex flex-col overflow-y-auto px-4"
|
class="relative flex flex-col overflow-y-auto px-4"
|
||||||
style="max-height: 75vh"
|
style="max-height: 75vh"
|
||||||
|
|
Loading…
Add table
Reference in a new issue