Skip to content

Commit

Permalink
block form if no calendar events loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
lucia-gomez committed Oct 1, 2024
1 parent 3abc870 commit 1337343
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FormContextLevel, RoomSetting } from "../../../../types";
import React, { useContext, useEffect, useMemo, useRef } from "react";

import { BookingContext } from "../bookingProvider";
import { Error } from "@mui/icons-material";
import { EventResizeDoneArg } from "fullcalendar";
import FullCalendar from "@fullcalendar/react";
import googleCalendarPlugin from "@fullcalendar/google-calendar";
Expand Down Expand Up @@ -70,6 +71,7 @@ const FullCalendarWrapper = styled(Box)({

const Empty = styled(Box)(({ theme }) => ({
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
height: 500,
Expand Down Expand Up @@ -213,6 +215,19 @@ export default function CalendarVerticalResource({
);
}, [existingCalendarEvents, formContext]);

if (existingCalendarEvents.length === 0) {
return (
<Empty>
<Error />
<Typography align="center">
Sorry, we were unable to retrieve existing calendar events.
<br />
Please refresh the page.
</Typography>
</Empty>
);
}

if (rooms.length === 0) {
return (
<Empty>
Expand Down

0 comments on commit 1337343

Please sign in to comment.