Skip to content

Commit 130fdea

Browse files
Merge pull request #5900 from topcoder-platform/feature/recommended-challenges-update
recommended challenge bucket update
2 parents 4c2bd9a + 6d023e3 commit 130fdea

File tree

13 files changed

+142
-91
lines changed

13 files changed

+142
-91
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ workflows:
343343
branches:
344344
only:
345345
- develop
346+
- feature/recommended-challenges-update
346347
# This is alternate dev env for parallel testing
347348
- "build-test":
348349
context : org-global
@@ -371,6 +372,7 @@ workflows:
371372
branches:
372373
only:
373374
- develop
375+
- feature/recommended-challenges-update
374376
# Production builds are exectuted
375377
# when PR is merged to the master
376378
# Don't change anything in this configuration

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
"supertest": "^3.1.0",
151151
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3",
152152
"tc-ui": "^1.0.12",
153-
"topcoder-react-lib": "1.2.1",
153+
"topcoder-react-lib": "1000.28.3",
154154
"topcoder-react-ui-kit": "2.0.1",
155155
"topcoder-react-utils": "0.7.8",
156156
"turndown": "^4.0.2",
Lines changed: 3 additions & 0 deletions
Loading

src/shared/components/SortingSelectBar/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $down-arrow-size: $base-unit;
2424
font-size: 13px;
2525
line-height: 13px;
2626
margin: 0;
27-
padding: 0 0 0 10px;
27+
padding: 4.5px 0 4.5px 10px;
2828
border: none;
2929
text-transform: none;
3030
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function ChallengeCard({
4949

5050
const registrationPhase = (challenge.phases || []).filter(phase => phase.name === 'Registration')[0];
5151
const isRegistrationOpen = registrationPhase ? registrationPhase.isOpen : false;
52-
const isRecommendedChallenge = challenge.jaccard_index;
52+
const isRecommendedChallenge = !!challenge.jaccard_index;
5353

5454
return (
5555
<div ref={domRef} styleName="challengeCard">

src/shared/components/challenge-listing/Filters/FiltersPanel/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ export default function FiltersPanel({
306306

307307
const recommendedCheckboxTip = (
308308
<div styleName="tctooltiptext">
309-
<p>Shows available challenges <br /> that match your skills</p>
309+
<p>Show the best challenges for you.</p>
310310
</div>
311311
);
312312

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

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import PT from 'prop-types';
99
// import qs from 'qs';
1010
import React, { useRef } from 'react';
1111
// import { config } from 'topcoder-react-utils';
12-
import Sort, { SORTS } from 'utils/challenge-listing/sort';
12+
import Sort from 'utils/challenge-listing/sort';
1313
import {
1414
NO_LIVE_CHALLENGES_CONFIG, BUCKETS, BUCKET_DATA, isRecommendedChallengeType,
1515
} from 'utils/challenge-listing/buckets';
@@ -18,6 +18,7 @@ import Waypoint from 'react-waypoint';
1818
// import { challenge as challengeUtils } from 'topcoder-react-lib';
1919
import CardPlaceholder from '../../placeholders/ChallengeCard';
2020
import ChallengeCard from '../../ChallengeCard';
21+
import NoRecommenderChallengeCard from '../../NoRecommenderChallengeCard';
2122
import './style.scss';
2223

2324
// const COLLAPSED_SIZE = 10;
@@ -53,9 +54,6 @@ export default function Bucket({
5354
isLoggedIn,
5455
setSearchText,
5556
}) {
56-
const activeBucketData = isRecommendedChallengeType(bucket, filterState)
57-
? [SORTS.BEST_MATCH] : BUCKET_DATA[bucket].sorts.filter(item => item !== 'bestMatch');
58-
5957
const refs = useRef([]);
6058
refs.current = [];
6159
const addToRefs = (el) => {
@@ -180,33 +178,50 @@ export default function Bucket({
180178
// // instead of waiting for scrolling to hit the react-waypoint to do the loadMore
181179
// loadMore();
182180
// }
183-
181+
const isRecommended = isRecommendedChallengeType(bucket, filterState);
182+
const isHighestPaying = isRecommended && _.sumBy(filteredChallenges, 'jaccard_index') === 0;
183+
const sectionTile = isHighestPaying ? 'HIGHEST PAYING OPEN CHALLENGES' : 'Recommended Open Challenges';
184184
return (
185185
// challenges.length !== 0
186186
// && (
187-
<div styleName="bucket">
188-
<SortingSelectBar
189-
onSelect={setSort}
190-
options={
191-
activeBucketData.map(item => ({
192-
label: Sort[item].name,
193-
value: item,
194-
}))
195-
}
196-
title={BUCKET_DATA[bucket].name}
197-
value={{
198-
label: Sort[activeSort].name,
199-
value: activeSort,
200-
}}
201-
/>
202-
{cards}
187+
<div>
203188
{
204-
!expanding && !expandable && loadMore && !loading && activeBucket === bucket ? (
205-
<Waypoint onEnter={loadMore} />
206-
) : null
189+
isHighestPaying && (!loading || filteredChallenges.length > 0)
190+
&& <NoRecommenderChallengeCard />
207191
}
208-
{placeholders}
209-
{
192+
<div styleName="bucket">
193+
{
194+
isRecommended
195+
? filteredChallenges.length > 0 && (
196+
<SortingSelectBar
197+
title={sectionTile}
198+
/>
199+
)
200+
: (
201+
<SortingSelectBar
202+
onSelect={setSort}
203+
options={
204+
BUCKET_DATA[bucket].sorts.map(item => ({
205+
label: Sort[item].name,
206+
value: item,
207+
}))
208+
}
209+
title={BUCKET_DATA[bucket].name}
210+
value={{
211+
label: Sort[activeSort].name,
212+
value: activeSort,
213+
}}
214+
/>
215+
)
216+
}
217+
{cards}
218+
{
219+
!expanding && !expandable && loadMore && !loading && activeBucket === bucket ? (
220+
<Waypoint onEnter={loadMore} />
221+
) : null
222+
}
223+
{placeholders}
224+
{
210225
// (expandable || loadMore) && (expandable || !keepPlaceholders) && !loading && !expanded ? (
211226
(expanding || expandable) && !loading && loadMore && (expandable ? expanded : !expanded) ? (
212227
<a
@@ -225,7 +240,8 @@ export default function Bucket({
225240
View more challenges
226241
</a>
227242
) : null
228-
}
243+
}
244+
</div>
229245
</div>
230246
// )
231247
);

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

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/shared/components/challenge-listing/NoChallengeCard/style.scss

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from 'react';
2+
3+
import { Link, config } from 'topcoder-react-utils';
4+
import './style.scss';
5+
import NotFoundIcon from 'assets/images/icon-not-found.svg';
6+
7+
const base = config.URL.BASE;
8+
9+
function NoRecommenderChallengeCard() {
10+
return (
11+
<div styleName="container">
12+
<div styleName="icon">
13+
<NotFoundIcon />
14+
</div>
15+
<span styleName="text-header">
16+
NO VERIFIED SKILLS ON YOUR PROFILE
17+
</span>
18+
<span styleName="text">
19+
Your recommended challenges are based on your Verified Skills.
20+
Competing in <Link styleName="challenge-link" to={`${base}/challenges`}>challenges</Link> is a great way to earn them.
21+
</span>
22+
</div>
23+
);
24+
}
25+
26+
export default NoRecommenderChallengeCard;

0 commit comments

Comments
 (0)