@@ -66,6 +66,7 @@ interface IManageApplicationState {
6666 hackerDetails : IHacker ;
6767 pageNumber : number ;
6868 resume ?: File ;
69+ loaded : boolean ;
6970}
7071
7172interface IManageApplicationProps {
@@ -81,6 +82,7 @@ class ManageApplicationContainer extends React.Component<
8182 mode : props . mode ,
8283 submitted : false ,
8384 submitting : false ,
85+ loaded : false ,
8486 pageNumber : 1 ,
8587 hackerDetails : {
8688 id : '' ,
@@ -147,74 +149,73 @@ class ManageApplicationContainer extends React.Component<
147149 this . setState ( { mode : ManageApplicationModes . CREATE } ) ;
148150 }
149151 }
152+ this . setState ( { loaded : true } ) ;
150153 }
151154
152155 public render ( ) {
153- const { mode, hackerDetails, submitted, pageNumber } = this . state ;
154- return submitted ? (
155- < Redirect to = { FrontendRoute . HOME_PAGE } />
156- ) : (
157- // <HorizontalSpacer paddingLeft={'20%'}>
158- < MaxWidthBox m = { 'auto' } maxWidth = { '500px' } >
159- { /* <Sidebar
160- currentPage="Application"
161- status={this.state.hackerDetails.status}
162- confirmed={true}
163- /> */ }
164- < BackgroundImage
165- right = { '10%' }
166- top = { '178px' }
167- src = { Drone }
168- imgHeight = { '133px' }
169- position = { 'fixed' as 'fixed' }
170- />
171- < BackgroundImage
172- left = { '5%' }
173- bottom = { '5%' }
174- src = { Bulby }
175- imgHeight = { '290px' }
176- position = { 'fixed' as 'fixed' }
177- />
178- < Helmet >
179- < title >
180- { mode === ManageApplicationModes . CREATE ? 'Create' : 'Edit' } { ' ' }
181- Application | { CONSTANTS . HACKATHON_NAME }
182- </ title >
183- </ Helmet >
184- < MaxWidthBox maxWidth = { '500px' } m = { 'auto' } >
185- < H1
186- color = { theme . colors . red }
187- fontSize = { '30px' }
188- textAlign = { 'left' }
189- marginTop = { '0px' }
190- marginBottom = { '20px' }
191- marginLeft = { '0px' }
192- paddingBottom = { '20px' }
193- paddingTop = { '70px' }
194- >
195- { mode === ManageApplicationModes . CREATE ? 'Create' : 'Edit' } your
196- Application
197- </ H1 >
198- < FormDescription > { CONSTANTS . REQUIRED_DESCRIPTION } </ FormDescription >
156+ const { mode, hackerDetails, submitted, pageNumber, loaded } = this . state ;
157+ return loaded ? (
158+ // If application creation deadline of Jan 3, 2020 11:59:59PM EST has passed or form is submitted, return user to the home page
159+ ( Date . now ( ) > CONSTANTS . APPLICATION_CLOSE_TIME &&
160+ mode === ManageApplicationModes . CREATE ) ||
161+ submitted ? (
162+ < Redirect to = { FrontendRoute . HOME_PAGE } />
163+ ) : (
164+ < MaxWidthBox m = { 'auto' } maxWidth = { '500px' } >
165+ < BackgroundImage
166+ right = { '10%' }
167+ top = { '178px' }
168+ src = { Drone }
169+ imgHeight = { '133px' }
170+ position = { 'fixed' as 'fixed' }
171+ />
172+ < BackgroundImage
173+ left = { '5%' }
174+ bottom = { '5%' }
175+ src = { Bulby }
176+ imgHeight = { '290px' }
177+ position = { 'fixed' as 'fixed' }
178+ />
179+ < Helmet >
180+ < title >
181+ { mode === ManageApplicationModes . CREATE ? 'Create' : 'Edit' } { ' ' }
182+ Application | { CONSTANTS . HACKATHON_NAME }
183+ </ title >
184+ </ Helmet >
185+ < MaxWidthBox maxWidth = { '500px' } m = { 'auto' } >
186+ < H1
187+ color = { theme . colors . red }
188+ fontSize = { '30px' }
189+ textAlign = { 'left' }
190+ marginTop = { '0px' }
191+ marginBottom = { '20px' }
192+ marginLeft = { '0px' }
193+ paddingBottom = { '20px' }
194+ paddingTop = { '70px' }
195+ >
196+ { mode === ManageApplicationModes . CREATE ? 'Create' : 'Edit' } your
197+ Application
198+ </ H1 >
199+ < FormDescription > { CONSTANTS . REQUIRED_DESCRIPTION } </ FormDescription >
200+ </ MaxWidthBox >
201+ < Formik
202+ enableReinitialize = { true }
203+ initialValues = { {
204+ hacker : hackerDetails ,
205+ resume : this . state . resume ? this . state . resume : undefined ,
206+ pageNumber,
207+ } }
208+ onSubmit = { this . handleSubmit }
209+ onReset = { this . previousPage }
210+ render = { this . renderFormik }
211+ validationSchema = { getValidationSchema (
212+ mode === ManageApplicationModes . CREATE ,
213+ this . state . pageNumber
214+ ) }
215+ />
199216 </ MaxWidthBox >
200- < Formik
201- enableReinitialize = { true }
202- initialValues = { {
203- hacker : hackerDetails ,
204- resume : this . state . resume ? this . state . resume : undefined ,
205- pageNumber,
206- } }
207- onSubmit = { this . handleSubmit }
208- onReset = { this . previousPage }
209- render = { this . renderFormik }
210- validationSchema = { getValidationSchema (
211- mode === ManageApplicationModes . CREATE ,
212- this . state . pageNumber
213- ) }
214- />
215- </ MaxWidthBox >
216- // </HorizontalSpacer>
217- ) ;
217+ )
218+ ) : null ;
218219 }
219220
220221 /**
0 commit comments