Skip to content

Commit 17260f3

Browse files
Merge pull request #20 from topcoder-platform/integration-v5-challenge-api
Integration v5 challenge api
2 parents 11f59b9 + 8a2d10c commit 17260f3

File tree

8 files changed

+48
-23
lines changed

8 files changed

+48
-23
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
"tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev",
135135
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3",
136136
"tc-ui": "^1.0.12",
137-
"topcoder-react-lib": "1000.19.3",
137+
"topcoder-react-lib": "1000.19.4",
138138
"topcoder-react-ui-kit": "^1.0.11",
139139
"topcoder-react-utils": "0.7.8",
140140
"turndown": "^4.0.2",

src/shared/actions/challenge-listing/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function getAllRecommendedChallengesInit(uuid) {
221221
function getAllRecommendedChallengesDone(uuid, tokenV3, recommendedTags) {
222222
const filter = {
223223
status: 'Active',
224-
tag: recommendedTags,
224+
...(!_.isEmpty(recommendedTags) && { tag: recommendedTags }),
225225
};
226226
return getAllActiveChallengesWithUsersDone(uuid, tokenV3, filter);
227227
}

src/shared/components/challenge-detail/Specification/SideBar/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ SideBar.defaultProps = {
348348
environment: '',
349349
codeRepo: '',
350350
isMM: false,
351-
metadata: [],
351+
metadata: {},
352352
reviewScorecardId: '',
353353
screeningScorecardId: '',
354354
};
@@ -370,7 +370,7 @@ SideBar.propTypes = {
370370
environment: PT.string,
371371
codeRepo: PT.string,
372372
isMM: PT.bool,
373-
metadata: PT.arrayOf(PT.shape()),
373+
metadata: PT.shape(),
374374
reviewScorecardId: PT.string,
375375
screeningScorecardId: PT.string,
376376
};

src/shared/components/challenge-detail/Specification/index.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default function ChallengeDetailsView(props) {
4747
codeRepo,
4848
userDetails,
4949
metadata,
50+
events,
5051
} = challenge;
5152

5253
const tags = challenge.tags || [];
@@ -410,6 +411,7 @@ export default function ChallengeDetailsView(props) {
410411
hasRegistered={hasRegistered}
411412
isDesign={track.toLowerCase() === 'design'}
412413
isDevelop={track.toLowerCase() === 'develop'}
414+
eventDetail={_.isEmpty(events) ? null : events[0]}
413415
isMM={isMM(challenge)}
414416
terms={terms}
415417
shareable={_.isEmpty(groups)}
@@ -436,7 +438,8 @@ ChallengeDetailsView.defaultProps = {
436438
finalSubmissionGuidelines: '',
437439
environment: '',
438440
codeRepo: '',
439-
metadata: [],
441+
metadata: {},
442+
events: [],
440443
reviewScorecardId: '',
441444
screeningScorecardId: '',
442445
},
@@ -467,7 +470,8 @@ ChallengeDetailsView.propTypes = {
467470
userDetails: PT.shape({
468471
roles: PT.arrayOf(PT.string).isRequired,
469472
}),
470-
metadata: PT.arrayOf(PT.shape()),
473+
metadata: PT.shape(),
474+
events: PT.arrayOf(PT.string),
471475
}),
472476
challengesUrl: PT.string.isRequired,
473477
communitiesList: PT.arrayOf(PT.shape({

src/shared/components/challenge-listing/ChallengeCard/index.jsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,15 @@ function ChallengeCard({
9191
{challenge.status === 'Active' ? 'Ends ' : 'Ended '}
9292
{getEndDate(challenge, challengeTypes)}
9393
</span>
94-
<Tags
95-
tags={challenge.tags}
96-
onTechTagClicked={onTechTagClicked}
97-
isExpanded={expandedTags.includes(challenge.id)}
98-
expand={() => expandTag(challenge.id)}
99-
/>
94+
{ challenge.tags.length > 0
95+
&& (
96+
<Tags
97+
tags={challenge.tags}
98+
onTechTagClicked={onTechTagClicked}
99+
isExpanded={expandedTags.includes(challenge.id)}
100+
expand={() => expandTag(challenge.id)}
101+
/>
102+
) }
100103
</div>
101104
</div>
102105
</div>

src/shared/components/challenge-listing/ReviewOpportunityCard/index.jsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ function ReviewOpportunityCard({
4848
}) {
4949
const { challenge } = opportunity;
5050
const { subTrack, legacy } = challenge;
51-
const tags = challenge.tags || challenge.technologies;
51+
let tags = challenge.tags || challenge.technologies;
52+
tags = tags.filter(tag => tag.trim().length);
5253
const track = legacy ? legacy.track : challenge.track;
5354
const start = moment(opportunity.startDate);
5455
return (
@@ -80,12 +81,15 @@ function ReviewOpportunityCard({
8081
{' '}
8182
{start.format('MMM DD')}
8283
</span>
83-
<Tags
84-
tags={tags}
85-
isExpanded={(expandedTags || []).includes(challenge.id)}
86-
expand={() => expandTag(challenge.id)}
87-
onTechTagClicked={onTechTagClicked}
88-
/>
84+
{ tags.length > 0
85+
&& (
86+
<Tags
87+
tags={tags}
88+
isExpanded={(expandedTags || []).includes(challenge.id)}
89+
expand={() => expandTag(challenge.id)}
90+
onTechTagClicked={onTechTagClicked}
91+
/>
92+
) }
8993
</div>
9094
</div>
9195
</div>

src/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip/index.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ const DESCRIPTION = {
2121
BUG_HUNT: 'Quickly find Bugs in apps, websites',
2222
CODE: 'Develop code for apps, services, etc. Final fixes are not included',
2323
DEVELOPMENT: 'Develop code for apps, services, etc. Final fixes are not included',
24+
TEST_SCENARIOS: 'Provide simple, easy information about what to test',
25+
CONTENT_CREATION: 'Generate topic ideas as a blog, video, infographic, or other format',
26+
SPECIFICATION: 'Document requirements to be satisfied for design, product, or service',
27+
TASK: 'An assigned piece of work',
28+
AUTOMATED_TESTING: 'Challenges were submissions are auto-scored against a set of automated test cases',
29+
COPILOT_POSTING: 'A post made to the copilot community which asks them to come back with a proposal for your project. This proposal typically includes a suggested gameplan, an estimated budget and their take on what approach to use.',
30+
DESIGN: 'Prepare the visual sketch or the plans for a website, feature, app, etc',
2431
TEST_SUITES: 'Develop test cases to be used to validate apps, website, etc.',
2532
CONCEPTUALIZATION: 'Discover and define user stories and requirements',
2633
DESIGN_FIRST_2_FINISH: 'Be the first to deliver the design solution',
@@ -47,6 +54,13 @@ const HEADER = {
4754
CODE: 'Code (Cd)',
4855
DEVELOPMENT: 'Development (Dv)',
4956
TEST_SUITES: 'Test Suites (TS)',
57+
TEST_SCENARIOS: 'Test Scenarios (Ts)',
58+
CONTENT_CREATION: 'Content Creation (CC)',
59+
SPECIFICATION: 'Specification (Sp)',
60+
TASK: 'Task (Tk)',
61+
AUTOMATED_TESTING: 'Automated Testing (AT)',
62+
COPILOT_POSTING: 'Copilot Posting (CP)',
63+
DESIGN: 'Design (Ds)',
5064
CONCEPTUALIZATION: 'Conceptualization (Cn)',
5165
DESIGN_FIRST_2_FINISH: 'Design First2Finish(DF2F)',
5266
FIRST_2_FINISH: 'First2Finish (F2F)',

src/shared/containers/challenge-detail/index.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,12 @@ class ChallengeDetailPageContainer extends React.Component {
248248
const { legacy } = nextProps.challenge;
249249
const track = legacy ? legacy.track : nextProps.challenge.track;
250250
if (track && track.toLowerCase() !== 'design' && thriveArticles.length === 0) {
251-
const { tags } = nextProps.challenge;
252-
if (tags.length > 0 && !(tags.length === 1 && tags[0] === 'Other')) {
253-
// for tags = ['Other', ...], if 'Other' is first, use second value
251+
// filter all tags with value 'Other'
252+
const tags = _.filter(nextProps.challenge.tags, tag => tag !== 'Other');
253+
if (tags.length > 0) {
254254
this.apiService.getEDUContent({
255255
limit: 3,
256-
phrase: tags[0] === 'Other' ? tags[1] : tags[0],
256+
phrase: tags[0],
257257
types: ['Article'],
258258
}).then((content) => {
259259
// format image file data

0 commit comments

Comments
 (0)