Skip to content

Commit

Permalink
fix: code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikmv committed Jan 13, 2025
1 parent 6101ea8 commit 16f9d52
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type ChangelogFilterProps = {
classes: { container: string },
filterValue: FilterValueType,
setFilterValue: (value: FilterValueType) => void,
columnToFilterBy: string | null,
setColumnToFilterBy: (value: string | null) => void,
fieldToFilterBy: string | null,
setfieldToFilterBy: (value: string | null) => void,
dataItemDefinitions: DataItemDefinitions,
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const ChangelogFilterBarPlain = ({
classes,
filterValue,
setFilterValue,
columnToFilterBy,
setColumnToFilterBy,
fieldToFilterBy,
setfieldToFilterBy,
dataItemDefinitions,
}: ChangelogFilterProps) => {
const [openMenu, setOpenMenu] = useState<string | null>(null);
Expand All @@ -36,14 +36,14 @@ const ChangelogFilterBarPlain = ({
setOpenMenu(null);
if (value === 'SHOW_ALL') {
setFilterValue('SHOW_ALL');
setColumnToFilterBy(null);
setfieldToFilterBy(null);
} else {
const column = getFilterColumn(value.id);
setFilterValue(value);
setColumnToFilterBy(column);
setfieldToFilterBy(column);
}
},
[setFilterValue, setColumnToFilterBy],
[setFilterValue, setfieldToFilterBy],
);

const dataItems = useMemo(
Expand All @@ -55,14 +55,14 @@ const ChangelogFilterBarPlain = ({
[dataItemDefinitions],
);

const selectedFilterValue = columnToFilterBy ? filterValue : 'SHOW_ALL';
const selectedFilterValue = fieldToFilterBy ? filterValue : 'SHOW_ALL';

return (
<div className={classes.container}>
<DropdownFilter
label={i18n.t('Data item')}
items={dataItems}
filterColumn="changelogFilterMenu"
filterColumn="dataItem"
openMenuName={openMenu}
onToggleMenu={toggleMenu}
onItemSelected={handleItemSelected}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const DropdownFilterPlain = ({

return (
<DropdownButton
className="filter-button"
open={isMenuOpen}
onClick={() => onToggleMenu(filterColumn)}
component={
Expand Down

0 comments on commit 16f9d52

Please sign in to comment.