import type { ReactElement } from 'react' import { makeStyles } from '@material-ui/core/styles' import { Table, TableBody, TableCell, TableContainer, TableRow, TableHead, Paper } from '@material-ui/core' import ClipboardCopy from '../../components/ClipboardCopy' import CashoutModal from '../../components/CashoutModal' import PeerDetailDrawer from '../../components/PeerDetail' import { Accounting } from '../../hooks/accounting' const useStyles = makeStyles({ table: { minWidth: 650, }, values: { textAlign: 'right', fontFamily: 'monospace, monospace', }, }) interface Props { isLoadingUncashed: boolean accounting: Accounting[] | null } function BalancesTable({ accounting, isLoadingUncashed }: Props): ReactElement | null { if (accounting === null) return null const classes = useStyles() return ( Peer Outstanding Balance Settlements Sent / Received Total Uncashed Amount {accounting.map(({ peer, balance, received, sent, uncashedAmount, total }) => (
{balance.toFixedDecimal()} {' '} BZZ -{sent.toFixedDecimal()} / {received.toFixedDecimal()} BZZ {total.toFixedDecimal()} {' '} BZZ {isLoadingUncashed && 'loading...'} {!isLoadingUncashed && ( <>{uncashedAmount.toBigNumber.isGreaterThan('0') ? uncashedAmount.toFixedDecimal() : '0'} BZZ )} {uncashedAmount.toBigNumber.isGreaterThan('0') && ( )}
))}
) } export default BalancesTable