Skip to content

Commit

Permalink
feat(FiltersApplied): stateType support
Browse files Browse the repository at this point in the history
  • Loading branch information
asabotovich committed Aug 22, 2023
1 parent 7d5fbeb commit cf03dd5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/components/FiltersPanelApplied/FiltersPanelApplied.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ export const FiltersPanelApplied: React.FC<FiltersPanelAppliedProps> = ({
appliedMap[tr('State')] = queryState.state.map((s) => statesMap[s]?.title).filter(Boolean);
}

if (queryState.stateType.length && states?.length) {
appliedMap[tr('State')] = states.reduce((acum, { type, title }) => {
if (queryState.stateType.includes(type) && !acum.includes(title)) {
acum.push(title);
}
return acum;
}, appliedMap[tr('State')] || []);
}

if (queryState.issuer.length && issuers?.length) {
appliedMap[tr('Issuer')] = queryState.issuer.map((u) => issuersMap[u]?.user?.name).filter(Boolean) as string[];
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/StateFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StateType } from '@prisma/client';

import { ColorizedFilterDropdown } from './ColorizedFilterDropdown';

type State = { id: string; title: string; hue: number; type: string };
type State = { id: string; title: string; hue: number; type: StateType };

export const StateFilter: FC<{
text: string;
Expand Down

0 comments on commit cf03dd5

Please sign in to comment.