Files
explore/ui/internalTxs/InternalTxsTable.tsx
tom goriunovandGitHub 29c84492c2 Block page: internal transactions tab (#2721)
* Block page: internal transactions tab

Fixes #2698

* add counter
2025-06-04 15:03:09 +02:00

56 lines
1.8 KiB
TypeScript

import React from 'react';
import type { InternalTransaction } from 'types/api/internalTransaction';
import { AddressHighlightProvider } from 'lib/contexts/addressHighlight';
import { currencyUnits } from 'lib/units';
import { TableBody, TableColumnHeader, TableHeaderSticky, TableRoot, TableRow } from 'toolkit/chakra/table';
import TimeFormatToggle from 'ui/shared/time/TimeFormatToggle';
import InternalTxsTableItem from './InternalTxsTableItem';
interface Props {
data: Array<InternalTransaction>;
currentAddress?: string;
isLoading?: boolean;
top?: number;
showBlockInfo?: boolean;
}
const InternalTxsTable = ({ data, currentAddress, isLoading, top, showBlockInfo = true }: Props) => {
return (
<AddressHighlightProvider>
<TableRoot minW="900px">
<TableHeaderSticky top={ top ?? 68 }>
<TableRow>
<TableColumnHeader width="280px">
Parent txn hash
<TimeFormatToggle/>
</TableColumnHeader>
<TableColumnHeader width="15%">Type</TableColumnHeader>
{ showBlockInfo && <TableColumnHeader width="15%">Block</TableColumnHeader> }
<TableColumnHeader width="50%">From/To</TableColumnHeader>
<TableColumnHeader width="20%" isNumeric>
Value { currencyUnits.ether }
</TableColumnHeader>
</TableRow>
</TableHeaderSticky>
<TableBody>
{ data.map((item, index) => (
<InternalTxsTableItem
key={ item.transaction_hash + '_' + index }
{ ...item }
currentAddress={ currentAddress }
isLoading={ isLoading }
showBlockInfo={ showBlockInfo }
/>
)) }
</TableBody>
</TableRoot>
</AddressHighlightProvider>
);
};
export default InternalTxsTable;