-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Calendar for Availability (#125)
- Loading branch information
1 parent
1ac92de
commit 6f53bb5
Showing
4 changed files
with
129 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from "react"; | ||
import styles from "./CalendarViews.module.css"; | ||
import Calendar from "@fullcalendar/react"; | ||
import dayGridPlugin from "@fullcalendar/daygrid"; | ||
import timeGridPlugin from "@fullcalendar/timegrid"; | ||
|
||
type AvailabilityCalendarProps = { | ||
userId: string | undefined; | ||
}; | ||
|
||
const AvailabilityCalendar: React.FC<AvailabilityCalendarProps> = ({ userId }) => { | ||
const _ = dayGridPlugin; | ||
// if no user id present, dont render calendar | ||
if (!userId) { | ||
return null; | ||
} | ||
return ( | ||
<div className={styles.calendarContainer}> | ||
<Calendar | ||
initialView="timeGridWeek" | ||
plugins={[timeGridPlugin]} | ||
height="85vh" | ||
slotMinTime="06:00:00" | ||
slotMaxTime="24:00:00" | ||
expandRows={true} | ||
eventSources={[ | ||
{ | ||
url: "/api/availability-feed/?userId=" + userId, | ||
method: "GET", | ||
textColor: "white", | ||
}, | ||
]} | ||
eventColor="blue" | ||
scrollTime="06:00:00" | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export { AvailabilityCalendar }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters