Skip to content

Commit 83e012b

Browse files
Merge pull request topcoder-platform#4989 from narekcat/issue-4964
fix: for issue topcoder-platform#4964
2 parents 692b747 + 346296a commit 83e012b

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
@@ -59,6 +59,7 @@ function Listing({
5959
expandTag,
6060
// pastSearchTimestamp,
6161
isLoggedIn,
62+
meta,
6263
}) {
6364
// const buckets = getBuckets(userChallenges);
6465
// const isChallengesAvailable = (bucket) => {
@@ -78,6 +79,7 @@ function Listing({
7879
let loadMore;
7980
// let searchTimestamp;
8081
let bucketChallenges = [];
82+
let newExpanded = expanded;
8183
switch (bucket) {
8284
// case BUCKETS.PAST:
8385
// keepPlaceholders = keepPastPlaceholders;
@@ -90,16 +92,19 @@ function Listing({
9092
bucketChallenges = [].concat(myChallenges);
9193
loading = loadingMyChallenges;
9294
loadMore = allMyChallengesLoaded ? null : loadMoreMy;
95+
newExpanded = newExpanded || (+meta.myChallengesCount === bucketChallenges.length);
9396
break;
9497
case BUCKETS.OPEN_FOR_REGISTRATION:
9598
bucketChallenges = [].concat(openForRegistrationChallenges);
9699
loading = loadingOpenForRegistrationChallenges;
97100
loadMore = allOpenForRegistrationChallengesLoaded ? null : loadMoreOpenForRegistration;
101+
newExpanded = newExpanded || (+meta.openChallengesCount === bucketChallenges.length);
98102
break;
99103
case BUCKETS.ONGOING:
100104
bucketChallenges = [].concat(challenges);
101105
loading = loadingOnGoingChallenges;
102106
loadMore = allActiveChallengesLoaded ? null : loadMoreOnGoing;
107+
newExpanded = newExpanded || (+meta.ongoingChallengesCount === bucketChallenges.length);
103108
break;
104109
default:
105110
break;
@@ -137,7 +142,7 @@ function Listing({
137142
challengesUrl={challengesUrl}
138143
communityName={communityName}
139144
expand={() => selectBucket(bucket)}
140-
expanded={expanded}
145+
expanded={newExpanded}
141146
expandedTags={expandedTags}
142147
expandTag={expandTag}
143148
filterState={filterState}
@@ -268,6 +273,7 @@ Listing.propTypes = {
268273
// pastSearchTimestamp: PT.number,
269274
// userChallenges: PT.arrayOf(PT.string),
270275
isLoggedIn: PT.bool.isRequired,
276+
meta: PT.shape().isRequired,
271277
};
272278

273279
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)