Skip to content

Commit 0c37799

Browse files
committed
Updated links between main challenge listing, header, and challenge details
Now the link to main challenge listing in the standard TopcoderHeader leads to the main challenge listing from Community App; challenge details links from the main challenge listing lead to the new challenge detail pages (the version of listing inside communities still refer to the old challenge detail pages); and the tags on challenge detail pages properly link back to the new challenge listing, without reloading the app.
1 parent 8752dcf commit 0c37799

File tree

12 files changed

+74
-21
lines changed

12 files changed

+74
-21
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ exports[`Default render 1`] = `
9292
"items": Array [
9393
Object {
9494
"icon": <IconNavRocket />,
95-
"link": "https://www.topcoder-dev.com/challenges",
95+
"link": "/challenges",
9696
"title": "All Challenges",
9797
},
9898
Object {
@@ -286,7 +286,7 @@ exports[`Render with open menu 1`] = `
286286
"items": Array [
287287
Object {
288288
"icon": <IconNavRocket />,
289-
"link": "https://www.topcoder-dev.com/challenges",
289+
"link": "/challenges",
290290
"title": "All Challenges",
291291
},
292292
Object {
@@ -482,7 +482,7 @@ exports[`Render with specified profile 1`] = `
482482
"items": Array [
483483
Object {
484484
"icon": <IconNavRocket />,
485-
"link": "https://www.topcoder-dev.com/challenges",
485+
"link": "/challenges",
486486
"title": "All Challenges",
487487
},
488488
Object {

__tests__/shared/components/challenge-listing/Listing/__snapshots__/Bucket.jsx.snap

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ exports[`Matches shallow shapshot 1`] = `
5656
"track": "DEVELOP",
5757
}
5858
}
59+
newChallengeDetails={true}
5960
onTechTagClicked={[Function]}
6061
openChallengesInNewTabs={false}
6162
prizeMode="money-usd"
@@ -107,6 +108,7 @@ exports[`Matches shallow shapshot 2`] = `
107108
"totalPrize": 1800,
108109
}
109110
}
111+
newChallengeDetails={true}
110112
onTechTagClicked={[Function]}
111113
openChallengesInNewTabs={false}
112114
prizeMode="money-usd"
@@ -124,6 +126,7 @@ exports[`Matches shallow shapshot 2`] = `
124126
"totalPrize": 1800,
125127
}
126128
}
129+
newChallengeDetails={true}
127130
onTechTagClicked={[Function]}
128131
openChallengesInNewTabs={false}
129132
prizeMode="money-usd"
@@ -141,6 +144,7 @@ exports[`Matches shallow shapshot 2`] = `
141144
"totalPrize": 1800,
142145
}
143146
}
147+
newChallengeDetails={true}
144148
onTechTagClicked={[Function]}
145149
openChallengesInNewTabs={false}
146150
prizeMode="money-usd"
@@ -158,6 +162,7 @@ exports[`Matches shallow shapshot 2`] = `
158162
"totalPrize": 1800,
159163
}
160164
}
165+
newChallengeDetails={true}
161166
onTechTagClicked={[Function]}
162167
openChallengesInNewTabs={false}
163168
prizeMode="money-usd"
@@ -175,6 +180,7 @@ exports[`Matches shallow shapshot 2`] = `
175180
"totalPrize": 1800,
176181
}
177182
}
183+
newChallengeDetails={true}
178184
onTechTagClicked={[Function]}
179185
openChallengesInNewTabs={false}
180186
prizeMode="money-usd"
@@ -192,6 +198,7 @@ exports[`Matches shallow shapshot 2`] = `
192198
"totalPrize": 1800,
193199
}
194200
}
201+
newChallengeDetails={true}
195202
onTechTagClicked={[Function]}
196203
openChallengesInNewTabs={false}
197204
prizeMode="money-usd"
@@ -209,6 +216,7 @@ exports[`Matches shallow shapshot 2`] = `
209216
"totalPrize": 1800,
210217
}
211218
}
219+
newChallengeDetails={true}
212220
onTechTagClicked={[Function]}
213221
openChallengesInNewTabs={false}
214222
prizeMode="money-usd"
@@ -226,6 +234,7 @@ exports[`Matches shallow shapshot 2`] = `
226234
"totalPrize": 1800,
227235
}
228236
}
237+
newChallengeDetails={true}
229238
onTechTagClicked={[Function]}
230239
openChallengesInNewTabs={false}
231240
prizeMode="money-usd"
@@ -243,6 +252,7 @@ exports[`Matches shallow shapshot 2`] = `
243252
"totalPrize": 1800,
244253
}
245254
}
255+
newChallengeDetails={true}
246256
onTechTagClicked={[Function]}
247257
openChallengesInNewTabs={false}
248258
prizeMode="money-usd"
@@ -260,6 +270,7 @@ exports[`Matches shallow shapshot 2`] = `
260270
"totalPrize": 1800,
261271
}
262272
}
273+
newChallengeDetails={true}
263274
onTechTagClicked={[Function]}
264275
openChallengesInNewTabs={false}
265276
prizeMode="money-usd"

