"use client"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { Badge } from "@/components/ui/badge"; import { CheckCircle2, Clock, AlertCircle, Calendar } from "lucide-react"; interface Task { id: number; title: string; description: string; status: string; priority: string; createdAt: string; updatedAt: string; } interface TaskDetailDialogProps { task: Task | null; open: boolean; onOpenChange: (open: boolean) => void; } const statusConfig: Record = { pending: { label: "Pending", icon: , variant: "secondary" }, in_progress: { label: "In Progress", icon: , variant: "default" }, completed: { label: "Completed", icon: , variant: "outline" }, }; const priorityColors: Record = { low: "bg-green-500/20 text-green-400 border-green-500/30", medium: "bg-yellow-500/20 text-yellow-400 border-yellow-500/30", high: "bg-red-500/20 text-red-400 border-red-500/30", }; export function TaskDetailDialog({ task, open, onOpenChange }: TaskDetailDialogProps) { if (!task) return null; const status = statusConfig[task.status] || statusConfig.pending; const formatDate = (dateString: string) => { return new Date(dateString).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit", }); }; return ( {task.title} Task #{task.id}
{status.icon} {status.label} {task.priority.charAt(0).toUpperCase() + task.priority.slice(1)} Priority

Description

{task.description || "No description provided."}

Created

{formatDate(task.createdAt)}

Last Updated

{formatDate(task.updatedAt)}

); }