Files
tom goriunovandGitHub f6725649da UI toolkit package (#2691)
* first version of the pack

* single entry point

* add custom components to the package

* move form components to toolkit

* add more utils and hooks to the package

* minor fixes

* add CI workflow

* update readme and package.json

* fix ts

* fix build of env-validator

* fix docker build

* fix icons size

* test fixes

* more test fixes
2025-04-21 19:44:22 +02:00

50 lines
1.7 KiB
TypeScript

import type BigNumber from 'bignumber.js';
import React from 'react';
import type { AddressesItem } from 'types/api/addresses';
import { currencyUnits } from 'lib/units';
import { TableBody, TableColumnHeader, TableHeaderSticky, TableRoot, TableRow } from 'toolkit/chakra/table';
import { ZERO } from 'toolkit/utils/consts';
import AddressesTableItem from './AddressesTableItem';
interface Props {
items: Array<AddressesItem>;
totalSupply: BigNumber;
pageStartIndex: number;
top: number;
isLoading?: boolean;
}
const AddressesTable = ({ items, totalSupply, pageStartIndex, top, isLoading }: Props) => {
const hasPercentage = !totalSupply.eq(ZERO);
return (
<TableRoot>
<TableHeaderSticky top={ top }>
<TableRow>
<TableColumnHeader width="64px">Rank</TableColumnHeader>
<TableColumnHeader width={ hasPercentage ? '50%' : '60%' }>Address</TableColumnHeader>
<TableColumnHeader width={ hasPercentage ? '20%' : '25%' } isNumeric>{ `Balance ${ currencyUnits.ether }` }</TableColumnHeader>
{ hasPercentage && <TableColumnHeader width="15%" isNumeric>Percentage</TableColumnHeader> }
<TableColumnHeader width="15%" isNumeric>Txn count</TableColumnHeader>
</TableRow>
</TableHeaderSticky>
<TableBody>
{ items.map((item, index) => (
<AddressesTableItem
key={ item.hash + (isLoading ? index : '') }
item={ item }
totalSupply={ totalSupply }
index={ pageStartIndex + index }
hasPercentage={ hasPercentage }
isLoading={ isLoading }
/>
)) }
</TableBody>
</TableRoot>
);
};
export default AddressesTable;