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",

src/assets/images/icon-not-found.svg

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;
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@import '~styles/mixins';
2+
3+
.container {
4+
min-height: 178px;
5+
background-color: #fff;
6+
border-radius: 4px;
7+
display: flex;
8+
justify-content: center;
9+
flex-direction: column;
10+
margin-top: 20px;
11+
}
12+
13+
.icon {
14+
display: flex;
15+
justify-content: center;
16+
17+
@include xs-to-sm {
18+
padding-top: 37.61px;
19+
}
20+
21+
@include sm-to-xl {
22+
padding-top: 46.25px;
23+
}
24+
}
25+
26+
.text-header {
27+
@include xs-to-lg {
28+
margin: 17.92px 10px 0 10px;
29+
}
30+
31+
@include lg-to-xl {
32+
margin: 26.68px 10px 0 10px;
33+
}
34+
35+
@include barlow-semi-bold;
36+
37+
font-size: 16px;
38+
text-align: center;
39+
line-height: 16px;
40+
color: #2a2a2a;
41+
}
42+
43+
.text {
44+
@include roboto-regular;
45+
46+
padding: 8px 10px 24px;
47+
font-size: 16px;
48+
text-align: center;
49+
line-height: 26px;
50+
color: #2a2a2a;
51+
}
52+
53+
.challenge-link {
54+
color: #2862b9;
55+
text-decoration: underline;
56+
57+
&:hover,
58+
&:active,
59+
&:visited {
60+
color: #2862b9;
61+
}
62+
}

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import Sidebar from 'containers/challenge-listing/Sidebar';
1515
// import { config } from 'topcoder-react-utils';
1616
import { useMediaQuery } from 'react-responsive';
1717

18-
import NoChallengeCard from './NoChallengeCard';
1918
import Listing from './Listing';
2019
// import ChallengeCardPlaceholder from './placeholders/ChallengeCard';
2120
import Banner from './Banner';
@@ -51,7 +50,6 @@ export default function ChallengeListing(props) {
5150
// isBucketSwitching,
5251
isLoggedIn,
5352
setSearchText,
54-
loadingOpenForRegistrationChallenges,
5553
} = props;
5654

5755
// const { challenges } = props;
@@ -151,10 +149,6 @@ export default function ChallengeListing(props) {
151149
);
152150

153151
const desktop = useMediaQuery({ minWidth: 1024 });
154-
const isRecommendedOn = filterState.recommended
155-
&& !loadingOpenForRegistrationChallenges
156-
&& activeBucket === 'openForRegistration'
157-
&& !openForRegistrationChallenges.length;
158152

159153
return (
160154
<div styleName="ChallengeFiltersExample" id="challengeFilterContainer">
@@ -186,11 +180,7 @@ export default function ChallengeListing(props) {
186180
/>
187181
</div>
188182

189-
{
190-
isRecommendedOn
191-
? <NoChallengeCard />
192-
: challengeCardContainer
193-
}
183+
{ challengeCardContainer }
194184

195185
</div>
196186
</div>

src/shared/utils/challenge-listing/buckets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const BUCKET_DATA = {
5858
// hideCount: false,
5959
name: 'Open for registration',
6060
sorts: [
61-
SORTS.BEST_MATCH,
61+
// SORTS.BEST_MATCH,
6262
SORTS.MOST_RECENT_START_DATE,
6363
// SORTS.TIME_TO_REGISTER,
6464
// SORTS.TIME_TO_SUBMIT,

0 commit comments

Comments
 (0)