/** * @file app/(app)/dashboard/modal/TaskModalContent.tsx * @description Client component rendering the scrollable inner details of the task modal. */ import { Task, PRIORITY_CONFIG } from "@/lib/types/task"; import { getFullName, getStatusColor } from "@/lib/utils/user"; import { X, CalendarDays, AlertCircle, User, Users, FileText, } from "lucide-react"; /** * Properties for the TaskModalContent component. * * @interface TaskModalContentProps * @property {Task} task - The task entity containing header, assignee, priority, and date details. * @property {() => void} onClose - Callback handler to trigger closing the modal overlay. */ interface TaskModalContentProps { task: Task; onClose: () => void; } /** * Renders the body content of the task detail modal including title, badges, description, creator, due date, and assignees. * * @param {TaskModalContentProps} props - The component props. * @returns {JSX.Element} The rendered scrollable task details section. */ export default function TaskModalContent({ task, onClose, }: TaskModalContentProps) { const priorityConfig = task.priority && PRIORITY_CONFIG[task.priority]; const isOverdue = task.dueDate && new Date(task.dueDate) < new Date() && task.status !== "done"; return (
{/* Header */}
{task.status} {priorityConfig && ( {priorityConfig.label} )}

{task.title}

{/* Description */}
Description
{task.description || "No description provided for this task."}
{/* Meta Grid (Creator & Due Date) */}

Creator

{getFullName(task.creator.firstName, task.creator.lastName)}

{isOverdue ? ( ) : ( )}

{isOverdue ? "Overdue Due Date" : "Due Date"}

{task.dueDate ? `${new Date(task.dueDate).toLocaleDateString("de-DE", { day: "2-digit", month: "short", year: "numeric" })} (${new Date(task.dueDate).toLocaleTimeString("de-DE", { hour: "2-digit", minute: "2-digit" })})` : "No due date"}

{/* Assignees */}
Assignees ({task.assignees.length})
{task.assignees.length > 0 ? ( task.assignees.map((a) => (
{getFullName(a.firstName, a.lastName)}
)) ) : (

No assignees assigned to this task.

)}
); }