'use client' import Link from 'next/link' import { Calendar, Tag, AlertCircle } from 'lucide-react' import ToggleItemButton from './ToggleItemButton' import DeleteItemButton from './DeleteItemButton' interface ItemCardProps { item: { id: string title: string description: string | null completed: boolean priority: string dueDate: Date | null tags: any notes: string | null } listId: string } export default function ItemCard({ item, listId }: ItemCardProps) { 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-700 border-green-200', medium: 'bg-yellow-100 text-yellow-700 border-yellow-200', high: 'bg-red-100 text-red-700 border-red-200', } const priorityColor = priorityColors[item.priority as keyof typeof priorityColors] || priorityColors.medium return (
{/* Completion Toggle */}
{/* Content */}

{item.title}

{item.description && (

{item.description}

)} {/* Metadata */}
{/* Priority Badge */} {item.priority.charAt(0).toUpperCase() + item.priority.slice(1)} {item.priority.charAt(0).toUpperCase()} {/* Due Date */} {item.dueDate && ( {new Date(item.dueDate).toLocaleDateString('en-US', { month: 'short', day: 'numeric', })} {isOverdue && (Overdue)} {isOverdue && !} )} {/* Tags */} {tags.length > 0 && (
{tags.slice(0, 2).join(', ')} {tags.length > 2 && ` +${tags.length - 2}`}
)}
{/* Delete Button */}
) }