@@ -8,15 +8,19 @@ import PT from 'prop-types';
8
8
import moment from 'moment' ;
9
9
import _ from 'lodash' ;
10
10
import cn from 'classnames' ;
11
+ import { getRatingLevel } from 'utils/tc' ;
11
12
12
13
import sortList from 'utils/challenge-detail/sort' ;
13
14
import CheckMark from '../icons/check-mark.svg' ;
14
15
import ArrowDown from '../../../../assets/images/arrow-down.svg' ;
15
16
import './style.scss' ;
16
17
18
+ const BUG_HUNT = 'Bug Hunt' ;
19
+ const F2F = 'First2Finish' ;
20
+
17
21
function formatDate ( date ) {
18
22
if ( ! date ) return '-' ;
19
- return moment ( date ) . format ( 'MMM DD, YYYY HH:mm' ) ;
23
+ return moment ( date ) . local ( ) . format ( 'MMM DD, YYYY HH:mm' ) ;
20
24
}
21
25
22
26
function getDate ( arr , handle ) {
@@ -194,8 +198,8 @@ export default class Registrants extends React.Component {
194
198
break ;
195
199
}
196
200
case 'Registration Date' : {
197
- valueA = new Date ( a . registrationDate ) ;
198
- valueB = new Date ( b . registrationDate ) ;
201
+ valueA = new Date ( a . created ) ;
202
+ valueB = new Date ( b . created ) ;
199
203
break ;
200
204
}
201
205
case 'Round 1 Submitted Date' : {
@@ -241,14 +245,20 @@ export default class Registrants extends React.Component {
241
245
const {
242
246
prizeSets,
243
247
legacy,
248
+ type,
244
249
} = challenge ;
250
+
245
251
const { track } = legacy ;
252
+
246
253
const { sortedRegistrants } = this . state ;
247
254
const { field, sort } = this . getRegistrantsSortParam ( ) ;
248
255
const revertSort = ( sort === 'desc' ) ? 'asc' : 'desc' ;
249
256
const isDesign = track . toLowerCase ( ) === 'design' ;
250
257
const isF2F = track . indexOf ( 'FIRST_2_FINISH' ) > - 1 ;
251
- const isBugHunt = track . indexOf ( 'BUG_HUNT' ) > - 1 ;
258
+
259
+ const isBugHunt = track . indexOf ( 'BUG_HUNT' ) > - 1
260
+ || type === BUG_HUNT
261
+ || type === F2F ;
252
262
const placementPrizes = _ . find ( prizeSets , { type : 'placement' } ) ;
253
263
const { prizes } = placementPrizes || [ ] ;
254
264
@@ -382,17 +392,11 @@ export default class Registrants extends React.Component {
382
392
{
383
393
sortedRegistrants . map ( ( r ) => {
384
394
const placement = getPlace ( results , r . memberHandle , places ) ;
385
- const colorStyle = JSON . parse ( r . colorStyle . replace ( / ( \w + ) : \s * ( [ ^ ; ] * ) / g, '{"$1": "$2"}' ) ) ;
386
395
let checkpoint = this . getCheckPoint ( r ) ;
387
396
if ( checkpoint ) {
388
397
checkpoint = formatDate ( checkpoint ) ;
389
398
}
390
- let final = this . getFinal ( r ) ;
391
- if ( final ) {
392
- final = formatDate ( final ) ;
393
- } else {
394
- final = '-' ;
395
- }
399
+ const final = this . getFinal ( r ) ;
396
400
397
401
return (
398
402
< div styleName = "row" key = { r . memberHandle } role = "row" >
@@ -403,8 +407,11 @@ export default class Registrants extends React.Component {
403
407
Rating
404
408
</ div >
405
409
< div >
406
- < span style = { colorStyle } role = "cell" >
407
- { ! _ . isNil ( r . rating ) ? r . rating : '-' }
410
+ < span
411
+ styleName = { `level-${ getRatingLevel ( _ . get ( r , 'rating' , 0 ) ) } ` }
412
+ role = "cell"
413
+ >
414
+ { ( ! _ . isNil ( r . rating ) && r . rating !== 0 ) ? r . rating : '-' }
408
415
</ span >
409
416
</ div >
410
417
</ div >
@@ -414,7 +421,7 @@ export default class Registrants extends React.Component {
414
421
< span role = "cell" >
415
422
< a
416
423
href = { `${ window . origin } /members/${ r . memberHandle } ` }
417
- style = { colorStyle }
424
+ styleName = { `level- ${ getRatingLevel ( _ . get ( r , 'rating' , 0 ) ) } ` }
418
425
target = { `${ _ . includes ( window . origin , 'www' ) ? '_self' : '_blank' } ` }
419
426
>
420
427
{ r . memberHandle }
@@ -453,7 +460,7 @@ export default class Registrants extends React.Component {
453
460
</ div >
454
461
< div >
455
462
< span role = "cell" >
456
- { final }
463
+ { formatDate ( final ) }
457
464
</ span >
458
465
{ placement > 0 && (
459
466
< span role = "cell" styleName = { `placement ${ placement < 4 ? `placement-${ placement } ` : '' } ` } >
@@ -496,6 +503,7 @@ Registrants.propTypes = {
496
503
registrants : PT . arrayOf ( PT . shape ( ) ) . isRequired ,
497
504
round1Introduction : PT . string ,
498
505
round2Introduction : PT . string ,
506
+ type : PT . string ,
499
507
} ) . isRequired ,
500
508
results : PT . arrayOf ( PT . shape ( ) ) ,
501
509
checkpointResults : PT . shape ( ) ,
0 commit comments