Skip to content

Hotfix: Update old challenge.lagacy.track with challenge.track #4759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: integration-v5-challenge-api
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"technologies": "",
"status": "COMPLETED",
"legacy": {
"track": "DESIGN",
"forumId": 599349
},
"subTrack": "LOGO_DESIGN",
"track": "Design",
"type": "Challenge",
"tags": "Logo Design",
"name": "Sunshot - MapMySolar - SunGiver - Brand Concept Logo Design Challenge",
"reviewType": "INTERNAL",
"id": 30051608,
Expand Down Expand Up @@ -320,10 +321,11 @@
"technologies": "",
"status": "COMPLETED",
"legacy": {
"track": "DESIGN",
"forumId": 598066
},
"subTrack": "LOGO_DESIGN",
"track": "Design",
"type": "Challenge",
"tags": ["Logo Design"],
"name": "2016 Topcoder Open Logo Design Challenge",
"reviewType": "INTERNAL",
"id": 30051059,
Expand Down Expand Up @@ -532,10 +534,11 @@
"technologies": "",
"status": "COMPLETED",
"legacy": {
"track": "DESIGN",
"forumId": 596557
},
"subTrack": "LOGO_DESIGN",
"track": "Design",
"type": "Challenge",
"tags": "Logo Design",
"name": "ACME Logos Design Challenge",
"reviewType": "INTERNAL",
"id": 30050375,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"technologies": "CSS, HTML, JavaScript",
"status": "COMPLETED",
"legacy": {
"track": "DEVELOP",
"forumId": 39153
},
"subTrack": "FIRST_2_FINISH",
"track": "Development",
"type": "First2Finish",
"name": "$100 Eaton PX 2.0 Petting Zoo - MDC Web Enhancement F2F Challenge",
"reviewType": "INTERNAL",
"id": 30060905,
Expand Down Expand Up @@ -165,10 +165,10 @@
"technologies": "ReactJS",
"status": "COMPLETED",
"legacy": {
"track": "DEVELOP",
"forumId": 39151
},
"subTrack": "FIRST_2_FINISH",
"track": "Development",
"type": "First2Finish",
"name": "$100 Eaton PX 2.0 Petting Zoo - ReactJS Enhancement F2F Challenge",
"reviewType": "INTERNAL",
"id": 30060903,
Expand Down Expand Up @@ -323,10 +323,10 @@
"technologies": "Angular 2+, Express, JSON, Node.js",
"status": "COMPLETED",
"legacy": {
"track": "DEVELOP",
"forumId": 38951
},
"subTrack": "FIRST_2_FINISH",
"track": "Development",
"type": "First2Finish",
"name": "$500 BG800 Online Course Mock Rest API F2F Challenge",
"reviewType": "INTERNAL",
"id": 30060687,
Expand Down Expand Up @@ -630,11 +630,11 @@
"updatedBy": "22841596",
"technologies": "JavaScript, ReactJS",
"status": "COMPLETED",
"legacy": {
"track": "DEVELOP",
"legacy": {
"forumId": 38702
},
"subTrack": "FIRST_2_FINISH",
"track": "Development",
"type": "First2Finish",
"name": "John Hancock - Giving Tuesday - General image handling",
"reviewType": "INTERNAL",
"id": 30060425,
Expand Down
32 changes: 12 additions & 20 deletions __tests__/shared/components/ChallengeTile/__mocks__/marathon.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`renders design 1`] = `
}
>
<div
className="src-shared-components-ChallengeTile-___style__challenge___1vlh0 src-shared-components-ChallengeTile-___style__tile-view___1stZU src-shared-components-ChallengeTile-___style__DESIGN___Qvjqd"
className="src-shared-components-ChallengeTile-___style__challenge___1vlh0 src-shared-components-ChallengeTile-___style__tile-view___1stZU src-shared-components-ChallengeTile-___style__design___1wk2u"
>
<div
className="src-shared-components-ChallengeTile-___style__completed-challenge___3w5tT"
Expand All @@ -30,7 +30,7 @@ exports[`renders design 1`] = `
<p
className="src-shared-components-ChallengeTile-___style__subtrack-color___2AJaw"
>
LOGO DESIGN
Challenge
</p>
<p
className="src-shared-components-ChallengeTile-___style__date-completed___22F18"
Expand All @@ -42,7 +42,7 @@ exports[`renders design 1`] = `
className="src-shared-components-ChallengeTile-___style__challenge-card__bottom___CYUWj"
>
<div
className="src-shared-components-ChallengeTile-___style__challenge-details___3xZDW src-shared-components-ChallengeTile-___style__DATA_SCIENCE___1b8GD"
className="src-shared-components-ChallengeTile-___style__challenge-details___3xZDW src-shared-components-ChallengeTile-___style__data-science___2SGr7"
>
<div
className="src-shared-components-ChallengeTile-___style__design-challenge-user-place___3v-1O"
Expand Down Expand Up @@ -91,7 +91,7 @@ exports[`renders develop 1`] = `
}
>
<div
className="src-shared-components-ChallengeTile-___style__challenge___1vlh0 src-shared-components-ChallengeTile-___style__tile-view___1stZU src-shared-components-ChallengeTile-___style__DEVELOP___GgzgV"
className="src-shared-components-ChallengeTile-___style__challenge___1vlh0 src-shared-components-ChallengeTile-___style__tile-view___1stZU src-shared-components-ChallengeTile-___style__development___19vlt"
>
<div
className="src-shared-components-ChallengeTile-___style__completed-challenge___3w5tT"
Expand All @@ -109,7 +109,7 @@ exports[`renders develop 1`] = `
<p
className="src-shared-components-ChallengeTile-___style__subtrack-color___2AJaw"
>
FIRST 2 FINISH
First2Finish
</p>
<p
className="src-shared-components-ChallengeTile-___style__date-completed___22F18"
Expand All @@ -131,7 +131,7 @@ exports[`renders develop 1`] = `
className="src-shared-components-ChallengeTile-___style__challenge-card__bottom___CYUWj"
>
<div
className="src-shared-components-ChallengeTile-___style__challenge-details___3xZDW src-shared-components-ChallengeTile-___style__DATA_SCIENCE___1b8GD"
className="src-shared-components-ChallengeTile-___style__challenge-details___3xZDW src-shared-components-ChallengeTile-___style__data-science___2SGr7"
>
<div
className="src-shared-components-ChallengeTile-___style__dev-challenge-user-place___2tS8j"
Expand Down Expand Up @@ -196,7 +196,7 @@ exports[`renders marathon 1`] = `
}
>
<div
className="src-shared-components-ChallengeTile-___style__challenge___1vlh0 src-shared-components-ChallengeTile-___style__tile-view___1stZU src-shared-components-ChallengeTile-___style__DATA_SCIENCE___1b8GD"
className="src-shared-components-ChallengeTile-___style__challenge___1vlh0 src-shared-components-ChallengeTile-___style__tile-view___1stZU src-shared-components-ChallengeTile-___style__data-science___2SGr7"
>
<div
className="src-shared-components-ChallengeTile-___style__completed-challenge___3w5tT"
Expand All @@ -211,7 +211,7 @@ exports[`renders marathon 1`] = `
<p
className="src-shared-components-ChallengeTile-___style__subtrack-color___2AJaw"
>
MARATHON MATCH
Challenge
</p>
<p
className="src-shared-components-ChallengeTile-___style__date-completed___22F18"
Expand All @@ -223,7 +223,7 @@ exports[`renders marathon 1`] = `
className="src-shared-components-ChallengeTile-___style__challenge-card__bottom___CYUWj"
>
<div
className="src-shared-components-ChallengeTile-___style__challenge-details___3xZDW src-shared-components-ChallengeTile-___style__DATA_SCIENCE___1b8GD"
className="src-shared-components-ChallengeTile-___style__challenge-details___3xZDW src-shared-components-ChallengeTile-___style__data-science___2SGr7"
>
<div
className="src-shared-components-ChallengeTile-___style__marathon-score___V-afd"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev",
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3",
"tc-ui": "^1.0.12",
"topcoder-react-lib": "1000.19.44",
"topcoder-react-lib": "1000.19.46",
"topcoder-react-ui-kit": "1000.0.4",
"topcoder-react-utils": "0.7.8",
"turndown": "^4.0.2",
Expand Down
29 changes: 17 additions & 12 deletions src/shared/components/ChallengeTile/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import _ from 'lodash';
import React from 'react';
import PT from 'prop-types';
import { Link } from 'react-router-dom';
import { formatDate } from 'utils/tc';
import { formatDate, COMPETITION_TRACKS } from 'utils/tc';
import { isMM } from 'utils/challenge';
import ReactImageFallback from 'react-image-fallback';
import InviteOnly from 'assets/images/ico-invite-only-prj.svg';
import WinnerRibbon from 'assets/images/ico-winner-ribbon.svg';
Expand Down Expand Up @@ -73,23 +74,27 @@ class ChallengeTile extends React.Component {
challenge,
} = this.props;

const { track } = challenge.legacy;
const { track, type } = challenge;

const outStyleName = `challenge tile-view ${track}`;
const outStyleName = `challenge tile-view ${track.replace(' ', '-').toLowerCase()}`;
const extraStyle = {
width: '285px',
padding: '15px',
margin: '10px 5px',
};

const roundId = track === 'DATA_SCIENCE' ? _.get(challenge, 'rounds.0.id') : 0;
const isDataScience = track === COMPETITION_TRACKS.DATA_SCIENCE;
const isDevelopment = track === COMPETITION_TRACKS.DEVELOP;
const isDesign = track === COMPETITION_TRACKS.DESIGN;

const roundId = isDataScience ? _.get(challenge, 'rounds.0.id') : 0;

return (
<div styleName="challenge tile" style={extraStyle}>
<div styleName={outStyleName}>
<div styleName="completed-challenge">
<header>
{ track !== 'DATA_SCIENCE' && (!challenge.isPrivate
{ !isDataScience && (!challenge.isPrivate
? (
<Link to={`/challenges/${challenge.id}`} styleName="name">
<span>
Expand All @@ -102,15 +107,15 @@ class ChallengeTile extends React.Component {
</span>
)) }

{ track === 'DATA_SCIENCE'
{ isDataScience
&& (
<a styleName="name" href={`https://community.topcoder.com/longcontest/stats/?module=ViewOverview&rd=${roundId}`}>
{ challenge.name }
</a>
) }

