@@ -5,9 +5,16 @@ import LoadingIndicator from 'components/LoadingIndicator';
5
5
import { config } from 'topcoder-react-utils' ;
6
6
import cn from 'classnames' ;
7
7
import _ from 'lodash' ;
8
- import theme from './styles.scss' ;
9
8
import PodiumSpot from '../PodiumSpot' ;
10
9
10
+ import defaultTheme from './themes/styles.scss' ;
11
+ import tco23Theme from './themes/tco23.scss' ;
12
+
13
+ const THEMES = {
14
+ Default : defaultTheme ,
15
+ TCO23 : tco23Theme ,
16
+ } ;
17
+
11
18
class ChallengeHistoryModal extends Component {
12
19
constructor ( props ) {
13
20
super ( props ) ;
@@ -34,31 +41,49 @@ class ChallengeHistoryModal extends Component {
34
41
const challengesOrdered = _ . orderBy ( challenges , [ sortParam . field ] , [ sortParam . order ] ) ;
35
42
const placeLabel = competitor [ 'member_profile_basic.handle' ] ? 'tco_leaderboard.placement' : 'place' ;
36
43
const pointsLabel = competitor [ 'member_profile_basic.handle' ] ? 'tco_leaderboard.tco_points' : 'points' ;
44
+ const styles = THEMES [ themeName ] || THEMES . Default ;
45
+ /* eslint-disable no-confusing-arrow */
46
+ const sortInner = ( ) => themeName === 'TCO23' ? (
47
+ < svg width = "14" height = "12" viewBox = "0 0 14 12" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
48
+ < path fillRule = "evenodd" clipRule = "evenodd" d = "M3.26721 0.267169C3.48786 0.046523 3.84559 0.046523 4.06624 0.267169L6.73291 2.93384C6.95355 3.15448 6.95355 3.51222 6.73291 3.73287C6.51226 3.95351 6.15452 3.95351 5.93388 3.73287L4.23173 2.03072V8.66668C4.23173 8.97873 3.97877 9.23168 3.66673 9.23168C3.35468 9.23168 3.10173 8.97873 3.10173 8.66668V2.03072L1.39957 3.73287C1.17893 3.95351 0.821189 3.95351 0.600543 3.73287C0.379897 3.51222 0.379897 3.15448 0.600543 2.93384L3.26721 0.267169ZM9.76839 3.33335C9.76839 3.02131 10.0214 2.76835 10.3334 2.76835C10.6454 2.76835 10.8984 3.02131 10.8984 3.33335V9.96932L12.6005 8.26717C12.8212 8.04652 13.1789 8.04652 13.3996 8.26717C13.6202 8.48781 13.6202 8.84555 13.3996 9.0662L10.7329 11.7329C10.5123 11.9535 10.1545 11.9535 9.93388 11.7329L7.26721 9.0662C7.04656 8.84555 7.04656 8.48781 7.26721 8.26717C7.48786 8.04652 7.84559 8.04652 8.06624 8.26717L9.76839 9.96932V3.33335Z" fill = "#767676" />
49
+ </ svg >
50
+ ) : (
51
+ < div >
52
+ < div className = { cn ( styles [ 'sort-up' ] , {
53
+ active : sortParam . field === pointsLabel && sortParam . order === styles . asc ,
54
+ } ) }
55
+ />
56
+ < div className = { cn ( styles [ 'sort-down' ] , {
57
+ active : sortParam . field === pointsLabel && sortParam . order === styles . desc ,
58
+ } ) }
59
+ />
60
+ </ div >
61
+ ) ;
37
62
38
63
return (
39
- < Modal onCancel = { onCancel } theme = { theme } >
64
+ < Modal onCancel = { onCancel } theme = { THEMES [ themeName ] || THEMES . Default } >
40
65
< h3 >
41
66
Completed Challenges History
42
67
</ h3 >
43
- < div styleName = " podium-spot-wrapper" >
68
+ < div className = { styles [ ' podium-spot-wrapper' ] } >
44
69
< PodiumSpot
45
70
competitor = { competitor }
46
71
isCopilot = { isCopilot }
47
72
isAlgo = { isAlgo }
48
73
themeName = { themeName }
49
74
/>
50
75
</ div >
51
- < table styleName = " history-table" >
76
+ < table className = { styles [ ' history-table' ] } >
52
77
< thead >
53
78
< tr >
54
79
< th > Challenge Name</ th >
55
80
{
56
81
! isCopilot ? (
57
82
< th >
58
- < div styleName = " header-table-content" >
83
+ < div className = { styles [ ' header-table-content' ] } >
59
84
< span > Placement</ span >
60
85
< button
61
- styleName = " sort-container"
86
+ className = { styles [ ' sort-container' ] }
62
87
onClick = { ( ) => {
63
88
if ( ! sortParam . field || sortParam . field !== placeLabel ) {
64
89
sortParam . field = placeLabel ;
@@ -70,24 +95,17 @@ class ChallengeHistoryModal extends Component {
70
95
} }
71
96
type = "button"
72
97
>
73
- < div styleName = { cn ( 'sort-up' , {
74
- active : sortParam . field === placeLabel && sortParam . order === 'asc' ,
75
- } ) }
76
- />
77
- < div styleName = { cn ( 'sort-down' , {
78
- active : sortParam . field === placeLabel && sortParam . order === 'desc' ,
79
- } ) }
80
- />
98
+ { sortInner ( ) }
81
99
</ button >
82
100
</ div >
83
101
</ th >
84
102
) : null
85
103
}
86
104
< th >
87
- < div styleName = " header-table-content" >
105
+ < div className = { styles [ ' header-table-content' ] } >
88
106
< span > Points</ span >
89
107
< button
90
- styleName = " sort-container"
108
+ className = { styles [ ' sort-container' ] }
91
109
onClick = { ( ) => {
92
110
if ( ! sortParam . field || sortParam . field !== pointsLabel ) {
93
111
sortParam . field = pointsLabel ;
@@ -99,14 +117,7 @@ class ChallengeHistoryModal extends Component {
99
117
} }
100
118
type = "button"
101
119
>
102
- < div styleName = { cn ( 'sort-up' , {
103
- active : sortParam . field === pointsLabel && sortParam . order === 'asc' ,
104
- } ) }
105
- />
106
- < div styleName = { cn ( 'sort-down' , {
107
- active : sortParam . field === pointsLabel && sortParam . order === 'desc' ,
108
- } ) }
109
- />
120
+ { sortInner ( ) }
110
121
</ button >
111
122
</ div >
112
123
</ th >
@@ -115,19 +126,19 @@ class ChallengeHistoryModal extends Component {
115
126
< tbody >
116
127
{
117
128
challengesOrdered . map ( challenge => (
118
- < tr styleName = " row" key = { `${ challenge [ 'tco_leaderboard.challenge_id' ] || challenge [ 'challenge.challenge_id' ] || challenge . challenge_id } ` } >
119
- < td styleName = " name" >
120
- < a href = { `${ config . URL . BASE } /challenges/${ challenge [ 'tco_leaderboard.challenge_id' ] || challenge [ 'challenge.challenge_id' ] || challenge . challenge_id || challenge [ 'challenge.challenge_GUID' ] } /` } styleName = " link" target = "_blank" rel = "noopener noreferrer" >
129
+ < tr className = { styles . row } key = { `${ challenge [ 'tco_leaderboard.challenge_id' ] || challenge [ 'challenge.challenge_id' ] || challenge . challenge_id } ` } >
130
+ < td className = { styles . name } >
131
+ < a href = { `${ config . URL . BASE } /challenges/${ challenge [ 'tco_leaderboard.challenge_id' ] || challenge [ 'challenge.challenge_id' ] || challenge . challenge_id || challenge [ 'challenge.challenge_GUID' ] } /` } className = { styles . link } target = "_blank" rel = "noopener noreferrer" >
121
132
{ challenge . challenge_name || challenge [ 'challenge.challenge_name' ] || challenge [ 'tco_leaderboard.challenge_id' ] || challenge . challenge_id }
122
133
</ a >
123
134
</ td >
124
135
{
125
136
! isCopilot ? (
126
- < td styleName = " placement" > { challenge [ 'tco_leaderboard.placement' ] || challenge . place } </ td >
137
+ < td className = { styles . placement } > { challenge [ 'tco_leaderboard.placement' ] || challenge . place } < span > placement </ span > </ td >
127
138
) : null
128
139
}
129
- < td styleName = " points" >
130
- { challenge [ 'tco_leaderboard.tco_points' ] || challenge . points }
140
+ < td className = { styles . points } >
141
+ { challenge [ 'tco_leaderboard.tco_points' ] || challenge . points } < span > points </ span >
131
142
</ td >
132
143
</ tr >
133
144
) )
@@ -142,8 +153,8 @@ class ChallengeHistoryModal extends Component {
142
153
< center > < strong > No data available.</ strong > </ center >
143
154
)
144
155
}
145
- < div styleName = " buttons" >
146
- < button onClick = { onCancel } type = "button" styleName = " close-btn" >
156
+ < div className = { styles . buttons } >
157
+ < button onClick = { onCancel } type = "button" className = { styles [ ' close-btn' ] } >
147
158
Return to page
148
159
</ button >
149
160
</ div >
0 commit comments