"use client"; import { useState } from "react"; import { type Appointment, ScheduleList, } from "@/components/appointments/appointments-view"; import { Calendar } from "@/components/ui/calendar"; import { Dialog, DialogDescription, DialogHeader, DialogPanel, DialogPopup, DialogTitle, } from "@/components/ui/dialog"; // The mock schedule all belongs to this day (matches "Wednesday, June 5" in the // Appointments view). Month is zero-based, so 5 = June. const SCHEDULE_DATE = new Date(2026, 5, 5); const sameDay = (a: Date, b: Date) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate(); const fullDate = (d: Date) => d.toLocaleDateString("en-US", { weekday: "long", month: "long", day: "numeric", }); // A month-grid calendar (à la Google Calendar) shown in a dialog. The day that // owns the mock schedule is ringed; selecting it lists those appointments, while // any other day shows an empty note. Mock-only — there's no per-date backend. export function CalendarDialog({ open, onOpenChange, schedule, }: { open: boolean; onOpenChange: (open: boolean) => void; schedule: Appointment[]; }) { const [selected, setSelected] = useState(SCHEDULE_DATE); const dayItems = sameDay(selected, SCHEDULE_DATE) ? schedule : []; return ( Calendar Browse the schedule by date. Sample data.
d && setSelected(d)} selected={selected} />

{fullDate(selected)}

{dayItems.length === 1 ? "1 appointment" : `${dayItems.length} appointments`}

{dayItems.length > 0 ? ( ) : (
No appointments on this day.
)}
); }