From 73ff63260ffe2bff77601f5042b137c43b51b7eb Mon Sep 17 00:00:00 2001 From: Tobias Frischmann Date: Mon, 14 Sep 2026 21:07:33 +0200 Subject: [PATCH] dont use non existing label --- app/components/Filter/FilterSheet.vue | 6 +++--- app/components/Nav/VerticalNav.vue | 6 +++--- app/components/Todo/TodoShell.vue | 2 +- app/composables/useFilters.ts | 26 ++++++++++++++++++++++---- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/components/Filter/FilterSheet.vue b/app/components/Filter/FilterSheet.vue index 020df44..0c90551 100644 --- a/app/components/Filter/FilterSheet.vue +++ b/app/components/Filter/FilterSheet.vue @@ -8,7 +8,7 @@ const { t } = useI18n(); - const { time, category, tags } = useFilter(); + const { time, rawCategory, rawTags } = useFilter(); function close() { isOpen.value = false; @@ -24,11 +24,11 @@

{{ t("categories") }}

- +

{{ t("tags") }}

- +
diff --git a/app/components/Nav/VerticalNav.vue b/app/components/Nav/VerticalNav.vue index 8e1814e..6459d09 100644 --- a/app/components/Nav/VerticalNav.vue +++ b/app/components/Nav/VerticalNav.vue @@ -6,7 +6,7 @@ const { t } = useI18n(); - const { time, category, tags } = useFilter(); + const { time, rawCategory, rawTags } = useFilter(); const isSettingsSheetOpen = defineModel("isSettingsSheetOpen"); const isNewSheetOpen = defineModel("isNewSheetOpen"); @@ -24,14 +24,14 @@ {{ t("categories") }} - +

{{ t("tags") }}

- +
diff --git a/app/components/Todo/TodoShell.vue b/app/components/Todo/TodoShell.vue index 9903197..8124aea 100644 --- a/app/components/Todo/TodoShell.vue +++ b/app/components/Todo/TodoShell.vue @@ -12,7 +12,7 @@ }>(); const emit = defineEmits<{ onClick: [] }>(); - const { tags: tagsFilter } = useFilter(); + const { rawTags: tagsFilter } = useFilter(); const tags = computed(() => { if (!props.data.tags) return []; diff --git a/app/composables/useFilters.ts b/app/composables/useFilters.ts index 3036bac..664529c 100644 --- a/app/composables/useFilters.ts +++ b/app/composables/useFilters.ts @@ -1,4 +1,6 @@ import { z } from "zod"; +import { useCategoriesQuery } from "~/queries/category"; +import { useTagsQuery } from "~/queries/tag"; const FilterSchema = z.object({ tags: z.array(z.string()).default([]), @@ -39,8 +41,8 @@ export function useFilter() { }, }); - const tags = createBinding(filter, "tags"); - const category = createBinding(filter, "category"); + const rawTags = createBinding(filter, "tags"); + const rawCategory = createBinding(filter, "category"); const time = createBinding(filter, "time"); const isFiltering = computed(() => { @@ -48,7 +50,23 @@ export function useFilter() { if (filter.value.category.length !== 0) return true; return filter.value.tags.length !== 0; - }); + }); + + const { data: currentTags } = useQuery(useTagsQuery()); + + const tags = computed(() => { + return rawTags.value.filter((tag) => { + return currentTags.value?.find((currentTag) => currentTag.uuid === tag ) + }) + }) + + const { data: currentCategories } = useQuery(useCategoriesQuery()); + + const category = computed(() => { + return rawCategory.value.filter((category) => { + return currentCategories.value?.find((currentCategory) => currentCategory.uuid === category ) + }) + }) - return { tags, category, time, isFiltering }; + return { tags, rawTags, category, rawCategory, time, isFiltering }; } -- 2.51.2