import { type Component, createMemo } from "solid-js"; import { type Task, toggleTask, calculateUrgencyFromDate, setActiveTaskId } from "@/store"; import { cn } from "@/lib/utils"; import { CheckCircle2, Circle, Clock, ArrowUpCircle } from "lucide-solid"; export const TaskCard: Component<{ task: Task }> = (props) => { const urgencyLevel = createMemo(() => calculateUrgencyFromDate(props.task.dueDate)); const urgencyColor = () => { const u = urgencyLevel(); if (u >= 8) return "text-red-500"; if (u >= 6) return "text-orange-500"; if (u >= 4) return "text-blue-500"; return "text-muted-foreground"; }; const formattedDate = () => { const date = new Date(props.task.dueDate); return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }); }; return (
setActiveTaskId(props.task.id)} >

{props.task.title}

{/* Priority */}
P{props.task.priority}
{/* Due Date + Urgency Slide-out */}
{/* Due Date - Static Layer on Top */}
{formattedDate()}
{/* Urgency Number - Slides out from behind with fade */}
Urgency {urgencyLevel()}
); };