Skip to content

Commit f9eac9d

Browse files
Merge pull request #6629 from topcoder-platform/develop
Release v1.17.18
2 parents 0cc5dd8 + 639a553 commit f9eac9d

File tree

38 files changed

+766
-98
lines changed

38 files changed

+766
-98
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,21 +356,21 @@ workflows:
356356
filters:
357357
branches:
358358
only:
359-
- tco23
359+
- free
360360
# This is alternate dev env for parallel testing
361361
- "build-qa":
362362
context : org-global
363363
filters:
364364
branches:
365365
only:
366-
- reskin-profile-settings
366+
- free
367367
# This is beta env for production soft releases
368368
- "build-prod-beta":
369369
context : org-global
370370
filters:
371371
branches:
372372
only:
373-
- social-share-updates
373+
- free
374374
# This is stage env for production QA releases
375375
- "build-prod-staging":
376376
context : org-global

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ ARG GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY
7878
# Optimizely
7979
ARG OPTIMIZELY_SDK_KEY
8080

81+
# Gamification
82+
ARG GAMIFICATION_ORG_ID
83+
8184
################################################################################
8285
# Setting of environment variables in the Docker image.
8386

@@ -143,6 +146,8 @@ ENV GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY=$GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY
143146
# Optimizely
144147
ENV OPTIMIZELY_SDK_KEY=$OPTIMIZELY_SDK_KEY
145148

149+
ENV GAMIFICATION_ORG_ID=$GAMIFICATION_ORG_ID
150+
146151
################################################################################
147152
# Testing and build of the application inside the container.
148153

__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"

__tests__/shared/components/ProfilePage/__snapshots__/index.jsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ exports[`renders a full Profile correctly 1`] = `
5858
},
5959
]
6060
}
61+
badges={Object {}}
6162
challenges={null}
6263
clearSubtrackChallenges={[Function]}
6364
copilot={true}
@@ -720,6 +721,7 @@ exports[`renders a full Profile correctly 1`] = `
720721
exports[`renders an empty Profile correctly 1`] = `
721722
<ProfilePage
722723
achievements={Array []}
724+
badges={Object {}}
723725
challenges={null}
724726
clearSubtrackChallenges={[Function]}
725727
copilot={false}

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ docker build -t $TAG \
5353
--build-arg OPTIMIZELY_SDK_KEY=$OPTIMIZELY_SDK_KEY \
5454
--build-arg COMMUNITY_APP_URL=$COMMUNITY_APP_URL \
5555
--build-arg GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY=$GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY \
56+
--build-arg GAMIFICATION_ORG_ID=$GAMIFICATION_ORG_ID \
5657
--build-arg VALID_ISSUERS=$VALID_ISSUERS .
5758

5859
# Copies "node_modules" from the created image, if necessary for caching.

config/custom-environment-variables.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,8 @@ module.exports = {
114114
SDK_KEY: 'OPTIMIZELY_SDK_KEY',
115115
},
116116
GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY: 'GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY',
117+
GAMIFICATION: {
118+
ORG_ID: 'GAMIFICATION_ORG_ID',
119+
ENABLE_BADGE_UI: 'GAMIFICATION_ENABLE_BADGE_UI',
120+
},
117121
};

config/default.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,9 @@ module.exports = {
452452
OPTIMIZELY: {
453453
SDK_KEY: '7V4CJhurXT3Y3bnzv1hv1',
454454
},
455-
PLATFORM_SITE_URL: 'https://platform.topcoder-dev.com',
455+
GAMIFICATION: {
456+
ORG_ID: '6052dd9b-ea80-494b-b258-edd1331e27a3',
457+
ENABLE_BADGE_UI: true,
458+
},
456459
PLATFORMUI_SITE_URL: 'https://platform-ui.topcoder-dev.com',
457460
};

src/assets/images/default-award.svg

Lines changed: 17 additions & 0 deletions
Loading
11.9 KB
Loading

src/assets/images/profile/header-overlay.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/shared/actions/page/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import _ from 'lodash';
22
import challengeDetails from './challenge-details';
3+
import memberProfile from './profile';
34

4-
export default _.merge({}, challengeDetails);
5+
export default _.merge({}, challengeDetails, memberProfile);

src/shared/actions/page/profile.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
* Actions for member profile page.
3+
*/
4+
/* global fetch */
5+
import { redux, config } from 'topcoder-react-utils';
6+
7+
/**
8+
* @static
9+
* @desc Initiates an action that fetch member's badges
10+
* @param {String} handle Member handle.
11+
* @return {Action}
12+
*/
13+
async function getGamificationBadgesInit(handle) {
14+
return { handle };
15+
}
16+
17+
/**
18+
* @static
19+
* @desc Creates an action that gets member's badges
20+
*
21+
* @param {String} handle Topcoder member handle.
22+
* @return {Action}
23+
*/
24+
async function getGamificationBadgesDone(handle) {
25+
try {
26+
const memberInfo = await fetch(`${config.API.V5}/members/${handle}`)
27+
.then(response => response.json());
28+
const badges = await fetch(`${config.API.V5}/gamification/badges/assigned/${memberInfo.userId}?organization_id=${config.GAMIFICATION.ORG_ID}`)
29+
.then(response => response.json());
30+
31+
return {
32+
handle,
33+
badges,
34+
};
35+
} catch (error) {
36+
return {
37+
handle,
38+
error,
39+
};
40+
}
41+
}
42+
43+
export default redux.createActions({
44+
PAGE: {
45+
PROFILE: {
46+
GET_GAMIFICATION_BADGES_INIT: getGamificationBadgesInit,
47+
GET_GAMIFICATION_BADGES_DONE: getGamificationBadgesDone,
48+
},
49+
},
50+
});

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>

0 commit comments

Comments
 (0)