import type { Task, TaskStatus, TaskPriority } from "../lib/types"; const priorityColors: Record = { critical: "bg-red-500 text-white", high: "bg-orange-500 text-white", medium: "bg-blue-500 text-white", low: "bg-gray-400 text-white", }; const sourceColors: Record = { donovan: "bg-purple-100 text-purple-800", david: "bg-green-100 text-green-800", hammer: "bg-yellow-100 text-yellow-800", heartbeat: "bg-pink-100 text-pink-800", cron: "bg-indigo-100 text-indigo-800", other: "bg-gray-100 text-gray-800", }; const statusActions: Record = { active: [ { label: "โธ Pause", next: "queued" }, { label: "๐Ÿšซ Block", next: "blocked" }, { label: "โœ… Complete", next: "completed" }, { label: "โŒ Cancel", next: "cancelled" }, ], queued: [ { label: "โ–ถ Activate", next: "active" }, { label: "๐Ÿšซ Block", next: "blocked" }, { label: "โŒ Cancel", next: "cancelled" }, ], blocked: [ { label: "โ–ถ Activate", next: "active" }, { label: "๐Ÿ“‹ Queue", next: "queued" }, { label: "โŒ Cancel", next: "cancelled" }, ], completed: [{ label: "๐Ÿ”„ Requeue", next: "queued" }], cancelled: [{ label: "๐Ÿ”„ Requeue", next: "queued" }], }; function timeAgo(dateStr: string): string { const seconds = Math.floor((Date.now() - new Date(dateStr).getTime()) / 1000); if (seconds < 60) return "just now"; const minutes = Math.floor(seconds / 60); if (minutes < 60) return `${minutes}m ago`; const hours = Math.floor(minutes / 60); if (hours < 24) return `${hours}h ago`; const days = Math.floor(hours / 24); return `${days}d ago`; } interface TaskCardProps { task: Task; onStatusChange: (id: string, status: TaskStatus) => void; onMoveUp?: () => void; onMoveDown?: () => void; isFirst?: boolean; isLast?: boolean; isActive?: boolean; } export function TaskCard({ task, onStatusChange, onMoveUp, onMoveDown, isFirst, isLast, isActive, }: TaskCardProps) { const actions = statusActions[task.status] || []; return (
{isActive && ( โšก ACTIVE )}

{task.title}

{task.priority} {task.source} created {timeAgo(task.createdAt)} {task.updatedAt !== task.createdAt && ( ยท updated {timeAgo(task.updatedAt)} )}
{task.description && (

{task.description}

)} {task.progressNotes && task.progressNotes.length > 0 && (
{task.progressNotes.length} progress note{task.progressNotes.length !== 1 ? "s" : ""}
{task.progressNotes .slice() .reverse() .map((note, i) => (
{timeAgo(note.timestamp)}{" "} โ€” {note.note}
))}
)}
{/* Reorder buttons for queued tasks */} {task.status === "queued" && (
)} {/* Status actions */} {actions.map((action) => ( ))}
); }