Skip to content

Commit 3a0074c

Browse files
committed
tco23 leaderboards
1 parent 99d50d3 commit 3a0074c

File tree

14 files changed

+227
-75
lines changed

14 files changed

+227
-75
lines changed

__tests__/shared/components/Leaderboard/__snapshots__/LeaderboardTable.jsx.snap

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ exports[`Matches shallow shapshot 1`] = `
7070
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__winnings-info___PBqQk"
7171
>
7272
<span>
73-
0
7473
points
7574
</span>
7675
<span>
@@ -84,7 +83,7 @@ exports[`Matches shallow shapshot 1`] = `
8483
<td
8584
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-points___2-5d7"
8685
>
87-
0.00
86+
NaN
8887
</td>
8988
</tr>
9089
<tr>
@@ -125,7 +124,6 @@ exports[`Matches shallow shapshot 1`] = `
125124
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__winnings-info___PBqQk"
126125
>
127126
<span>
128-
0
129127
points
130128
</span>
131129
<span>
@@ -139,7 +137,7 @@ exports[`Matches shallow shapshot 1`] = `
139137
<td
140138
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-points___2-5d7"
141139
>
142-
0.00
140+
NaN
143141
</td>
144142
</tr>
145143
<tr>
@@ -180,7 +178,6 @@ exports[`Matches shallow shapshot 1`] = `
180178
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__winnings-info___PBqQk"
181179
>
182180
<span>
183-
0
184181
points
185182
</span>
186183
<span>
@@ -194,7 +191,7 @@ exports[`Matches shallow shapshot 1`] = `
194191
<td
195192
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-points___2-5d7"
196193
>
197-
0.00
194+
NaN
198195
</td>
199196
</tr>
200197
<tr>
@@ -235,7 +232,6 @@ exports[`Matches shallow shapshot 1`] = `
235232
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__winnings-info___PBqQk"
236233
>
237234
<span>
238-
0
239235
points
240236
</span>
241237
<span>
@@ -249,7 +245,7 @@ exports[`Matches shallow shapshot 1`] = `
249245
<td
250246
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-points___2-5d7"
251247
>
252-
0.00
248+
NaN
253249
</td>
254250
</tr>
255251
</tbody>

