mirror of
https://github.com/luxfi/explore.git
synced 2026-10-30 14:46:12 +00:00
68 lines
2.4 KiB
TypeScript
68 lines
2.4 KiB
TypeScript
import React from 'react';
|
|
|
|
import type { OptimisticL2TxnBatchesItem } from 'types/api/optimisticL2';
|
|
|
|
import { route } from 'nextjs-routes';
|
|
|
|
import config from 'configs/app';
|
|
import { Link } from 'toolkit/next/link';
|
|
import { Skeleton } from '@luxfi/ui/skeleton';
|
|
import { TableCell, TableRow } from '@luxfi/ui/table';
|
|
import OptimisticL2TxnBatchDA from 'ui/shared/batch/OptimisticL2TxnBatchDA';
|
|
import BatchEntityL2 from 'ui/shared/entities/block/BatchEntityL2';
|
|
import TimeWithTooltip from 'ui/shared/time/TimeWithTooltip';
|
|
|
|
const rollupFeature = config.features.rollup;
|
|
|
|
type Props = { item: OptimisticL2TxnBatchesItem; isLoading?: boolean };
|
|
|
|
const OptimisticL2TxnBatchesTableItem = ({ item, isLoading }: Props) => {
|
|
if (!rollupFeature.isEnabled || rollupFeature.type !== 'optimistic') {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<TableRow>
|
|
<TableCell verticalAlign="middle">
|
|
<BatchEntityL2 number={ item.number } isLoading={ isLoading }/>
|
|
</TableCell>
|
|
<TableCell verticalAlign="middle">
|
|
{ item.batch_data_container ? <OptimisticL2TxnBatchDA container={ item.batch_data_container } isLoading={ isLoading }/> : '-' }
|
|
</TableCell>
|
|
<TableCell verticalAlign="middle">
|
|
<TimeWithTooltip
|
|
timestamp={ item.l1_timestamp }
|
|
isLoading={ isLoading }
|
|
className="inline-block my-1"
|
|
color="text.secondary"
|
|
/>
|
|
</TableCell>
|
|
<TableCell verticalAlign="middle" isNumeric>
|
|
<Skeleton loading={ isLoading } minW="40px" display="inline-block">
|
|
{ item.l1_transaction_hashes.length }
|
|
</Skeleton>
|
|
</TableCell>
|
|
<TableCell verticalAlign="middle" isNumeric>
|
|
<Link
|
|
href={ route({ pathname: '/batches/[number]', query: { number: item.number.toString(), tab: 'blocks' } }) }
|
|
loading={ isLoading }
|
|
className="justify-end min-w-[40px]"
|
|
>
|
|
{ item.l2_end_block_number - item.l2_start_block_number + 1 }
|
|
</Link>
|
|
</TableCell>
|
|
<TableCell verticalAlign="middle" isNumeric>
|
|
<Link
|
|
href={ route({ pathname: '/batches/[number]', query: { number: item.number.toString(), tab: 'txs' } }) }
|
|
loading={ isLoading }
|
|
className="justify-end min-w-[40px]"
|
|
>
|
|
{ item.transactions_count }
|
|
</Link>
|
|
</TableCell>
|
|
</TableRow>
|
|
);
|
|
};
|
|
|
|
export default OptimisticL2TxnBatchesTableItem;
|