Skip to content

Commit 216bc0c

Browse files
Hover active filters (#10168)
- Quick view of active filters on table
1 parent 3e37550 commit 216bc0c

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

src/frontend/src/tables/InvenTreeTableHeader.tsx

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ import { t } from '@lingui/core/macro';
22
import {
33
ActionIcon,
44
Alert,
5+
Divider,
56
Group,
7+
HoverCard,
68
Indicator,
9+
Paper,
710
Space,
11+
Stack,
12+
Text,
813
Tooltip
914
} from '@mantine/core';
1015
import {
@@ -28,6 +33,7 @@ import type { InvenTreeTableProps } from '@lib/types/Tables';
2833
import { showNotification } from '@mantine/notifications';
2934
import { Boundary } from '../components/Boundary';
3035
import { PrintingActions } from '../components/buttons/PrintingActions';
36+
import { StylishText } from '../components/items/StylishText';
3137
import useDataExport from '../hooks/UseDataExport';
3238
import { useDeleteApiFormModal } from '../hooks/UseForm';
3339
import { TableColumnSelect } from './ColumnSelect';
@@ -242,9 +248,36 @@ export default function InvenTreeTableHeader({
242248
aria-label='table-select-filters'
243249
>
244250
<Tooltip label={t`Table Filters`} position='top-end'>
245-
<IconFilter
246-
onClick={() => setFiltersVisible(!filtersVisible)}
247-
/>
251+
<HoverCard
252+
position='bottom-end'
253+
withinPortal={true}
254+
disabled={!tableState.filterSet.activeFilters?.length}
255+
>
256+
<HoverCard.Target>
257+
<IconFilter
258+
onClick={() => setFiltersVisible(!filtersVisible)}
259+
/>
260+
</HoverCard.Target>
261+
<HoverCard.Dropdown>
262+
<Paper p='sm' withBorder>
263+
<Stack gap='xs'>
264+
<StylishText size='md'>{t`Active Filters`}</StylishText>
265+
<Divider />
266+
{tableState.filterSet.activeFilters?.map((filter) => (
267+
<Group
268+
key={filter.name}
269+
justify='space-between'
270+
gap='xl'
271+
wrap='nowrap'
272+
>
273+
<Text size='sm'>{filter.label}</Text>
274+
<Text size='xs'>{filter.displayValue}</Text>
275+
</Group>
276+
))}
277+
</Stack>
278+
</Paper>
279+
</HoverCard.Dropdown>
280+
</HoverCard>
248281
</Tooltip>
249282
</ActionIcon>
250283
</Indicator>

0 commit comments

Comments
 (0)