__tests__/shared/components/Leaderboard/__snapshots__/Podium.jsx.snap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`Matches shallow shapshot 1`] = `
55
className="src-shared-components-Leaderboard-Podium-themes-___default__Podium___1qIZm"
66
>
77
<div
8-
className="src-shared-components-Leaderboard-Podium-themes-___default__PodiumWrap___2hDWP"
8+
className="src-shared-components-Leaderboard-Podium-themes-___default__PodiumWrapCondense___3aV24"
99
style={
1010
Object {
1111
"justify-content": "space-between",
@@ -29,6 +29,7 @@ exports[`Matches shallow shapshot 1`] = `
2929
isCopilot={false}
3030
isTopGear={false}
3131
onUsernameClick={null}
32+
podiumPlaces={4}
3233
themeName="Default"
3334
/>
3435
</div>
@@ -49,6 +50,7 @@ exports[`Matches shallow shapshot 1`] = `
4950
isCopilot={false}
5051
isTopGear={false}
5152
onUsernameClick={null}
53+
podiumPlaces={4}
5254
themeName="Default"
5355
/>
5456
</div>
@@ -69,6 +71,7 @@ exports[`Matches shallow shapshot 1`] = `
6971
isCopilot={false}
7072
isTopGear={false}
7173
onUsernameClick={null}
74+
podiumPlaces={4}
7275
themeName="Default"
7376
/>
7477
</div>
@@ -89,6 +92,7 @@ exports[`Matches shallow shapshot 1`] = `
8992
isCopilot={false}
9093
isTopGear={false}
9194
onUsernameClick={null}
95+
podiumPlaces={4}
9296
themeName="Default"
9397
/>
9498
</div>

__tests__/shared/components/Leaderboard/__snapshots__/PodiumSpot.jsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ exports[`Matches shallow shapshot 1`] = `
4747
<span
4848
className="src-shared-components-Leaderboard-PodiumSpot-themes-___styles__value___2shA5"
4949
>
50-
0.00
50+
NaN
5151
</span>
5252
<span
5353
className="src-shared-components-Leaderboard-PodiumSpot-themes-___styles__value-title___1Jf_7"
@@ -106,7 +106,7 @@ exports[`Matches shallow shapshot 2`] = `
106106
<span
107107
className="src-shared-components-Leaderboard-PodiumSpot-themes-___styles__value___2shA5"
108108
>
109-
0.00
109+
NaN
110110
</span>
111111
<span
112112
className="src-shared-components-Leaderboard-PodiumSpot-themes-___styles__value-title___1Jf_7"

src/shared/components/Leaderboard/ChallengeHistoryModal/index.jsx

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ class ChallengeHistoryModal extends Component {
3939
} = this.props;
4040
const { sortParam } = this.state;
4141
const challengesOrdered = _.orderBy(challenges, [sortParam.field], [sortParam.order]);
42+
// eslint-disable-next-line
4243
const placeLabel = competitor['member_profile_basic.handle'] ? (competitor['tco23_leaderboard.placement'] ? 'tco23_leaderboard.placement' : 'tco_leaderboard.placement') : 'place';
44+
// eslint-disable-next-line
4345
const pointsLabel = competitor['member_profile_basic.handle'] ? (competitor['tco23_leaderboard.tco_points'] ? 'tco23_leaderboard.tco_points' : 'tco_leaderboard.tco_points') : 'points';
4446
const styles = THEMES[themeName] || THEMES.Default;
4547
/* eslint-disable no-confusing-arrow */
@@ -125,23 +127,27 @@ class ChallengeHistoryModal extends Component {
125127
</thead>
126128
<tbody>
127129
{
128-
challengesOrdered.map(challenge => {
130+
challengesOrdered.map((challenge) => {
129131
const challengeId = challenge['tco23_leaderboard.challenge_id'] || challenge['tco_leaderboard.challenge_id'] || challenge['challenge.challenge_id'] || challenge.challenge_id;
130-
return <tr className={styles.row} key={`${challengeId}`}>
131-
<td className={styles.name}>
132-
<a href={`${config.URL.BASE}/challenges/${challengeId || challenge['challenge.challenge_GUID']}/`} className={styles.link} target="_blank" rel="noopener noreferrer">
133-
{challenge.challenge_name || challenge['challenge.challenge_name'] || challengeId}
134-
</a>
135-
</td>
136-
{
132+
return (
133+
<tr className={styles.row} key={`${challengeId}`}>
134+
<td className={styles.name}>
135+
<a href={`${config.URL.BASE}/challenges/${challengeId || challenge['challenge.challenge_GUID']}/`} className={styles.link} target="_blank" rel="noopener noreferrer">
136+
{challenge.challenge_name || challenge['challenge.challenge_name'] || challengeId}
137+
</a>
138+
</td>
139+
{
137140
!isCopilot ? (
138-
<td className={styles.placement}>{challenge[placeLabel] || challenge.place}<span>placement</span></td>
141+
<td className={styles.placement}>
142+
{challenge[placeLabel]}<span>placement</span>
143+
</td>
139144
) : null
140145
}
141-
<td className={styles.points}>
142-
{challenge[pointsLabel] || challenge.points}<span>points</span>
143-
</td>
144-
</tr>
146+
<td className={styles.points}>
147+
{challenge[pointsLabel] || challenge.points}<span>points</span>
148+
</td>
149+
</tr>
150+
);
145151
})
146152
}
147153
</tbody>

src/shared/components/Leaderboard/LeaderboardTable/index.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,11 @@ export default function LeaderboardTable(props) {
6767
const addSufix = val => isAlgo ? (val !== 1 ? `${val} matches` : `${val} match`) : (val !== 1 ? `${val} challenges` : `${val} challenge`);
6868
const renderTableRows = comps => (
6969
comps.map((competitor) => {
70-
const tcoPoints =
71-
competitor['tco23_leaderboard.tco_points'] ||
72-
competitor['tco_leaderboard.tco_points'] ||
73-
competitor.points ||
74-
competitor['tco_leaderboard.total_score'] ||
75-
competitor['srm_tco19.score'];
70+
const tcoPoints = competitor['tco23_leaderboard.tco_points']
71+
|| competitor['tco_leaderboard.tco_points']
72+
|| competitor.points
73+
|| competitor['tco_leaderboard.total_score']
74+
|| competitor['srm_tco19.score'];
7675
const tcoChallengeCnt = competitor['tco23_leaderboard.challenge_count'] || competitor['tco_leaderboard.challenge_count'] || competitor.challengecount;
7776
let photoUrl = competitor['member_profile_basic.photo_url'] || competitor.avatar;
7877
if (photoUrl) {

src/shared/components/Leaderboard/Podium/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ export default function Podium(props) {
6464
isTopGear={isTopGear}
6565
isAlgo={isAlgo}
6666
themeName={themeName}
67+
podiumPlaces={comps.length}
6768
/>
6869
</div>
6970
));
7071

7172
return (
72-
<div styleName={`${stylesName}.PodiumWrap`} style={comps.length === 4 ? { 'justify-content': 'space-between' } : {}}>
73+
<div styleName={`${stylesName}.${comps.length > 3 ? 'PodiumWrapCondense' : 'PodiumWrap'}`} style={comps.length === 4 ? { 'justify-content': 'space-between' } : {}}>
7374
{podiumSpots}
7475
</div>
7576
);

src/shared/components/Leaderboard/Podium/themes/default.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
}
1919
}
2020

21-
.PodiumWrap {
21+
.PodiumWrap,
22+
.PodiumWrapCondense {
2223
display: flex;
2324
justify-content: center !important;
2425

src/shared/components/Leaderboard/Podium/themes/tco23.scss

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@
2323
}
2424
}
2525

26-
.PodiumWrap {
26+
.PodiumWrap,
27+
.PodiumWrapCondense {
2728
display: flex;
2829
justify-content: center !important;
2930

3031
@include xs-to-sm {
3132
flex-direction: column;
3233
align-items: center;
3334
}
35+
}
3436

37+
.PodiumWrap {
3538
.podium-column:nth-child(2) {
3639
@include md-to-xl {
3740
margin-top: -16px;
@@ -58,3 +61,19 @@
5861
margin-right: 0;
5962
}
6063
}
64+
65+
.PodiumWrapCondense {
66+
@media screen and (min-width: 375px) and (max-width: 768px) {
67+
display: grid;
68+
grid-template-columns: 1fr 1fr;
69+
gap: 17px;
70+
}
71+
72+
.podium-column {
73+
margin-right: 16px;
74+
75+
@include xs-to-sm {
76+
margin: 0;
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)