import { useT } from "@agent-native/core/client/i18n"; import { format, parseISO } from "date-fns"; import { Button } from "@/components/ui/button"; import { Skeleton } from "@/components/ui/skeleton"; interface TimeSlotPickerProps { slots: { start: string; end: string }[]; selectedSlot: string | null; onSelect: (start: string) => void; loading?: boolean; errorMessage?: string; } export function TimeSlotPicker({ slots, selectedSlot, onSelect, loading, errorMessage, }: TimeSlotPickerProps) { const t = useT(); if (loading) { return (
{Array.from({ length: 6 }).map((_, i) => ( ))}
); } if (errorMessage) { return (

{errorMessage}

); } if (slots.length === 0) { return (

{t("bookingLinks.noAvailableSlotsForDate")}

); } return (
{slots.map((slot) => { const isSelected = selectedSlot === slot.start; return ( ); })}
); }