Skip to content

Commit

Permalink
Merge pull request #6629 from topcoder-platform/develop
Browse files Browse the repository at this point in the history
Release v1.17.18
  • Loading branch information
luizrrodrigues authored Aug 31, 2022
2 parents 0cc5dd8 + 639a553 commit f9eac9d
Show file tree
Hide file tree
Showing 38 changed files with 766 additions and 98 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,21 +356,21 @@ workflows:
filters:
branches:
only:
- tco23
- free
# This is alternate dev env for parallel testing
- "build-qa":
context : org-global
filters:
branches:
only:
- reskin-profile-settings
- free
# This is beta env for production soft releases
- "build-prod-beta":
context : org-global
filters:
branches:
only:
- social-share-updates
- free
# This is stage env for production QA releases
- "build-prod-staging":
context : org-global
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ ARG GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY
# Optimizely
ARG OPTIMIZELY_SDK_KEY

# Gamification
ARG GAMIFICATION_ORG_ID

################################################################################
# Setting of environment variables in the Docker image.

Expand Down Expand Up @@ -143,6 +146,8 @@ ENV GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY=$GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY
# Optimizely
ENV OPTIMIZELY_SDK_KEY=$OPTIMIZELY_SDK_KEY

ENV GAMIFICATION_ORG_ID=$GAMIFICATION_ORG_ID

################################################################################
# Testing and build of the application inside the container.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ exports[`Matches shallow shapshot 1`] = `
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__winnings-info___PBqQk"
>
<span>
0
points
</span>
<span>
Expand All @@ -84,7 +83,7 @@ exports[`Matches shallow shapshot 1`] = `
<td
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-points___2-5d7"
>
0.00
NaN
</td>
</tr>
<tr>
Expand Down Expand Up @@ -125,7 +124,6 @@ exports[`Matches shallow shapshot 1`] = `
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__winnings-info___PBqQk"
>
<span>
0
points
</span>
<span>
Expand All @@ -139,7 +137,7 @@ exports[`Matches shallow shapshot 1`] = `
<td
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-points___2-5d7"
>
0.00
NaN
</td>
</tr>
<tr>
Expand Down Expand Up @@ -180,7 +178,6 @@ exports[`Matches shallow shapshot 1`] = `
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__winnings-info___PBqQk"
>
<span>
0
points
</span>
<span>
Expand All @@ -194,7 +191,7 @@ exports[`Matches shallow shapshot 1`] = `
<td
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-points___2-5d7"
>
0.00
NaN
</td>
</tr>
<tr>
Expand Down Expand Up @@ -235,7 +232,6 @@ exports[`Matches shallow shapshot 1`] = `
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__winnings-info___PBqQk"
>
<span>
0
points
</span>
<span>
Expand All @@ -249,7 +245,7 @@ exports[`Matches shallow shapshot 1`] = `
<td
className="src-shared-components-Leaderboard-LeaderboardTable-themes-___styles__col-points___2-5d7"
>
0.00
NaN
</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`Matches shallow shapshot 1`] = `
className="src-shared-components-Leaderboard-Podium-themes-___default__Podium___1qIZm"
>
<div
className="src-shared-components-Leaderboard-Podium-themes-___default__PodiumWrap___2hDWP"
className="src-shared-components-Leaderboard-Podium-themes-___default__PodiumWrapCondense___3aV24"
style={
Object {
"justify-content": "space-between",
Expand All @@ -29,6 +29,7 @@ exports[`Matches shallow shapshot 1`] = `
isCopilot={false}
isTopGear={false}
onUsernameClick={null}
podiumPlaces={4}
themeName="Default"
/>
</div>
Expand All @@ -49,6 +50,7 @@ exports[`Matches shallow shapshot 1`] = `
isCopilot={false}
isTopGear={false}
onUsernameClick={null}
podiumPlaces={4}
themeName="Default"
/>
</div>
Expand All @@ -69,6 +71,7 @@ exports[`Matches shallow shapshot 1`] = `
isCopilot={false}
isTopGear={false}
onUsernameClick={null}
podiumPlaces={4}
themeName="Default"
/>
</div>
Expand All @@ -89,6 +92,7 @@ exports[`Matches shallow shapshot 1`] = `
isCopilot={false}
isTopGear={false}
onUsernameClick={null}
podiumPlaces={4}
themeName="Default"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ exports[`Matches shallow shapshot 1`] = `
<span
className="src-shared-components-Leaderboard-PodiumSpot-themes-___styles__value___2shA5"
>
0.00
NaN
</span>
<span
className="src-shared-components-Leaderboard-PodiumSpot-themes-___styles__value-title___1Jf_7"
Expand Down Expand Up @@ -106,7 +106,7 @@ exports[`Matches shallow shapshot 2`] = `
<span
className="src-shared-components-Leaderboard-PodiumSpot-themes-___styles__value___2shA5"
>
0.00
NaN
</span>
<span
className="src-shared-components-Leaderboard-PodiumSpot-themes-___styles__value-title___1Jf_7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ exports[`renders a full Profile correctly 1`] = `
},
]
}
badges={Object {}}
challenges={null}
clearSubtrackChallenges={[Function]}
copilot={true}
Expand Down Expand Up @@ -720,6 +721,7 @@ exports[`renders a full Profile correctly 1`] = `
exports[`renders an empty Profile correctly 1`] = `
<ProfilePage
achievements={Array []}
badges={Object {}}
challenges={null}
clearSubtrackChallenges={[Function]}
copilot={false}
Expand Down
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ docker build -t $TAG \
--build-arg OPTIMIZELY_SDK_KEY=$OPTIMIZELY_SDK_KEY \
--build-arg COMMUNITY_APP_URL=$COMMUNITY_APP_URL \
--build-arg GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY=$GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY \
--build-arg GAMIFICATION_ORG_ID=$GAMIFICATION_ORG_ID \
--build-arg VALID_ISSUERS=$VALID_ISSUERS .

