Skip to content

Commit

Permalink
fixes 3
Browse files Browse the repository at this point in the history
  • Loading branch information
isstuev committed Dec 11, 2024
1 parent 486bc57 commit d91ff15
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ui/advancedFilter/FilterByColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const FilterByColumn = ({ column, filters, columnName, handleFilterChange, searc

const value = tokens ?
Object.entries(tokens).map(([ address, token ]) => {
const mode = filters.token_contract_address_hashes_to_include?.find(i => i.toLowerCase() === address) ?
const mode = filters.token_contract_address_hashes_to_include?.find(i => i.toLowerCase() === address.toLowerCase()) ?
'include' as AssetFilterMode :
'exclude' as AssetFilterMode;
return ({ token, mode });
Expand Down
2 changes: 1 addition & 1 deletion ui/advancedFilter/ItemByColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ItemByColumn = ({ item, column, isLoading }: Props) => {
return <Tag isLoading={ isLoading }>{ type.name }</Tag>;
}
case 'method':
return item.method ? <Tag isLoading={ isLoading } isTruncated colorScheme="gray-blue">{ item.method }</Tag> : null;
return item.method ? <Tag isLoading={ isLoading } isTruncated colorScheme="gray">{ item.method }</Tag> : null;
case 'age':
return <TimeAgoWithTooltip timestamp={ item.timestamp } isLoading={ isLoading } color="text_secondary" fontWeight={ 400 }/>;
case 'from':
Expand Down
13 changes: 11 additions & 2 deletions ui/advancedFilter/filters/AddressFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ type InputProps = {
onAddFieldClick: () => void;
};

type AddressFilter = {
address: string;
mode: AddressFilterMode;
};

function addressFilterToKey(filter: AddressFilter) {
return `${ filter.address.toLowerCase() }-${ filter.mode }`;
}

const AddressFilterInput = ({ address, mode, onModeChange, onChange, onClear, isLast, onAddFieldClick }: InputProps) => {
return (
<Flex alignItems="center" w="100%">
Expand Down Expand Up @@ -78,7 +87,7 @@ const emptyItem = { address: '', mode: 'include' as AddressFilterMode };

const AddressFilter = ({ type, value = [], handleFilterChange, onClose }: Props) => {
const [ currentValue, setCurrentValue ] =
React.useState<Array<{ address: string; mode: AddressFilterMode }>>([ ...value, emptyItem ]);
React.useState<Array<AddressFilter>>([ ...value, emptyItem ]);

const handleModeSelectChange = React.useCallback((index: number) => (event: React.ChangeEvent<HTMLSelectElement>) => {
const value = event.target.value as AddressFilterMode;
Expand Down Expand Up @@ -126,7 +135,7 @@ const AddressFilter = ({ type, value = [], handleFilterChange, onClose }: Props)
<TableColumnFilter
title={ type === 'from' ? 'From address' : 'To address' }
isFilled={ Boolean(currentValue[0].address) }
isTouched={ !isEqual(currentValue.filter(i => i.address).map(i => JSON.stringify(i)).sort(), value.map(i => JSON.stringify(i)).sort()) }
isTouched={ !isEqual(currentValue.filter(i => i.address).map(addressFilterToKey).sort(), value.map(addressFilterToKey).sort()) }
onFilter={ onFilter }
onReset={ onReset }
onClose={ onClose }
Expand Down

0 comments on commit d91ff15

Please sign in to comment.