import { Calendar, Tag, FileText, AlertCircle, CheckCircle2, Circle } from 'lucide-react' import Link from 'next/link' interface ItemDetailProps { item: { id: string title: string description: string | null completed: boolean priority: string dueDate: Date | null tags: any notes: string | null createdAt: Date updatedAt: Date listId: string } listTitle: string } export default function ItemDetail({ item, listTitle }: ItemDetailProps) { const tags = Array.isArray(item.tags) ? item.tags : [] const isOverdue = item.dueDate && new Date(item.dueDate) < new Date() && !item.completed const priorityColors = { low: 'bg-green-100 text-green-800', medium: 'bg-yellow-100 text-yellow-800', high: 'bg-red-100 text-red-800', } const priorityColor = priorityColors[item.priority as keyof typeof priorityColors] || priorityColors.medium return (
{/* Header */}
{listTitle} / Task Details
{item.completed ? ( ) : ( )}

{item.title}

{item.completed && (

Completed

)}
{/* Metadata Grid */}
{/* Priority */}
Priority
{item.priority.charAt(0).toUpperCase() + item.priority.slice(1)}
{/* Due Date */}
Due Date
{item.dueDate ? (

{new Date(item.dueDate).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', })}

{isOverdue && (

Overdue

)}
) : (

No due date

)}
{/* Description */} {item.description && (

Description

{item.description}

)} {/* Tags */} {tags.length > 0 && (
Tags
{tags.map((tag: string) => ( {tag} ))}
)} {/* Notes */} {item.notes && (
Notes

{item.notes}

)} {/* Timestamps */}

Created: {new Date(item.createdAt).toLocaleString('en-US', { year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', })}

Updated: {new Date(item.updatedAt).toLocaleString('en-US', { year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', })}

) }