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
70 lines
2.1 KiB
TypeScript
70 lines
2.1 KiB
TypeScript
import { Box } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import type { TokenType } from 'types/api/token';
|
|
|
|
import ActionBar, { ACTION_BAR_HEIGHT_DESKTOP } from 'ui/shared/ActionBar';
|
|
import DataListDisplay from 'ui/shared/DataListDisplay';
|
|
import PopoverFilter from 'ui/shared/filters/PopoverFilter';
|
|
import TokenTypeFilter from 'ui/shared/filters/TokenTypeFilter';
|
|
import Pagination from 'ui/shared/pagination/Pagination';
|
|
|
|
import TokenTransfersListItem from './TokenTransfersListItem';
|
|
import TokenTransfersTable from './TokenTransfersTable';
|
|
import useTokenTransfersQuery from './useTokenTransfersQuery';
|
|
|
|
const TokenTransfersLocal = () => {
|
|
const { query, typeFilter, onTokenTypesChange } = useTokenTransfersQuery({ enabled: true });
|
|
|
|
const content = (
|
|
<>
|
|
<Box hideFrom="lg">
|
|
{ query.data?.items.map((item, index) => (
|
|
<TokenTransfersListItem
|
|
key={ item.transaction_hash + item.log_index + (query.isPlaceholderData ? index : '') }
|
|
isLoading={ query.isPlaceholderData }
|
|
item={ item }
|
|
/>
|
|
)) }
|
|
</Box>
|
|
<Box hideBelow="lg">
|
|
<TokenTransfersTable
|
|
items={ query.data?.items }
|
|
top={ query.pagination.isVisible ? ACTION_BAR_HEIGHT_DESKTOP : 0 }
|
|
isLoading={ query.isPlaceholderData }
|
|
/>
|
|
</Box>
|
|
</>
|
|
);
|
|
|
|
const filter = (
|
|
<PopoverFilter contentProps={{ w: '200px' }} appliedFiltersNum={ typeFilter.length }>
|
|
<TokenTypeFilter<TokenType> onChange={ onTokenTypesChange } defaultValue={ typeFilter } nftOnly={ false }/>
|
|
</PopoverFilter>
|
|
);
|
|
|
|
const actionBar = (
|
|
<ActionBar mt={ -6 }>
|
|
{ filter }
|
|
<Pagination { ...query.pagination }/>
|
|
</ActionBar>
|
|
);
|
|
|
|
return (
|
|
<DataListDisplay
|
|
isError={ query.isError }
|
|
itemsNum={ query.data?.items.length }
|
|
emptyText="There are no token transfers."
|
|
actionBar={ actionBar }
|
|
hasActiveFilters={ Boolean(typeFilter.length) }
|
|
emptyStateProps={{
|
|
term: 'token transfer',
|
|
}}
|
|
>
|
|
{ content }
|
|
</DataListDisplay>
|
|
);
|
|
};
|
|
|
|
export default TokenTransfersLocal;
|