import { useNavigate } from "react-router-dom"; import { CircleCheck, CircleX } from "lucide-react"; import type { Task } from "fhir/r4"; import { taskDisplayTitle, patientTaskRoute } from "../../utils/appointmentTasks.ts"; /** * "Tasks due for this appointment" - the named, clickable list.. * * EXTRACTED FROM THE ONE SURFACE THAT ALREADY WORKED (`components/dashboard/Appointment.tsx`) rather * than written again, which is what the card asked for. Three surfaces show an appointment and only one * of them showed its tasks; a second implementation would have made that two answers instead of one. * * It renders NOTHING when there are no tasks - the caller decides whether "no tasks" deserves a * sentence. On a list row it does (see `appointmentTaskSummary`, which distinguishes "none assigned" * from "all done"); inside the dialog an empty block would just be a heading over nothing. */ export const AppointmentTaskList = ({ tasks, onNavigate, }: { tasks: readonly Task[]; /** Called before routing, so a dialog can close itself rather than leave a modal over the task page. */ onNavigate?: () => void; }) => { const navigate = useNavigate(); if (tasks.length === 0) return null; return (

Tasks due for this appointment

{tasks.map((task) => { const isCompleted = task.status === "completed"; return ( ); })}
); }; export default AppointmentTaskList;