/** * @file dashboard/KanbanCard.tsx * @description Client component rendering an individual task card within a kanban column, featuring priority configuration, due dates, overdue highlights, and user avatars. */ "use client"; import { AlertCircle, Crown, CalendarDays } from "lucide-react"; import { KanbanCardProps } from "@/types/tasks"; /** * Renders a task card component displaying its title, priority badge, description, * deadline with hover time details, and creator/assignee avatars. * * @param {KanbanCardProps} props - The component props containing the task object. * @returns {JSX.Element} The rendered kanban card component. */ export default function KanbanCard({ task }: KanbanCardProps) { const isOverdue = task.dueDate && new Date(task.dueDate) < new Date() && task.status !== "done"; const filteredAssignees = (task.assignees || []).filter( (a) => a !== task.creator, ); return (
{/* --- Card Header (Title & Priority) --- */}
{/* Title */}

{task.title}

{/* Priority Badge */} {task.priority && ( {task.priority.charAt(0).toUpperCase() + task.priority.slice(1)} )}
{/* Card Description */}

{task.description}

{/* --- Card Footer (Date, Mobile Action Menu, Avatars) --- */}
{/* Left Side: Date Badge */} {task.dueDate && (
{isOverdue ? : } {new Date(task.dueDate).toLocaleDateString("de-DE", { day: "2-digit", month: "short", })} {/* Time displayed when hovering over the badge */} {new Date(task.dueDate).toLocaleTimeString("de-DE", { hour: "2-digit", minute: "2-digit", })}
)} {/* Right Side: Avatars & Mobile Switcher */}
{/* Avatars */} {(task.creator || filteredAssignees.length > 0) && (
{filteredAssignees.map((assignee, index) => (
{assignee.substring(0, 2).toUpperCase()}
))} {task.creator && (
{task.creator.substring(0, 2).toUpperCase()}
)}
)}
); }