Files
explore/ui/outputRoots/optimisticL2/OptimisticL2OutputRootsTable.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

45 lines
1.5 KiB
TypeScript

import React from 'react';
import type { OptimisticL2OutputRootsItem } from 'types/api/optimisticL2';
import { TableBody, TableColumnHeader, TableHeaderSticky, TableRoot, TableRow } from 'toolkit/chakra/table';
import TimeFormatToggle from 'ui/shared/time/TimeFormatToggle';
import OptimisticL2OutputRootsTableItem from './OptimisticL2OutputRootsTableItem';
type Props = {
items: Array<OptimisticL2OutputRootsItem>;
top: number;
isLoading?: boolean;
};
const OptimisticL2OutputRootsTable = ({ items, top, isLoading }: Props) => {
return (
<TableRoot minW="900px">
<TableHeaderSticky top={ top }>
<TableRow>
<TableColumnHeader width="160px">L2 output index</TableColumnHeader>
<TableColumnHeader width="20%">
Timestamp
<TimeFormatToggle/>
</TableColumnHeader>
<TableColumnHeader width="20%">L2 block #</TableColumnHeader>
<TableColumnHeader width="30%">L1 txn hash</TableColumnHeader>
<TableColumnHeader width="30%">Output root</TableColumnHeader>
</TableRow>
</TableHeaderSticky>
<TableBody>
{ items.map((item, index) => (
<OptimisticL2OutputRootsTableItem
key={ item.l2_output_index + (Number(isLoading ? index : '') ? String(index) : '') }
item={ item }
isLoading={ isLoading }
/>
)) }
</TableBody>
</TableRoot>
);
};
export default OptimisticL2OutputRootsTable;