Skip to content

Release v1.18.3 #6659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ exports[`Matches shallow shapshot 1`] = `
expanding={false}
loadMore={[MockFunction]}
loading={false}
needLoad={false}
newChallengeDetails={false}
openChallengesInNewTabs={false}
setFilterState={[MockFunction]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import React from 'react';

import TwitterIcon from '../../../../../assets/images/social/icon_twitter.svg';
import FacebookIcon from '../../../../../assets/images/social/icon_facebook.svg';
import EmailIcon from '../../../../../assets/images/social/icon_email.svg';
import MoreIcon from '../../../../../assets/images/social/icon_plus.svg';

import './social_media.scss';
Expand All @@ -23,8 +22,15 @@ export default class ShareSocial extends React.Component {
}
} else {
const scriptNode = document.createElement('script');
const scriptNodeConfig = document.createElement('script');

scriptNode.type = 'text/javascript';
scriptNodeConfig.type = 'text/javascript';
scriptNode.src = 'https://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-52f22306211cecfc';
scriptNodeConfig.text = "var addthis_config = { services_exclude: 'email' };";

this.shareDiv.appendChild(scriptNode);
this.shareDiv.appendChild(scriptNodeConfig);
}
}

Expand All @@ -48,15 +54,6 @@ export default class ShareSocial extends React.Component {
>
<TwitterIcon />
</a>
<a
className="addthis_button_email"
target="_blank"
title="Email"
aria-label="Email this challenge"
href="#"
>
<EmailIcon />
</a>
<a
className="addthis_button_compact"
href="#"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import './style.scss';
// const COLLAPSED_SIZE = 10;

// const Filter = challengeUtils.filter;
const LOADING_MESSAGE = 'Loading Challenges';

export default function Bucket({
bucket,
Expand All @@ -36,6 +37,7 @@ export default function Bucket({
expand,
filterState,
// keepPlaceholders,
needLoad,
loading,
loadMore,
newChallengeDetails,
Expand Down Expand Up @@ -137,7 +139,12 @@ export default function Bucket({
title={BUCKET_DATA[bucket].name}
/>
<h1 styleName="no-results">
{`${NO_LIVE_CHALLENGES_CONFIG[activeBucket]}`}
{
needLoad ? LOADING_MESSAGE
: (
`${NO_LIVE_CHALLENGES_CONFIG[activeBucket]}`
)
}
</h1>
</div>
</div>
Expand Down Expand Up @@ -262,6 +269,7 @@ Bucket.defaultProps = {
expand: _.noop,
challengeTypes: [],
// keepPlaceholders: false,
needLoad: false,
loading: false,
loadMore: null,
newChallengeDetails: false,
Expand All @@ -286,6 +294,7 @@ Bucket.propTypes = {
challengesUrl: PT.string.isRequired,
filterState: PT.shape().isRequired,
// keepPlaceholders: PT.bool,
needLoad: PT.bool,
loading: PT.bool,
loadMore: PT.func,
newChallengeDetails: PT.bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import './style.scss';
const Filter = challengeUtils.filter;

const NO_RESULTS_MESSAGE = 'No challenges found';
const LOADING_MESSAGE = 'Loading Challenges';

// Functional implementation of ReviewOpportunityBucket component
export default function ReviewOpportunityBucket({
Expand All @@ -26,6 +27,7 @@ export default function ReviewOpportunityBucket({
expandTag,
filterState,
keepPlaceholders,
needLoad,
loading,
loadMore,
opportunities,
Expand Down Expand Up @@ -133,7 +135,7 @@ export default function ReviewOpportunityBucket({
onSelect={setSort}
/>
<h1 styleName="no-results">
{NO_RESULTS_MESSAGE}
{needLoad ? LOADING_MESSAGE : NO_RESULTS_MESSAGE}
</h1>
</div>
</div>
Expand All @@ -154,6 +156,7 @@ ReviewOpportunityBucket.defaultProps = {
expandedTags: [],
expandTag: null,
keepPlaceholders: false,
needLoad: false,
loading: false,
loadMore: null,
sort: null,
Expand All @@ -169,6 +172,7 @@ ReviewOpportunityBucket.propTypes = {
filterState: PT.shape().isRequired,
opportunities: PT.arrayOf(PT.shape()).isRequired,
keepPlaceholders: PT.bool,
needLoad: PT.bool,
loading: PT.bool,
loadMore: PT.func,
setFilterState: PT.func.isRequired,
Expand Down
14 changes: 13 additions & 1 deletion src/shared/components/challenge-listing/Listing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import CardPlaceholder from '../placeholders/ChallengeCard';
import './style.scss';

// const Filter = challengeUtils.filter;
const LOADING_MESSAGE = 'Loading Challenges';

function Listing({
activeBucket,
Expand All @@ -40,6 +41,7 @@ function Listing({
// extraBucket,
filterState,
keepPastPlaceholders,
needLoad,
loadingPastChallenges,
loadingReviewOpportunities,
loadingMyChallenges,
Expand Down Expand Up @@ -152,6 +154,7 @@ function Listing({
expandTag={expandTag}
filterState={filterState}
keepPlaceholders={keepPastPlaceholders}
needLoad={needLoad}
loading={loadingReviewOpportunities}
loadMore={loadMoreReviewOpportunities}
opportunities={reviewOpportunities}
Expand Down Expand Up @@ -182,6 +185,7 @@ function Listing({
expandTag={expandTag}
filterState={filterState}
// keepPlaceholders={keepPlaceholders}
needLoad={needLoad}
loading={loading}
loadMore={loadMore}
newChallengeDetails={newChallengeDetails}
Expand Down Expand Up @@ -255,7 +259,14 @@ function Listing({
loading
? placeholders
: (!filterState.recommended || activeBucket !== 'openForRegistration') && (
<div styleName="no-results">{ `${NO_LIVE_CHALLENGES_CONFIG[activeBucket]}` }</div>
<div styleName="no-results">
{
needLoad ? LOADING_MESSAGE
: (
`${NO_LIVE_CHALLENGES_CONFIG[activeBucket]}`
)
}
</div>
)
}
</div>
Expand Down Expand Up @@ -322,6 +333,7 @@ Listing.propTypes = {
// extraBucket: PT.string,
filterState: PT.shape().isRequired,
keepPastPlaceholders: PT.bool.isRequired,
needLoad: PT.bool.isRequired,
loadingPastChallenges: PT.bool.isRequired,
loadingMyChallenges: PT.bool.isRequired,
loadingMyPastChallenges: PT.bool.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.challengeCardContainer {
border-radius: $corner-radius;
width: 76.5%;
margin-left: auto;

@include xs-to-md {
width: 100%;
Expand Down
2 changes: 2 additions & 0 deletions src/shared/components/challenge-listing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export default function ChallengeListing(props) {
// extraBucket={extraBucket}
filterState={props.filterState}
keepPastPlaceholders={keepPastPlaceholders}
needLoad={props.needLoad}
loadingPastChallenges={props.loadingPastChallenges}
loadingMyChallenges={props.loadingMyChallenges}
loadingMyPastChallenges={props.loadingMyPastChallenges}
Expand Down Expand Up @@ -241,6 +242,7 @@ ChallengeListing.propTypes = {
keepPastPlaceholders: PT.bool.isRequired,
// lastUpdateOfActiveChallenges: PT.number.isRequired,
// loadingChallenges: PT.bool.isRequired,
needLoad: PT.bool.isRequired,
loadingMyChallenges: PT.bool.isRequired,
loadingMyPastChallenges: PT.bool.isRequired,
loadingAllChallenges: PT.bool.isRequired,
Expand Down
14 changes: 14 additions & 0 deletions src/shared/containers/challenge-listing/Listing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class ListingContainer extends React.Component {
super(props);

this.state = {
needLoad: true,
previousBucketOfActiveTab: null,
previousBucketOfPastChallengesTab: null,
};
Expand Down Expand Up @@ -132,6 +133,7 @@ export class ListingContainer extends React.Component {
dropPastChallenges,
getPastChallenges,
filterState,
loading,
} = this.props;
const oldUserId = _.get(prevProps, 'auth.user.userId');
const userId = _.get(this.props, 'auth.user.userId');
Expand Down Expand Up @@ -257,6 +259,10 @@ export class ListingContainer extends React.Component {
}
if (filterChanged(filter, prevProps.filter)) {
this.reloadChallenges();
if (!loading) {
// eslint-disable-next-line react/no-did-update-set-state
this.setState({ needLoad: false });
}
}
setTimeout(() => {
selectBucketDone();
Expand Down Expand Up @@ -495,6 +501,7 @@ export class ListingContainer extends React.Component {
} = this.props;

const {
needLoad,
previousBucketOfActiveTab,
previousBucketOfPastChallengesTab,
} = this.state;
Expand Down Expand Up @@ -630,6 +637,7 @@ export class ListingContainer extends React.Component {
keepPastPlaceholders={keepPastPlaceholders}
// lastUpdateOfActiveChallenges={lastUpdateOfActiveChallenges}
// eslint-disable-next-line max-len
needLoad={needLoad}
loadingMyChallenges={Boolean(loadingMyChallengesUUID)}
loadingMyPastChallenges={Boolean(loadingMyPastChallengesUUID)}
loadingAllChallenges={Boolean(loadingAllChallengesUUID)}
Expand Down Expand Up @@ -706,6 +714,7 @@ ListingContainer.defaultProps = {
queryBucket: BUCKETS.OPEN_FOR_REGISTRATION,
meta: {},
expanding: false,
loading: false,
// isBucketSwitching: false,
// userChallenges: [],
};
Expand Down Expand Up @@ -805,6 +814,7 @@ ListingContainer.propTypes = {
// getUserChallenges: PT.func.isRequired,
setSearchText: PT.func.isRequired,
filterState: PT.shape().isRequired,
loading: PT.bool,
};

const mapStateToProps = (state, ownProps) => {
Expand Down Expand Up @@ -865,6 +875,10 @@ const mapStateToProps = (state, ownProps) => {
meta: cl.meta,
// userChallenges: cl.userChallenges,
filterState: cl.filter,
loading: Boolean(cl.loadingActiveChallengesUUID)
|| Boolean(cl.loadingOpenForRegistrationChallengesUUID)
|| Boolean(cl.loadingMyChallengesUUID) || Boolean(cl.loadingAllChallengesUUID)
|| Boolean(cl.loadingPastChallengesUUID) || cl.loadingReviewOpportunitiesUUID,
};
};

Expand Down