__tests__/shared/components/challenge-listing/Listing/__snapshots__/index.jsx.snap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ exports[`Matches shallow shapshot 1`] = `
77
<Bucket
88
bucket={Object {}}
99
challenges={Array []}
10+
communityName={null}
1011
expand={[Function]}
1112
expanded={false}
1213
loadMore={null}
@@ -20,6 +21,7 @@ exports[`Matches shallow shapshot 1`] = `
2021
<Bucket
2122
bucket={Object {}}
2223
challenges={Array []}
24+
communityName={null}
2325
expand={[Function]}
2426
expanded={false}
2527
loadMore={null}
@@ -33,6 +35,7 @@ exports[`Matches shallow shapshot 1`] = `
3335
<Bucket
3436
bucket={Object {}}
3537
challenges={Array []}
38+
communityName={null}
3639
expand={[Function]}
3740
expanded={false}
3841
loadMore={null}
@@ -46,6 +49,7 @@ exports[`Matches shallow shapshot 1`] = `
4649
<Bucket
4750
bucket={Object {}}
4851
challenges={Array []}
52+
communityName={null}
4953
expand={[Function]}
5054
expanded={false}
5155
loadMore={[Function]}
@@ -66,6 +70,7 @@ exports[`Matches shallow shapshot 2`] = `
6670
<Bucket
6771
bucket={Object {}}
6872
challenges={Array []}
73+
communityName={null}
6974
expand={[Function]}
7075
expanded={true}
7176
loadMore={[Function]}
@@ -86,6 +91,7 @@ exports[`Matches shallow shapshot 3`] = `
8691
<Bucket
8792
bucket={Object {}}
8893
challenges={Array []}
94+
communityName={null}
8995
expand={[Function]}
9096
expanded={true}
9197
loadMore={[Function]}
@@ -106,6 +112,7 @@ exports[`Matches shallow shapshot 4`] = `
106112
<Bucket
107113
bucket={Object {}}
108114
challenges={Array []}
115+
communityName={null}
109116
expand={[Function]}
110117
expanded={false}
111118
loadMore={null}
@@ -119,6 +126,7 @@ exports[`Matches shallow shapshot 4`] = `
119126
<Bucket
120127
bucket={Object {}}
121128
challenges={Array []}
129+
communityName={null}
122130
expand={[Function]}
123131
expanded={false}
124132
loadMore={null}
@@ -132,6 +140,7 @@ exports[`Matches shallow shapshot 4`] = `
132140
<Bucket
133141
bucket={Object {}}
134142
challenges={Array []}
143+
communityName={null}
135144
expand={[Function]}
136145
expanded={false}
137146
loadMore={[Function]}
@@ -152,6 +161,7 @@ exports[`Matches shallow shapshot 5`] = `
152161
<Bucket
153162
bucket={Object {}}
154163
challenges={Array []}
164+
communityName={null}
155165
expand={[Function]}
156166
expanded={true}
157167
loadMore={null}

