Skip to content

Commit

Permalink
Add codetta filter
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangDrescher committed Nov 19, 2024
1 parent 2eca430 commit 2b0b723
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions locales/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ nCountResults: '{n} von {count} Ergebnissen'
previous: Vorheriges
next: Nächstes
subject: Thema
codetta: Zwischentakte
12 changes: 12 additions & 0 deletions pages/wtc/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ const columns = [
key: 'category',
label: t('category'),
},
{
key: 'codetta',
label: t('codetta'),
},
];
function getVoiceName(num, voicesCount) {
Expand Down Expand Up @@ -103,6 +107,7 @@ const pieces = data.value.map(fugue => ({
horizontal: fugue.exposition?.map(a => getVoiceName(a.voice, fugue.parts)).join(', '),
majorMinor: fugue.majorMinor,
modulatingSubject: fugue.modulatingSubject,
codetta: fugue.codetta,
}));
const selectedColumns = ref(columns);
Expand All @@ -115,6 +120,7 @@ const defaultFilters = {
majorMinor: null,
modulatingSubject: null,
category: null,
codetta: null,
};
const filters = reactive({ ...defaultFilters });
Expand All @@ -133,6 +139,7 @@ const filteredPieces = computed(() => {
&& (!filters.majorMinor || filters.majorMinor === item.majorMinor)
&& (!filters.modulatingSubject || item.modulatingSubject)
&& (!filters.category || item.category.includes(filters.category))
&& (filters.codetta === null || item.codetta === filters.codetta)
);
});
});
Expand Down Expand Up @@ -176,6 +183,11 @@ function resetFilters() {
<USelectMenu v-model="filters.category" :options="categories" size="xs" class="w-24" />
</UFormGroup>
</div>
<div>
<UFormGroup>
<UCheckbox v-model="filters.codetta" :label="$t('codetta')"/>
</UFormGroup>
</div>
<div>
<UButton icon="i-heroicons-funnel" color="gray" size="xs" @click="resetFilters">
{{ $t('reset') }}
Expand Down

0 comments on commit 2b0b723

Please sign in to comment.