# Copies "node_modules" from the created image, if necessary for caching.
Expand Down
4 changes: 4 additions & 0 deletions config/custom-environment-variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,8 @@ module.exports = {
SDK_KEY: 'OPTIMIZELY_SDK_KEY',
},
GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY: 'GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY',
GAMIFICATION: {
ORG_ID: 'GAMIFICATION_ORG_ID',
ENABLE_BADGE_UI: 'GAMIFICATION_ENABLE_BADGE_UI',
},
};
5 changes: 4 additions & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ module.exports = {
OPTIMIZELY: {
SDK_KEY: '7V4CJhurXT3Y3bnzv1hv1',
},
PLATFORM_SITE_URL: 'https://platform.topcoder-dev.com',
GAMIFICATION: {
ORG_ID: '6052dd9b-ea80-494b-b258-edd1331e27a3',
ENABLE_BADGE_UI: true,
},
PLATFORMUI_SITE_URL: 'https://platform-ui.topcoder-dev.com',
};
17 changes: 17 additions & 0 deletions src/assets/images/default-award.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/profile/header-overlay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions src/assets/images/profile/header-overlay.svg

This file was deleted.

3 changes: 2 additions & 1 deletion src/shared/actions/page/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import _ from 'lodash';
import challengeDetails from './challenge-details';
import memberProfile from './profile';

export default _.merge({}, challengeDetails);
export default _.merge({}, challengeDetails, memberProfile);
50 changes: 50 additions & 0 deletions src/shared/actions/page/profile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Actions for member profile page.
*/
/* global fetch */
import { redux, config } from 'topcoder-react-utils';

/**
* @static
* @desc Initiates an action that fetch member's badges
* @param {String} handle Member handle.
* @return {Action}
*/
async function getGamificationBadgesInit(handle) {
return { handle };
}