__tests__/shared/components/challenge-listing/__snapshots__/index.jsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ exports[`Matches shallow shapshot 1 shapshot 1 1`] = `
6969
activeBucket="abc"
7070
auth={Object {}}
7171
challenges={Array []}
72+
communityName={null}
7273
currentFilterName=""
7374
expanded={false}
7475
groupId=""

src/shared/components/TopcoderHeader/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const MENU = [{
4747
title: 'Compete',
4848
items: [{
4949
icon: <IconNavRocket />,
50-
link: `${BASE_URL}/challenges`,
50+
link: '/challenges',
5151
title: 'All Challenges',
5252
}, {
5353
icon: <IconNavCP />,

src/shared/components/challenge-detail/Header/ChallengeTags.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ export default function ChallengeTags(props) {
1919
technPlatforms,
2020
subTrackStyle,
2121
eventStyle,
22+
setChallengeListingFilter,
2223
} = props;
2324

2425
return (
2526
<div styleName="tag-holder">
2627
{
2728
subTrack &&
2829
<Link
29-
enforceA
30-
to={`/challenges?filter[subtracks][0]=${subTrack}`}
30+
onClick={() => setChallengeListingFilter({ subtracks: [subTrack] })}
31+
to="/challenges"
3132
styleName={`tag-common ${subTrackStyle}`}
3233
>{subTrack}</Link>
3334
}
@@ -45,9 +46,9 @@ export default function ChallengeTags(props) {
4546
tag =>
4647
(
4748
<Link
48-
enforceA
4949
key={tag}
50-
to={`/challenges?filter[tags][0]=${tag}`}
50+
onClick={() => setChallengeListingFilter({ tags: [tag] })}
51+
to="/challenges"
5152
styleName="tag-common misc-tag"
5253
>{tag}</Link>
5354
),
@@ -69,4 +70,5 @@ ChallengeTags.propTypes = {
6970
technPlatforms: PT.arrayOf(PT.string),
7071
subTrackStyle: PT.string.isRequired,
7172
eventStyle: PT.string.isRequired,
73+
setChallengeListingFilter: PT.func.isRequired,
7274
};

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ import style from './style.scss';
2727
export default function ChallengeHeader(props) {
2828
const {
2929
challenge,
30+
checkpoints,
31+
hasRegistered,
3032
registering,
3133
registerForChallenge,
34+
setChallengeListingFilter,
3235
unregisterFromChallenge,
3336
unregistering,
34-
hasRegistered,
35-
checkpoints,
3637
} = props;
3738

3839
const {
@@ -142,6 +143,7 @@ export default function ChallengeHeader(props) {
142143
technPlatforms={miscTags}
143144
subTrackStyle={subTrackStyle}
144145
eventStyle={eventStyle}
146+
setChallengeListingFilter={setChallengeListingFilter}
145147
/>
146148
<div styleName="prizes-ops-container">
147149
<div styleName="prizes-outer-container">
@@ -243,17 +245,18 @@ ChallengeHeader.defaultProps = {
243245
};
244246

245247
ChallengeHeader.propTypes = {
246-
onSelectorClicked: PT.func.isRequired,
247-
selectedView: PT.string.isRequired,
248+
checkpoints: PT.shape(),
248249
challenge: PT.shape({
249250
id: PT.number.isRequired,
250251
}).isRequired,
251-
registerForChallenge: PT.func.isRequired,
252-
showDeadlineDetail: PT.bool.isRequired,
252+
hasRegistered: PT.bool.isRequired,
253+
onSelectorClicked: PT.func.isRequired,
253254
onToggleDeadlines: PT.func.isRequired,
255+
registerForChallenge: PT.func.isRequired,
254256
registering: PT.bool.isRequired,
257+
selectedView: PT.string.isRequired,
258+
setChallengeListingFilter: PT.func.isRequired,
259+
showDeadlineDetail: PT.bool.isRequired,
255260
unregisterFromChallenge: PT.func.isRequired,
256261
unregistering: PT.bool.isRequired,
257-
hasRegistered: PT.bool.isRequired,
258-
checkpoints: PT.shape(),
259262
};

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const getEndDate = date => moment(date).format('MMM DD');
3333

3434
function ChallengeCard({
3535
challenge: passedInChallenge,
36+
newChallengeDetails,
3637
onTechTagClicked,
3738
openChallengesInNewTabs,
3839
prizeMode,
@@ -49,7 +50,8 @@ function ChallengeCard({
4950

5051
let challengeDetailLink;
5152
{
52-
const challengeUrl = `${config.URL.BASE}/challenge-details/`;
53+
const challengeUrl = newChallengeDetails
54+
? '/challenges/' : `${config.URL.BASE}/challenge-details/`;
5355
if (challenge.track === 'DATA_SCIENCE') {
5456
const mmDetailUrl = `${config.URL.COMMUNITY}/tc?module=MatchDetails&rd=`;
5557
/* TODO: Don't we have a better way, whether a challenge is MM or not? */
@@ -163,16 +165,18 @@ function ChallengeCard({
163165
}
164166

165167
ChallengeCard.defaultProps = {
166-
onTechTagClicked: _.noop,
167168
challenge: {},
169+
newChallengeDetails: false,
170+
onTechTagClicked: _.noop,
168171
openChallengesInNewTabs: false,
169172
prizeMode: PRIZE_MODE.MONEY_USD,
170173
sampleWinnerProfile: undefined,
171174
};
172175

173176
ChallengeCard.propTypes = {
174-
onTechTagClicked: PT.func,
175177
challenge: PT.shape(),
178+
newChallengeDetails: PT.bool,
179+
onTechTagClicked: PT.func,
176180
openChallengesInNewTabs: PT.bool,
177181
prizeMode: PT.oneOf(_.toArray(PRIZE_MODE)),
178182
sampleWinnerProfile: PT.shape(),
@@ -235,13 +239,13 @@ class Tags extends React.Component {
235239
}
236240

237241
Tags.defaultProps = {
238-
technologies: '',
239242
onTechTagClicked: _.noop,
243+
technologies: '',
240244
};
241245

242246
Tags.propTypes = {
243-
technologies: PT.string,
244247
onTechTagClicked: PT.func,
248+
technologies: PT.string,
245249
};
246250

247251
export default ChallengeCard;

src/shared/components/challenge-listing/Listing/Bucket/index.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const COLLAPSED_SIZE = 10;
1818
export default function Bucket({
1919
bucket,
2020
challenges,
21+
communityName,
2122
expanded,
2223
expand,
2324
loading,
@@ -51,6 +52,7 @@ export default function Bucket({
5152
const cards = filteredChallenges.map(item => (
5253
<ChallengeCard
5354
challenge={item}
55+
newChallengeDetails={!communityName}
5456
onTechTagClicked={tag => setFilterState({ tags: [tag] })}
5557
openChallengesInNewTabs={openChallengesInNewTabs}
5658
prizeMode={prizeMode}
@@ -101,6 +103,7 @@ export default function Bucket({
101103
}
102104

103105
Bucket.defaultProps = {
106+
communityName: null,
104107
expanded: false,
105108
expand: _.noop,
106109
loading: false,
@@ -114,6 +117,7 @@ Bucket.propTypes = {
114117
expanded: PT.bool,
115118
expand: PT.func,
116119
challenges: PT.arrayOf(PT.shape()).isRequired,
120+
communityName: PT.string,
117121
loading: PT.bool,
118122
loadMore: PT.func,
119123
openChallengesInNewTabs: PT.bool,

0 commit comments

Comments
 (0)