From 59d7df1437e1c2bf0cb449e32bc8ef34c6bc5cf5 Mon Sep 17 00:00:00 2001 From: Taehee Choi Date: Wed, 30 Mar 2022 04:42:50 -0700 Subject: [PATCH] fix merge issues --- src/ProtectedRoute.tsx | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/ProtectedRoute.tsx b/src/ProtectedRoute.tsx index 3f30da5..a1d66db 100644 --- a/src/ProtectedRoute.tsx +++ b/src/ProtectedRoute.tsx @@ -3,14 +3,11 @@ import useAuth from "./hooks/useAuth"; import Navbar from "./components/navbar/Navbar"; import Sidebar from "./components/sidebar/Sidebar"; import { Alert, AlertTitle, Box, Snackbar, Typography } from "@mui/material"; -import { store } from "./redux/store"; -import { fetchFavorites } from "./redux/slices/favoritesSlice"; -import { fetchMeetings, selectMeetings } from "./redux/slices/meetingsAndUserStatusSlice"; -import { fetchUsers, selectMe } from "./redux/slices/usersSlice"; +import { selectMeetings } from "./redux/slices/meetingsAndUserStatusSlice"; +import { selectMe } from "./redux/slices/usersSlice"; import { useAppDispatch, useAppSelector, useInterval } from "./redux/hooks"; import DetailedMeeting from "./api-bodies/DetailedMeeting"; import React, { useState } from "react"; -import { Box } from "@mui/material"; const ProtectedRoute = () => { const auth = useAuth(); @@ -19,7 +16,9 @@ const ProtectedRoute = () => { useAppDispatch(); const currentUserUuid: string = useAppSelector(selectMe); const meetings: DetailedMeeting[] = useAppSelector(selectMeetings); - const currentUserMeetings = meetings.filter((m) => m.registrantIds.includes(currentUserUuid)); + const currentUserMeetings = meetings.filter((m) => + m.registrantIds.includes(currentUserUuid) + ); const [open, setOpen] = useState(false); const [notifMeetings, setNotifMeetings] = useState([""]); @@ -30,14 +29,20 @@ const ProtectedRoute = () => { () => { console.log("polling"); const currentTime = Math.floor(Date.now() / sixtySec); // in minutes - const upcomingMeetings = currentUserMeetings.filter((meeting) => - (currentTime == Math.floor(Date.parse(meeting.start) / sixtySec) - 15) || // 15 mins before meeting time - (currentTime == Math.floor(Date.parse(meeting.start) / sixtySec) - 30) // or 30 mins before meeting time + const upcomingMeetings = currentUserMeetings.filter( + (meeting) => + currentTime == + Math.floor(Date.parse(meeting.startTime) / sixtySec) - 15 || // 15 mins before meeting time + currentTime == + Math.floor(Date.parse(meeting.startTime) / sixtySec) - 30 // or 30 mins before meeting time ); if (upcomingMeetings.length != 0) { setOpen(true); const newNotifMeetings: string[] = upcomingMeetings.map((m) => { - if (currentTime == Math.floor(Date.parse(m.start) / sixtySec) - 15) { + if ( + currentTime == + Math.floor(Date.parse(m.startTime) / sixtySec) - 15 + ) { return m.topic + " in 15 minutes"; } else { return m.topic + " in 30 minutes"; @@ -49,7 +54,10 @@ const ProtectedRoute = () => { sixtySec // poll time ); - const handleClose = (event?: React.SyntheticEvent | Event, reason?: string) => { + const handleClose = ( + event?: React.SyntheticEvent | Event, + reason?: string + ) => { if (reason == "clickaway") { return; } @@ -62,9 +70,9 @@ const ProtectedRoute = () => { Upcoming Meetings - {notifMeetings.map((m, i) => + {notifMeetings.map((m, i) => ( {m} - )} + ))} {/* ----- */}