mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
import React from 'react';
|
|
|
|
import type { InterchainTransfer } from '@luxfi/interchain-indexer-types';
|
|
import type { PaginationParams } from 'ui/shared/pagination/types';
|
|
|
|
import { ACTION_BAR_HEIGHT_DESKTOP } from 'ui/shared/ActionBar';
|
|
import DataListDisplay, { type Props as DataListDisplayProps } from 'ui/shared/DataListDisplay';
|
|
|
|
import TokenTransfersCrossChainListItem from './TokenTransfersCrossChainListItem';
|
|
import TokenTransfersCrossChainTable from './TokenTransfersCrossChainTable';
|
|
import { getItemKey } from './utils';
|
|
|
|
interface Props extends Omit<DataListDisplayProps, 'children'> {
|
|
items?: Array<InterchainTransfer>;
|
|
isLoading?: boolean;
|
|
pagination?: PaginationParams;
|
|
currentAddress?: string;
|
|
tableTop?: number;
|
|
}
|
|
|
|
const TokenTransfersCrossChainContent = ({ items, isLoading, pagination, currentAddress, tableTop, ...rest }: Props) => {
|
|
|
|
const content = items ? (
|
|
<>
|
|
<div className="lg:hidden">
|
|
{ items.map((item, index) => (
|
|
<TokenTransfersCrossChainListItem
|
|
key={ getItemKey(item, isLoading ? index : undefined) }
|
|
data={ item }
|
|
isLoading={ isLoading }
|
|
currentAddress={ currentAddress }
|
|
/>
|
|
)) }
|
|
</div>
|
|
<div className="hidden lg:block">
|
|
<TokenTransfersCrossChainTable
|
|
data={ items }
|
|
isLoading={ isLoading }
|
|
top={ tableTop ?? (pagination?.isVisible ? ACTION_BAR_HEIGHT_DESKTOP : 0) }
|
|
currentAddress={ currentAddress }
|
|
/>
|
|
</div>
|
|
</>
|
|
) : null;
|
|
|
|
return (
|
|
<DataListDisplay
|
|
itemsNum={ items?.length }
|
|
emptyText="There are no cross-chain token transfers."
|
|
emptyStateProps={{
|
|
term: 'token transfer',
|
|
}}
|
|
{ ...rest }
|
|
>
|
|
{ content }
|
|
</DataListDisplay>
|
|
);
|
|
};
|
|
|
|
export default React.memo(TokenTransfersCrossChainContent);
|