From b256465d4116f14db3a8441d1d72ced6398512ca Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Fri, 7 Aug 2020 06:53:52 -0300 Subject: [PATCH 1/8] Updated isMM() to check in challenge.tag instead challenge.type --- .../challenge-detail/Header/ChallengeTags.jsx | 3 +-- src/shared/utils/challenge.js | 12 ++---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/shared/components/challenge-detail/Header/ChallengeTags.jsx b/src/shared/components/challenge-detail/Header/ChallengeTags.jsx index 2353351528..30e951887c 100644 --- a/src/shared/components/challenge-detail/Header/ChallengeTags.jsx +++ b/src/shared/components/challenge-detail/Header/ChallengeTags.jsx @@ -41,7 +41,6 @@ export default function ChallengeTags(props) { let EventTag; let TrackTag; switch (track) { - case 'datasci': case COMPETITION_TRACKS.DATA_SCIENCE: EventTag = DataScienceTrackEventTag; TrackTag = DataScienceTrackTag; @@ -52,7 +51,7 @@ export default function ChallengeTags(props) { break; case COMPETITION_TRACKS.DEVELOP: EventTag = DevelopmentTrackEventTag; - TrackTag = subTrack === 'DEVELOP_MARATHON_MATCH' ? DataScienceTrackTag : DevelopmentTrackTag; + TrackTag = DevelopmentTrackTag; break; case COMPETITION_TRACKS.QA: EventTag = QATrackEventTag; diff --git a/src/shared/utils/challenge.js b/src/shared/utils/challenge.js index c7aab75dae..ba546f39ab 100644 --- a/src/shared/utils/challenge.js +++ b/src/shared/utils/challenge.js @@ -8,15 +8,8 @@ import _ from 'lodash'; * @param {Object} challenge challenge object */ export function isMM(challenge) { - return challenge.type === 'Marathon Match'; -} - -/** - * check if is develop marathon match challenge - * @param {Object} challenge challenge object - */ -export function isDevelopMM(challenge) { - return challenge.type === 'Develop Marathon Match'; + const tags = _.get(challenge, 'challenge.tags') || []; + return tags.includes('Marathon Match'); } /** @@ -35,6 +28,5 @@ export function updateChallengeType(challenges, challengeTypeMap) { export default { isMM, - isDevelopMM, updateChallengeType, }; From 937dbaefb6ad162bae1507f2474554b92299b7ab Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Sun, 9 Aug 2020 23:59:08 -0300 Subject: [PATCH 2/8] Remove legacy.track/legacy.subTrack, added challenge.type/challenge.track --- .../SubmissionManagement/SubmissionsTable.jsx | 4 +- .../__snapshots__/SubmissionsTable.jsx.snap | 2 +- .../TrackIcon/__snapshots__/index.jsx.snap | 10 ++-- .../shared/components/TrackIcon/index.jsx | 11 +++- .../__snapshots__/index.jsx.snap | 39 ++++++++----- .../challenge-listing/ChallengeCard/index.jsx | 50 +++++++++------- .../challenge-listing/Listing/Bucket.jsx | 43 ++++++++++++-- .../Listing/__snapshots__/Bucket.jsx.snap | 58 ++++++++++++++++--- .../Tooltips/TrackAbbreviationTooltip.jsx | 14 +++-- .../TrackAbbreviationTooltip.jsx.snap | 18 ++++-- .../Contentful/ChallengesBlock/Card/index.jsx | 19 +++--- .../SubmissionManagement/Submission/index.jsx | 8 +-- .../SubmissionManagement/index.jsx | 7 +-- .../SubmissionsTable/index.jsx | 10 ++-- src/shared/components/TrackIcon/index.jsx | 16 ++--- .../challenge-detail/Header/ChallengeTags.jsx | 5 +- .../Header/TabSelector/index.jsx | 7 +-- .../challenge-detail/Header/index.jsx | 9 +-- .../MySubmissions/SubmissionsList/index.jsx | 3 - .../challenge-detail/MySubmissions/index.jsx | 3 - .../ChallengesCard/index.jsx | 16 ++--- .../RecommendedActiveChallenges/index.jsx | 2 +- .../challenge-detail/Registrants/index.jsx | 8 +-- .../challenge-detail/Specification/index.jsx | 27 +++++---- .../challenge-detail/Submissions/index.jsx | 16 ++--- .../ChallengeCard/NumRegistrants/index.jsx | 9 +-- .../ChallengeCard/NumSubmissions/index.jsx | 9 +-- .../challenge-listing/ChallengeCard/index.jsx | 16 ++--- .../Listing/Bucket/index.jsx | 8 +-- .../Listing/ReviewOpportunityBucket/index.jsx | 1 + .../ReviewOpportunityCard/index.jsx | 9 +-- .../challenge-listing/SRMCard/PastSRMCard.jsx | 10 ++-- .../challenge-listing/SRMCard/index.jsx | 15 ++--- .../challenge-listing/Listing/index.jsx | 2 +- src/shared/utils/challenge-detail/helper.jsx | 10 ++-- 35 files changed, 286 insertions(+), 208 deletions(-) diff --git a/__tests__/shared/components/SubmissionManagement/SubmissionsTable.jsx b/__tests__/shared/components/SubmissionManagement/SubmissionsTable.jsx index cb39cc0077..51a7ecdf36 100644 --- a/__tests__/shared/components/SubmissionManagement/SubmissionsTable.jsx +++ b/__tests__/shared/components/SubmissionManagement/SubmissionsTable.jsx @@ -10,7 +10,7 @@ test('Matches shallow shapshot', () => { submissionObjects={[{ id: '12345', }]} - type="DESIGN" + track="Design" /> )); expect(renderer.getRenderOutput()).toMatchSnapshot(); @@ -18,7 +18,7 @@ test('Matches shallow shapshot', () => { renderer.render(( )); expect(renderer.getRenderOutput()).toMatchSnapshot(); diff --git a/__tests__/shared/components/SubmissionManagement/__snapshots__/SubmissionsTable.jsx.snap b/__tests__/shared/components/SubmissionManagement/__snapshots__/SubmissionsTable.jsx.snap index 9da7ba94bf..144fc3df39 100644 --- a/__tests__/shared/components/SubmissionManagement/__snapshots__/SubmissionsTable.jsx.snap +++ b/__tests__/shared/components/SubmissionManagement/__snapshots__/SubmissionsTable.jsx.snap @@ -39,7 +39,7 @@ exports[`Matches shallow shapshot 1`] = ` "id": "12345", } } - type="DESIGN" + track="Design" />
CH
@@ -26,7 +26,7 @@ exports[`Matches shallow shapshot 2`] = ` className="src-shared-components-TrackIcon-___style__trackIcon___3gJ9l" >
CH
@@ -34,7 +34,7 @@ exports[`Matches shallow shapshot 2`] = ` href="https://www.topcoder-dev.com/tco" >
TCO
@@ -47,7 +47,7 @@ exports[`Matches shallow shapshot 3`] = ` className="src-shared-components-TrackIcon-___style__trackIcon___3gJ9l" >
CH
@@ -55,7 +55,7 @@ exports[`Matches shallow shapshot 3`] = ` href="https://www.topcoder-dev.com/tco" >
TCO
diff --git a/__tests__/shared/components/TrackIcon/index.jsx b/__tests__/shared/components/TrackIcon/index.jsx index 14dad327d6..368f5bafe4 100644 --- a/__tests__/shared/components/TrackIcon/index.jsx +++ b/__tests__/shared/components/TrackIcon/index.jsx @@ -5,18 +5,23 @@ import TrackIcon from 'components/TrackIcon'; test('Matches shallow shapshot', () => { const renderer = new Renderer(); + const type = { + name: 'Challenge', + abbreviation: 'CH', + }; + renderer.render(( - + )); expect(renderer.getRenderOutput()).toMatchSnapshot(); renderer.render(( - + )); expect(renderer.getRenderOutput()).toMatchSnapshot(); renderer.render(( - + )); expect(renderer.getRenderOutput()).toMatchSnapshot(); }); diff --git a/__tests__/shared/components/challenge-listing/ChallengeCard/__snapshots__/index.jsx.snap b/__tests__/shared/components/challenge-listing/ChallengeCard/__snapshots__/index.jsx.snap index 8973393552..b595db39c0 100644 --- a/__tests__/shared/components/challenge-listing/ChallengeCard/__snapshots__/index.jsx.snap +++ b/__tests__/shared/components/challenge-listing/ChallengeCard/__snapshots__/index.jsx.snap @@ -18,9 +18,6 @@ exports[`Matches shallow shapshot shapshot 1 1`] = ` "eventName": "Submit", }, ], - "legacy": Object { - "track": "DEVELOP", - }, "prize": Array [ 1200, 600, @@ -30,7 +27,6 @@ exports[`Matches shallow shapshot shapshot 1 1`] = ` 600, ], "status": "ACTIVE", - "subTrack": "CODE", "tags": Array [ "Data Science", ], @@ -38,10 +34,17 @@ exports[`Matches shallow shapshot shapshot 1 1`] = ` "Data Science", ], "totalPrize": 1800, + "track": "Data Science", + "type": "Challenge", "users": Object {}, } } - challengeTypes={Array []} + challengeType={ + Object { + "abbreviation": "CH", + "name": "Challenge", + } + } domRef={null} expandTag={null} expandedTags={Array []} @@ -67,14 +70,10 @@ exports[`Matches shallow shapshot shapshot 2 1`] = ` ], "events": Array [], "id": "1", - "legacy": Object { - "track": "DATA_SCIENCE", - }, "prizes": Array [ 1200, 600, ], - "subTrack": "CODE", "tags": Array [ "Go", ], @@ -82,10 +81,17 @@ exports[`Matches shallow shapshot shapshot 2 1`] = ` "Go", ], "totalPrize": 1800, + "track": "Data Science", + "type": "Challenge", "users": Object {}, } } - challengeTypes={Array []} + challengeType={ + Object { + "abbreviation": "CH", + "name": "Challenge", + } + } domRef={null} expandTag={null} expandedTags={Array []} @@ -111,21 +117,24 @@ exports[`Matches shallow shapshot shapshot 3 1`] = ` ], "events": Array [], "id": "long id", - "legacy": Object { - "track": "DATA_SCIENCE", - }, "prizes": Array [ 1200, 600, ], - "subTrack": "CODE", "tags": Array [], "technologies": Array [], "totalPrize": 1800, + "track": "Data Science", + "type": "Challenge", "users": Object {}, } } - challengeTypes={Array []} + challengeType={ + Object { + "abbreviation": "CH", + "name": "Challenge", + } + } domRef={null} expandTag={null} expandedTags={Array []} diff --git a/__tests__/shared/components/challenge-listing/ChallengeCard/index.jsx b/__tests__/shared/components/challenge-listing/ChallengeCard/index.jsx index 317e911923..53ebc52729 100644 --- a/__tests__/shared/components/challenge-listing/ChallengeCard/index.jsx +++ b/__tests__/shared/components/challenge-listing/ChallengeCard/index.jsx @@ -28,15 +28,17 @@ const mockData1 = { }], currentPhases: ['Registration'], prizes: [1200, 600], - legacy: { - track: 'DEVELOP', - }, + track: 'Data Science', + type: 'Challenge', totalPrize: 1800, - subTrack: 'CODE', events: [{ eventName: 'Submit' }], status: 'ACTIVE', users: {}, }, + challengeType: { + name: 'Challenge', + abbreviation: 'CH', + }, }; const mockData2 = { @@ -49,15 +51,17 @@ const mockData2 = { }], currentPhases: ['Registration'], prizes: [1200, 600], - legacy: { - track: 'DATA_SCIENCE', - }, - subTrack: 'CODE', + track: 'Data Science', + type: 'Challenge', id: '1', totalPrize: 1800, users: {}, events: [], }, + challengeType: { + name: 'Challenge', + abbreviation: 'CH', + }, }; const mockData3 = { @@ -70,15 +74,17 @@ const mockData3 = { }], currentPhases: ['Registration'], prizes: [1200, 600], - legacy: { - track: 'DATA_SCIENCE', - }, - subTrack: 'CODE', + track: 'Data Science', + type: 'Challenge', id: 'long id', totalPrize: 1800, users: {}, events: [], }, + challengeType: { + name: 'Challenge', + abbreviation: 'CH', + }, }; const mockData4 = { @@ -91,15 +97,17 @@ const mockData4 = { }], currentPhases: ['Registration'], prizes: [1200, 600], - legacy: { - track: 'DATA_SCIENCE', - }, - subTrack: 'CODE', + track: 'Data Science', + type: 'Challenge', id: 'long id', totalPrize: 1800, users: {}, events: [], }, + challengeType: { + name: 'Challenge', + abbreviation: 'CH', + }, }; const mockData5 = { @@ -112,15 +120,17 @@ const mockData5 = { }], currentPhases: ['Registration'], prizes: [1200, 600], - legacy: { - track: 'DATA_SCIENCE', - }, - subTrack: 'CODE', + track: 'Data Science', + type: 'Challenge', id: 'long id', totalPrize: 1800, users: {}, events: [], }, + challengeType: { + name: 'Challenge', + abbreviation: 'CH', + }, }; describe('Matches shallow shapshot', () => { diff --git a/__tests__/shared/components/challenge-listing/Listing/Bucket.jsx b/__tests__/shared/components/challenge-listing/Listing/Bucket.jsx index 1b28e33d08..13253f1035 100644 --- a/__tests__/shared/components/challenge-listing/Listing/Bucket.jsx +++ b/__tests__/shared/components/challenge-listing/Listing/Bucket.jsx @@ -32,6 +32,7 @@ const mockDatas = [{ prizes: [1200, 600], totalPrize: 1800, users: {}, + type: 'Challenge', }, { id: '2', @@ -43,15 +44,25 @@ const mockDatas = [{ phaseStatus: 'Open', }], currentPhases: ['Registration'], - legacy: { - track: 'DEVELOP', - }, - subTrack: 'CODE', + track: 'Development', + type: 'Challenge', events: [{ eventName: 'Submit' }], prizes: [1200, 600], totalPrize: 1800, users: {}, }], + challengeTypes: [ + { + name: 'Challenge', + abbreviation: 'CH', + }, { + name: 'First2Finish', + abbreviation: 'F2F', + }, { + name: 'Task', + abbreviation: 'TSK', + }, + ], loading: false, loadMore, setFilterState, @@ -145,6 +156,18 @@ const mockDatas = [{ users: {}, }, ], + challengeTypes: [ + { + name: 'Challenge', + abbreviation: 'CH', + }, { + name: 'First2Finish', + abbreviation: 'F2F', + }, { + name: 'Task', + abbreviation: 'TSK', + }, + ], loading: true, loadMore, setFilterState, @@ -161,6 +184,18 @@ const mockDatas = [{ expand, challenges: [ ], + challengeTypes: [ + { + name: 'Challenge', + abbreviation: 'CH', + }, { + name: 'First2Finish', + abbreviation: 'F2F', + }, { + name: 'Task', + abbreviation: 'TSK', + }, + ], loading: true, setFilterState, setSort, diff --git a/__tests__/shared/components/challenge-listing/Listing/__snapshots__/Bucket.jsx.snap b/__tests__/shared/components/challenge-listing/Listing/__snapshots__/Bucket.jsx.snap index 683b99a40a..9df5d16dcf 100644 --- a/__tests__/shared/components/challenge-listing/Listing/__snapshots__/Bucket.jsx.snap +++ b/__tests__/shared/components/challenge-listing/Listing/__snapshots__/Bucket.jsx.snap @@ -18,7 +18,22 @@ exports[`Matches shallow shapshot 1`] = ` ], } } - challengeTypes={Array []} + challengeTypes={ + Array [ + Object { + "abbreviation": "CH", + "name": "Challenge", + }, + Object { + "abbreviation": "F2F", + "name": "First2Finish", + }, + Object { + "abbreviation": "TSK", + "name": "Task", + }, + ] + } challenges={ Array [ Object { @@ -29,6 +44,7 @@ exports[`Matches shallow shapshot 1`] = ` ], "status": "b", "totalPrize": 1800, + "type": "Challenge", "users": Object {}, }, Object { @@ -47,9 +63,6 @@ exports[`Matches shallow shapshot 1`] = ` }, ], "id": "2", - "legacy": Object { - "track": "DEVELOP", - }, "prize": Array [ 1200, 600, @@ -59,7 +72,6 @@ exports[`Matches shallow shapshot 1`] = ` 600, ], "status": "a", - "subTrack": "CODE", "tags": Array [ "a", "b", @@ -71,6 +83,8 @@ exports[`Matches shallow shapshot 1`] = ` "c", ], "totalPrize": 1800, + "track": "Development", + "type": "Challenge", "users": Object {}, }, ] @@ -111,7 +125,22 @@ exports[`Matches shallow shapshot 2`] = ` ], } } - challengeTypes={Array []} + challengeTypes={ + Array [ + Object { + "abbreviation": "CH", + "name": "Challenge", + }, + Object { + "abbreviation": "F2F", + "name": "First2Finish", + }, + Object { + "abbreviation": "TSK", + "name": "Task", + }, + ] + } challenges={ Array [ Object { @@ -262,7 +291,22 @@ exports[`Matches shallow shapshot 3`] = ` ], } } - challengeTypes={Array []} + challengeTypes={ + Array [ + Object { + "abbreviation": "CH", + "name": "Challenge", + }, + Object { + "abbreviation": "F2F", + "name": "First2Finish", + }, + Object { + "abbreviation": "TSK", + "name": "Task", + }, + ] + } challenges={Array []} expand={[MockFunction]} expandTag={null} diff --git a/__tests__/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip.jsx b/__tests__/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip.jsx index ed5094f7ed..2520064152 100644 --- a/__tests__/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip.jsx +++ b/__tests__/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip.jsx @@ -6,15 +6,17 @@ import TrackAbbreviationTooltip from 'components/challenge-listing/Tooltips/Trac const mockDatas = [ { - legacy: { - track: 'DEVELOP', + track: 'Development', + type: { + name: 'First2Finish', + abbreviation: 'F2F', }, - subTrack: 'CODE', }, { - legacy: { - track: 'DEVELOP', + track: 'Design', + type: { + name: 'Challenge', + abbreviation: 'CH', }, - subTrack: 'CODE', }, ]; diff --git a/__tests__/shared/components/challenge-listing/Tooltips/__snapshots__/TrackAbbreviationTooltip.jsx.snap b/__tests__/shared/components/challenge-listing/Tooltips/__snapshots__/TrackAbbreviationTooltip.jsx.snap index dea04181d5..101f88cee8 100644 --- a/__tests__/shared/components/challenge-listing/Tooltips/__snapshots__/TrackAbbreviationTooltip.jsx.snap +++ b/__tests__/shared/components/challenge-listing/Tooltips/__snapshots__/TrackAbbreviationTooltip.jsx.snap @@ -6,8 +6,13 @@ exports[`Matches shallow shapshot 1`] = ` className="track-abbreviation-tooltip" content={ } defaultVisible={false} @@ -36,8 +41,13 @@ exports[`Matches shallow shapshot 2`] = ` className="track-abbreviation-tooltip" content={ } defaultVisible={false} diff --git a/src/shared/components/Contentful/ChallengesBlock/Card/index.jsx b/src/shared/components/Contentful/ChallengesBlock/Card/index.jsx index f870ee2398..3c51580da6 100644 --- a/src/shared/components/Contentful/ChallengesBlock/Card/index.jsx +++ b/src/shared/components/Contentful/ChallengesBlock/Card/index.jsx @@ -23,15 +23,13 @@ export default function Card({ challenge, }) { const { - subTrack, - legacy, + type, + typeId, + track, } = challenge; - const { track } = legacy; - let TrackTag; switch (track.toLowerCase()) { - case 'datasci': case COMPETITION_TRACKS.DATA_SCIENCE: TrackTag = DataScienceTrackTag; break; @@ -62,9 +60,9 @@ export default function Card({
- {_.capitalize(subTrack).replace(/_/g, ' ')} + {_.capitalize(type).replace(/_/g, ' ')}

{ - type === 'DESIGN' && ( + track === 'Design' && ( {submissionObject.screening && ( @@ -66,7 +66,7 @@ export default function Submission(props) {
p.name !== 'Registration' && p.isOpen) .sort((a, b) => moment(a.scheduledEndDate).diff(b.scheduledEndDate))[0]; @@ -152,7 +151,7 @@ export default function SubmissionManagement(props) { Submission Date - {type === 'DESIGN' && ( + {track === 'Design' && ( Screening Status @@ -126,7 +126,7 @@ const SubShape = PT.shape({ status: PT.string, }), submitted: PT.string, - type: PT.string, + track: PT.string, }); SubmissionsTable.defaultProps = { @@ -141,7 +141,7 @@ SubmissionsTable.defaultProps = { SubmissionsTable.propTypes = { submissionObjects: PT.arrayOf(SubShape), showDetails: PT.shape().isRequired, - type: PT.string.isRequired, + track: PT.string.isRequired, onDelete: PT.func, onlineReviewUrl: PT.string, helpPageUrl: PT.string, diff --git a/src/shared/components/TrackIcon/index.jsx b/src/shared/components/TrackIcon/index.jsx index ee5917463c..411c71bf60 100644 --- a/src/shared/components/TrackIcon/index.jsx +++ b/src/shared/components/TrackIcon/index.jsx @@ -7,7 +7,6 @@ import './style.scss'; export default function TrackIcon({ track, - subTrack, type, tcoEligible, MAIN_URL, @@ -19,17 +18,17 @@ export default function TrackIcon({ {challengesUrl ? ( - {type} + {type.abbreviation} ) : (
- {type} + {type.abbreviation}
)} @@ -45,16 +44,13 @@ TrackIcon.defaultProps = { MAIN_URL: config.URL.BASE, tcoEligible: '', challengesUrl: '', - track: 'DEVELOP', - subTrack: 'DEVELOPMENT', - type: 'CH', + track: 'Development', }; TrackIcon.propTypes = { tcoEligible: PT.string, track: PT.string, - subTrack: PT.string, - type: PT.string, + type: PT.shape().isRequired, MAIN_URL: PT.string, challengesUrl: PT.string, }; diff --git a/src/shared/components/challenge-detail/Header/ChallengeTags.jsx b/src/shared/components/challenge-detail/Header/ChallengeTags.jsx index 30e951887c..9f428ada7e 100644 --- a/src/shared/components/challenge-detail/Header/ChallengeTags.jsx +++ b/src/shared/components/challenge-detail/Header/ChallengeTags.jsx @@ -27,7 +27,6 @@ import { COMPETITION_TRACKS } from 'utils/tc'; export default function ChallengeTags(props) { const { challengesUrl, - subTrack, track, type, events, @@ -64,7 +63,7 @@ export default function ChallengeTags(props) { return (
{ - subTrack + type && ( setImmediate(() => setChallengeListingFilter({ types: [typeId] })) @@ -106,14 +105,12 @@ export default function ChallengeTags(props) { } ChallengeTags.defaultProps = { - subTrack: undefined, events: [], technPlatforms: [], }; ChallengeTags.propTypes = { challengesUrl: PT.string.isRequired, - subTrack: PT.string, track: PT.string.isRequired, type: PT.string.isRequired, events: PT.arrayOf(PT.string), diff --git a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx index ecbd593b38..d3a25644b5 100644 --- a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx +++ b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx @@ -35,8 +35,9 @@ export default function ChallengeViewSelector(props) { const forumId = _.get(challenge, 'legacy.forumId') || 0; const roles = _.get(challenge, 'userDetails.roles') || []; + const isDesign = trackLower === 'design'; - const forumEndpoint = trackLower === 'design' + const forumEndpoint = isDesign ? `/?module=ThreadList&forumID=${forumId}` : `/?module=Category&categoryID=${forumId}`; @@ -106,7 +107,7 @@ export default function ChallengeViewSelector(props) { ) : null } { - trackLower === 'design' && checkpointCount > 0 + isDesign && checkpointCount > 0 && ( p.name === 'Iterative Review' && !p.isOpen); const endPhaseDate = Math.max(...phases2.map(d => new Date(d.scheduledEndDate))); relevantPhases = _.filter(relevantPhases, p => (p.name.toLowerCase().includes('registration') @@ -253,7 +251,6 @@ export default function ChallengeHeader(props) {

0 ? challenge.events[0].key : ''} isDataScience={challenge.isDataScience} challengesUrl={challengesUrl} @@ -123,6 +118,7 @@ ChallengesCard.defaultProps = { ChallengesCard.propTypes = { challenge: PT.shape().isRequired, + challengeType: PT.shape().isRequired, className: PT.string, challengesUrl: PT.string.isRequired, selectChallengeDetailsTab: PT.func.isRequired, diff --git a/src/shared/components/challenge-detail/RecommendedActiveChallenges/index.jsx b/src/shared/components/challenge-detail/RecommendedActiveChallenges/index.jsx index 3b7ab75ea6..6113f62ec4 100644 --- a/src/shared/components/challenge-detail/RecommendedActiveChallenges/index.jsx +++ b/src/shared/components/challenge-detail/RecommendedActiveChallenges/index.jsx @@ -25,7 +25,7 @@ export default function RecommendedActiveChallenges({ prizeMode={prizeMode} userHandle={_.get(auth, 'user.handle')} challenge={c} - challengeTypes={challengeTypes} + challengeType={_.find(challengeTypes, { name: c.type })} expandedTags={expandedTags} expandTag={expandTag} isLoggedIn={isLoggedIn} diff --git a/src/shared/components/challenge-detail/Registrants/index.jsx b/src/shared/components/challenge-detail/Registrants/index.jsx index 82e67f6cf4..5722c029a8 100644 --- a/src/shared/components/challenge-detail/Registrants/index.jsx +++ b/src/shared/components/challenge-detail/Registrants/index.jsx @@ -241,11 +241,9 @@ export default class Registrants extends React.Component { } = this.props; const { prizeSets, - legacy, + track, } = challenge; - const { track } = legacy; - const { sortedRegistrants } = this.state; const { field, sort } = this.getRegistrantsSortParam(); const revertSort = (sort === 'desc') ? 'asc' : 'desc'; @@ -487,15 +485,13 @@ Registrants.propTypes = { scheduledEndDate: PT.string, })).isRequired, checkpoints: PT.arrayOf(PT.shape()), - legacy: PT.shape({ - track: PT.any, - }), subTrack: PT.any, prizeSets: PT.arrayOf(PT.shape()).isRequired, registrants: PT.arrayOf(PT.shape()).isRequired, round1Introduction: PT.string, round2Introduction: PT.string, type: PT.string, + track: PT.string, }).isRequired, results: PT.arrayOf(PT.shape()), checkpointResults: PT.shape(), diff --git a/src/shared/components/challenge-detail/Specification/index.jsx b/src/shared/components/challenge-detail/Specification/index.jsx index a3f4fca66c..cbe1c9c619 100644 --- a/src/shared/components/challenge-detail/Specification/index.jsx +++ b/src/shared/components/challenge-detail/Specification/index.jsx @@ -49,12 +49,11 @@ export default function ChallengeDetailsView(props) { userDetails, metadata, events, + track, } = challenge; - const tags = challenge.tags || []; const roles = (userDetails || {}).roles || []; const { - track, reviewScorecardId, screeningScorecardId, forumId, @@ -84,10 +83,19 @@ export default function ChallengeDetailsView(props) { isWipro = wiproCommunity.groupIds.some(id => groups[id]); } - const isDataScience = tags.includes('Data Science'); - let accentedStyle = 'challenge-specs-design'; - if (track.toLowerCase() === 'develop') { - accentedStyle = isDataScience ? 'challenge-specs-datasci' : 'challenge-specs-develop'; + let accentedStyle = ''; + switch (track.toLowerCase()) { + case 'design': + accentedStyle = 'challenge-specs-design'; + break; + + case 'data science': + accentedStyle = 'challenge-specs-datasci'; + break; + + default: + accentedStyle = 'challenge-specs-develop'; + break; } const canEdit = roles.some(x => x === 'Copilot' || x === 'Manager'); @@ -371,7 +379,7 @@ export default function ChallengeDetailsView(props) { documents={documents} hasRegistered={hasRegistered} isDesign={track.toLowerCase() === 'design'} - isDevelop={track.toLowerCase() === 'develop'} + isDevelop={track.toLowerCase() === 'development'} eventDetail={_.isEmpty(events) ? null : events[0]} isMM={isMM(challenge)} terms={terms} @@ -394,7 +402,6 @@ ChallengeDetailsView.defaultProps = { privateDescription: undefined, track: 'design', reviewType: undefined, - tags: [], numberOfCheckpointsPrizes: 0, finalSubmissionGuidelines: '', environment: '', @@ -415,18 +422,16 @@ ChallengeDetailsView.propTypes = { descriptionFormat: PT.string, documents: PT.any, id: PT.any, - subTrack: PT.any, privateDescription: PT.string, legacy: PT.shape({ - track: PT.string.isRequired, reviewScorecardId: PT.string, screeningScorecardId: PT.string, forumId: PT.number, }), + track: PT.string.isRequired, legacyId: PT.string, groups: PT.any, reviewType: PT.string, - tags: PT.arrayOf(PT.string), numberOfCheckpointsPrizes: PT.number, finalSubmissionGuidelines: PT.string, environment: PT.string, diff --git a/src/shared/components/challenge-detail/Submissions/index.jsx b/src/shared/components/challenge-detail/Submissions/index.jsx index 27221b068d..4f54b38aff 100644 --- a/src/shared/components/challenge-detail/Submissions/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/index.jsx @@ -276,10 +276,11 @@ class SubmissionsComponent extends React.Component { const { checkpoints, id: challengeId, - legacy, + track, + type, + tags, } = challenge; - const { track } = legacy; const isMM = checkIsMM(challenge); const isReviewPhaseComplete = this.checkIsReviewPhaseComplete(); @@ -329,8 +330,8 @@ class SubmissionsComponent extends React.Component {
); - const isF2F = track.indexOf('FIRST_2_FINISH') > -1; - const isBugHunt = track.indexOf('BUG_HUNT') > -1; + const isF2F = type === 'First2Finish'; + const isBugHunt = _.includes(tags, 'Bug Hunt'); // copy colorStyle from registrants to submissions _.forEach(sortedSubmissions, (s) => { @@ -788,12 +789,11 @@ SubmissionsComponent.propTypes = { checkpoints: PT.arrayOf(PT.object), submissions: PT.arrayOf(PT.object), submissionViewable: PT.string, - legacy: PT.shape({ - track: PT.string.isRequired, - }), + track: PT.string.isRequired, + type: PT.string.isRequired, + tags: PT.arrayOf(PT.string), registrants: PT.any, phases: PT.any, - subTrack: PT.any, }).isRequired, toggleSubmissionHistory: PT.func.isRequired, submissionHistoryOpen: PT.shape({}).isRequired, diff --git a/src/shared/components/challenge-listing/ChallengeCard/NumRegistrants/index.jsx b/src/shared/components/challenge-listing/ChallengeCard/NumRegistrants/index.jsx index 423d834a0c..4cd58eee4b 100644 --- a/src/shared/components/challenge-listing/ChallengeCard/NumRegistrants/index.jsx +++ b/src/shared/components/challenge-listing/ChallengeCard/NumRegistrants/index.jsx @@ -17,7 +17,7 @@ import './style.scss'; export default function NumRegistrants({ challenge: { - id, numOfRegistrants, legacy, + id, numOfRegistrants, track, }, challengesUrl, newChallengeDetails, @@ -31,10 +31,9 @@ export default function NumRegistrants({ case 1: tip = '1 total registrant'; break; default: tip = `${numOfReg} total registrants`; } - const { track } = legacy; const query = numOfReg ? `?tab=${DETAIL_TABS.REGISTRANTS}` : ''; let link = `${challengesUrl}/${id}${query}`; - if (!newChallengeDetails && track !== 'DATA_SCIENCE') { + if (!newChallengeDetails && track !== 'Data Science') { link = `${config.URL.BASE}/challenge-details/${id}/?type=develop#viewRegistrant`; } return ( @@ -75,9 +74,7 @@ NumRegistrants.propTypes = { challenge: PT.shape({ id: PT.oneOfType([PT.number, PT.string]).isRequired, numOfRegistrants: PT.number, - legacy: PT.shape({ - track: PT.string.isRequired, - }), + track: PT.string.isRequired, }).isRequired, challengesUrl: PT.string.isRequired, newChallengeDetails: PT.bool.isRequired, diff --git a/src/shared/components/challenge-listing/ChallengeCard/NumSubmissions/index.jsx b/src/shared/components/challenge-listing/ChallengeCard/NumSubmissions/index.jsx index d969a985b9..9ec4d28c62 100644 --- a/src/shared/components/challenge-listing/ChallengeCard/NumSubmissions/index.jsx +++ b/src/shared/components/challenge-listing/ChallengeCard/NumSubmissions/index.jsx @@ -20,7 +20,7 @@ export default function NumSubmissions({ id, numOfSubmissions, numOfCheckpointSubmissions, - legacy, + track, }, challengesUrl, newChallengeDetails, @@ -37,9 +37,8 @@ export default function NumSubmissions({ } const query = (numOfSub && isLoggedIn) ? `?tab=${DETAIL_TABS.SUBMISSIONS}` : ''; - const { track } = legacy; let link = `${challengesUrl}/${id}${query}`; - if (!newChallengeDetails && track !== 'DATA_SCIENCE') { + if (!newChallengeDetails && track !== 'Data Science') { link = `${config.URL.BASE}/challenge-details/${id}/?type=develop#viewRegistrant`; } return ( @@ -79,9 +78,7 @@ NumSubmissions.propTypes = { numOfSubmissions: PT.number, numOfCheckpointSubmissions: PT.number, status: PT.string.isRequired, - legacy: PT.shape({ - track: PT.string.isRequired, - }), + track: PT.string.isRequired, }).isRequired, challengesUrl: PT.string.isRequired, newChallengeDetails: PT.bool.isRequired, diff --git a/src/shared/components/challenge-listing/ChallengeCard/index.jsx b/src/shared/components/challenge-listing/ChallengeCard/index.jsx index 8bffeef763..ab1dec84e4 100644 --- a/src/shared/components/challenge-listing/ChallengeCard/index.jsx +++ b/src/shared/components/challenge-listing/ChallengeCard/index.jsx @@ -7,7 +7,6 @@ import { Link } from 'topcoder-react-utils'; import { getEndDate, getPrizePointsUI, - getChallengeTypeAbbr, } from 'utils/challenge-detail/helper'; import Tags from '../Tags'; @@ -23,7 +22,7 @@ import './style.scss'; function ChallengeCard({ challenge: passedInChallenge, - challengeTypes, + challengeType, challengesUrl, expandedTags, expandTag, @@ -39,17 +38,12 @@ function ChallengeCard({ const challenge = passedInChallenge; const { id, - legacy, track, - type, } = challenge; - const { subTrack } = legacy; - challenge.prize = challenge.prizes || []; const challengeDetailLink = `${challengesUrl}/${id}`; - const typeAbbr = getChallengeTypeAbbr(type, challengeTypes); const registrationPhase = (challenge.phases || []).filter(phase => phase.name === 'Registration')[0]; const isRegistrationOpen = registrationPhase ? registrationPhase.isOpen : false; @@ -60,13 +54,12 @@ function ChallengeCard({
0 ? challenge.events[0].key : ''} /> @@ -121,7 +114,6 @@ function ChallengeCard({ ChallengeCard.defaultProps = { challenge: {}, - challengeTypes: [], newChallengeDetails: false, onTechTagClicked: _.noop, openChallengesInNewTabs: false, @@ -134,7 +126,7 @@ ChallengeCard.defaultProps = { ChallengeCard.propTypes = { challenge: PT.shape(), - challengeTypes: PT.arrayOf(PT.shape()), + challengeType: PT.shape().isRequired, challengesUrl: PT.string.isRequired, newChallengeDetails: PT.bool, onTechTagClicked: PT.func, diff --git a/src/shared/components/challenge-listing/Listing/Bucket/index.jsx b/src/shared/components/challenge-listing/Listing/Bucket/index.jsx index 2084f17f11..d58a3c0681 100644 --- a/src/shared/components/challenge-listing/Listing/Bucket/index.jsx +++ b/src/shared/components/challenge-listing/Listing/Bucket/index.jsx @@ -99,16 +99,16 @@ export default function Bucket({ ); } - const cards = filteredChallenges.map(item => ( + const cards = filteredChallenges.map(challenge => ( setFilterState({ tags: [tag] })} openChallengesInNewTabs={openChallengesInNewTabs} prizeMode={prizeMode} - key={item.id} + key={challenge.id} selectChallengeDetailsTab={selectChallengeDetailsTab} userId={userId} expandedTags={expandedTags} diff --git a/src/shared/components/challenge-listing/Listing/ReviewOpportunityBucket/index.jsx b/src/shared/components/challenge-listing/Listing/ReviewOpportunityBucket/index.jsx index d0515ad32b..40e2dcef1a 100644 --- a/src/shared/components/challenge-listing/Listing/ReviewOpportunityBucket/index.jsx +++ b/src/shared/components/challenge-listing/Listing/ReviewOpportunityBucket/index.jsx @@ -54,6 +54,7 @@ export default function ReviewOpportunityBucket({ const cards = filteredOpportunities.map(item => ( setFilterState({ tags: [tag] })} diff --git a/src/shared/components/challenge-listing/ReviewOpportunityCard/index.jsx b/src/shared/components/challenge-listing/ReviewOpportunityCard/index.jsx index 25df3548a3..7d213380e7 100644 --- a/src/shared/components/challenge-listing/ReviewOpportunityCard/index.jsx +++ b/src/shared/components/challenge-listing/ReviewOpportunityCard/index.jsx @@ -45,12 +45,12 @@ function ReviewOpportunityCard({ expandTag, onTechTagClicked, opportunity, + challengeType, }) { const { challenge } = opportunity; - const { subTrack, legacy } = challenge; let tags = challenge.tags || challenge.technologies; tags = tags.filter(tag => tag.trim().length); - const track = legacy ? legacy.track : challenge.track; + const { track } = challenge.track; const start = moment(opportunity.startDate); return (
@@ -58,12 +58,12 @@ function ReviewOpportunityCard({
@@ -177,6 +177,7 @@ ReviewOpportunityCard.propTypes = { challengesUrl: PT.string.isRequired, onTechTagClicked: PT.func, opportunity: PT.shape().isRequired, + challengeType: PT.shape().isRequired, }; export default ReviewOpportunityCard; diff --git a/src/shared/components/challenge-listing/SRMCard/PastSRMCard.jsx b/src/shared/components/challenge-listing/SRMCard/PastSRMCard.jsx index afd13a371a..10625503cc 100644 --- a/src/shared/components/challenge-listing/SRMCard/PastSRMCard.jsx +++ b/src/shared/components/challenge-listing/SRMCard/PastSRMCard.jsx @@ -29,8 +29,10 @@ function numSubmissionsTipText(number) { /* * Past SRMCard */ -const legacy = { - track: 'DATA_SCIENCE', +const track = 'Data Science'; +const type = { + name: 'Single Round Match', + abbreviation: 'SRM', }; const PastSRMCard = () => ( @@ -38,8 +40,8 @@ const PastSRMCard = () => (
- - + +
diff --git a/src/shared/components/challenge-listing/SRMCard/index.jsx b/src/shared/components/challenge-listing/SRMCard/index.jsx index a50517be22..1485e6a026 100644 --- a/src/shared/components/challenge-listing/SRMCard/index.jsx +++ b/src/shared/components/challenge-listing/SRMCard/index.jsx @@ -58,17 +58,18 @@ const renderLeaderboard = MOCK_REGISTRANTS.map((winner, index) => (
)); -// Happening now -const legacy = { - track: 'DATA_SCIENCE', +const track = 'Data Science'; +const type = { + name: 'Single Round Match', + abbreviation: 'SRM', }; const HappeningNow = () => (
- - + +
@@ -103,8 +104,8 @@ const UpcomingSRMs = ({ srmChallenge }) => (
- - + +
diff --git a/src/shared/containers/challenge-listing/Listing/index.jsx b/src/shared/containers/challenge-listing/Listing/index.jsx index 9ef1e90437..8b27e52269 100644 --- a/src/shared/containers/challenge-listing/Listing/index.jsx +++ b/src/shared/containers/challenge-listing/Listing/index.jsx @@ -158,7 +158,7 @@ export class ListingContainer extends React.Component { auth.tokenV3, f.front, ); - if (auth) { + if (auth.tokenV3) { const userId = _.get(auth.user, 'userId'); getUserChallenges(userId, auth.tokenV3); } diff --git a/src/shared/utils/challenge-detail/helper.jsx b/src/shared/utils/challenge-detail/helper.jsx index d81ac31fc7..2a6fb4b8be 100644 --- a/src/shared/utils/challenge-detail/helper.jsx +++ b/src/shared/utils/challenge-detail/helper.jsx @@ -25,9 +25,9 @@ export const PRIZE_MODE = { * @param {Object} challenge challenge info */ export function getChallengeTypeAbbr(track, challengeTypes) { - const subTrack = _.find(challengeTypes, { name: track }); - if (subTrack) { - return subTrack.abbreviation; + const type = _.find(challengeTypes, { name: track }); + if (type) { + return type.abbreviation; } return null; } @@ -37,9 +37,9 @@ export function getChallengeTypeAbbr(track, challengeTypes) { * @param {Object} challenge challenge info */ export function getEndDate(challenge) { - const { subTrack } = challenge.legacy; + const { type } = challenge; let phases = challenge.phases || []; - if (subTrack === 'FIRST_2_FINISH' && challenge.status === 'COMPLETED') { + if (type === 'First2Finish' && challenge.status === 'Completed') { phases = challenge.phases.filter(p => p.phaseType === 'Iterative Review' && p.phaseStatus === 'Closed'); } const endPhaseDate = Math.max(...phases.map(d => new Date(d.scheduledEndDate))); From 60116924d3fad4dc223044039b00a517e42a501b Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Sun, 9 Aug 2020 23:59:36 -0300 Subject: [PATCH 3/8] Removed unnecessary code --- .../__snapshots__/index.jsx.snap | 98 ------------------- .../components/challenge-listing/index.jsx | 35 +------ 2 files changed, 1 insertion(+), 132 deletions(-) diff --git a/__tests__/shared/components/challenge-listing/__snapshots__/index.jsx.snap b/__tests__/shared/components/challenge-listing/__snapshots__/index.jsx.snap index 51535b93b8..f590d36b19 100644 --- a/__tests__/shared/components/challenge-listing/__snapshots__/index.jsx.snap +++ b/__tests__/shared/components/challenge-listing/__snapshots__/index.jsx.snap @@ -12,55 +12,6 @@ exports[`Matches shallow shapshot 1 shapshot 1 1`] = ` isCardTypeSet="Challenges" setCardType={[Function]} /> -
-
-
-
- -
-
-
- Upcoming SRMs -
-
-
-
- Past SRMs -
- -
-
-
- -
-
@@ -129,55 +80,6 @@ exports[`Matches shallow shapshot 2 shapshot 2 1`] = ` isCardTypeSet="Challenges" setCardType={[Function]} /> -
-
-
-
- -
-
-
- Upcoming SRMs -
-
-
-
- Past SRMs -
- -
-
-
- -
-
diff --git a/src/shared/components/challenge-listing/index.jsx b/src/shared/components/challenge-listing/index.jsx index 3594ab91be..4c381ab420 100644 --- a/src/shared/components/challenge-listing/index.jsx +++ b/src/shared/components/challenge-listing/index.jsx @@ -15,7 +15,6 @@ import { config } from 'topcoder-react-utils'; import Listing from './Listing'; import ChallengeCardPlaceholder from './placeholders/ChallengeCard'; -import SRMCard from './SRMCard'; import './style.scss'; @@ -133,40 +132,8 @@ export default function ChallengeListing(props) { isCardTypeSet="Challenges" isAuth={Boolean(auth.user)} /> -
-
- {/* */} -
- -
- {/* happening now */} -
- -
- {/* upcoming SRMs */} -
-
- Upcoming SRMs -
- { /* UpcomingSrm */ } -
- {/* past SRMs */} -
-
- Past SRMs -
- -
-
- -
- - {/* */} - -
-
-
+
From dd5cf88986ceed9111ab8e8253e6cdbf5cc6832e Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Sun, 9 Aug 2020 23:59:56 -0300 Subject: [PATCH 4/8] Updated challenge card tooltip --- .../TrackAbbreviationTooltip/index.jsx | 97 ++----------------- 1 file changed, 9 insertions(+), 88 deletions(-) diff --git a/src/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip/index.jsx b/src/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip/index.jsx index aab76ff2e6..51d2ed9f9a 100644 --- a/src/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip/index.jsx +++ b/src/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip/index.jsx @@ -11,111 +11,33 @@ import PT from 'prop-types'; import Tooltip from 'components/Tooltip'; import './style.scss'; -const DESCRIPTION = { - // TODO: [Review Opps] This is temporary - REVIEW_OPPORTUNITY: 'As a topcoder member, you can participate in review boards that review work submitted into challenges by other members.', - APPLICATION_FRONT_END_DESIGN: 'Design UI and front end experiences for apps', - ARCHITECTURE: 'Architect modules, components, or full applications', - ASSEMBLY_COMPETITION: 'Develop code for a variety of use cases. Rigorous review and final fix process is included.', - BANNERS_OR_ICONS: 'Design UI assets for use in web, mobile, print, and other digital formats', - BUG_HUNT: 'Quickly find Bugs in apps, websites', - CODE: 'Develop code for apps, services, etc. Final fixes are not included', - DEVELOPMENT: 'Develop code for apps, services, etc. Final fixes are not included', - TEST_SCENARIOS: 'Provide simple, easy information about what to test', - CONTENT_CREATION: 'Generate topic ideas as a blog, video, infographic, or other format', - IDEA_GENERATION: 'Generate feasible concepts for products, apps, features, etc', - SPECIFICATION: 'Document requirements to be satisfied for design, product, or service', - TASK: 'An assigned piece of work', - AUTOMATED_TESTING: 'Challenges were submissions are auto-scored against a set of automated test cases', - 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.', - SPEC_REVIEW: 'Review of technical writing of requirements for the scope of work', - MARATHON: 'Programming competition', - DESIGN: 'Prepare the visual sketch or the plans for a website, feature, app, etc', - TEST_SUITES: 'Develop test cases to be used to validate apps, website, etc.', - CONCEPTUALIZATION: 'Discover and define user stories and requirements', - DESIGN_FIRST2FINISH: 'Be the first to deliver the design solution', - DESIGN_FIRST_2_FINISH: 'Be the first to deliver the design solution', - FIRST_2_FINISH: 'Be the first to deliver the development solution', - FIRST2FINISH: 'Be the first to deliver the development solution', - LOGO_DESIGN: 'Logo Design', - MARATHON_MATCH: 'Write algorithms to solve complex problems, often for real world issues', - DEVELOP_MARATHON_MATCH: 'Write algorithms to solve complex problems, often for real world issues', - PRINT_OR_PRESENTATION: 'Design print and presentation assets', - SRM: 'Single Round Match - quickly write code to solve algorythm problems head to head against other competitors', - STUDIO_OTHER: 'Studio other', - UI_PROTOTYPE_COMPETITION: 'Develop the front end of a UX', - WEB_DESIGN: 'Design UI and front end experiences for web experiences', - WEB_DESIGNS: 'Design UI and front end experiences for web experiences', - WIDGET_OR_MOBILE_SCREEN_DESIGN: 'Design UI and front end experiences for mobile', - WIREFRAMES: 'Produce the information architecture for user experiences', -}; - -const HEADER = { - REVIEW_OPPORTUNITY: 'Review Opportunity', // TODO: [Review Opps] this is temporary - APPLICATION_FRONT_END_DESIGN: 'Application Front-End Design (AFED)', - ARCHITECTURE: 'Architecture (Ar)', - ASSEMBLY_COMPETITION: 'Assembly (As)', - BANNERS_OR_ICONS: 'Banners/Icons (BI)', - BUG_HUNT: 'Bug Hunt (BH)', - CODE: 'Code (Cd)', - DEVELOPMENT: 'Development (Dv)', - TEST_SUITES: 'Test Suites (TS)', - TEST_SCENARIOS: 'Test Scenarios (Ts)', - CONTENT_CREATION: 'Content Creation (CC)', - IDEA_GENERATION: 'Idea Generation (IG)', - SPECIFICATION: 'Specification (Sp)', - TASK: 'Task (Tk)', - AUTOMATED_TESTING: 'Automated Testing (AT)', - COPILOT_POSTING: 'Copilot Posting (CP)', - SPEC_REVIEW: 'Specification Review (SR)', - MARATHON: 'Marathon (MM)', - DESIGN: 'Design (Ds)', - CONCEPTUALIZATION: 'Conceptualization (Cn)', - DESIGN_FIRST2FINISH: 'Design First2Finish(DF2F)', - DESIGN_FIRST_2_FINISH: 'Design First2Finish(DF2F)', - FIRST2FINISH: 'First2Finish (F2F)', - FIRST_2_FINISH: 'First2Finish (F2F)', - LOGO_DESIGN: 'Logo Design (Lg)', - MARATHON_MATCH: 'Marathon Match (MM)', - DEVELOP_MARATHON_MATCH: 'Marathon Match (MM)', - PRINT_OR_PRESENTATION: 'Print/Presentation (PP)', - SRM: 'Single Round Match (SRM)', - UI_PROTOTYPE_COMPETITION: 'UI Prototype (Pr)', - WEB_DESIGN: 'Web Design (Wb)', - WEB_DESIGNS: 'Web Design (Wb)', - WIDGET_OR_MOBILE_SCREEN_DESIGN: 'Widget or Mobile Screen Design (Wg)', - STUDIO_OTHER: 'Generic design challenge (D)', - WIREFRAMES: 'Wireframe (Wf)', -}; - /** * Renders the tooltip's content. */ function Tip({ - subTrack, track, + type, }) { const trackStyle = track.replace(' ', '-').toLowerCase(); return (
- {HEADER[subTrack]} + {type.name}
- {subTrack ? DESCRIPTION[subTrack] : ''} + {type.description}
); } Tip.defaultProps = { - subTrack: 'CODE', - track: 'development', + track: 'Development', }; Tip.propTypes = { - subTrack: PT.string, track: PT.string, + type: PT.shape().isRequired, }; function placeArrow(TooltipNode) { @@ -128,10 +50,10 @@ function placeArrow(TooltipNode) { */ function TrackAbbreviationTooltip({ children, - subTrack, track, + type, }) { - const tip = ; + const tip = ; return ( Date: Mon, 10 Aug 2020 00:26:14 -0300 Subject: [PATCH 5/8] Change QA track color --- src/shared/components/TrackIcon/style.scss | 6 +++--- .../Tooltips/TrackAbbreviationTooltip/style.scss | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/components/TrackIcon/style.scss b/src/shared/components/TrackIcon/style.scss index 5c9c370263..96c861f9db 100644 --- a/src/shared/components/TrackIcon/style.scss +++ b/src/shared/components/TrackIcon/style.scss @@ -41,7 +41,7 @@ $track-radius-4: $corner-radius * 2; &.qa, &.quality-assurance { - background: $tc-purple-110; + background: $tc-purple-120; } &.data_science, @@ -76,8 +76,8 @@ $track-radius-4: $corner-radius * 2; &.qa, &.quality-assurance { - color: $tc-purple-110; - background: $tc-purple-10; + color: $tc-purple-120; + background: $tc-purple-20; } &.data_science, diff --git a/src/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip/style.scss b/src/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip/style.scss index 6666a51588..f73e9db228 100644 --- a/src/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip/style.scss +++ b/src/shared/components/challenge-listing/Tooltips/TrackAbbreviationTooltip/style.scss @@ -27,7 +27,7 @@ $track-radius-4: $corner-radius * 2; } &.quality-assurance { - border-left: $track-radius-4 solid $tc-purple; + border-left: $track-radius-4 solid $tc-purple-120; } } From bb28712086b0df2b61a2ec8ee290d838a5b987e8 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Mon, 10 Aug 2020 03:27:13 -0300 Subject: [PATCH 6/8] Change QA track color --- src/shared/components/examples/ColorMixins/Color/style.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shared/components/examples/ColorMixins/Color/style.scss b/src/shared/components/examples/ColorMixins/Color/style.scss index c44289aa0a..9db9ce4512 100644 --- a/src/shared/components/examples/ColorMixins/Color/style.scss +++ b/src/shared/components/examples/ColorMixins/Color/style.scss @@ -81,10 +81,12 @@ .tc-green-30 { @include color($tc-green-30); } .tc-green-10 { @include color($tc-green-10); } +.tc-purple-120 { @include color($tc-purple-110); } .tc-purple-110 { @include color($tc-purple-110); } .tc-purple-100 { @include color($tc-purple-100); } .tc-purple-70 { @include color($tc-purple-70); } .tc-purple-30 { @include color($tc-purple-30); } +.tc-purple-20 { @include color($tc-purple-20); } .tc-purple-10 { @include color($tc-purple-10); } .tc-gold { @include color($tc-gold); } From 5e787faf363d89349bd51f9e8b84fb40e592d0fb Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Mon, 10 Aug 2020 03:29:17 -0300 Subject: [PATCH 7/8] Update ChallengeTags --- .../challenge-detail/Header/ChallengeTags.jsx | 11 ++++------- .../components/challenge-detail/Header/index.jsx | 3 +-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/shared/components/challenge-detail/Header/ChallengeTags.jsx b/src/shared/components/challenge-detail/Header/ChallengeTags.jsx index 9f428ada7e..33b3d420f8 100644 --- a/src/shared/components/challenge-detail/Header/ChallengeTags.jsx +++ b/src/shared/components/challenge-detail/Header/ChallengeTags.jsx @@ -28,15 +28,12 @@ export default function ChallengeTags(props) { const { challengesUrl, track, - type, + challengeType, events, technPlatforms, setChallengeListingFilter, - challengeTypesMap, } = props; - const typeId = _.findKey(challengeTypesMap, { name: type }) || type; - let EventTag; let TrackTag; switch (track) { @@ -66,11 +63,11 @@ export default function ChallengeTags(props) { type && ( setImmediate(() => setChallengeListingFilter({ types: [typeId] })) + onClick={() => setImmediate(() => setChallengeListingFilter(challengeType.id)) } - to={`${challengesUrl}?filter[types][0]=${encodeURIComponent(typeId)}`} + to={`${challengesUrl}?filter[types][0]=${encodeURIComponent(challengeType.id)}`} > - {type} + {challengeType.name} ) } diff --git a/src/shared/components/challenge-detail/Header/index.jsx b/src/shared/components/challenge-detail/Header/index.jsx index 924eb2473f..662816fb73 100644 --- a/src/shared/components/challenge-detail/Header/index.jsx +++ b/src/shared/components/challenge-detail/Header/index.jsx @@ -252,9 +252,8 @@ export default function ChallengeHeader(props) {
Date: Mon, 10 Aug 2020 03:55:47 -0300 Subject: [PATCH 8/8] Hotfix ChallengeTags --- .../challenge-detail/Header/ChallengeTags.jsx | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/shared/components/challenge-detail/Header/ChallengeTags.jsx b/src/shared/components/challenge-detail/Header/ChallengeTags.jsx index 33b3d420f8..bbea412300 100644 --- a/src/shared/components/challenge-detail/Header/ChallengeTags.jsx +++ b/src/shared/components/challenge-detail/Header/ChallengeTags.jsx @@ -8,7 +8,6 @@ import React from 'react'; import PT from 'prop-types'; -import _ from 'lodash'; import { Tag, @@ -60,15 +59,15 @@ export default function ChallengeTags(props) { return (
{ - type + challengeType && ( - setImmediate(() => setChallengeListingFilter(challengeType.id)) - } - to={`${challengesUrl}?filter[types][0]=${encodeURIComponent(challengeType.id)}`} - > - {challengeType.name} - + setImmediate(() => setChallengeListingFilter(challengeType.id)) + } + to={`${challengesUrl}?filter[types][0]=${encodeURIComponent(challengeType.id)}`} + > + {challengeType.name} + ) } { @@ -109,9 +108,8 @@ ChallengeTags.defaultProps = { ChallengeTags.propTypes = { challengesUrl: PT.string.isRequired, track: PT.string.isRequired, - type: PT.string.isRequired, events: PT.arrayOf(PT.string), technPlatforms: PT.arrayOf(PT.string), setChallengeListingFilter: PT.func.isRequired, - challengeTypesMap: PT.shape().isRequired, + challengeType: PT.shape().isRequired, };