Files
explore/ui/txs/TxsWithAPISorting.tsx
tom goriunovandGitHub 24eb4fc014 API resource refactoring (#2699)
* add prefix to API resources

* fix pw tests

* refactor config

* remove unnecessary prefixes in resource names

* fixes

* update screenshots
2025-05-01 15:22:38 +02:00

64 lines
1.6 KiB
TypeScript

import React from 'react';
import type { TxsSocketType } from './socket/types';
import type { AddressFromToFilter } from 'types/api/address';
import type { TransactionsSortingValue } from 'types/api/transaction';
import type { QueryWithPagesResult } from 'ui/shared/pagination/useQueryWithPages';
import getSortParamsFromValue from 'ui/shared/sort/getSortParamsFromValue';
import TxsContent from './TxsContent';
type Props = {
query: QueryWithPagesResult<'general:address_txs'>;
showBlockInfo?: boolean;
socketType?: TxsSocketType;
currentAddress?: string;
filter?: React.ReactNode;
filterValue?: AddressFromToFilter;
enableTimeIncrement?: boolean;
top?: number;
sorting: TransactionsSortingValue;
setSort: (value: TransactionsSortingValue) => void;
};
const TxsWithAPISorting = ({
filter,
filterValue,
query,
showBlockInfo = true,
socketType,
currentAddress,
enableTimeIncrement,
top,
sorting,
setSort,
}: Props) => {
const handleSortChange = React.useCallback((value: TransactionsSortingValue) => {
setSort(value);
query.onSortingChange(getSortParamsFromValue(value));
}, [ setSort, query ]);
return (
<TxsContent
filter={ filter }
filterValue={ filterValue }
showBlockInfo={ showBlockInfo }
socketType={ socketType }
currentAddress={ currentAddress }
enableTimeIncrement={ enableTimeIncrement }
top={ top }
items={ query.data?.items }
isPlaceholderData={ query.isPlaceholderData }
isError={ query.isError }
setSorting={ handleSortChange }
sort={ sorting }
query={ query }
/>
);
};
export default TxsWithAPISorting;