Skip to content

Feature refactor challengelist fixes #4983

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
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 @@ -32,6 +32,7 @@ import Tooltip from 'components/Tooltip';
import { config, Link } from 'topcoder-react-utils';
import { COMPOSE, PRIORITY } from 'react-css-super-themr';
import { REVIEW_OPPORTUNITY_TYPES } from 'utils/tc';
import { isFilterEmpty } from 'utils/challenge-listing/buckets';
import CheckmarkIcon from './CheckmarkIcon';
import DateRangePicker from '../DateRangePicker';
import style from './style.scss';
Expand Down Expand Up @@ -187,11 +188,12 @@ export default function FiltersPanel({
data: getLabel(community),
}));

const disableClearSaveFilterButtons = false;
// const disableClearSaveFilterButtons = false;
// const disableClearSaveFilterButtons = isSavingFilter || (
// selectedCommunityId === defaultCommunityId
// && _.isEmpty(filterState)
// );
const disableClearSaveFilterButtons = isFilterEmpty(filterState);

const mapOps = item => ({ label: item, value: item });
const mapTypes = item => ({ label: item.name, value: item.abbreviation });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function Bucket({
challengesUrl,
expanded,
expand,
// filterState,
filterState,
// keepPlaceholders,
loading,
loadMore,
Expand Down Expand Up @@ -108,7 +108,7 @@ export default function Bucket({
challengeType={_.find(challengeTypes, { name: challenge.type })}
challengesUrl={challengesUrl}
newChallengeDetails={newChallengeDetails}
onTechTagClicked={tag => setFilterState({ tags: [tag] })}
onTechTagClicked={tag => setFilterState({ ..._.clone(filterState), tags: [tag] })}
openChallengesInNewTabs={openChallengesInNewTabs}
prizeMode={prizeMode}
key={challenge.id}
Expand Down Expand Up @@ -213,7 +213,7 @@ Bucket.propTypes = {
challenges: PT.arrayOf(PT.shape()).isRequired,
challengeTypes: PT.arrayOf(PT.shape()),
challengesUrl: PT.string.isRequired,
// filterState: PT.shape().isRequired,
filterState: PT.shape().isRequired,
// keepPlaceholders: PT.bool,
loading: PT.bool,
loadMore: PT.func,
Expand Down
16 changes: 10 additions & 6 deletions src/shared/containers/challenge-listing/Listing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,16 @@ export class ListingContainer extends React.Component {
auth.tokenV3,
f.front,
);
getMyChallenges(
0,
f.back,
auth.tokenV3,
f.front,
);

// Only retrieve my challenge only when user has login
if (auth.user) {
getMyChallenges(
0,
f.back,
auth.tokenV3,
f.front,
);
}
// getPastChallenges(
// 0,
// f.back,
Expand Down
17 changes: 17 additions & 0 deletions src/shared/utils/challenge-listing/buckets.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,21 @@ export function sortChangedBucket(sorts, prevSorts) {
return '';
}

export function isFilterEmpty(filter) {
return _.isEqual(filter, {
tracks: {
Dev: true,
Des: true,
DS: true,
QA: true,
},
name: '',
tags: [],
types: [],
groups: [],
startDateStart: null,
endDateEnd: null,
});
}

export default undefined;