'use client';
import { FileText } from 'lucide-react';
import type { PastTreatment } from '@/types/treatment';
import { CaseSentLabel } from '@/components/ui/treatment/CaseSentLabel';
interface PastTreatmentsPanelProps {
items: PastTreatment[];
loading?: boolean;
onReviewTreatment?: (treatment: PastTreatment) => void;
}
export function PastTreatmentsPanel({
items,
loading,
onReviewTreatment,
}: PastTreatmentsPanelProps) {
return (
Previous treatments
Completed treatments for this patient. Each case is listed separately.
{loading &&
Loading history…
}
{!loading && items.length === 0 && (
No prior treatments for this patient.
)}
{items.map((t) => (
{t.title}
Status: {t.status}
{t.cases.map((c, idx) => {
const attachments = c.attachmentMetas ?? [];
return (
Case {idx + 1} · {c.treatmentType}
{c.sentAt && (
)}
Teeth: {c.teeth.length ? [...c.teeth].sort().join(', ') : 'None selected'}
{c.notes?.trim() && (
{c.notes}
)}
Attachments
{attachments.length === 0 ? (
None
) : (
{attachments.map((doc) => (
-
{doc.fileName}
{(doc.sizeBytes / 1024).toFixed(1)} KB
))}
)}
);
})}
{onReviewTreatment && (
)}
))}
);
}