Skip to content

Commit

Permalink
eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
isstuev committed Dec 6, 2024
1 parent 9e6fb3e commit d4d4ffc
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 23 deletions.
10 changes: 5 additions & 5 deletions types/api/advancedFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type AdvancedFilterAge = typeof ADVANCED_FILTER_AGES[number];
export type AdvancedFilterResponseItem = {
fee: string;
from: AddressParam;
created_contract?: AddressParam;
created_contract: AddressParam | null;
hash: string;
method: string | null;
timestamp: string;
Expand All @@ -42,12 +42,12 @@ export type AdvancedFilterResponseItem = {
} | null;
type: string;
value: string | null;
}
};

export type AdvancedFiltersSearchParams = {
methods: Record<string, string>;
tokens: Record<string, TokenInfo>;
}
};

export type AdvancedFilterResponse = {
items: Array<AdvancedFilterResponseItem>;
Expand All @@ -59,11 +59,11 @@ export type AdvancedFilterResponse = {
transaction_index: number;
items_count: number;
};
}
};

export type AdvancedFilterMethodsResponse = Array<AdvancedFilterMethodInfo>;

export type AdvancedFilterMethodInfo = {
method_id: string;
name?: string;
}
};
2 changes: 1 addition & 1 deletion ui/address/mud/AddressMudRecordsKeyFilterContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type Props = {
title: string;
columnName: string;
onClose?: () => void;
}
};

const AddressMudRecordsKeyFilter = ({ value = '', handleFilterChange, columnName, title, onClose }: Props) => {
const [ filterValue, setFilterValue ] = React.useState<string>(value);
Expand Down
6 changes: 3 additions & 3 deletions ui/advancedFilter/ColumnFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Props = {
isLoading?: boolean;
className?: string;
children: React.ReactNode;
}
};

type ContentProps = {
title: string;
Expand All @@ -29,7 +29,7 @@ type ContentProps = {
onReset?: () => void;
onClose?: () => void;
children: React.ReactNode;
}
};

const ColumnFilterContent = ({ title, isFilled, onFilter, onReset, onClose, children }: ContentProps) => {
const onFilterClick = React.useCallback(() => {
Expand All @@ -48,7 +48,7 @@ const ColumnFilterContent = ({ title, isFilled, onFilter, onReset, onClose, chil
color: isFilled ? 'link_hovered' : 'none',
}}
>
Reset
Reset
</Link>
</Flex>
{ children }
Expand Down
2 changes: 1 addition & 1 deletion ui/advancedFilter/FilterByColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Props = {
columnName: string;
handleFilterChange: (field: keyof AdvancedFilterParams, val: unknown) => void;
isLoading?: boolean;
}
};

const FilterByColumn = ({ column, filters, columnName, handleFilterChange, searchParams, isLoading }: Props) => {
const commonProps = { columnName, handleFilterChange, isLoading };
Expand Down
12 changes: 9 additions & 3 deletions ui/advancedFilter/ItemByColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ type Props = {
item: AdvancedFilterResponseItem;
column: ColumnsIds;
isLoading?: boolean;
}
};

const ItemByColumn = ({ item, column, isLoading }: Props) => {
switch (column) {
case 'tx_hash':
Expand All @@ -41,8 +42,13 @@ const ItemByColumn = ({ item, column, isLoading }: Props) => {
<AddressEntity address={ item.from } truncation="constant" isLoading={ isLoading }/>
</Flex>
);
case 'to':
return <AddressEntity address={ item.to ? item.to : item.created_contract } truncation="constant" isLoading={ isLoading }/>;
case 'to': {
const address = item.to ? item.to : item.created_contract;
if (!address) {
return null;
}
return <AddressEntity address={ address } truncation="constant" isLoading={ isLoading }/>;
}
case 'or_and':
return (
<AddressFromToIcon
Expand Down
4 changes: 2 additions & 2 deletions ui/advancedFilter/filters/AddressFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Props = {
type: 'from' | 'to';
isLoading?: boolean;
onClose?: () => void;
}
};

type InputProps = {
address?: string;
Expand All @@ -35,7 +35,7 @@ type InputProps = {
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
onClear: () => void;
onAddFieldClick: () => void;
}
};

const AddressFilterInput = ({ address, mode, onModeChange, onChange, onClear, isLast, onAddFieldClick }: InputProps) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion ui/advancedFilter/filters/AddressRelationFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Props = {
columnName: string;
isLoading?: boolean;
onClose?: () => void;
}
};

const AddressRelationFilter = ({ value = DEFAULT_VALUE, handleFilterChange, onClose }: Props) => {
const onFilter = React.useCallback((val: Value) => {
Expand Down
4 changes: 2 additions & 2 deletions ui/advancedFilter/filters/AgeFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ const FILTER_PARAM_TO = 'age_to';
const FILTER_PARAM_AGE = 'age';

const defaultValue = { age: '', from: '', to: '' } as const;
type AgeFromToValue = { age: AdvancedFilterAge | ''; from: string; to: string }
type AgeFromToValue = { age: AdvancedFilterAge | ''; from: string; to: string };

type Props = {
value?: AgeFromToValue;
handleFilterChange: (filed: keyof AdvancedFilterParams, value?: string) => void;
columnName: string;
isLoading?: boolean;
onClose?: () => void;
}
};

const AgeFilter = ({ value = defaultValue, handleFilterChange, onClose }: Props) => {
const [ currentValue, setCurrentValue ] = React.useState<AgeFromToValue>(value);
Expand Down
4 changes: 2 additions & 2 deletions ui/advancedFilter/filters/AmountFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ const PRESETS = [
];

const defaultValue = { from: '', to: '' };
type AmountValue = { from?: string; to?: string }
type AmountValue = { from?: string; to?: string };

type Props = {
value?: AmountValue;
handleFilterChange: (filed: keyof AdvancedFilterParams, value?: string) => void;
onClose?: () => void;
}
};

const AmountFilter = ({ value = {}, handleFilterChange, onClose }: Props) => {
const [ currentValue, setCurrentValue ] = React.useState<AmountValue>(value || defaultValue);
Expand Down
2 changes: 1 addition & 1 deletion ui/advancedFilter/filters/AssetFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Props = {
columnName: string;
isLoading?: boolean;
onClose?: () => void;
}
};

const AssetFilter = ({ value = [], handleFilterChange, onClose }: Props) => {
const [ currentValue, setCurrentValue ] = React.useState<Value>([ ...value ]);
Expand Down
2 changes: 1 addition & 1 deletion ui/advancedFilter/filters/MethodFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Props = {
value?: Array<AdvancedFilterMethodInfo>;
handleFilterChange: (filed: keyof AdvancedFilterParams, val: Array<string>) => void;
onClose?: () => void;
}
};

const MethodFilter = ({ value = [], handleFilterChange, onClose }: Props) => {
const [ currentValue, setCurrentValue ] = React.useState<Array<AdvancedFilterMethodInfo>>([ ...value ]);
Expand Down
2 changes: 1 addition & 1 deletion ui/advancedFilter/filters/TypeFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Props = {
value?: Array<AdvancedFilterType>;
handleFilterChange: (filed: keyof AdvancedFilterParams, value: Array<AdvancedFilterType>) => void;
onClose?: () => void;
}
};

const TypeFilter = ({ value = [], handleFilterChange, onClose }: Props) => {
const [ currentValue, setCurrentValue ] = React.useState<Array<AdvancedFilterType>>([ ...value ]);
Expand Down

0 comments on commit d4d4ffc

Please sign in to comment.