("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 };
}