Fixed 'clear all' button not showing for networks in channel filter.

This commit is contained in:
DebaucheryLibrarian 2020-09-12 03:33:23 +02:00
parent 63e4c7d888
commit 2612c55c85
1 changed files with 8 additions and 3 deletions

View File

@ -4,9 +4,9 @@
<Icon icon="antenna" /> <Icon icon="antenna" />
<div <div
v-if="selectedChannels.length + selectedNetworks.length > 0" v-if="selectedLength > 0"
class="filter-applied" class="filter-applied"
>{{ selectedChannels.length + selectedNetworks.length }} {{ selectedChannels.length + selectedNetworks.length > 1 ? 'channels' : 'channel' }}</div> >{{ selectedLength }} {{ selectedLength > 1 ? 'channels' : 'channel' }}</div>
<div <div
v-else v-else
@ -18,7 +18,7 @@
<router-link <router-link
class="filter-clear" class="filter-clear"
:to="{ query: { ...$route.query, channels: undefined, networks: undefined } }" :to="{ query: { ...$route.query, channels: undefined, networks: undefined } }"
:class="{ active: selectedChannels.length > 0 }" :class="{ active: selectedLength > 0 }"
>clear all<Icon icon="cross2" /></router-link> >clear all<Icon icon="cross2" /></router-link>
<ul class="filter-items nolist"> <ul class="filter-items nolist">
@ -126,6 +126,10 @@ function channelsPerNetwork() {
return Object.values(networks).reduce((acc, network) => [...acc, network, ...(network.children || [])], []); return Object.values(networks).reduce((acc, network) => [...acc, network, ...(network.children || [])], []);
} }
function selectedLength() {
return this.selectedChannels.length + this.selectedNetworks.length;
}
export default { export default {
props: { props: {
filter: { filter: {
@ -145,6 +149,7 @@ export default {
channelsPerNetwork, channelsPerNetwork,
selectedChannels, selectedChannels,
selectedNetworks, selectedNetworks,
selectedLength,
}, },
methods: { methods: {
getNewRange, getNewRange,