mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* envs and feature setup * home page layout * cross-chain txs page * cross-chain transfers page * cross-chain transfers on tx page * cross-chain messages on tx page * cross-chain tx page * cross-chain tx details token transfers * stats and counters for lists * migrate to new API version * add swagger * mobile lists * placeholder views on address page * tests * fix adaptive tabs initial state when there is only one tab in the list * tweaks * bug fixes * fix tests * update screenshots * migrate to new api version * add chain label tooltip, copy button to txs in lists and same address highlight * list views on address page * fix tests * fix links to current address in the list views * update tooltips * update tables layout * review fixes * fix spelling * update screenshots * update screenshot
60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
import { Box } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import type { TokenTransfer } from 'types/api/tokenTransfer';
|
|
|
|
import { ACTION_BAR_HEIGHT_DESKTOP } from 'ui/shared/ActionBar';
|
|
import DataListDisplay from 'ui/shared/DataListDisplay';
|
|
import type { QueryWithPagesResult } from 'ui/shared/pagination/useQueryWithPages';
|
|
import TokenTransferList from 'ui/shared/TokenTransfer/TokenTransferList';
|
|
import TokenTransferTable from 'ui/shared/TokenTransfer/TokenTransferTable';
|
|
|
|
import type { TxQuery } from '../useTxQuery';
|
|
|
|
interface Props {
|
|
txQuery: TxQuery;
|
|
tokenTransferQuery: QueryWithPagesResult<'general:tx_token_transfers'>;
|
|
tokenTransferFilter?: (data: TokenTransfer) => boolean;
|
|
numActiveFilters: number;
|
|
}
|
|
|
|
const TxTokenTransferLocal = ({ txQuery, tokenTransferQuery, tokenTransferFilter, numActiveFilters }: Props) => {
|
|
|
|
let items: Array<TokenTransfer> = [];
|
|
|
|
if (tokenTransferQuery.data?.items) {
|
|
if (tokenTransferQuery.isPlaceholderData) {
|
|
items = tokenTransferQuery.data?.items;
|
|
} else {
|
|
items = tokenTransferFilter ? tokenTransferQuery.data.items.filter(tokenTransferFilter) : tokenTransferQuery.data.items;
|
|
}
|
|
}
|
|
|
|
const content = tokenTransferQuery.data?.items ? (
|
|
<>
|
|
<Box hideBelow="lg">
|
|
<TokenTransferTable data={ items } top={ ACTION_BAR_HEIGHT_DESKTOP } isLoading={ tokenTransferQuery.isPlaceholderData }/>
|
|
</Box>
|
|
<Box hideFrom="lg">
|
|
<TokenTransferList data={ items } isLoading={ tokenTransferQuery.isPlaceholderData }/>
|
|
</Box>
|
|
</>
|
|
) : null;
|
|
|
|
return (
|
|
<DataListDisplay
|
|
isError={ txQuery.isError || tokenTransferQuery.isError }
|
|
itemsNum={ items.length }
|
|
emptyText="There are no token transfers."
|
|
hasActiveFilters={ Boolean(numActiveFilters) }
|
|
emptyStateProps={{
|
|
term: 'token transfer',
|
|
}}
|
|
>
|
|
{ content }
|
|
</DataListDisplay>
|
|
);
|
|
};
|
|
|
|
export default React.memo(TxTokenTransferLocal);
|