From cce151e64bab633a7ee84bec80a464971c5374bb Mon Sep 17 00:00:00 2001 From: Brad Groux Date: Thu, 29 Jan 2026 14:27:26 -0600 Subject: [PATCH] fix: add task ID to board and archive search filters --- web/src/components/board/FilterBar.tsx | 5 +- web/src/components/layout/ArchiveSidebar.tsx | 93 ++++++++++---------- 2 files changed, 50 insertions(+), 48 deletions(-) diff --git a/web/src/components/board/FilterBar.tsx b/web/src/components/board/FilterBar.tsx index a725ce29..52ac5299 100644 --- a/web/src/components/board/FilterBar.tsx +++ b/web/src/components/board/FilterBar.tsx @@ -160,12 +160,13 @@ export function searchParamsToFilters(params: URLSearchParams): FilterState { // Filter function export function filterTasks(tasks: Task[], filters: FilterState): Task[] { return tasks.filter((task) => { - // Search filter (title + description) + // Search filter (title + description + task ID) if (filters.search) { const searchLower = filters.search.toLowerCase(); const titleMatch = task.title.toLowerCase().includes(searchLower); const descMatch = task.description?.toLowerCase().includes(searchLower); - if (!titleMatch && !descMatch) return false; + const idMatch = task.id.toLowerCase().includes(searchLower); + if (!titleMatch && !descMatch && !idMatch) return false; } // Project filter diff --git a/web/src/components/layout/ArchiveSidebar.tsx b/web/src/components/layout/ArchiveSidebar.tsx index a5cb7cf6..093b819c 100644 --- a/web/src/components/layout/ArchiveSidebar.tsx +++ b/web/src/components/layout/ArchiveSidebar.tsx @@ -1,15 +1,18 @@ import { useState, useMemo } from 'react'; -import { Archive, RefreshCw, Search, Calendar, FolderOpen, RotateCcw, ChevronDown } from 'lucide-react'; +import { + Archive, + RefreshCw, + Search, + Calendar, + FolderOpen, + RotateCcw, + ChevronDown, +} from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { ScrollArea } from '@/components/ui/scroll-area'; import { Badge } from '@/components/ui/badge'; -import { - Sheet, - SheetContent, - SheetHeader, - SheetTitle, -} from '@/components/ui/sheet'; +import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet'; import { Select, SelectContent, @@ -64,43 +67,39 @@ interface SprintConfig { label: string; } -function ArchivedTaskItem({ - task, +function ArchivedTaskItem({ + task, onClick, onRestore, isRestoring, projects = [], sprints = [], -}: { - task: Task; +}: { + task: Task; onClick?: () => void; onRestore?: () => void; isRestoring?: boolean; projects?: ProjectConfig[]; sprints?: SprintConfig[]; }) { - const projectLabel = task.project - ? projects.find(p => p.id === task.project)?.label || task.project + const projectLabel = task.project + ? projects.find((p) => p.id === task.project)?.label || task.project : null; - const sprintLabel = task.sprint - ? sprints.find(s => s.id === task.sprint)?.label || task.sprint + const sprintLabel = task.sprint + ? sprints.find((s) => s.id === task.sprint)?.label || task.sprint : null; return ( -
- - {typeIcons[task.type] || '📋'} - + {typeIcons[task.type] || '📋'}
-
- {task.title} -
+
{task.title}
{projectLabel && ( @@ -133,7 +132,7 @@ function ArchivedTaskItem({ disabled={isRestoring} title="Restore to board" > - + )}
@@ -148,7 +147,7 @@ export function ArchiveSidebar({ open, onOpenChange }: ArchiveSidebarProps) { const [visibleCount, setVisibleCount] = useState(PAGE_SIZE); const [selectedTask, setSelectedTask] = useState(null); const [detailOpen, setDetailOpen] = useState(false); - + const { data: archivedTasks, isLoading, refetch, isRefetching } = useArchivedTasks(); const restoreTask = useRestoreTask(); const { data: sprintsList = [] } = useSprints(); @@ -170,7 +169,7 @@ export function ArchiveSidebar({ open, onOpenChange }: ArchiveSidebarProps) { }; const handleRestoreFromDetail = async (taskId: string) => { - const task = archivedTasks?.find(t => t.id === taskId); + const task = archivedTasks?.find((t) => t.id === taskId); if (task) { await handleRestore(task); } @@ -194,32 +193,33 @@ export function ArchiveSidebar({ open, onOpenChange }: ArchiveSidebarProps) { // Get unique projects for filter dropdown, with labels const projects = useMemo(() => { if (!archivedTasks) return []; - const projectIds = new Set(archivedTasks.map(t => t.project).filter(Boolean) as string[]); + const projectIds = new Set(archivedTasks.map((t) => t.project).filter(Boolean) as string[]); return projectsList - .filter(p => projectIds.has(p.id)) + .filter((p) => projectIds.has(p.id)) .sort((a, b) => a.label.localeCompare(b.label)); }, [archivedTasks, projectsList]); // Filter tasks const filteredTasks = useMemo(() => { if (!archivedTasks) return []; - - return archivedTasks.filter(task => { + + return archivedTasks.filter((task) => { // Search filter if (search) { const searchLower = search.toLowerCase(); const matchesTitle = task.title.toLowerCase().includes(searchLower); const matchesDescription = task.description?.toLowerCase().includes(searchLower); const matchesSprint = task.sprint?.toLowerCase().includes(searchLower); - if (!matchesTitle && !matchesDescription && !matchesSprint) return false; + const matchesId = task.id.toLowerCase().includes(searchLower); + if (!matchesTitle && !matchesDescription && !matchesSprint && !matchesId) return false; } - + // Type filter if (typeFilter !== 'all' && task.type !== typeFilter) return false; - + // Project filter if (projectFilter !== 'all' && task.project !== projectFilter) return false; - + return true; }); }, [archivedTasks, search, typeFilter, projectFilter]); @@ -256,10 +256,10 @@ export function ArchiveSidebar({ open, onOpenChange }: ArchiveSidebarProps) { disabled={isRefetching} className="h-8 w-8" > - +
- + {/* Search */}
@@ -286,7 +286,7 @@ export function ArchiveSidebar({ open, onOpenChange }: ArchiveSidebarProps) { ))} - + {projects.length > 0 && (