import { format, isPast } from 'date-fns'; import { Calendar, CheckCircle2 } from 'lucide-react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { cn } from '@/lib/utils'; interface DashboardTodo { id: number; title: string; due_date: string; priority: string; category?: string; } interface TodoWidgetProps { todos: DashboardTodo[]; } const priorityColors: Record = { low: 'bg-green-500/10 text-green-500 border-green-500/20', medium: 'bg-yellow-500/10 text-yellow-500 border-yellow-500/20', high: 'bg-red-500/10 text-red-500 border-red-500/20', }; export default function TodoWidget({ todos }: TodoWidgetProps) { return ( Upcoming Todos {todos.length === 0 ? (

No upcoming todos. You're all caught up!

) : (
{todos.slice(0, 5).map((todo) => { const isOverdue = isPast(new Date(todo.due_date)); return (

{todo.title}

{format(new Date(todo.due_date), 'MMM d, yyyy')} {isOverdue && (Overdue)}
{todo.category && ( {todo.category} )}
{todo.priority}
); })}
)}
); }