File tree 4 files changed +33
-10
lines changed
components/challenge-listing
containers/challenge-listing/Listing
4 files changed +33
-10
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import Tooltip from 'components/Tooltip';
32
32
import { config , Link } from 'topcoder-react-utils' ;
33
33
import { COMPOSE , PRIORITY } from 'react-css-super-themr' ;
34
34
import { REVIEW_OPPORTUNITY_TYPES } from 'utils/tc' ;
35
+ import { isFilterEmpty } from 'utils/challenge-listing/buckets' ;
35
36
import CheckmarkIcon from './CheckmarkIcon' ;
36
37
import DateRangePicker from '../DateRangePicker' ;
37
38
import style from './style.scss' ;
@@ -187,11 +188,12 @@ export default function FiltersPanel({
187
188
data : getLabel ( community ) ,
188
189
} ) ) ;
189
190
190
- const disableClearSaveFilterButtons = false ;
191
+ // const disableClearSaveFilterButtons = false;
191
192
// const disableClearSaveFilterButtons = isSavingFilter || (
192
193
// selectedCommunityId === defaultCommunityId
193
194
// && _.isEmpty(filterState)
194
195
// );
196
+ const disableClearSaveFilterButtons = isFilterEmpty ( filterState ) ;
195
197
196
198
const mapOps = item => ( { label : item , value : item } ) ;
197
199
const mapTypes = item => ( { label : item . name , value : item . abbreviation } ) ;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export default function Bucket({
32
32
challengesUrl,
33
33
expanded,
34
34
expand,
35
- // filterState,
35
+ filterState,
36
36
// keepPlaceholders,
37
37
loading,
38
38
loadMore,
@@ -108,7 +108,7 @@ export default function Bucket({
108
108
challengeType = { _ . find ( challengeTypes , { name : challenge . type } ) }
109
109
challengesUrl = { challengesUrl }
110
110
newChallengeDetails = { newChallengeDetails }
111
- onTechTagClicked = { tag => setFilterState ( { tags : [ tag ] } ) }
111
+ onTechTagClicked = { tag => setFilterState ( { ... _ . clone ( filterState ) , tags : [ tag ] } ) }
112
112
openChallengesInNewTabs = { openChallengesInNewTabs }
113
113
prizeMode = { prizeMode }
114
114
key = { challenge . id }
@@ -213,7 +213,7 @@ Bucket.propTypes = {
213
213
challenges : PT . arrayOf ( PT . shape ( ) ) . isRequired ,
214
214
challengeTypes : PT . arrayOf ( PT . shape ( ) ) ,
215
215
challengesUrl : PT . string . isRequired ,
216
- // filterState: PT.shape().isRequired,
216
+ filterState : PT . shape ( ) . isRequired ,
217
217
// keepPlaceholders: PT.bool,
218
218
loading : PT . bool ,
219
219
loadMore : PT . func ,
Original file line number Diff line number Diff line change @@ -254,12 +254,16 @@ export class ListingContainer extends React.Component {
254
254
auth . tokenV3 ,
255
255
f . front ,
256
256
) ;
257
- getMyChallenges (
258
- 0 ,
259
- f . back ,
260
- auth . tokenV3 ,
261
- f . front ,
262
- ) ;
257
+
258
+ // Only retrieve my challenge only when user has login
259
+ if ( auth . user ) {
260
+ getMyChallenges (
261
+ 0 ,
262
+ f . back ,
263
+ auth . tokenV3 ,
264
+ f . front ,
265
+ ) ;
266
+ }
263
267
// getPastChallenges(
264
268
// 0,
265
269
// f.back,
Original file line number Diff line number Diff line change @@ -190,4 +190,21 @@ export function sortChangedBucket(sorts, prevSorts) {
190
190
return '' ;
191
191
}
192
192
193
+ export function isFilterEmpty ( filter ) {
194
+ return _ . isEqual ( filter , {
195
+ tracks : {
196
+ Dev : true ,
197
+ Des : true ,
198
+ DS : true ,
199
+ QA : true ,
200
+ } ,
201
+ name : '' ,
202
+ tags : [ ] ,
203
+ types : [ ] ,
204
+ groups : [ ] ,
205
+ startDateStart : null ,
206
+ endDateEnd : null ,
207
+ } ) ;
208
+ }
209
+
193
210
export default undefined ;
You can’t perform that action at this time.
0 commit comments