diff --git a/components/committee/CommitteeInterviewTimes.tsx b/components/committee/CommitteeInterviewTimes.tsx index 88a98947..0e9f9a4f 100644 --- a/components/committee/CommitteeInterviewTimes.tsx +++ b/components/committee/CommitteeInterviewTimes.tsx @@ -2,8 +2,6 @@ import { BaseSyntheticEvent, useEffect, useRef } from "react"; import { useState } from "react"; import { useSession } from "next-auth/react"; import FullCalendar from "@fullcalendar/react"; -import timeGridPlugin from "@fullcalendar/timegrid"; -import interactionPlugin from "@fullcalendar/interaction"; import { periodType, committeeInterviewType } from "../../lib/types/types"; import toast from "react-hot-toast"; import NotFound from "../../pages/404"; @@ -13,8 +11,7 @@ import useUnsavedChangesWarning from "../../lib/utils/unSavedChangesWarning"; import { SimpleTitle } from "../Typography"; import { useQuery } from "@tanstack/react-query"; import { fetchApplicantsByPeriodIdAndCommittee } from "../../lib/api/applicantApi"; -import { CheckIcon } from "@heroicons/react/24/outline"; -import { XMarkIcon } from "@heroicons/react/24/solid"; +import { RoomBookingCalendar } from "./RoomBookingCalendar"; interface Interview { id: string; @@ -150,11 +147,15 @@ const CommitteeInterviewTimes = ({ } }, [calendarEvents, selectedTimeslot]); - const handleDateSelect = (selectionInfo: any) => { - setCurrentSelection(selectionInfo); - setIsModalOpen(true); - setUnsavedChanges(true); - }; + useEffect(() => { + if (period) { + setCountdown(getSubmissionDeadline()); + const intervalId = setInterval(() => { + setCountdown(getSubmissionDeadline()); + }, 1000); + return () => clearInterval(intervalId); + } + }, [period]); const handleRoomSubmit = () => { if (!roomInput) { @@ -217,51 +218,11 @@ const CommitteeInterviewTimes = ({ } }; - const removeCell = (event: Interview) => { - setCalendarEvents((prevEvents) => - prevEvents.filter((evt) => evt.id !== event.id) - ); - - setUnsavedChanges(true); - }; - const updateInterviewInterval = (e: BaseSyntheticEvent) => { setInterviewInterval(parseInt(e.target.value)); setUnsavedChanges(true); }; - const calendarEventStyle = (eventContent: { event: Interview }) => { - return ( -
- {!hasAlreadySubmitted && ( - - )} -

- {eventContent.event.title} -

-
- ); - }; - const formatEventsForExport = (events: Interview[]) => { return events.map((event) => { const startDateTime = new Date(event.start); @@ -306,16 +267,6 @@ const CommitteeInterviewTimes = ({ } }; - useEffect(() => { - if (period) { - setCountdown(getSubmissionDeadline()); - const intervalId = setInterval(() => { - setCountdown(getSubmissionDeadline()); - }, 1000); - return () => clearInterval(intervalId); - } - }, [period]); - const getSubmissionDeadline = (): string => { const deadlineIso = period!.applicationPeriod.end; @@ -373,7 +324,7 @@ const CommitteeInterviewTimes = ({ if (deadLineHasPassed) return ( ); @@ -381,11 +332,11 @@ const CommitteeInterviewTimes = ({ return (
- Legg inn ledige tider for intervjuer + Book rom for intervjuer

@@ -418,49 +369,8 @@ const CommitteeInterviewTimes = ({

)} -

{`${interviewsPlanned} / ${numberOfApplications} intervjuer planlagt`}

-
- { - const start = selectInfo.start; - const end = selectInfo.end; - const startHour = start.getHours(); - const endHour = end.getHours(); - const isSameDay = start.toDateString() === end.toDateString(); - return isSameDay && startHour >= 8 && endHour <= 18; - }} - slotLabelFormat={{ - hour: "2-digit", - minute: "2-digit", - hour12: false, - }} - handleWindowResize={true} - longPressDelay={0} - /> -
+ + {!hasAlreadySubmitted && (