diff --git a/src/components/FilterBar.tsx b/src/components/FilterBar.tsx index 69f6a11..e8e8b29 100644 --- a/src/components/FilterBar.tsx +++ b/src/components/FilterBar.tsx @@ -5,6 +5,7 @@ import { Button } from "./ui/button"; import { cn } from "@/lib/utils"; import { Badge } from "./ui/badge"; import { Select, SelectContent, SelectItem, SelectTrigger } from "./ui/select"; +import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "./ui/command"; import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover"; import { useTheme } from "./ThemeProvider"; import { getThemeAdjustedColor } from "@/lib/colors"; @@ -12,6 +13,8 @@ import { getThemeAdjustedColor } from "@/lib/colors"; export const FilterBar: Component<{ mode?: 'tasks' | 'notes', class?: string, triggerClass?: string }> = (props) => { const { resolvedTheme } = useTheme(); const [isOpen, setIsOpen] = createSignal(false); + const [isTagOpen, setIsTagOpen] = createSignal(false); + const [tagSearch, setTagSearch] = createSignal(""); const [newTemplateName, setNewTemplateName] = createSignal(""); const [isSaving, setIsSaving] = createSignal(false); @@ -294,22 +297,53 @@ export const FilterBar: Component<{ mode?: 'tasks' | 'notes', class?: string, tr )} - + + + + + + { + if (t.startsWith('_')) return false; + const search = tagSearch().toLowerCase(); + if (!search && (t.startsWith('@') || t.startsWith('#'))) return false; + return t.toLowerCase().includes(search); + }).length === 0}> + No tags found. + + + { + if (t.startsWith('_')) return false; + const search = tagSearch().toLowerCase(); + if (!search && (t.startsWith('@') || t.startsWith('#'))) return false; + return t.toLowerCase().includes(search); + })}> + {(tag) => ( + { + if (!currentFilter().tags.some(t => t.name === tag)) { + currentSetFilter({ tags: [...currentFilter().tags, { name: tag, excluded: false }] }); + } + setIsTagOpen(false); + setTagSearch(""); + }} + > + {tag} + + )} + + + + + +