Skip to content

Commit 2158f70

Browse files
committed
Merge branch 'develop' into feature/filter-update
2 parents a393519 + ce63e59 commit 2158f70

File tree

30 files changed

+354
-127
lines changed

30 files changed

+354
-127
lines changed

.circleci/config.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -231,21 +231,20 @@ workflows:
231231
branches:
232232
only:
233233
- develop
234-
- auth0-hotfix-v3
235234
# This is alternate dev env for parallel testing
236235
- "build-test":
237236
context : org-global
238237
filters:
239238
branches:
240239
only:
241-
- apollo-site
240+
- free
242241
# This is alternate dev env for parallel testing
243242
- "build-qa":
244243
context : org-global
245244
filters:
246245
branches:
247246
only:
248-
- issue-5041
247+
- free
249248
# This is beta env for production soft releases
250249
- "build-prod-beta":
251250
context : org-global

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

-3
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,6 @@ exports[`renders marathon 1`] = `
241241
</p>
242242
</div>
243243
</div>
244-
<p
245-
className="src-shared-components-ChallengeTile-___style__roles___1V-WA"
246-
/>
247244
</div>
248245
</div>
249246
</div>

__tests__/shared/components/GUIKit/TextInput/__snapshots__/index.jsx.snap

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ exports[`Default render 1`] = `
99
defaultValue=""
1010
onBlur={[Function]}
1111
onChange={[Function]}
12+
onKeyPress={[Function]}
1213
placeholder=""
1314
type="text"
1415
/>

__tests__/shared/components/SubmissionManagement/Submission.jsx

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Submission from 'components/SubmissionManagement/Submission';
44
import TU from 'react-dom/test-utils';
55

66
const mockOnDelete = jest.fn();
7+
const mockOnDownload = jest.fn();
78
const mockOnShowDetails = jest.fn();
89

