@@ -17,6 +17,7 @@ import { useCurrentUser } from '../../hooks/users.hooks';
1717import { datePipe } from '../../utils/pipes' ;
1818import { useAllTeamTypes } from '../../hooks/design-reviews.hooks' ;
1919import LoadingIndicator from '../../components/LoadingIndicator' ;
20+ import { DesignReviewAttendeeModal } from './DesignReviewAttendeeModal' ;
2021
2122const CalendarPage = ( ) => {
2223 const theme = useTheme ( ) ;
@@ -30,6 +31,7 @@ const CalendarPage = () => {
3031 const [ displayMonthYear , setDisplayMonthYear ] = useState < Date > ( new Date ( ) ) ;
3132 const { isLoading, isError, error, data : allDesignReviews } = useAllDesignReviews ( ) ;
3233 const user = useCurrentUser ( ) ;
34+ const [ unconfirmedDesignReview , setUnconfirmedDesignReview ] = useState < DesignReview > ( ) ;
3335
3436 if ( isLoading || ! allDesignReviews ) return < LoadingIndicator /> ;
3537 if ( isError ) return < ErrorPage message = { error . message } /> ;
@@ -72,7 +74,9 @@ const CalendarPage = () => {
7274 return {
7375 icon : getTeamTypeIcon ( designReview . teamType . name ) ,
7476 title : designReview . wbsName ,
75- onClick : ( ) => { } ,
77+ onClick : ( ) => {
78+ setUnconfirmedDesignReview ( designReview ) ;
79+ } ,
7680 disabled : false
7781 } ;
7882 } ) ;
@@ -102,54 +106,66 @@ const CalendarPage = () => {
102106 if ( allTeamTypesIsError ) return < ErrorPage error = { allTeamTypesError } message = { allTeamTypesError ?. message } /> ;
103107
104108 return (
105- < PageLayout
106- title = "Design Review Calendar"
107- headerRight = {
108- < Stack direction = "row" justifyContent = "flex-end" >
109- < MonthSelector displayMonth = { displayMonthYear } setDisplayMonth = { setDisplayMonthYear } />
110- < Box marginLeft = { 1 } > { unconfirmedDRSDropdown } </ Box >
111- </ Stack >
112- }
113- >
114- < Grid container >
115- { EnumToArray ( DAY_NAMES ) . map ( ( day ) => (
116- < Grid item xs = { 12 / 7 } >
117- < Typography align = { 'center' } sx = { { fontWeight : 'bold' , fontSize : 18 } } >
118- { day }
119- </ Typography >
120- </ Grid >
121- ) ) }
122- </ Grid >
123- < Box sx = { { border : '2px solid grey' , borderRadius : 2 , bgcolor : theme . palette . background . paper } } >
124- < Grid container marginBottom = { 2 } >
125- { startOfEachWeek . map ( ( week ) => (
126- < Grid container >
127- { daysThisMonth . slice ( week , week + 7 ) . map ( ( day ) => {
128- const cardDate = new Date ( displayMonthYear . getFullYear ( ) , displayMonthYear . getMonth ( ) , day ) ;
129- return (
130- < Grid item xs = { 12 / 7 } >
131- < Box marginLeft = { 1.5 } marginTop = { 2 } sx = { { justifyContent : 'center' , display : 'flex' } } >
132- { isDayInDifferentMonth ( day , week ) ? (
133- < FillerCalendarDayCard day = { day } />
134- ) : (
135- < CalendarDayCard
136- cardDate = { cardDate }
137- events = {
138- eventDict . get ( datePipe ( new Date ( cardDate . getTime ( ) - cardDate . getTimezoneOffset ( ) * - 60000 ) ) ) ??
139- [ ]
140- }
141- teamTypes = { allTeamTypes }
142- />
143- ) }
144- </ Box >
145- </ Grid >
146- ) ;
147- } ) }
109+ < >
110+ { unconfirmedDesignReview && (
111+ < DesignReviewAttendeeModal
112+ open = { ! ! unconfirmedDesignReview }
113+ onHide = { ( ) => {
114+ setUnconfirmedDesignReview ( undefined ) ;
115+ } }
116+ designReview = { unconfirmedDesignReview as DesignReview }
117+ />
118+ ) }
119+ < PageLayout
120+ title = "Design Review Calendar"
121+ headerRight = {
122+ < Stack direction = "row" justifyContent = "flex-end" >
123+ < MonthSelector displayMonth = { displayMonthYear } setDisplayMonth = { setDisplayMonthYear } />
124+ < Box marginLeft = { 1 } > { unconfirmedDRSDropdown } </ Box >
125+ </ Stack >
126+ }
127+ >
128+ < Grid container >
129+ { EnumToArray ( DAY_NAMES ) . map ( ( day ) => (
130+ < Grid item xs = { 12 / 7 } >
131+ < Typography align = { 'center' } sx = { { fontWeight : 'bold' , fontSize : 18 } } >
132+ { day }
133+ </ Typography >
148134 </ Grid >
149135 ) ) }
150136 </ Grid >
151- </ Box >
152- </ PageLayout >
137+ < Box sx = { { border : '2px solid grey' , borderRadius : 2 , bgcolor : theme . palette . background . paper } } >
138+ < Grid container marginBottom = { 2 } >
139+ { startOfEachWeek . map ( ( week ) => (
140+ < Grid container >
141+ { daysThisMonth . slice ( week , week + 7 ) . map ( ( day ) => {
142+ const cardDate = new Date ( displayMonthYear . getFullYear ( ) , displayMonthYear . getMonth ( ) , day ) ;
143+ return (
144+ < Grid item xs = { 12 / 7 } >
145+ < Box marginLeft = { 1.5 } marginTop = { 2 } sx = { { justifyContent : 'center' , display : 'flex' } } >
146+ { isDayInDifferentMonth ( day , week ) ? (
147+ < FillerCalendarDayCard day = { day } />
148+ ) : (
149+ < CalendarDayCard
150+ cardDate = { cardDate }
151+ events = {
152+ eventDict . get (
153+ datePipe ( new Date ( cardDate . getTime ( ) - cardDate . getTimezoneOffset ( ) * - 60000 ) )
154+ ) ?? [ ]
155+ }
156+ teamTypes = { allTeamTypes }
157+ />
158+ ) }
159+ </ Box >
160+ </ Grid >
161+ ) ;
162+ } ) }
163+ </ Grid >
164+ ) ) }
165+ </ Grid >
166+ </ Box >
167+ </ PageLayout >
168+ </ >
153169 ) ;
154170} ;
155171
0 commit comments