@@ -5,6 +5,7 @@ import { enableCPEx } from 'featureFlags';
5
5
import Modal from 'views/components/Modal' ;
6
6
import type { MpeSubmission } from 'types/mpe' ;
7
7
import ExternalLink from 'views/components/ExternalLink' ;
8
+ import config from 'config' ;
8
9
import {
9
10
getLoginState ,
10
11
getSSOLink ,
@@ -22,6 +23,15 @@ const MpeContainer: React.FC = () => {
22
23
const [ isModalOpen , setIsModalOpen ] = useState ( false ) ;
23
24
const [ isLoggedIn , setIsLoggedIn ] = useState ( getLoginState ( useLocation ( ) , useHistory ( ) ) ) ;
24
25
26
+ const ugCPEx = config . modRegSchedule . Undergraduate . find (
27
+ ( { type : t } ) => t === 'Course Planning Exercise (CPEx)' ,
28
+ ) ;
29
+ const gdCPEx = config . modRegSchedule . Graduate . find (
30
+ ( { type : t } ) => t === 'Course Planning Exercise (CPEx)' ,
31
+ ) ;
32
+ const hasCPEx = ugCPEx && gdCPEx ;
33
+ const sameTime = hasCPEx && ugCPEx . startDate . getTime ( ) === gdCPEx . startDate . getTime ( ) ;
34
+
25
35
const onLogin = useCallback ( ( ) => {
26
36
setIsGettingSSOLink ( true ) ;
27
37
return getSSOLink ( )
@@ -119,7 +129,21 @@ const MpeContainer: React.FC = () => {
119
129
) : (
120
130
< >
121
131
< hr />
122
- < div > CPEx is not open.</ div >
132
+ { hasCPEx &&
133
+ ( sameTime ? (
134
+ < p >
135
+ < strong > CPEx will open on:</ strong > { ugCPEx . start }
136
+ </ p >
137
+ ) : (
138
+ < div >
139
+ < p >
140
+ < strong > Undergraduate CPEx will open on:</ strong > { ugCPEx . start }
141
+ </ p >
142
+ < p >
143
+ < strong > Graduate CPEx will open on:</ strong > { gdCPEx . start }
144
+ </ p >
145
+ </ div >
146
+ ) ) }
123
147
</ >
124
148
) }
125
149
</ div >
0 commit comments