diff --git a/components/calendar/search/CalendarSearch.vue b/components/calendar/search/CalendarSearch.vue index 26682cf..25f3376 100644 --- a/components/calendar/search/CalendarSearch.vue +++ b/components/calendar/search/CalendarSearch.vue @@ -212,11 +212,21 @@ const categoryFilterOpened = ref(false) const searchCategory = ref("") const filteredCategories = computed(() => { + // Display original data if (!currentCategories.value) return [] - return currentCategories.value.filter((i) => !selectedCategories.value.includes(i)) + + // If current categories are selected, ignore them + if (!searchCategory.value) return currentCategories.value.filter((i) => !selectedCategories.value.includes(i)) + + // If we also have a query to filter them by, do that + return currentCategories.value.filter((i) => { + return !selectedCategories.value.includes(i) && i.name.toLocaleLowerCase().includes(searchCategory.value.toLocaleLowerCase()) + }) }) +// Reactivity rules for category searches const categoryInput = ref(null) +const categoryInputValue = ref("") const { focused: categoryInputFocused } = useFocus(categoryInput) watch(categoryInputFocused, (isFocused) => { @@ -318,6 +328,7 @@ function handleCategoryUnselect(e: Category) {