Files
explore/ui/txnBatches/zkEvmL2/ZkEvmTxnBatchesTableItem.tsx
tom goriunovandGitHub f982eb07a0 Time format toggle for table views (#2729)
* cookie for storing time format value

* rename TimeAgo component

* add toggle to tables (pt. 1)

* move TimeWithTooltip component

* add toggle to tables (pt. 2)

* change implementation of toggle component

* remove unnecessary timestamp label

* update screenshots

* more screenshot updates

* [skip ci] update clock icon

* update screenshots
2025-06-03 14:01:12 +02:00

84 lines
2.5 KiB
TypeScript

import { Text } from '@chakra-ui/react';
import React from 'react';
import type { ZkEvmL2TxnBatchesItem } from 'types/api/zkEvmL2';
import { route } from 'nextjs-routes';
import config from 'configs/app';
import { Link } from 'toolkit/chakra/link';
import { TableCell, TableRow } from 'toolkit/chakra/table';
import BatchEntityL2 from 'ui/shared/entities/block/BatchEntityL2';
import TxEntityL1 from 'ui/shared/entities/tx/TxEntityL1';
import ZkEvmL2TxnBatchStatus from 'ui/shared/statusTag/ZkEvmL2TxnBatchStatus';
import TimeWithTooltip from 'ui/shared/time/TimeWithTooltip';
const rollupFeature = config.features.rollup;
type Props = { item: ZkEvmL2TxnBatchesItem; isLoading?: boolean };
const TxnBatchesTableItem = ({ item, isLoading }: Props) => {
if (!rollupFeature.isEnabled || rollupFeature.type !== 'zkEvm') {
return null;
}
return (
<TableRow>
<TableCell verticalAlign="middle">
<BatchEntityL2
isLoading={ isLoading }
number={ item.number }
textStyle="sm"
fontWeight={ 600 }
noIcon
/>
</TableCell>
<TableCell verticalAlign="middle">
<ZkEvmL2TxnBatchStatus status={ item.status } isLoading={ isLoading }/>
</TableCell>
<TableCell verticalAlign="middle">
<TimeWithTooltip
timestamp={ item.timestamp }
fallbackText="Undefined"
isLoading={ isLoading }
color="text.secondary"
/>
</TableCell>
<TableCell verticalAlign="middle">
<Link
href={ route({ pathname: '/batches/[number]', query: { number: item.number.toString(), tab: 'txs' } }) }
minW="40px"
my={ 1 }
loading={ isLoading }
>
{ item.transactions_count }
</Link>
</TableCell>
<TableCell pr={ 12 } verticalAlign="middle">
{ item.verify_transaction_hash ? (
<TxEntityL1
isLoading={ isLoading }
hash={ item.verify_transaction_hash }
textStyle="sm"
truncation="constant_long"
noIcon
/>
) : <Text>Pending</Text> }
</TableCell>
<TableCell pr={ 12 } verticalAlign="middle">
{ item.sequence_transaction_hash ? (
<TxEntityL1
isLoading={ isLoading }
hash={ item.sequence_transaction_hash }
textStyle="sm"
truncation="constant_long"
noIcon
/>
) : <Text>Pending</Text> }
</TableCell>
</TableRow>
);
};
export default TxnBatchesTableItem;