import { Calendar, Flag, Plus } from 'lucide-react'; import type { Task, Project, Section } from '@/types'; import { cn, formatDate, isOverdue, getPriorityColor } from '@/lib/utils'; import { useTasksStore } from '@/stores/tasks'; import { AddTask } from '@/components/AddTask'; interface BoardViewProps { project: Project; sections: Section[]; tasks: Task[]; isLoading: boolean; } function TaskCard({ task }: { task: Task }) { const { toggleComplete, setSelectedTask } = useTasksStore(); const overdue = !task.isCompleted && isOverdue(task.dueDate); return (
setSelectedTask(task)} >
{/* Priority indicator */}

{task.title}

{task.description && (

{task.description}

)}
{task.dueDate && ( {formatDate(task.dueDate)} )} {task.assignee && ( {task.assignee.name.charAt(0).toUpperCase()} )}
); } function BoardColumn({ title, tasks, projectId, sectionId, }: { title: string; tasks: Task[]; projectId: string; sectionId?: string; }) { return (
{/* Column header */}

{title} {tasks.length}

{/* Tasks */}
{tasks.map((task) => ( ))}
{/* Add task */}
); } export function BoardView({ project, sections, tasks, isLoading }: BoardViewProps) { if (isLoading) { return (
Loading tasks...
); } const unsectionedTasks = tasks.filter((t) => !t.sectionId); const columns = [ { title: 'No Section', tasks: unsectionedTasks, sectionId: undefined }, ...sections.map((section) => ({ title: section.name, tasks: tasks.filter((t) => t.sectionId === section.id), sectionId: section.id, })), ]; return (
{columns.map((col) => ( ))}
); }