refactor: filters list component (#1687)

* refactor: filters list component

* fix: build error
This commit is contained in:
Aaryan Khandelwal 2023-07-27 00:57:12 +05:30 committed by GitHub
parent 0b86080166
commit c54b8b9a15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 139 additions and 196 deletions

View file

@ -200,17 +200,15 @@ export const MyIssuesView: React.FC<Props> = ({
},
[makeIssueCopy, handleEditIssue, handleDeleteIssue]
);
const filtersToShow = { ...filters };
delete filtersToShow?.assignees;
delete filtersToShow?.created_by;
const nullFilters = Object.keys(filtersToShow).filter(
(key) => filtersToShow[key as keyof IIssueFilterOptions] === null
const filtersToDisplay = { ...filters, assignees: null, created_by: null };
const nullFilters = Object.keys(filtersToDisplay).filter(
(key) => filtersToDisplay[key as keyof IIssueFilterOptions] === null
);
const areFiltersApplied =
Object.keys(filtersToShow).length > 0 &&
nullFilters.length !== Object.keys(filtersToShow).length;
Object.keys(filtersToDisplay).length > 0 &&
nullFilters.length !== Object.keys(filtersToDisplay).length;
return (
<>
@ -242,7 +240,7 @@ export const MyIssuesView: React.FC<Props> = ({
<>
<div className="flex items-center justify-between gap-2 px-5 pt-3 pb-0">
<FiltersList
filters={filtersToShow}
filters={filtersToDisplay}
setFilters={setFilters}
labels={labels}
members={undefined}