Skip to content

Commit 38ec31a

Browse files
Merge pull request #6659 from topcoder-platform/develop
Release v1.18.3
2 parents bd11298 + c1fecb7 commit 38ec31a

File tree

8 files changed

+53
-13
lines changed

8 files changed

+53
-13
lines changed

__tests__/shared/components/challenge-listing/Listing/__snapshots__/Bucket.jsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ exports[`Matches shallow shapshot 1`] = `
8484
expanding={false}
8585
loadMore={[MockFunction]}
8686
loading={false}
87+
needLoad={false}
8788
newChallengeDetails={false}
8889
openChallengesInNewTabs={false}
8990
setFilterState={[MockFunction]}

src/shared/components/challenge-detail/Specification/SideBar/ShareSocial.jsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import React from 'react';
66

77
import TwitterIcon from '../../../../../assets/images/social/icon_twitter.svg';
88
import FacebookIcon from '../../../../../assets/images/social/icon_facebook.svg';
9-
import EmailIcon from '../../../../../assets/images/social/icon_email.svg';
109
import MoreIcon from '../../../../../assets/images/social/icon_plus.svg';
1110

1211
import './social_media.scss';
@@ -23,8 +22,15 @@ export default class ShareSocial extends React.Component {
2322
}
2423
} else {
2524
const scriptNode = document.createElement('script');
25+
const scriptNodeConfig = document.createElement('script');
26+
27+
scriptNode.type = 'text/javascript';
28+
scriptNodeConfig.type = 'text/javascript';
2629
scriptNode.src = 'https://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-52f22306211cecfc';
30+
scriptNodeConfig.text = "var addthis_config = { services_exclude: 'email' };";
31+
2732
this.shareDiv.appendChild(scriptNode);
33+
this.shareDiv.appendChild(scriptNodeConfig);
2834
}
2935
}
3036

@@ -48,15 +54,6 @@ export default class ShareSocial extends React.Component {
4854
>
4955
<TwitterIcon />
5056
</a>
51-
<a
52-
className="addthis_button_email"
53-
target="_blank"
54-
title="Email"
55-
aria-label="Email this challenge"
56-
href="#"
57-
>
58-
<EmailIcon />
59-
</a>
6057
<a
6158
className="addthis_button_compact"
6259
href="#"

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import './style.scss';
2424
// const COLLAPSED_SIZE = 10;
2525

2626
// const Filter = challengeUtils.filter;
27+
const LOADING_MESSAGE = 'Loading Challenges';
2728

2829
export default function Bucket({
2930
bucket,
@@ -36,6 +37,7 @@ export default function Bucket({
3637
expand,
3738
filterState,
3839
// keepPlaceholders,
40+
needLoad,
3941
loading,
4042
loadMore,
4143
newChallengeDetails,
@@ -137,7 +139,12 @@ export default function Bucket({
137139
title={BUCKET_DATA[bucket].name}
138140
/>
139141
<h1 styleName="no-results">
140-
{`${NO_LIVE_CHALLENGES_CONFIG[activeBucket]}`}
142+
{
143+
needLoad ? LOADING_MESSAGE
144+
: (
145+
`${NO_LIVE_CHALLENGES_CONFIG[activeBucket]}`
146+
)
147+
}
141148
</h1>
142149
</div>
143150
</div>
@@ -262,6 +269,7 @@ Bucket.defaultProps = {
262269
expand: _.noop,
263270
challengeTypes: [],
264271
// keepPlaceholders: false,
272+
needLoad: false,
265273
loading: false,
266274
loadMore: null,
267275
newChallengeDetails: false,
@@ -286,6 +294,7 @@ Bucket.propTypes = {
286294
challengesUrl: PT.string.isRequired,
287295
filterState: PT.shape().isRequired,
288296
// keepPlaceholders: PT.bool,
297+
needLoad: PT.bool,
289298
loading: PT.bool,
290299
loadMore: PT.func,
291300
newChallengeDetails: PT.bool,

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import './style.scss';
1717
const Filter = challengeUtils.filter;
1818

1919
const NO_RESULTS_MESSAGE = 'No challenges found';
20+
const LOADING_MESSAGE = 'Loading Challenges';
2021

2122
// Functional implementation of ReviewOpportunityBucket component
2223
export default function ReviewOpportunityBucket({
@@ -26,6 +27,7 @@ export default function ReviewOpportunityBucket({
2627
expandTag,
2728
filterState,
2829
keepPlaceholders,
30+
needLoad,
2931
loading,
3032
loadMore,
3133
opportunities,
@@ -133,7 +135,7 @@ export default function ReviewOpportunityBucket({
133135
onSelect={setSort}
134136
/>
135137
<h1 styleName="no-results">
136-
{NO_RESULTS_MESSAGE}
138+
{needLoad ? LOADING_MESSAGE : NO_RESULTS_MESSAGE}
137139
</h1>
138140
</div>
139141
</div>
@@ -154,6 +156,7 @@ ReviewOpportunityBucket.defaultProps = {
154156
expandedTags: [],
155157
expandTag: null,
156158
keepPlaceholders: false,
159+
needLoad: false,
157160
loading: false,
158161
loadMore: null,
159162
sort: null,
@@ -169,6 +172,7 @@ ReviewOpportunityBucket.propTypes = {
169172
filterState: PT.shape().isRequired,
170173
opportunities: PT.arrayOf(PT.shape()).isRequired,
171174
keepPlaceholders: PT.bool,
175+
needLoad: PT.bool,
172176
loading: PT.bool,
173177
loadMore: PT.func,
174178
setFilterState: PT.func.isRequired,

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import CardPlaceholder from '../placeholders/ChallengeCard';
1717
import './style.scss';
1818

1919
// const Filter = challengeUtils.filter;
20+
const LOADING_MESSAGE = 'Loading Challenges';
2021

2122
function Listing({
2223
activeBucket,
@@ -40,6 +41,7 @@ function Listing({
4041
// extraBucket,
4142
filterState,
4243
keepPastPlaceholders,
44+
needLoad,
4345
loadingPastChallenges,
4446
loadingReviewOpportunities,
4547
loadingMyChallenges,
@@ -152,6 +154,7 @@ function Listing({
152154
expandTag={expandTag}
153155
filterState={filterState}
154156
keepPlaceholders={keepPastPlaceholders}
157+
needLoad={needLoad}
155158
loading={loadingReviewOpportunities}
156159
loadMore={loadMoreReviewOpportunities}
157160
opportunities={reviewOpportunities}
@@ -182,6 +185,7 @@ function Listing({
182185
expandTag={expandTag}
183186
filterState={filterState}
184187
// keepPlaceholders={keepPlaceholders}
188+
needLoad={needLoad}
185189
loading={loading}
186190
loadMore={loadMore}
187191
newChallengeDetails={newChallengeDetails}
@@ -255,7 +259,14 @@ function Listing({
255259
loading
256260
? placeholders
257261
: (!filterState.recommended || activeBucket !== 'openForRegistration') && (
258-
<div styleName="no-results">{ `${NO_LIVE_CHALLENGES_CONFIG[activeBucket]}` }</div>
262+
<div styleName="no-results">
263+
{
264+
needLoad ? LOADING_MESSAGE
265+
: (
266+
`${NO_LIVE_CHALLENGES_CONFIG[activeBucket]}`
267+
)
268+
}
269+
</div>
259270
)
260271
}
261272
</div>
@@ -322,6 +333,7 @@ Listing.propTypes = {
322333
// extraBucket: PT.string,
323334
filterState: PT.shape().isRequired,
324335
keepPastPlaceholders: PT.bool.isRequired,
336+
needLoad: PT.bool.isRequired,
325337
loadingPastChallenges: PT.bool.isRequired,
326338
loadingMyChallenges: PT.bool.isRequired,
327339
loadingMyPastChallenges: PT.bool.isRequired,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.challengeCardContainer {
44
border-radius: $corner-radius;
55
width: 76.5%;
6+
margin-left: auto;
67

78
@include xs-to-md {
89
width: 100%;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export default function ChallengeListing(props) {
118118
// extraBucket={extraBucket}
119119
filterState={props.filterState}
120120
keepPastPlaceholders={keepPastPlaceholders}
121+
needLoad={props.needLoad}
121122
loadingPastChallenges={props.loadingPastChallenges}
122123
loadingMyChallenges={props.loadingMyChallenges}
123124
loadingMyPastChallenges={props.loadingMyPastChallenges}
@@ -241,6 +242,7 @@ ChallengeListing.propTypes = {
241242
keepPastPlaceholders: PT.bool.isRequired,
242243
// lastUpdateOfActiveChallenges: PT.number.isRequired,
243244
// loadingChallenges: PT.bool.isRequired,
245+
needLoad: PT.bool.isRequired,
244246
loadingMyChallenges: PT.bool.isRequired,
245247
loadingMyPastChallenges: PT.bool.isRequired,
246248
loadingAllChallenges: PT.bool.isRequired,

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class ListingContainer extends React.Component {
4444
super(props);
4545

4646
this.state = {
47+
needLoad: true,
4748
previousBucketOfActiveTab: null,
4849
previousBucketOfPastChallengesTab: null,
4950
};
@@ -132,6 +133,7 @@ export class ListingContainer extends React.Component {
132133
dropPastChallenges,
133134
getPastChallenges,
134135
filterState,
136+
loading,
135137
} = this.props;
136138
const oldUserId = _.get(prevProps, 'auth.user.userId');
137139
const userId = _.get(this.props, 'auth.user.userId');
@@ -257,6 +259,10 @@ export class ListingContainer extends React.Component {
257259
}
258260
if (filterChanged(filter, prevProps.filter)) {
259261
this.reloadChallenges();
262+
if (!loading) {
263+
// eslint-disable-next-line react/no-did-update-set-state
264+
this.setState({ needLoad: false });
265+
}
260266
}
261267
setTimeout(() => {
262268
selectBucketDone();
@@ -495,6 +501,7 @@ export class ListingContainer extends React.Component {
495501
} = this.props;
496502

497503
const {
504+
needLoad,
498505
previousBucketOfActiveTab,
499506
previousBucketOfPastChallengesTab,
500507
} = this.state;
@@ -630,6 +637,7 @@ export class ListingContainer extends React.Component {
630637
keepPastPlaceholders={keepPastPlaceholders}
631638
// lastUpdateOfActiveChallenges={lastUpdateOfActiveChallenges}
632639
// eslint-disable-next-line max-len
640+
needLoad={needLoad}
633641
loadingMyChallenges={Boolean(loadingMyChallengesUUID)}
634642
loadingMyPastChallenges={Boolean(loadingMyPastChallengesUUID)}
635643
loadingAllChallenges={Boolean(loadingAllChallengesUUID)}
@@ -706,6 +714,7 @@ ListingContainer.defaultProps = {
706714
queryBucket: BUCKETS.OPEN_FOR_REGISTRATION,
707715
meta: {},
708716
expanding: false,
717+
loading: false,
709718
// isBucketSwitching: false,
710719
// userChallenges: [],
711720
};
@@ -805,6 +814,7 @@ ListingContainer.propTypes = {
805814
// getUserChallenges: PT.func.isRequired,
806815
setSearchText: PT.func.isRequired,
807816
filterState: PT.shape().isRequired,
817+
loading: PT.bool,
808818
};
809819

810820
const mapStateToProps = (state, ownProps) => {
@@ -865,6 +875,10 @@ const mapStateToProps = (state, ownProps) => {
865875
meta: cl.meta,
866876
// userChallenges: cl.userChallenges,
867877
filterState: cl.filter,
878+
loading: Boolean(cl.loadingActiveChallengesUUID)
879+
|| Boolean(cl.loadingOpenForRegistrationChallengesUUID)
880+
|| Boolean(cl.loadingMyChallengesUUID) || Boolean(cl.loadingAllChallengesUUID)
881+
|| Boolean(cl.loadingPastChallengesUUID) || cl.loadingReviewOpportunitiesUUID,
868882
};
869883
};
870884

0 commit comments

Comments
 (0)