'use client'; import { useTranslations } from 'next-intl'; import { TreatmentHistoryDetailLine } from '@/components/ui/treatment/TreatmentHistoryDetailLine'; import type { PastTreatment } from '@/types/treatment'; import type { TreatmentCatalogEntry } from '@/types/treatment-catalog'; interface PastTreatmentsPanelProps { items: PastTreatment[]; treatmentCatalog: TreatmentCatalogEntry[]; loading?: boolean; selectedPreviewId?: string | null; onSelectTreatment?: (treatment: PastTreatment) => void; } export function PastTreatmentsPanel({ items, treatmentCatalog, loading, selectedPreviewId, onSelectTreatment, }: PastTreatmentsPanelProps) { const t = useTranslations('treatment'); return (

{t('historyTitle')}

{t('historySubtitle')}

{loading &&

{t('loadingHistory')}

} {!loading && items.length === 0 && (

{t('historyEmpty')}

)}
{items.map((treatment) => { const isSelected = selectedPreviewId === treatment.id; return (
onSelectTreatment?.(treatment)} onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onSelectTreatment?.(treatment); } }} className={` border rounded-[var(--radius-sm)] px-2 py-1.5 cursor-pointer transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 ${ isSelected ? 'border-primary bg-primary/5' : 'border-border/60 bg-background-secondary/30 hover:border-border hover:bg-background-secondary/50' } `} > {treatment.details.length === 0 ? (

{t('noDetails')}

) : (
{treatment.details.map((detail, idx) => (
))}
)}
); })}
); }