update search type badges

This commit is contained in:
bymyself
2026-01-22 22:11:32 -08:00
committed by Christian Byrne
parent e3bad033ed
commit 247a970dc9
2 changed files with 41 additions and 9 deletions

View File

@@ -1,13 +1,27 @@
<template>
<div class="_content">
<SelectButton
v-model="selectedFilter"
class="filter-type-select"
:options="filters"
:allow-empty="false"
option-label="name"
@change="updateSelectedFilterValue"
/>
<div
class="filter-type-group"
role="tablist"
:aria-label="$t('sideToolbar.nodeLibraryTab.filterCategory')"
>
<Button
v-for="filterOption in filters"
:key="filterOption.id"
type="button"
size="sm"
:variant="
selectedFilter?.id === filterOption.id
? 'secondary'
: 'muted-textonly'
"
class="filter-type-button"
:aria-pressed="selectedFilter?.id === filterOption.id"
@click="selectFilterOption(filterOption)"
>
{{ filterOption.name }}
</Button>
</div>
<Select
v-model="selectedFilterValue"
class="filter-value-select"
@@ -23,7 +37,6 @@
<script setup lang="ts">
import Select from 'primevue/select'
import SelectButton from 'primevue/selectbutton'
import { computed, onMounted, ref } from 'vue'
import Button from '@/components/ui/button/Button.vue'
@@ -57,6 +70,16 @@ const updateSelectedFilterValue = () => {
selectedFilterValue.value = filterValues.value[0]
}
const selectFilterOption = (
filterOption: FuseFilter<ComfyNodeDefImpl, string>
) => {
if (selectedFilter.value?.id === filterOption.id) {
return
}
selectedFilter.value = filterOption
updateSelectedFilterValue()
}
const submit = () => {
if (!selectedFilter.value) {
return
@@ -75,6 +98,14 @@ const submit = () => {
@apply flex flex-col space-y-2;
}
.filter-type-group {
@apply flex flex-wrap gap-2;
}
.filter-type-button {
@apply flex-1 justify-center px-3 py-2 text-sm;
}
._footer {
@apply flex flex-col pt-4 items-end;
}

View File

@@ -720,6 +720,7 @@
"groupBy": "Group By",
"sortMode": "Sort Mode",
"resetView": "Reset View to Default",
"filterCategory": "Filter category",
"groupStrategies": {
"category": "Category",
"categoryDesc": "Group by node category",