feat: categories and option search

This commit is contained in:
2025-03-15 15:32:45 +00:00
parent 97831caf75
commit 08d6a2a2fe
11 changed files with 214 additions and 33 deletions

View File

@ -1,11 +1,29 @@
<script setup lang="ts">
defineProps({
import { computed, getCurrentInstance } from 'vue';
import { useGeneralStore } from '../stores';
const general = useGeneralStore();
const category = getCurrentInstance()?.parent?.parent?.parent?.parent; // yes indeed
const props = defineProps({
title: String,
});
const searched = computed(() => {
const term = general.cfgSearchTerm.toLowerCase();
const categoryTitle = category?.props?.title as string | undefined;
const res =
props.title?.toLowerCase().includes(term) ||
categoryTitle?.toLowerCase().includes(term);
if (res === true && categoryTitle !== undefined) {
general.cfgCategories.add(categoryTitle);
}
return res;
});
</script>
<template>
<div class="flex flex-row w-full p-2 gap-2 items-center">
<div v-if="searched" class="flex flex-row w-full p-2 gap-2 items-center">
<div class="grow">{{ title }}</div>
<slot />
</div>