import Link from "next/link"; import { useRouter } from "next/router"; import Slots from "./Slots"; import { ExclamationIcon } from "@heroicons/react/solid"; import React from "react"; import Loader from "@components/Loader"; const AvailableTimes = ({ date, eventLength, eventTypeId, minimumBookingNotice, workingHours, timeFormat, user, organizerTimeZone, }) => { const router = useRouter(); const { rescheduleUid } = router.query; const { slots, isFullyBooked, hasErrors } = Slots({ date, eventLength, workingHours, organizerTimeZone, minimumBookingNotice, }); return (
{date.format("dddd")} {date.format(", DD MMMM")}
{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;