Skip to content

Commit e73c49e

Browse files
committed
fix: review opp numbers a little while
1 parent ff0ec42 commit e73c49e

File tree

8 files changed

+35
-3
lines changed

8 files changed

+35
-3
lines changed

__tests__/shared/components/challenge-listing/Filters/__snapshots__/FiltersPanel.jsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ exports[`Matches shallow shapshot 2`] = `
6767
expanding={false}
6868
isAuth={false}
6969
isReviewer={false}
70+
loading={true}
7071
past={false}
7172
/>
7273
</div>

__tests__/shared/components/challenge-listing/Sidebar/__snapshots__/index.jsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ exports[`Matches shallow shapshot 1`] = `
1313
disabled={false}
1414
expanding={false}
1515
isAuth={false}
16+
loading={true}
1617
past={false}
1718
selectBucket={[MockFunction]}
1819
/>
@@ -36,6 +37,7 @@ exports[`Matches shallow shapshot 2`] = `
3637
disabled={false}
3738
expanding={false}
3839
isAuth={false}
40+
loading={true}
3941
past={false}
4042
selectBucket={[MockFunction]}
4143
/>

src/shared/components/challenge-listing/Sidebar/BucketSelector/Bucket/index.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function Bucket({
2020
onClick,
2121
// allActiveChallengesLoaded,
2222
meta,
23+
loading,
2324
}) {
2425
// let countEl;
2526
// if (!disabled) { // !bucket.hideCount &&
@@ -93,7 +94,7 @@ function Bucket({
9394
}}
9495
/>
9596
<span styleName="bucketName">{BUCKET_DATA[bucket].name}</span>
96-
{(bucket !== BUCKETS.ALL && count > 0) ? <span styleName="count">{count}</span> : null}
97+
{(bucket !== BUCKETS.ALL && count > 0 && !loading) ? <span styleName="count">{count}</span> : null}
9798
</div>
9899
);
99100
}
@@ -103,6 +104,7 @@ Bucket.defaultProps = {
103104
disabled: false,
104105
onClick: _.noop,
105106
meta: {},
107+
loading: true,
106108
};
107109

108110
Bucket.propTypes = {
@@ -119,6 +121,7 @@ Bucket.propTypes = {
119121
onClick: PT.func,
120122
meta: PT.shape(),
121123
// allActiveChallengesLoaded: PT.bool.isRequired,
124+
loading: PT.bool,
122125
};
123126

124127
const mapStateToProps = (state) => {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default function BucketSelector({
3636
// setEditSavedFiltersMode,
3737
past,
3838
auth,
39+
loading,
3940
}) {
4041
// let filteredChallenges = challenges.filter(Filter.getFilterFunction(filterState));
4142

@@ -59,6 +60,7 @@ export default function BucketSelector({
5960
document.body.scrollTop = 0;
6061
document.documentElement.scrollTop = 0;
6162
}}
63+
loading={loading}
6264
/>
6365
);
6466
};
@@ -144,6 +146,7 @@ BucketSelector.defaultProps = {
144146
isAuth: false,
145147
expanding: false,
146148
past: false,
149+
loading: true,
147150
};
148151

149152
BucketSelector.propTypes = {
@@ -168,4 +171,5 @@ BucketSelector.propTypes = {
168171
// selectSavedFilter: PT.func.isRequired,
169172
// setEditSavedFiltersMode: PT.func.isRequired,
170173
past: PT.bool,
174+
loading: PT.bool,
171175
};

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default function SideBarFilters({
5353
// updateSavedFilter,
5454
// setFilter,
5555
setFilterState,
56+
loading,
5657
}) {
5758
const past = isPastBucket(activeBucket);
5859

@@ -120,6 +121,7 @@ export default function SideBarFilters({
120121
// selectSavedFilter={selectSavedFilter}
121122
// setEditSavedFiltersMode={setEditSavedFiltersMode}
122123
past={past}
124+
loading={loading}
123125
/>
124126
{/* )} */}
125127
</div>
@@ -168,4 +170,5 @@ SideBarFilters.propTypes = {
168170
// updateSavedFilter: PT.func.isRequired,
169171
// setFilter: PT.func.isRequired,
170172
setFilterState: PT.func.isRequired,
173+
loading: PT.bool.isRequired,
171174
};

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ export default function ChallengeListing(props) {
175175
<Sidebar
176176
expanding={expanding}
177177
setFilterState={props.setFilterState}
178+
loadingMyChallenges={props.loadingMyChallenges}
179+
loadingOpenForRegistrationChallenges={props.loadingOpenForRegistrationChallenges}
180+
loadingReviewOpportunities={props.loadingReviewOpportunities}
178181
/>
179182

180183
<FilterPanel

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export class ListingContainer extends React.Component {
6464
selectCommunity,
6565
queryBucket,
6666
filter,
67+
getReviewOpportunities,
6768
} = this.props;
6869

6970
markHeaderMenu();
@@ -105,6 +106,8 @@ export class ListingContainer extends React.Component {
105106
});
106107
}
107108
// }
109+
110+
getReviewOpportunities(0, auth.tokenV3);
108111
}
109112

110113
componentDidUpdate(prevProps) {
@@ -138,6 +141,7 @@ export class ListingContainer extends React.Component {
138141
loading,
139142
setFilter,
140143
} = this.props;
144+
141145
const oldUserId = _.get(prevProps, 'auth.user.userId');
142146
const userId = _.get(this.props, 'auth.user.userId');
143147
const handle = _.get(auth, 'user.handle');
@@ -347,7 +351,6 @@ export class ListingContainer extends React.Component {
347351
getMyPastChallenges,
348352
getAllChallenges,
349353
getPastChallenges,
350-
getReviewOpportunities,
351354
// lastRequestedPageOfActiveChallenges,
352355
// lastRequestedPageOfOpenForRegistrationChallenges,
353356
// lastRequestedPageOfMyChallenges,
@@ -405,7 +408,6 @@ export class ListingContainer extends React.Component {
405408
f.front,
406409
);
407410
getTotalChallengesCount(auth.tokenV3, f.front);
408-
getReviewOpportunities(0, auth.tokenV3);
409411
}
410412

411413
reloadChallenges() {

src/shared/containers/challenge-listing/Sidebar.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ export class SidebarContainer extends React.Component {
7171
// userChallenges,
7272
// } = this.props;
7373

74+
const {
75+
loadingMyChallenges,
76+
loadingOpenForRegistrationChallenges,
77+
loadingReviewOpportunities,
78+
} = this.props;
79+
7480
const {
7581
previousBucketOfActiveTab,
7682
previousBucketOfPastChallengesTab,
@@ -98,6 +104,10 @@ export class SidebarContainer extends React.Component {
98104

99105
// const savedFilters = checkFilterErrors(origSavedFilters, updatedCommunityFilters);
100106

107+
const loading = loadingMyChallenges
108+
|| loadingOpenForRegistrationChallenges
109+
|| loadingReviewOpportunities;
110+
101111
return (
102112
<Sidebar
103113
{...this.props}
@@ -126,6 +136,7 @@ export class SidebarContainer extends React.Component {
126136
setPreviousBucketOfPastChallengesTab={(bucket) => {
127137
this.setState({ previousBucketOfPastChallengesTab: bucket });
128138
}}
139+
loading={loading}
129140
/>
130141
);
131142
}
@@ -160,6 +171,9 @@ SidebarContainer.propTypes = {
160171
// user: PT.shape(),
161172
// userChallenges: PT.arrayOf(PT.string),
162173
expanding: PT.bool,
174+
loadingMyChallenges: PT.bool.isRequired,
175+
loadingOpenForRegistrationChallenges: PT.bool.isRequired,
176+
loadingReviewOpportunities: PT.bool.isRequired,
163177
};
164178

165179
function mapDispatchToProps(dispatch) {

0 commit comments

Comments
 (0)