Skip to content

Commit fbe8ea2

Browse files
committed
fix(challenge-listing): do not render buckets that have 0 challenges
1 parent fa93b3d commit fbe8ea2

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import React, { useRef } from 'react';
1212
import Sort from 'utils/challenge-listing/sort';
1313
// import { NO_LIVE_CHALLENGES_CONFIG, BUCKETS, BUCKET_DATA }
1414
// from 'utils/challenge-listing/buckets';
15-
import { BUCKET_DATA } from 'utils/challenge-listing/buckets';
15+
import { NO_LIVE_CHALLENGES_CONFIG, BUCKET_DATA } from 'utils/challenge-listing/buckets';
1616
import SortingSelectBar from 'components/SortingSelectBar';
1717
import Waypoint from 'react-waypoint';
1818
// import { challenge as challengeUtils } from 'topcoder-react-lib';
@@ -102,6 +102,13 @@ export default function Bucket({
102102
// );
103103
// }
104104

105+
if (sortedChallenges.length === 0) {
106+
return (
107+
<div styleName="no-results">
108+
{ `${NO_LIVE_CHALLENGES_CONFIG[bucket]}` }
109+
</div>
110+
);
111+
}
105112
const cards = sortedChallenges.map(challenge => (
106113
<ChallengeCard
107114
challenge={challenge}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ function Listing({
184184
return (
185185
<div styleName="challengeCardContainer">
186186
{preListingMsg}
187-
{auth.user ? getBucket(BUCKETS.MY) : null}
187+
{(auth.user && myChallenges.length > 0) ? getBucket(BUCKETS.MY) : null}
188188
{/* {extraBucket ? getBucket(extraBucket) : null} */}
189-
{getBucket(BUCKETS.OPEN_FOR_REGISTRATION)}
189+
{openForRegistrationChallenges.length > 0 && getBucket(BUCKETS.OPEN_FOR_REGISTRATION)}
190190
{/* {getBucket(BUCKETS.ONGOING)} */}
191191
</div>
192192
);

0 commit comments

Comments
 (0)