Add module Filter category or level == null -> belongs to all

This commit is contained in:
Lorenz Padberg 2023-08-29 15:53:36 +02:00
parent de4737fa3f
commit b24c5419f1
3 changed files with 4 additions and 8 deletions

View File

@ -44,7 +44,7 @@ onMounted(() => {
&__input-wrapper {
position: relative;
width: 400px;
width: 380px; // With from modules, has nothing to do with it but at least it is the same width
max-width: 500px;
}

View File

@ -113,11 +113,11 @@ const updateLevel = (level: ModuleLevelNode) => {
};
const filterByLevel = (module: ModuleNode, level: ModuleLevelNode) => {
return level.filterAttributeType === 'ALL' || module.level?.id === level.id;
return level.filterAttributeType === 'ALL' || module.level?.id === level.id || module.level === null;
};
const filterByCategory = (module: ModuleNode, category: ModuleCategoryNode) => {
return category.filterAttributeType === 'ALL' || module.category?.id === category.id;
return category.filterAttributeType === 'ALL' || module.category?.id === category.id || module.category === null;
};
const filterByLanguage = (module: ModuleNode, language: string) => {

View File

@ -10,7 +10,7 @@
v-else
/>
<div class="instrument-overview__list">
<FilterBar v-model:filter="searchText"></FilterBar>
<FilterBar :search-query="searchText" @update:searchQuery="val => searchText = val"></FilterBar>
<router-link
:to="{ name: 'instrument', params: { slug: instrument.slug } }"
data-cy="instrument"
@ -29,7 +29,6 @@ import InstrumentEntry from '@/components/instruments/InstrumentEntry.vue';
import INSTRUMENTS_QUERY from '@/graphql/gql/queries/instrumentsQuery.gql';
import INSTRUMENT_FILTER_QUERY from 'gql/local/instrumentFilter.gql';
import FilterBar from '@/components/instruments/FilterBar.vue';
import ME_QUERY from '@/graphql/gql/queries/meQuery.gql';
import { graphql } from '@/__generated__';
export default {
@ -96,9 +95,6 @@ export default {
instruments = instruments.filter((i) => i.title.toLowerCase().includes(this.searchText.toLowerCase()));
return instruments;
},
// language() {
// return this.instruments.value?.me.language || 'de';
// },
},
methods: {