Skip to content

Commit 962d894

Browse files
committed
fix: for issue topcoder-platform#4964
1 parent fa93b3d commit 962d894

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ function Listing({
5656
expandTag,
5757
// pastSearchTimestamp,
5858
isLoggedIn,
59+
meta,
5960
}) {
6061
// const buckets = getBuckets(userChallenges);
6162
// const isChallengesAvailable = (bucket) => {
@@ -75,6 +76,7 @@ function Listing({
7576
let loadMore;
7677
// let searchTimestamp;
7778
let bucketChallenges = [];
79+
let newExpanded = expanded;
7880
switch (bucket) {
7981
// case BUCKETS.PAST:
8082
// keepPlaceholders = keepPastPlaceholders;
@@ -87,16 +89,19 @@ function Listing({
8789
bucketChallenges = [].concat(myChallenges);
8890
loading = loadingMyChallenges;
8991
loadMore = loadMoreMy;
92+
newExpanded = newExpanded || (+meta.myChallengesCount === bucketChallenges.length);
9093
break;
9194
case BUCKETS.OPEN_FOR_REGISTRATION:
9295
bucketChallenges = [].concat(openForRegistrationChallenges);
9396
loading = loadingOpenForRegistrationChallenges;
9497
loadMore = loadMoreOpenForRegistration;
98+
newExpanded = newExpanded || (+meta.openChallengesCount === bucketChallenges.length);
9599
break;
96100
case BUCKETS.ONGOING:
97101
bucketChallenges = [].concat(challenges);
98102
loading = loadingOnGoingChallenges;
99103
loadMore = loadMoreOnGoing;
104+
newExpanded = newExpanded || (+meta.ongoingChallengesCount === bucketChallenges.length);
100105
break;
101106
default:
102107
break;
@@ -134,7 +139,7 @@ function Listing({
134139
challengesUrl={challengesUrl}
135140
communityName={communityName}
136141
expand={() => selectBucket(bucket)}
137-
expanded={expanded}
142+
expanded={newExpanded}
138143
expandedTags={expandedTags}
139144
expandTag={expandTag}
140145
filterState={filterState}
@@ -262,6 +267,7 @@ Listing.propTypes = {
262267
// pastSearchTimestamp: PT.number,
263268
// userChallenges: PT.arrayOf(PT.string),
264269
isLoggedIn: PT.bool.isRequired,
270+
meta: PT.shape().isRequired,
265271
};
266272

267273
const mapStateToProps = (state) => {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export default function ChallengeListing(props) {
4444
preListingMsg,
4545
// isBucketSwitching,
4646
isLoggedIn,
47+
meta,
4748
} = props;
4849

4950
// const { challenges } = props;
@@ -131,6 +132,7 @@ export default function ChallengeListing(props) {
131132
// loadingActiveChallenges={props.loadingChallenges}
132133
// userChallenges={props.userChallenges}
133134
isLoggedIn={isLoggedIn}
135+
meta={meta}
134136
/>
135137
);
136138
// }
@@ -236,4 +238,5 @@ ChallengeListing.propTypes = {
236238
// isBucketSwitching: PT.bool,
237239
// userChallenges: PT.arrayOf(PT.string),
238240
isLoggedIn: PT.bool.isRequired,
241+
meta: PT.shape().isRequired,
239242
};

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ export class ListingContainer extends React.Component {
375375
hideTcLinksInSidebarFooter,
376376
// isBucketSwitching,
377377
// userChallenges,
378+
meta,
378379
} = this.props;
379380

380381
const { tokenV3 } = auth;
@@ -530,6 +531,7 @@ export class ListingContainer extends React.Component {
530531
// isBucketSwitching={isBucketSwitching}
531532
// userChallenges={[]}
532533
isLoggedIn={isLoggedIn}
534+
meta={meta}
533535
/>
534536
</div>
535537
);
@@ -555,7 +557,7 @@ ListingContainer.defaultProps = {
555557
preListingMsg: null,
556558
prizeMode: 'money-usd',
557559
queryBucket: BUCKETS.ALL,
558-
// meta: {},
560+
meta: {},
559561
// isBucketSwitching: false,
560562
// userChallenges: [],
561563
};
@@ -637,7 +639,7 @@ ListingContainer.propTypes = {
637639
expandedTags: PT.arrayOf(PT.number).isRequired,
638640
expandTag: PT.func.isRequired,
639641
queryBucket: PT.string,
640-
// meta: PT.shape(),
642+
meta: PT.shape(),
641643
// isBucketSwitching: PT.bool,
642644
selectBucketDone: PT.func.isRequired,
643645
getTotalChallengesCount: PT.func.isRequired,

0 commit comments

Comments
 (0)