import Link from "next/link"; import { useRouter } from "next/router"; import Slots from "./Slots"; import { ExclamationIcon } from "@heroicons/react/solid"; const AvailableTimes = ({ date, eventLength, eventTypeId, workingHours, timeFormat, user }) => { const router = useRouter(); const { rescheduleUid } = router.query; const { slots, isFullyBooked, hasErrors } = Slots({ date, eventLength, workingHours }); return (
{date.format("dddd DD MMMM YYYY")}
{slots.length > 0 && slots.map((slot) => (
{slot.format(timeFormat)}
))} {isFullyBooked && (

{user.name} is all booked today.

)} {!isFullyBooked && slots.length === 0 && !hasErrors &&
} {hasErrors && (

Could not load the available time slots.{" "} Contact {user.name} via e-mail

)}
); }; export default AvailableTimes;