Skip to content

Commit bb8fd8b

Browse files
Merge pull request #6627 from topcoder-platform/gig-share
Gig share
2 parents 771ae5f + 2d37646 commit bb8fd8b

File tree

16 files changed

+252
-82
lines changed

16 files changed

+252
-82
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ workflows:
356356
filters:
357357
branches:
358358
only:
359-
- tco23
359+
- gig-share
360360
# This is alternate dev env for parallel testing
361361
- "build-qa":
362362
context : org-global
@@ -370,7 +370,7 @@ workflows:
370370
filters:
371371
branches:
372372
only:
373-
- social-share-updates
373+
- tco23-leaderboards
374374
# This is stage env for production QA releases
375375
- "build-prod-staging":
376376
context : org-global

__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: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ class ChallengeHistoryModal extends Component {
3939
} = this.props;
4040
const { sortParam } = this.state;
4141
const challengesOrdered = _.orderBy(challenges, [sortParam.field], [sortParam.order]);
42-
const placeLabel = competitor['member_profile_basic.handle'] ? 'tco_leaderboard.placement' : 'place';
43-
const pointsLabel = competitor['member_profile_basic.handle'] ? 'tco_leaderboard.tco_points' : 'points';
42+
// eslint-disable-next-line
43+
const placeLabel = competitor['tco23_leaderboard.challenge_count'] ? 'tco23_leaderboard.placement' : 'tco_leaderboard.placement';
44+
// eslint-disable-next-line
45+
const pointsLabel = competitor['tco23_leaderboard.tco_points'] ? 'tco23_leaderboard.tco_points' : 'tco_leaderboard.tco_points';
4446
const styles = THEMES[themeName] || THEMES.Default;
4547
/* eslint-disable no-confusing-arrow */
4648
const sortInner = () => themeName === 'TCO23' ? (
@@ -95,7 +97,7 @@ class ChallengeHistoryModal extends Component {
9597
}}
9698
type="button"
9799
>
98-
{ sortInner() }
100+
{sortInner()}
99101
</button>
100102
</div>
101103
</th>
@@ -117,31 +119,36 @@ class ChallengeHistoryModal extends Component {
117119
}}
118120
type="button"
119121
>
120-
{ sortInner() }
122+
{sortInner()}
121123
</button>
122124
</div>
123125
</th>
124126
</tr>
125127
</thead>
126128
<tbody>
127129
{
128-
challengesOrdered.map(challenge => (
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">
132-
{challenge.challenge_name || challenge['challenge.challenge_name'] || challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id}
133-
</a>
134-
</td>
135-
{
130+
challengesOrdered.map((challenge) => {
131+
const challengeId = challenge['tco23_leaderboard.challenge_id'] || challenge['tco_leaderboard.challenge_id'] || challenge['challenge.challenge_GUID'] || challenge['challenge.challenge_id'] || challenge.challenge_id;
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+
{
136140
!isCopilot ? (
137-
<td className={styles.placement}>{challenge['tco_leaderboard.placement'] || challenge.place}<span>placement</span></td>
141+
<td className={styles.placement}>
142+
{challenge[placeLabel]}<span>placement</span>
143+
</td>
138144
) : null
139145
}
140-
<td className={styles.points}>
141-
{challenge['tco_leaderboard.tco_points'] || challenge.points}<span>points</span>
142-
</td>
143-
</tr>
144-
))
146+
<td className={styles.points}>
147+
{challenge[pointsLabel] || challenge.points}<span>points</span>
148+
</td>
149+
</tr>
150+
);
151+
})
145152
}
146153
</tbody>
147154
</table>

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ 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 = 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'];
75+
const tcoChallengeCnt = competitor['tco23_leaderboard.challenge_count'] || competitor['tco_leaderboard.challenge_count'] || competitor.challengecount;
7076
let photoUrl = competitor['member_profile_basic.photo_url'] || competitor.avatar;
7177
if (photoUrl) {
7278
photoUrl = `${config.CDN.PUBLIC}/avatar/${encodeURIComponent(photoUrl)}?size=40`;
@@ -147,13 +153,13 @@ export default function LeaderboardTable(props) {
147153
}
148154
<div styleName={`${stylesName}.winnings-info`}>
149155
{fulfillment && (<span>{fulfillment} fulfillment</span>)}
150-
<span>{competitor['tco_leaderboard.tco_points'] || competitor.points} points</span>
156+
<span>{tcoPoints} points</span>
151157
{
152158
themeName === 'TCO23' ? (
153159
<div onClick={() => onUsernameClick(competitor)} styleName={`${stylesName}.mobile-link`}>
154-
{addSufix(competitor['tco_leaderboard.challenge_count'] || competitor.challengecount)}
160+
{addSufix(tcoChallengeCnt)}
155161
</div>
156-
) : <span>{addSufix(competitor['tco_leaderboard.challenge_count'] || competitor.challengecount)}</span>
162+
) : <span>{addSufix(tcoChallengeCnt)}</span>
157163
}
158164
</div>
159165
</td>
@@ -172,15 +178,15 @@ export default function LeaderboardTable(props) {
172178
style={{ cursor: 'pointer', display: 'inline-block', color: '#0d61bf' }}
173179
onClick={() => onUsernameClick(competitor)}
174180
>
175-
{ `${addSufix(competitor['tco_leaderboard.challenge_count'] || competitor.challengecount)}` }
181+
{`${addSufix(tcoChallengeCnt)}`}
176182
</div>
177-
) : `${addSufix(competitor['tco_leaderboard.challenge_count'] || competitor.challengecount)}`
183+
) : `${addSufix(tcoChallengeCnt)}`
178184
) : (
179-
competitor['tco_leaderboard.challenge_count'] || competitor.challengecount
185+
tcoChallengeCnt
180186
)
181187
}
182188
</td>
183-
<td styleName={`${stylesName}.col-points`}>{formatPoints(competitor['tco_leaderboard.tco_points'] || competitor.points)}</td>
189+
<td styleName={`${stylesName}.col-points`}>{formatPoints(tcoPoints)}</td>
184190
{
185191
isTopGear ? (
186192
<td styleName={`${stylesName}.col-points`}>{competitor.wins}</td>
@@ -193,7 +199,7 @@ export default function LeaderboardTable(props) {
193199
}
194200
{
195201
isAlgo ? (
196-
<td styleName={`${stylesName}.col-points`}>{competitor['tco_leaderboard.total_score'] || competitor['srm_tco19.score']}</td>
202+
<td styleName={`${stylesName}.col-points`}>{tcoPoints}</td>
197203
) : null
198204
}
199205
</tr>

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)