@@ -38,7 +38,7 @@ export default function ChallengeHeader(props) {
38
38
challenge,
39
39
challengesUrl,
40
40
checkpoints,
41
- hasRegistered ,
41
+ isRegistered ,
42
42
numWinners,
43
43
onSelectorClicked,
44
44
onToggleDeadlines,
@@ -122,13 +122,15 @@ export default function ChallengeHeader(props) {
122
122
*/
123
123
const hasSubmissions = ! _ . isEmpty ( mySubmissions ) ;
124
124
125
- let nextPhase = allPhases . filter ( p => p . isOpen )
126
- . sort ( ( a , b ) => moment ( a . scheduledEndDate ) . diff ( b . scheduledEndDate ) ) [ 0 ] ;
127
- if ( hasRegistered && allPhases [ 0 ] && allPhases [ 0 ] . name === 'Registration' ) {
125
+ const nextPhaseArray = allPhases . filter ( p => p . isOpen )
126
+ . sort ( ( a , b ) => moment ( b . scheduledEndDate ) . diff ( a . scheduledEndDate ) ) ;
127
+ let nextPhase = nextPhaseArray [ 0 ] ;
128
+ if ( isRegistered && allPhases [ 0 ] && allPhases [ 0 ] . name === 'Registration' ) {
128
129
nextPhase = allPhases [ 1 ] || { } ;
129
130
}
130
- const nextDeadline = nextPhase && nextPhase . name ;
131
-
131
+ if ( ! isRegistered && nextPhase . name === 'Submission' && type === 'First2Finish' ) {
132
+ nextPhase = nextPhaseArray [ 1 ] || { } ;
133
+ }
132
134
const deadlineEnd = moment ( nextPhase && nextPhase . scheduledEndDate ) ;
133
135
const currentTime = moment ( ) ;
134
136
@@ -182,23 +184,25 @@ export default function ChallengeHeader(props) {
182
184
scheduledEndDate : endPhaseDate ,
183
185
} ) ;
184
186
} else if ( relevantPhases . length > 1 ) {
185
- const lastPhase = relevantPhases [ relevantPhases . length - 1 ] ;
187
+ const lastPhase = allPhases [ allPhases . length - 1 ] ;
186
188
const lastPhaseTime = (
187
189
new Date ( lastPhase . actualEndDate || lastPhase . scheduledEndDate )
188
190
) . getTime ( ) ;
191
+ const challengeName = lastPhase . name === 'Iterative Review' ? lastPhase . name : 'Winners' ;
189
192
190
193
const appealsEnd = ( new Date ( appealsEndDate ) . getTime ( ) ) ;
191
- if ( lastPhaseTime < appealsEnd && lastPhase . name !== 'Review' ) {
194
+ if ( lastPhaseTime < appealsEnd && lastPhase . name !== 'Review' && lastPhase . name !== 'Approval' ) {
192
195
relevantPhases . push ( {
193
196
id : - 1 ,
194
- name : 'Winners' ,
197
+ name : challengeName ,
195
198
scheduledEndDate : appealsEndDate ,
196
199
} ) ;
197
200
}
198
201
}
199
202
}
200
203
201
204
const checkpointCount = checkpoints && checkpoints . numberOfUniqueSubmitters ;
205
+ const nextDeadline = nextPhase && nextPhase . name ;
202
206
203
207
let nextDeadlineMsg ;
204
208
switch ( ( status || '' ) . toLowerCase ( ) ) {
@@ -358,7 +362,7 @@ export default function ChallengeHeader(props) {
358
362
</ div >
359
363
< div styleName = "challenge-ops-wrapper" >
360
364
< div styleName = "challenge-ops-container" >
361
- { hasRegistered ? (
365
+ { isRegistered ? (
362
366
< DangerButton
363
367
disabled = { unregistering || registrationEnded
364
368
|| hasSubmissions || isLegacyMM }
@@ -379,14 +383,14 @@ export default function ChallengeHeader(props) {
379
383
</ PrimaryButton >
380
384
) }
381
385
< PrimaryButton
382
- disabled = { ! hasRegistered || unregistering || submissionEnded || isLegacyMM }
386
+ disabled = { ! isRegistered || unregistering || submissionEnded || isLegacyMM }
383
387
theme = { { button : style . challengeAction } }
384
388
to = { `${ challengesUrl } /${ challengeId } /submit` }
385
389
>
386
390
Submit
387
391
</ PrimaryButton >
388
392
{
389
- track === COMPETITION_TRACKS . DESIGN && hasRegistered && ! unregistering
393
+ track === COMPETITION_TRACKS . DESIGN && isRegistered && ! unregistering
390
394
&& hasSubmissions && (
391
395
< PrimaryButton
392
396
theme = { { button : style . challengeAction } }
@@ -456,7 +460,7 @@ export default function ChallengeHeader(props) {
456
460
hasCheckpoints = { checkpoints && checkpoints . length > 0 }
457
461
numOfSubmissions = { numOfSubmissions }
458
462
numOfCheckpointSubmissions = { numOfCheckpointSubmissions }
459
- hasRegistered = { hasRegistered }
463
+ hasRegistered = { isRegistered }
460
464
checkpointCount = { checkpointCount }
461
465
mySubmissions = { mySubmissions }
462
466
/>
@@ -501,7 +505,7 @@ ChallengeHeader.propTypes = {
501
505
prizeSets : PT . any ,
502
506
} ) . isRequired ,
503
507
challengesUrl : PT . string . isRequired ,
504
- hasRegistered : PT . bool . isRequired ,
508
+ isRegistered : PT . bool . isRequired ,
505
509
hasThriveArticles : PT . bool ,
506
510
hasRecommendedChallenges : PT . bool ,
507
511
submissionEnded : PT . bool . isRequired ,
0 commit comments