import { Badge } from "./badge"; import { Toggle } from "./toggle"; // --------------------------------------------------------------------------- // Shared appointment domain types // // These are the canonical definitions — all other appointment components import // from here instead of re-defining their own copies. // --------------------------------------------------------------------------- export type AppointmentStatus = | "pending" | "confirmed" | "cancelled" | "rescheduled"; export type AppointmentMeetingFormat = | "call" | "google-meet" | "microsoft-teams" | "online" | "offline"; // --------------------------------------------------------------------------- // Time slot // --------------------------------------------------------------------------- export interface AppointmentTimeSlot { id: string; /** Display label — "9:00 AM" */ label: string; available: boolean; } // --------------------------------------------------------------------------- // Slot section — shared sub-component used by multiple appointment dialogs // --------------------------------------------------------------------------- export interface AppointmentSlotSectionProps { label: string; slots: AppointmentTimeSlot[]; selectedSlotId?: string; onSelect?: (slot: AppointmentTimeSlot) => void; } export function AppointmentSlotSection({ label, slots, selectedSlotId, onSelect, }: AppointmentSlotSectionProps) { const hasAvailable = slots.some((s) => s.available); return (

{label}

{!hasAvailable && ( No availability )}
{slots.map((slot) => ( { if (pressed && slot.available) onSelect?.(slot); }} disabled={!slot.available} className="min-w-[88px]" > {slot.label} ))}
); } // --------------------------------------------------------------------------- // Full picker (Morning + Afternoon sections combined) // --------------------------------------------------------------------------- export interface AppointmentTimeSlotPickerProps { amSlots: AppointmentTimeSlot[]; pmSlots: AppointmentTimeSlot[]; selectedSlotId?: string; onSelect?: (slot: AppointmentTimeSlot) => void; } export function AppointmentTimeSlotPicker({ amSlots, pmSlots, selectedSlotId, onSelect, }: AppointmentTimeSlotPickerProps) { const totalAvailable = [...amSlots, ...pmSlots].filter( (s) => s.available, ).length; return (

Select a time slot

{totalAvailable} available
); }