'use client'; import { CalendarDays } from 'lucide-react'; import { purposeStyle } from '@/components/ui/appointments/appointmentPurposeStyles'; import { ScheduleDayPicker } from '@/components/ui/common/ScheduleDayPicker'; import { startOfLocalDay } from '@/lib/appointmentTime'; import type { TreatmentAppointment } from '@/types/treatment'; interface AppointmentsStripProps { stripHidden: boolean; onToggleStripHidden: () => void; selectedDay: Date; onSelectDay: (day: Date) => void; /** Same lower bound as Appointments schedule (cannot pick days before this). */ minScheduleDate: Date; appointments: TreatmentAppointment[]; selectedAppointmentId: string | null; onSelectAppointment: (id: string) => void; loading?: boolean; } export function AppointmentsStrip({ stripHidden, onToggleStripHidden, selectedDay, onSelectDay, minScheduleDate, appointments, selectedAppointmentId, onSelectAppointment, loading = false, }: AppointmentsStripProps) { if (stripHidden) { return (
Appointments are hidden.
Loading appointments…
)}No appointments assigned to you on this day.
)} {appointments.map((a) => { const sel = a.id === selectedAppointmentId; const start = new Date(a.startAt); const end = new Date(a.endAt); const timeLabel = `${start.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit', })} – ${end.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit', })}`; const palette = purposeStyle(a.purpose); return ( ); })}