UI: hide 'active filters' and 'filter results' if the filter view is disabled

This commit is contained in:
Pieter Vander Vennet 2024-10-21 23:29:56 +02:00
parent d10f89469a
commit 35b4943948

View file

@ -18,7 +18,7 @@
.filter( .filter(
(f) => (f) =>
f.filter.options[0].fields.length === 0 && f.filter.options[0].fields.length === 0 &&
Constants.priviliged_layers.indexOf(<any>f.layer.id) < 0 Constants.priviliged_layers.indexOf(<any>f.layer.id) < 0,
) )
.map((af) => { .map((af) => {
const index = <number>af.control.data const index = <number>af.control.data
@ -28,15 +28,18 @@
option: af.filter.options[index], option: af.filter.options[index],
} }
return r return r
}) }),
) )
let allowOtherThemes = state.featureSwitches.featureSwitchBackToThemeOverview
let searchTerm = state.searchState.searchTerm let searchTerm = state.searchState.searchTerm
let allowOtherThemes = state.featureSwitches.featureSwitchBackToThemeOverview
let allowFilters = state.featureSwitches.featureSwitchFilter
</script> </script>
<div class="low-interaction flex flex-col gap-y-2 p-4"> <div class="low-interaction flex flex-col gap-y-2 p-4">
{#if $allowFilters}
<ActiveFilters {state} activeFilters={$activeFilters} /> <ActiveFilters {state} activeFilters={$activeFilters} />
{/if}
{#if $searchTerm.length === 0 && $activeFilters.length === 0} {#if $searchTerm.length === 0 && $activeFilters.length === 0}
<div class="items-center p-8 text-center"> <div class="items-center p-8 text-center">
<b> <b>
@ -45,8 +48,9 @@
</div> </div>
{/if} {/if}
{#if $allowFilters}
<FilterResults {state} /> <FilterResults {state} />
{/if}
<GeocodeResults {state} /> <GeocodeResults {state} />
{#if $allowOtherThemes} {#if $allowOtherThemes}