mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* Rollups: move layer numbering to the ENV Resolves #2554 * fix review comments
104 lines
3.8 KiB
TypeScript
104 lines
3.8 KiB
TypeScript
import React from 'react';
|
|
|
|
import type { ArbitrumL2TxnBatchesItem } from 'types/api/arbitrumL2';
|
|
|
|
import { route } from 'nextjs-routes';
|
|
|
|
import config from 'configs/app';
|
|
import { layerLabels } from 'lib/rollups/utils';
|
|
import { Link } from 'toolkit/chakra/link';
|
|
import { Skeleton } from 'toolkit/chakra/skeleton';
|
|
import ArbitrumL2TxnBatchDA from 'ui/shared/batch/ArbitrumL2TxnBatchDA';
|
|
import BatchEntityL2 from 'ui/shared/entities/block/BatchEntityL2';
|
|
import BlockEntityL1 from 'ui/shared/entities/block/BlockEntityL1';
|
|
import TxEntityL1 from 'ui/shared/entities/tx/TxEntityL1';
|
|
import ListItemMobileGrid from 'ui/shared/ListItemMobile/ListItemMobileGrid';
|
|
import ArbitrumL2TxnBatchStatus from 'ui/shared/statusTag/ArbitrumL2TxnBatchStatus';
|
|
import TimeWithTooltip from 'ui/shared/time/TimeWithTooltip';
|
|
|
|
const rollupFeature = config.features.rollup;
|
|
|
|
type Props = { item: ArbitrumL2TxnBatchesItem; isLoading?: boolean };
|
|
|
|
const ArbitrumL2TxnBatchesListItem = ({ item, isLoading }: Props) => {
|
|
if (!rollupFeature.isEnabled || rollupFeature.type !== 'arbitrum') {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<ListItemMobileGrid.Container gridTemplateColumns="110px auto">
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Batch #</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<BatchEntityL2
|
|
isLoading={ isLoading }
|
|
number={ item.number }
|
|
fontWeight={ 600 }
|
|
/>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>{ layerLabels.parent } status</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<ArbitrumL2TxnBatchStatus status={ item.commitment_transaction.status } isLoading={ isLoading }/>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>{ layerLabels.parent } block</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<BlockEntityL1
|
|
number={ item.commitment_transaction.block_number }
|
|
isLoading={ isLoading }
|
|
/>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
{ item.blocks_count && (
|
|
<>
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Block count</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<Skeleton loading={ isLoading } display="inline-block">{ item.blocks_count.toLocaleString() }</Skeleton>
|
|
</ListItemMobileGrid.Value>
|
|
</>
|
|
) }
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>{ layerLabels.parent } transaction</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<TxEntityL1
|
|
hash={ item.commitment_transaction.hash }
|
|
isLoading={ isLoading }
|
|
truncation="constant_long"
|
|
noCopy
|
|
/>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Age</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<TimeWithTooltip
|
|
timestamp={ item.commitment_transaction.timestamp }
|
|
fallbackText="Undefined"
|
|
isLoading={ isLoading }
|
|
display="inline-block"
|
|
/>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Txn count</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<Link
|
|
href={ route({ pathname: '/batches/[number]', query: { number: item.number.toString(), tab: 'txs' } }) }
|
|
loading={ isLoading }
|
|
fontWeight={ 600 }
|
|
minW="40px"
|
|
>
|
|
{ item.transactions_count.toLocaleString() }
|
|
</Link>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Data container</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<ArbitrumL2TxnBatchDA dataContainer={ item.batch_data_container } isLoading={ isLoading }/>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
</ListItemMobileGrid.Container>
|
|
);
|
|
};
|
|
|
|
export default ArbitrumL2TxnBatchesListItem;
|