/**
* @static
* @desc Creates an action that gets member's badges
*
* @param {String} handle Topcoder member handle.
* @return {Action}
*/
async function getGamificationBadgesDone(handle) {
try {
const memberInfo = await fetch(`${config.API.V5}/members/${handle}`)
.then(response => response.json());
const badges = await fetch(`${config.API.V5}/gamification/badges/assigned/${memberInfo.userId}?organization_id=${config.GAMIFICATION.ORG_ID}`)
.then(response => response.json());

return {
handle,
badges,
};
} catch (error) {
return {
handle,
error,
};
}
}

export default redux.createActions({
PAGE: {
PROFILE: {
GET_GAMIFICATION_BADGES_INIT: getGamificationBadgesInit,
GET_GAMIFICATION_BADGES_DONE: getGamificationBadgesDone,
},
},
});
43 changes: 25 additions & 18 deletions src/shared/components/Leaderboard/ChallengeHistoryModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ class ChallengeHistoryModal extends Component {
} = this.props;
const { sortParam } = this.state;
const challengesOrdered = _.orderBy(challenges, [sortParam.field], [sortParam.order]);
const placeLabel = competitor['member_profile_basic.handle'] ? 'tco_leaderboard.placement' : 'place';
const pointsLabel = competitor['member_profile_basic.handle'] ? 'tco_leaderboard.tco_points' : 'points';
// eslint-disable-next-line
const placeLabel = competitor['tco23_leaderboard.challenge_count'] ? 'tco23_leaderboard.placement' : 'tco_leaderboard.placement';
// eslint-disable-next-line
const pointsLabel = competitor['tco23_leaderboard.tco_points'] ? 'tco23_leaderboard.tco_points' : 'tco_leaderboard.tco_points';
const styles = THEMES[themeName] || THEMES.Default;
/* eslint-disable no-confusing-arrow */
const sortInner = () => themeName === 'TCO23' ? (
Expand Down Expand Up @@ -95,7 +97,7 @@ class ChallengeHistoryModal extends Component {
}}
type="button"
>
{ sortInner() }
{sortInner()}
</button>
</div>
</th>
Expand All @@ -117,31 +119,36 @@ class ChallengeHistoryModal extends Component {
}}
type="button"
>
{ sortInner() }
{sortInner()}
</button>
</div>
</th>
</tr>
</thead>
<tbody>
{
challengesOrdered.map(challenge => (
<tr className={styles.row} key={`${challenge['tco_leaderboard.challenge_id'] || challenge['challenge.challenge_id'] || challenge.challenge_id}`}>
<td className={styles.name}>
<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">
{challenge.challenge_name || challenge['challenge.challenge_name'] || challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id}
</a>
</td>
{
challengesOrdered.map((challenge) => {
const challengeId = challenge['tco23_leaderboard.challenge_id'] || challenge['tco_leaderboard.challenge_id'] || challenge['challenge.challenge_GUID'] || challenge['challenge.challenge_id'] || challenge.challenge_id;
return (
<tr className={styles.row} key={`${challengeId}`}>
<td className={styles.name}>
<a href={`${config.URL.BASE}/challenges/${challengeId || challenge['challenge.challenge_GUID']}/`} className={styles.link} target="_blank" rel="noopener noreferrer">
{challenge.challenge_name || challenge['challenge.challenge_name'] || challengeId}
</a>
</td>
{
!isCopilot ? (
<td className={styles.placement}>{challenge['tco_leaderboard.placement'] || challenge.place}<span>placement</span></td>
<td className={styles.placement}>
{challenge[placeLabel]}<span>placement</span>
</td>
) : null
}
<td className={styles.points}>
{challenge['tco_leaderboard.tco_points'] || challenge.points}<span>points</span>
</td>
</tr>
))
<td className={styles.points}>
{challenge[pointsLabel] || challenge.points}<span>points</span>
</td>
</tr>
);
})
}
</tbody>
</table>
Expand Down
Loading

0 comments on commit f9eac9d

Please sign in to comment.