55import { useState } from 'react' ;
66import { Box , Grid , Stack , Typography , useTheme } from '@mui/material' ;
77import PageLayout from '../../components/PageLayout' ;
8- import { DesignReview , DesignReviewStatus } from 'shared' ;
8+ import { DesignReview } from 'shared' ;
99import MonthSelector from './CalendarComponents/MonthSelector' ;
1010import CalendarDayCard , { getTeamTypeIcon } from './CalendarComponents/CalendarDayCard' ;
1111import FillerCalendarDayCard from './CalendarComponents/FillerCalendarDayCard' ;
@@ -26,10 +26,11 @@ const CalendarPage = () => {
2626 if ( isLoading || ! allDesignReviews ) return < LoadingIndicator /> ;
2727 if ( isError ) return < ErrorPage message = { error . message } /> ;
2828
29- const designReviews = allDesignReviews . filter ( isConfirmed ) ;
29+ const confirmedDesignReviews = allDesignReviews . filter ( isConfirmed ) ;
3030
3131 const eventDict = new Map < string , DesignReview [ ] > ( ) ;
32- designReviews . forEach ( ( designReview ) => {
32+ confirmedDesignReviews . forEach ( ( designReview ) => {
33+ // Accessing the date actually converts it to local time, which causes the date to be off. This is a workaround.
3334 const date = datePipe (
3435 new Date ( designReview . dateScheduled . getTime ( ) - designReview . dateScheduled . getTimezoneOffset ( ) * - 60000 )
3536 ) ;
@@ -41,8 +42,7 @@ const CalendarPage = () => {
4142 } ) ;
4243
4344 const unconfirmedDR = allDesignReviews . filter (
44- ( designReview ) =>
45- designReview . userCreated . userId === user . userId && designReview . status === DesignReviewStatus . UNCONFIRMED
45+ ( designReview ) => designReview . userCreated . userId === user . userId && ! isConfirmed ( designReview )
4646 ) ;
4747
4848 const startOfEachWeek = [ 0 , 7 , 14 , 21 , 28 , 35 ] ;
0 commit comments