'use client'; import { useTranslations } from 'next-intl'; import { CalendarDays } from 'lucide-react'; import { Card } from '@/components/ui/shared/Card'; import { ScheduleDayPicker } from '@/components/ui/shared/ScheduleDayPicker'; import { startOfLocalDay } from '@/components/appointments/appointmentTime'; import { DayStripCard } from '@/components/ui/treatment/DayStripCard'; import type { DayStripItem } from '@/components/treatment/dayStrip'; import type { TreatmentCatalogEntry } from '@/types/treatment-catalog'; interface AppointmentsStripProps { stripHidden: boolean; onToggleStripHidden: () => void; selectedDay: Date; onSelectDay: (day: Date) => void; items: DayStripItem[]; selectedItemId: string | null; onSelectItem: (item: DayStripItem) => void; onDeleteUnscheduled?: (item: DayStripItem) => void; treatmentCatalog: TreatmentCatalogEntry[]; loading?: boolean; } export function AppointmentsStrip({ stripHidden, onToggleStripHidden, selectedDay, onSelectDay, items, selectedItemId, onSelectItem, onDeleteUnscheduled, treatmentCatalog, loading = false, }: AppointmentsStripProps) { const t = useTranslations('treatment'); if (stripHidden) { return (

{t('hiddenMessage')}

); } const timed = items.filter((item) => item.kind === 'appointment'); const unscheduled = items.filter((item) => item.kind === 'unscheduled'); return (

{t('appointmentsTitle')}

onSelectDay(startOfLocalDay(d))} />
{loading ? (

{t('loadingAppointments')}

) : null}
{timed.length === 0 && unscheduled.length === 0 && (

{t('emptyDay')}

)} {timed.map((item) => ( onSelectItem(item)} /> ))}
{unscheduled.length > 0 ? (

{t('unscheduledHeading')}

{unscheduled.map((item) => ( onSelectItem(item)} canDelete={item.canDelete} onDelete={ item.canDelete && onDeleteUnscheduled ? () => onDeleteUnscheduled(item) : undefined } deleteAriaLabel={t('deleteEmptyTreatment')} /> ))}
) : null}
); }