-
Notifications
You must be signed in to change notification settings - Fork 727
Expand file tree
/
Copy pathBeaconChainDepositsTable.tsx
More file actions
55 lines (46 loc) · 2.1 KB
/
Copy pathBeaconChainDepositsTable.tsx
File metadata and controls
55 lines (46 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React from 'react';
import type { DepositsItem } from 'types/api/deposits';
import config from 'configs/app';
import { AddressHighlightProvider } from 'lib/contexts/addressHighlight';
import useLazyRenderedList from 'lib/hooks/useLazyRenderedList';
import { TableBody, TableColumnHeader, TableHeaderSticky, TableRoot, TableRow } from 'toolkit/chakra/table';
import TimeFormatToggle from 'ui/shared/time/TimeFormatToggle';
import BeaconChainDepositsTableItem from './BeaconChainDepositsTableItem';
const feature = config.features.beaconChain;
type Props = {
top: number;
isLoading?: boolean;
items: Array<DepositsItem>;
view: 'list' | 'address' | 'block';
};
const BeaconChainDepositsTable = ({ items, isLoading, top, view }: Props) => {
const { cutRef, renderedItemsNum } = useLazyRenderedList(items, !isLoading);
if (!feature.isEnabled || feature.withdrawalsOnly) {
return null;
}
return (
<AddressHighlightProvider>
<TableRoot minW="1100px">
<TableHeaderSticky top={ top }>
<TableRow>
<TableColumnHeader w="190px">Transaction hash</TableColumnHeader>
{ view !== 'block' && <TableColumnHeader>Block</TableColumnHeader> }
{ view !== 'block' && <TableColumnHeader w="180px">Timestamp<TimeFormatToggle/></TableColumnHeader> }
<TableColumnHeader>{ `Value ${ feature.currency.symbol }` }</TableColumnHeader>
{ view !== 'address' && <TableColumnHeader w="200px">From</TableColumnHeader> }
<TableColumnHeader>PubKey</TableColumnHeader>
<TableColumnHeader>Signature</TableColumnHeader>
<TableColumnHeader>Status</TableColumnHeader>
</TableRow>
</TableHeaderSticky>
<TableBody>
{ items.slice(0, renderedItemsNum).map((item, index) => (
<BeaconChainDepositsTableItem key={ item.index + (isLoading ? String(index) : '') } item={ item } view={ view } isLoading={ isLoading }/>
)) }
<TableRow ref={ cutRef }/>
</TableBody>
</TableRoot>
</AddressHighlightProvider>
);
};
export default BeaconChainDepositsTable;