910
const rnd = new Rnd();
@@ -12,6 +13,7 @@ test('Snapshot match', () => {
1213
rnd.render((
1314
<Submission
1415
onDelete={mockOnDelete}
16+
onDownload={mockOnDownload}
1517
onShowDetails={mockOnShowDetails}
1618
showScreeningDetails
1719
type="develop"
@@ -21,6 +23,7 @@ test('Snapshot match', () => {
2123
rnd.render((
2224
<Submission
2325
onDelete={mockOnDelete}
26+
onDownload={mockOnDownload}
2427
onShowDetails={mockOnShowDetails}
2528
submissionObject={{
2629
id: '12345',
@@ -49,6 +52,7 @@ class Wrapper extends React.Component {
4952
const page = TU.renderIntoDocument((
5053
<Wrapper
5154
onDelete={mockOnDelete}
55+
onDownload={mockOnDownload}
5256
onShowDetails={mockOnShowDetails}
5357
submissionObject={{
5458
id: '12345',

__tests__/shared/components/SubmissionManagement/__snapshots__/Submission.jsx.snap

+10-4
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ exports[`Snapshot match 1`] = `
2121
className="src-shared-components-SubmissionManagement-Submission-___styles__action-col___2M1RY"
2222
>
2323
<div>
24-
<a>
24+
<button
25+
onClick={[Function]}
26+
type="button"
27+
>
2528
<DownloadIcon
2629
height="16"
2730
viewBox="0 0 16 16"
2831
width="16"
2932
xmlns="http://www.w3.org/2000/svg"
3033
/>
31-
</a>
34+
</button>
3235
<button
3336
className="src-shared-components-SubmissionManagement-Submission-___styles__delete-icon___2M67z"
3437
disabled={true}
@@ -81,14 +84,17 @@ exports[`Snapshot match 2`] = `
8184
className="src-shared-components-SubmissionManagement-Submission-___styles__action-col___2M1RY"
8285
>
8386
<div>
84-
<a>
87+
<button
88+
onClick={[Function]}
89+
type="button"
90+
>
8591
<DownloadIcon
8692
height="16"
8793
viewBox="0 0 16 16"
8894
width="16"
8995
xmlns="http://www.w3.org/2000/svg"
9096
/>
91-
</a>
97+
</button>
9298
<button
9399
className="src-shared-components-SubmissionManagement-Submission-___styles__delete-icon___2M67z"
94100
disabled={true}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
"supertest": "^3.1.0",
144144
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3",
145145
"tc-ui": "^1.0.12",
146-
"topcoder-react-lib": "1.1.1",
146+
"topcoder-react-lib": "1.1.2",
147147
"topcoder-react-ui-kit": "2.0.1",
148148
"topcoder-react-utils": "0.7.8",
149149
"turndown": "^4.0.2",

src/shared/actions/page/challenge-details.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function setSpecsTabState(state) {
5959
* @param {Boolean} open
6060
* @return {Object}
6161
*/
62-
function toggleCheckpointFeedback(id, open) {
62+
function toggleCheckpointFeedback(id, open = false) {
6363
return { id, open };
6464
}
6565

src/shared/components/ChallengeTile/index.jsx

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Challenge tile.
33
*/
44
/* eslint-env browser */
5+
import _ from 'lodash';
56
import React from 'react';
67
import PT from 'prop-types';
78
import { Link } from 'react-router-dom';
@@ -74,6 +75,7 @@ class ChallengeTile extends React.Component {
7475
} = this.props;
7576

7677
const { track, type } = challenge;
78+
const roles = _.get(challenge, 'userDetails.roles');
7779

7880
const outStyleName = `challenge tile-view ${track.replace(' ', '-').toLowerCase()}`;
7981
const extraStyle = {
@@ -307,19 +309,22 @@ class ChallengeTile extends React.Component {
307309
) }
308310
</div>
309311

310-
<p styleName="roles">
311-
{ track !== COMPETITION_TRACKS.DS
312+
{ !_.isEmpty(roles)
313+
&& (
314+
<p styleName="roles">
315+
{ track !== COMPETITION_TRACKS.DS
312316
&& (
313317
<span>
314318
<span>
315319
Role: &nbsp;
316320
</span>
317321
<span>
318-
{ listRoles(challenge.userDetails.roles) }
322+
{ listRoles(roles) }
319323
</span>
320324
</span>
321325
) }
322-
</p>
326+
</p>
327+
) }
323328
</div>
324329
</div>
325330
</div>

src/shared/components/Contentful/PasswordScreen/index.jsx

+25-6
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ export default class PasswordScreen extends React.Component {
2121

2222
onSubmit() {
2323
const { password } = this.props;
24-
const { inputVal } = this.state;
25-
this.setState({
26-
authorized: password === inputVal,
27-
errorMsg: password === inputVal ? '' : 'Password incorrect',
24+
this.setState((state) => {
25+
const { inputVal } = state;
26+
return {
27+
authorized: password === inputVal,
28+
errorMsg: password === inputVal ? '' : 'Password incorrect',
29+
};
2830
});
2931
}
3032

@@ -41,7 +43,7 @@ export default class PasswordScreen extends React.Component {
4143
authorized, errorMsg, inputVal,
4244
} = this.state;
4345
const {
44-
viewPortId, preview, spaceName, environment, baseUrl, title,
46+
viewPortId, preview, spaceName, environment, baseUrl, title, btnText, content,
4547
} = this.props;
4648
return authorized ? (
4749
<Viewport
@@ -62,11 +64,24 @@ export default class PasswordScreen extends React.Component {
6264
onChange={val => this.onPasswordInput(val)}
6365
errorMsg={errorMsg}
6466
required
67+
type="password"
68+
onEnterKey={this.onSubmit}
6569
/>
6670
<div styleName="cta">
67-
<button type="button" styleName="submit" onClick={this.onSubmit} disabled={!inputVal}>SUBMIT</button>
71+
<button type="button" styleName="submit" onClick={this.onSubmit} disabled={!inputVal}>{btnText}</button>
6872
</div>
6973
</div>
74+
{
75+
content ? (
76+
<Viewport
77+
id={content.sys.id}
78+
preview={preview}
79+
spaceName={spaceName}
80+
environment={environment}
81+
baseUrl={baseUrl}
82+
/>
83+
) : null
84+
}
7085
</div>
7186
);
7287
}
@@ -78,6 +93,8 @@ PasswordScreen.defaultProps = {
7893
environment: null,
7994
baseUrl: '',
8095
title: 'GET ACCESS WITH PASSWORD',
96+
btnText: 'SUBMIT',
97+
content: null,
8198
};
8299

83100
PasswordScreen.propTypes = {
@@ -88,4 +105,6 @@ PasswordScreen.propTypes = {
88105
environment: PT.string,
89106
baseUrl: PT.string,
90107
title: PT.string,
108+
btnText: PT.string,
109+
content: PT.shape(),
91110
};

src/shared/components/Contentful/Route.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ function ChildRoutesLoader(props) {
7171
environment={environment}
7272
baseUrl={url}
7373
title={fields.passwordScreenTitle}
74+
btnText={fields.passwordScreenButtonText}
75+
content={fields.passwordScreenContent}
7476
/>
7577
)
7678
) : <Error404 />

src/shared/components/GUIKit/TextInput/index.jsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ function TextInput({
1717
onChange,
1818
required,
1919
size,
20+
type,
21+
onEnterKey,
2022
}) {
2123
const [val, setVal] = useState(value);
2224
const delayedOnChange = useRef(
@@ -28,7 +30,7 @@ function TextInput({
2830
<div className="textInputContainer" styleName={`container ${sizeStyle}`}>
2931
<input
3032
defaultValue={value}
31-
type="text"
33+
type={type}
3234
placeholder={`${placeholder}${placeholder && required ? ' *' : ''}`}
3335
styleName={`${value || val ? 'haveValue' : ''} ${errorMsg ? 'haveError' : ''}`}
3436
onChange={(e) => {
@@ -39,6 +41,11 @@ function TextInput({
3941
delayedOnChange(e.target.value, onChange);
4042
setVal(e.target.value);
4143
}}
44+
onKeyPress={(e) => {
45+
if (e.key === 'Enter') {
46+
onEnterKey();
47+
}
48+
}}
4249
/>
4350
{label ? (
4451
<label htmlFor="textBoxInput">
@@ -58,6 +65,8 @@ TextInput.defaultProps = {
5865
onChange: () => {},
5966
required: false,
6067
size: 'lg',
68+
type: 'text',
69+
onEnterKey: () => {},
6170
};
6271

6372
TextInput.propTypes = {
@@ -68,6 +77,8 @@ TextInput.propTypes = {
6877
onChange: PT.func,
6978
required: PT.bool,
7079
size: PT.oneOf(['xs', 'lg']),
80+
type: PT.string,
81+
onEnterKey: PT.func,
7182
};
7283

7384
export default TextInput;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class ChallengeHistoryModal extends Component {
116116
challengesOrdered.map(challenge => (
117117
<tr styleName="row" key={`${challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id}`}>
118118
<td styleName="name">
119-
<a href={`${config.URL.BASE}/challenges/${challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id}/`} styleName="link" target="_blank" rel="noopener noreferrer">
119+
<a href={`${config.URL.BASE}/challenges/${challenge['tco_leaderboard.challenge_id'] || challenge['challenge.challenge_id'] || challenge.challenge_id}/`} styleName="link" target="_blank" rel="noopener noreferrer">
120120
{challenge.challenge_name || challenge['challenge.challenge_name'] || challenge['tco_leaderboard.challenge_id'] || challenge.challenge_id}
121121
</a>
122122
</td>

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

+12-3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ export default function LeaderboardTable(props) {
6565
photoUrl = `${config.CDN.PUBLIC}/avatar/${
6666
encodeURIComponent(photoUrl)}?size=40`;
6767
}
68+
const fulfillment = competitor['tco_leaderboard.fulfillment']
69+
? (parseFloat(competitor['tco_leaderboard.fulfillment']) * 100).toFixed(2).replace(/[.,]00$/, '')
70+
: competitor.fulfillment;
6871
return (
6972
<tr key={competitor.rank}>
7073
<td styleName={`${stylesName}.col-rank`}>{competitor.rank}</td>
@@ -105,7 +108,7 @@ export default function LeaderboardTable(props) {
105108
</td>
106109
{
107110
isCopilot ? (
108-
<td styleName={`${stylesName}.col-fulfillment`}>{competitor.fulfillment}</td>
111+
<td styleName={`${stylesName}.col-fulfillment`}>{fulfillment}</td>
109112
) : null
110113
}
111114
<td styleName={`${stylesName}.col-challenges`}>{competitor['tco_leaderboard.challenge_count'] || competitor.challengecount}</td>
@@ -122,7 +125,7 @@ export default function LeaderboardTable(props) {
122125
}
123126
{
124127
isAlgo ? (
125-
<td styleName={`${stylesName}.col-points`}>{competitor['srm_tco19.score']}</td>
128+
<td styleName={`${stylesName}.col-points`}>{competitor['tco_leaderboard.total_score'] || competitor['srm_tco19.score']}</td>
126129
) : null
127130
}
128131
</tr>
@@ -141,7 +144,13 @@ export default function LeaderboardTable(props) {
141144
<th styleName={`${stylesName}.col-fulfillment`}>Fulfillment</th>
142145
) : null
143146
}
144-
<th styleName={`${stylesName}.col-challenges`}># of Challenges</th>
147+
{
148+
isAlgo ? (
149+
<th styleName={`${stylesName}.col-challenges`}># of Matches</th>
150+
) : (
151+
<th styleName={`${stylesName}.col-challenges`}># of Challenges</th>
152+
)
153+
}
145154
<th styleName={`${stylesName}.col-points`}>Points</th>
146155
{
147156
isTopGear ? (

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

+12-3
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ export default function PodiumSpot(props) {
107107
}
108108
let rootStyle = `${stylesName}.PodiumSpot`;
109109
if (PODIUM_ITEM_MODIFIER[competitor.rank]) rootStyle += ` ${stylesName}.PodiumSpot--${PODIUM_ITEM_MODIFIER[competitor.rank]}`;
110+
const fulfillment = competitor['tco_leaderboard.fulfillment']
111+
? (parseFloat(competitor['tco_leaderboard.fulfillment']) * 100).toFixed(2).replace(/[.,]00$/, '')
112+
: competitor.fulfillment;
110113

111114
return (
112115
<div styleName={rootStyle}>
@@ -175,14 +178,20 @@ export default function PodiumSpot(props) {
175178
{
176179
isCopilot ? (
177180
<div styleName={`${stylesName}.stats`}>
178-
<span styleName={`${stylesName}.value`}>{competitor.fulfillment}</span>
181+
<span styleName={`${stylesName}.value`}>{fulfillment}</span>
179182
<span styleName={`${stylesName}.value-title`}>fulfillment</span>
180183
</div>
181184
) : null
182185
}
183186
<div styleName={`${stylesName}.stats`}>
184187
<span styleName={`${stylesName}.value`}>{competitor['tco_leaderboard.challenge_count'] || competitor.challengecount}</span>
185-
<span styleName={`${stylesName}.value-title`}>challenges</span>
188+
{
189+
isAlgo ? (
190+
<span styleName={`${stylesName}.value-title`}># of matches</span>
191+
) : (
192+
<span styleName={`${stylesName}.value-title`}>challenges</span>
193+
)
194+
}
186195
</div>
187196
<div styleName={`${stylesName}.stats`}>
188197
<span styleName={`${stylesName}.value`}>{formatPoints(competitor['tco_leaderboard.tco_points'] || competitor.points)}</span>
@@ -207,7 +216,7 @@ export default function PodiumSpot(props) {
207216
{
208217
isAlgo ? (
209218
<div styleName={`${stylesName}.stats`}>
210-
<span styleName={`${stylesName}.value`}>{competitor['srm_tco19.score']}</span>
219+
<span styleName={`${stylesName}.value`}>{competitor['tco_leaderboard.total_score'] || competitor['srm_tco19.score']}</span>
211220
<span styleName={`${stylesName}.value-title`}>total score</span>
212221
</div>
213222
) : null

0 commit comments

Comments
 (0)