'use client'; import { cn } from '@/lib/cn'; import type { Task, TaskStatus } from '@/lib/types'; interface TaskStatusSummaryProps { tasks: Task[]; activeFilter: TaskStatus | 'all'; onFilterChange: (filter: TaskStatus | 'all') => void; } const statusConfig: { id: TaskStatus | 'all'; label: string; color: string; activeColor: string; }[] = [ { id: 'all', label: 'All', color: 'text-text-muted', activeColor: 'bg-surface-elevated text-text-primary', }, { id: 'not-started', label: 'Not Started', color: 'text-gray-400', activeColor: 'bg-gray-600/20 text-gray-300', }, { id: 'in-progress', label: 'In Progress', color: 'text-blue-400', activeColor: 'bg-blue-600/20 text-blue-400', }, { id: 'blocked', label: 'Blocked', color: 'text-error', activeColor: 'bg-error/20 text-error', }, { id: 'done', label: 'Done', color: 'text-success', activeColor: 'bg-success/20 text-success', }, ]; export function TaskStatusSummary({ tasks, activeFilter, onFilterChange, }: TaskStatusSummaryProps): React.ReactElement { const counts: Record = { all: tasks.length, 'not-started': 0, 'in-progress': 0, blocked: 0, done: 0, cancelled: 0, }; for (const task of tasks) { counts[task.status] = (counts[task.status] ?? 0) + 1; } return (
{statusConfig.map((config) => { const count = counts[config.id]; const isActive = activeFilter === config.id; return ( ); })}
); }