Advanced filter: amount (#3208)

This commit is contained in:
Igor Stuev
2026-01-01 20:11:44 +01:00
committed by GitHub
parent 4335faeb35
commit 590e23282f
3 changed files with 8 additions and 13 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

+8 -13
View File
@@ -7,9 +7,9 @@ import type { AdvancedFilterParams } from 'types/api/advancedFilter';
import { Input } from 'toolkit/chakra/input';
import { PopoverCloseTriggerWrapper } from 'toolkit/chakra/popover';
import { Tag } from 'toolkit/chakra/tag';
import { ndash } from 'toolkit/utils/htmlEntities';
import TableColumnFilter from 'ui/shared/filters/TableColumnFilter';
import TagGroupSelect from 'ui/shared/tagGroupSelect/TagGroupSelect';
const FILTER_PARAM_FROM = 'amount_from';
const FILTER_PARAM_TO = 'amount_to';
@@ -67,8 +67,8 @@ const AmountFilter = ({ value = {}, handleFilterChange }: Props) => {
handleFilterChange(FILTER_PARAM_TO, currentValue.to);
}, [ handleFilterChange, currentValue ]);
const onPresetClick = React.useCallback((event: React.SyntheticEvent) => {
const to = (event.currentTarget as HTMLDivElement).getAttribute('data-id') as string;
const onPresetChange = React.useCallback((to: string) => {
setCurrentValue({ from: '', to });
handleFilterChange(FILTER_PARAM_FROM, '');
handleFilterChange(FILTER_PARAM_TO, to);
}, [ handleFilterChange ]);
@@ -84,16 +84,11 @@ const AmountFilter = ({ value = {}, handleFilterChange }: Props) => {
>
<PopoverCloseTriggerWrapper>
<Flex gap={ 3 }>
{ PRESETS.map(preset => (
<Tag
key={ preset.value }
data-id={ preset.value }
onClick={ onPresetClick }
variant="select"
>
{ preset.name }
</Tag>
)) }
<TagGroupSelect<string>
items={ PRESETS.map((preset) => ({ id: preset.value, title: preset.name })) }
onChange={ onPresetChange }
value={ (!currentValue.from || currentValue.from === '0') ? PRESETS.find(preset => preset.value === currentValue.to)?.value : undefined }
/>
</Flex>
</PopoverCloseTriggerWrapper>
<Flex mt={ 3 } alignItems="center">