import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import { Table, TableBody, TableCell, TableContainer, TableRow, TableHead, Paper, Container, CircularProgress } from '@material-ui/core'; import { ConvertBalanceToBZZ } from '../../utils/common'; import EthereumAddress from '../../components/EthereumAddress'; import ClipboardCopy from '../../components/ClipboardCopy'; import PeerDetailDrawer from './PeerDetailDrawer'; const useStyles = makeStyles({ table: { minWidth: 650, }, }); interface ChequeEvent { beneficiary: string, chequebook: string, payout: number, } interface PeerCheque { lastreceived?: ChequeEvent, lastsent?: ChequeEvent, peer: string, } interface PeerCheques { lastcheques: Array } interface IProps { peerCheques: PeerCheques | null, loading?: boolean, } function ChequebookTable(props: IProps) { const classes = useStyles(); return (
{props.loading ? :
Peer Last Received Last Sent {props.peerCheques?.lastcheques.map((peerCheque: PeerCheque, idx: number) => (

{peerCheque.lastreceived?.payout ? `${ConvertBalanceToBZZ(peerCheque.lastreceived?.payout).toFixed(7).toLocaleString()} from` : '-'} {peerCheque.lastreceived ? : null}

{peerCheque.lastsent?.payout ? `${ConvertBalanceToBZZ(peerCheque.lastsent?.payout).toFixed(7).toLocaleString()} to` : '-'} {peerCheque.lastsent ? : null}

))}
}
) } export default ChequebookTable;