Files
explore/ui/zetaChain/cctxs/ZetaChainCCTxsTableItem.tsx
Igor StuevandGitHub 0f4e29e4d0 zeta chain cctx (#2904)
* zetachain start

* zeta chain cctx table

* pagination

* cctx page init

* meta for new route

* remove backlink

* schema

* continue

* fix

* navigation

* filters to test

* some fixes

* add chain filter

* add error message and revert options

* address chain logo fix

* cctx search

* socket

* fix conflict

* fixes1

* fixes2

* fixes3

* fixes4

* fixes5

* tests

* fixes6

* test fixes

* revert options fix

* stats and revert semi-fix

* fix readme

* cleanup

* check for cctx in lifecycle

* update config

* fixes 8

* fixes 9

* update config

* fixes10
2025-09-05 15:53:00 +02:00

67 lines
2.2 KiB
TypeScript

import { HStack } from '@chakra-ui/react';
import React from 'react';
import type { CctxListItem } from '@blockscout/zetachain-cctx-types';
import { TableCell, TableRow } from 'toolkit/chakra/table';
import { SECOND } from 'toolkit/utils/consts';
import AddressFromTo from 'ui/shared/address/AddressFromTo';
import TxEntityZetaChainCC from 'ui/shared/entities/tx/TxEntityZetaChainCC';
import TimeWithTooltip from 'ui/shared/time/TimeWithTooltip';
import ZetaChainCCTXReducedStatus from 'ui/shared/zetaChain/ZetaChainCCTXReducedStatus';
import ZetaChainCCTXValue from 'ui/shared/zetaChain/ZetaChainCCTXValue';
type Props = {
tx: CctxListItem;
enableTimeIncrement?: boolean;
isLoading?: boolean;
animation?: string;
};
const ZetaChainCCTxsTableItem = ({ tx, enableTimeIncrement, isLoading, animation }: Props) => {
return (
<TableRow key={ tx.index } animation={ animation }>
<TableCell pr={ 4 }>
<HStack alignItems="start" lineHeight="24px">
<TxEntityZetaChainCC
hash={ tx.index }
isLoading={ isLoading }
fontWeight="bold"
noIcon
maxW="100%"
truncation="constant"
/>
<TimeWithTooltip
timestamp={ Number(tx.last_update_timestamp) * SECOND }
enableIncrement={ enableTimeIncrement }
isLoading={ isLoading }
color="text.secondary"
/>
</HStack>
</TableCell>
<TableCell>
<ZetaChainCCTXReducedStatus status={ tx.status_reduced } type="full" isLoading={ isLoading }/>
</TableCell>
<TableCell colSpan={ 2 }>
<AddressFromTo
from={{ hash: tx.sender_address, chainId: tx.source_chain_id.toString(), chainType: 'zeta' }}
to={{ hash: tx.receiver_address, chainId: tx.target_chain_id.toString(), chainType: 'zeta' }}
isLoading={ isLoading }
/>
</TableCell>
<TableCell isNumeric>
<ZetaChainCCTXValue
coinType={ tx.coin_type }
tokenSymbol={ tx.token_symbol }
amount={ tx.amount }
decimals={ tx.decimals }
isLoading={ isLoading }
justifyContent="flex-end"
/>
</TableCell>
</TableRow>
);
};
export default React.memo(ZetaChainCCTxsTableItem);