<p styleName="subtrack-color">
{underscoreReplace(challenge.subTrack)}
{underscoreReplace(type)}
</p>
<p styleName="date-completed">
{formatDate(challenge.submissionEndDate)}
Expand All @@ -124,8 +129,8 @@ class ChallengeTile extends React.Component {
}
</header>
<div styleName="challenge-card__bottom">
<div styleName="challenge-details DATA_SCIENCE">
{ track === 'DATA_SCIENCE' && challenge.subTrack
<div styleName="challenge-details data-science">
{ isMM(challenge)
&& (
<div styleName="marathon-score">
<p styleName="score">
Expand All @@ -136,7 +141,7 @@ class ChallengeTile extends React.Component {
</p>
</div>
) }
{ track === 'DEVELOP'
{ isDevelopment
&& (
<div styleName="dev-challenge-user-place">
<div styleName="tile-view">
Expand Down Expand Up @@ -193,7 +198,7 @@ class ChallengeTile extends React.Component {
)
}
{
track === 'DESIGN' && !challenge.isPrivate
isDesign && !challenge.isPrivate
&& (
<div styleName="design-challenge-user-place">
<div styleName="tile-view">
Expand Down Expand Up @@ -313,7 +318,7 @@ class ChallengeTile extends React.Component {
</div>

<p styleName="roles">
{ track !== 'DATA_SCIENCE'
{ track !== COMPETITION_TRACKS.DATA_SCIENCE
&& (
<span>
<span>
Expand Down
6 changes: 3 additions & 3 deletions src/shared/components/ChallengeTile/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
}

// Dynamic colors based on track
.DESIGN {
.design {
&.tile-view {
header {
border-left: 3px solid #21b2f1;
Expand All @@ -94,7 +94,7 @@
}
}

.DEVELOP {
.development {
&.tile-view {
header {
border-left: 3px solid #05c14f;
Expand All @@ -111,7 +111,7 @@
}
}

.DATA_SCIENCE {
.data-science {
&.tile-view {
header {
border-left: 3px solid #fc9a00;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import _ from 'lodash';
import moment from 'moment';
import React from 'react';
import { config } from 'topcoder-react-utils';
import { COMPETITION_TRACKS } from 'utils/tc';

import PT from 'prop-types';

Expand Down Expand Up @@ -49,7 +50,7 @@ export default function Submission(props) {
{formatDate(submissionObject.created)}
</td>
{
track === 'Design' && (
track === COMPETITION_TRACKS.DESIGN && (
<td styleName="status-col">
{submissionObject.screening
&& (
Expand All @@ -66,7 +67,7 @@ export default function Submission(props) {
<div>
<a
href={
track === 'Design'
track === COMPETITION_TRACKS.DESIGN
? `${config.URL.ONLINE_REVIEW}/review/actions/DownloadContestSubmission?uid=${submissionObject.id}`
: submissionObject.download
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import React from 'react';
import PT from 'prop-types';
import shortid from 'shortid';
import moment from 'moment';
import { COMPETITION_TRACKS } from 'utils/tc';
import Submission from '../Submission';
import ScreeningDetails from '../ScreeningDetails';
import './styles.scss';
Expand Down Expand Up @@ -101,7 +102,7 @@ export default function SubmissionsTable(props) {
<th>
Submission Date
</th>
{track === 'Design' && (
{track === COMPETITION_TRACKS.DESIGN && (
<th styleName="status">
Screening Status
</th>
Expand Down
5 changes: 3 additions & 2 deletions src/shared/components/SubmissionPage/Submit/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import PT from 'prop-types';
import { PrimaryButton } from 'topcoder-react-ui-kit';
import { config } from 'topcoder-react-utils';
import LoadingIndicator from 'components/LoadingIndicator';
import { COMPETITION_TRACKS } from 'utils/tc';

import FilestackFilePicker from '../FilestackFilePicker';

Expand Down Expand Up @@ -192,14 +193,14 @@ class Submit extends React.Component {
</div>
<div styleName="right">
<div styleName="submission-hints">
{ track === 'DEVELOP' ? (
{ track === COMPETITION_TRACKS.DEVELOP ? (
<div>
{isChallengeBelongToTopgearGroup
? (<p>Enter the URL to your submission.</p>)
: (<p>Upload your entire submission as a single zip file.</p>)}
</div>
) : null }
{ track === 'DESIGN' ? (
{ track === COMPETITION_TRACKS.DESIGN ? (
<div>
<ol>
<li>Place your submission files into a &quot;Submission.zip&quot; file.</li>
Expand Down
4 changes: 3 additions & 1 deletion src/shared/components/SubmissionPage/Uploading/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import RobotSad from 'assets/images/robot-embarassed.svg';
import { PrimaryButton, Button } from 'topcoder-react-ui-kit';
import './styles.scss';

import { COMPETITION_TRACKS } from 'utils/tc';

const Uploading = ({
challengeId,
challengeName,
Expand Down Expand Up @@ -156,7 +158,7 @@ const Uploading = ({
submitDone && !error
&& (
<div styleName="button-container">
{ track === 'DESIGN' ? (
{ track === COMPETITION_TRACKS.DESIGN ? (
<span>
<Button
onClick={() => reset()}
Expand Down
Loading