"use client"; import { Trash2 } from "lucide-react"; import { useTranslation } from "react-i18next"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Sheet, SheetFooter, SheetHeader, SheetPanel, SheetPopup, SheetTitle, } from "@/components/ui/sheet"; import { ROLE_LABELS } from "@/lib/access"; import type { TaskStatus } from "@/lib/tasks"; import { cn } from "@/lib/utils"; import type { Priority, Task } from "@/components/tasks/tasks-view"; const STATUSES: TaskStatus[] = ["todo", "in_progress", "done"]; const priorityVariant: Record = { high: "destructive", medium: "secondary", low: "outline", }; function deptLabel(role: string): string { return (ROLE_LABELS as Record)[role] ?? role; } // Right-side Sheet showing a single task's full detail, opened from the Tasks // list (mirrors the Patients table → PatientDetailSheet pattern). The task is // passed in directly from the page. export function TaskDetailSheet({ task, open, onOpenChange, onMove, onDelete, }: { task: Task | null; open: boolean; onOpenChange: (open: boolean) => void; onMove: (id: string, status: TaskStatus) => void; onDelete?: () => void; }) { const { t } = useTranslation(); return ( {task?.title ?? t("tasks.detail.fallbackTitle")} {task && (
{t("tasks.detail.priorityBadge", { priority: t(`tasks.priority.${task.priority}`), })}
{t("tasks.detail.status")}
{t(`tasks.status.${task.status}`)}
{t("tasks.detail.assignedTo")}
{task.assigneeUserId ? task.assignee : task.assigneeRole ? t("tasks.detail.deptTeam", { dept: deptLabel(task.assigneeRole), }) : t("tasks.detail.personal")}
{t("tasks.detail.createdBy")}
{task.createdByName ?? "—"}
{t("tasks.detail.due")}
{task.due}
{task.patient && ( <>
{t("tasks.detail.patient")}
{task.patient}
)}
{task.notes && (
{t("tasks.detail.details")}

{task.notes}

)}
{t("tasks.detail.moveTo")}
{STATUSES.map((s) => ( ))}
)}
{task && onDelete && ( )}
); }