import { CalendarX2 } from "lucide-react"; import { shallow } from "zustand/shallow"; import type { Dayjs } from "@calcom/dayjs"; import dayjs from "@calcom/dayjs"; import type { Slots } from "@calcom/features/schedules"; import { classNames } from "@calcom/lib"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { nameOfDay } from "@calcom/lib/weekday"; import { BookerLayouts } from "@calcom/prisma/zod-utils"; import { Button, SkeletonText } from "@calcom/ui"; import { useBookerStore } from "../Booker/store"; import { useTimePreferences } from "../lib"; import { TimeFormatToggle } from "./TimeFormatToggle"; type AvailableTimesProps = { date: Dayjs; slots: Slots[string]; onTimeSelect: ( time: string, attendees: number, seatsPerTimeSlot?: number | null, bookingUid?: string ) => void; seatsPerTimeSlot?: number | null; showTimeFormatToggle?: boolean; className?: string; selectedSlots?: string[]; }; export const AvailableTimes = ({ date, slots, onTimeSelect, seatsPerTimeSlot, showTimeFormatToggle = true, className, selectedSlots, }: AvailableTimesProps) => { const { t, i18n } = useLocale(); const [timeFormat, timezone] = useTimePreferences((state) => [state.timeFormat, state.timezone]); const bookingData = useBookerStore((state) => state.bookingData); const hasTimeSlots = !!seatsPerTimeSlot; const [layout] = useBookerStore((state) => [state.layout], shallow); const isColumnView = layout === BookerLayouts.COLUMN_VIEW; const isMonthView = layout === BookerLayouts.MONTH_VIEW; const isToday = dayjs().isSame(date, "day"); return (
{t("all_booked_today")}