a768b4ea06
* feat: add top up * chore: remove console.log * build: add pseudo-missing dependency * feat: add missing top up components * fix: crypto route * feat(wip): add gift wallet logic * fix: fix gift wallet flows * feat: simplify flow without fund step * feat: add loading screens * fix: remove alert * fix: prepend http if needed * fix: fix bug that was reintroduced with merge * refactor: rename minusEther to minusBaseUnits * fix: remove unused setStartedAt * build: remove unused dependency
51 lines
2.1 KiB
TypeScript
51 lines
2.1 KiB
TypeScript
import type { ReactElement } from 'react'
|
|
import CashoutModal from '../../components/CashoutModal'
|
|
import ExpandableList from '../../components/ExpandableList'
|
|
import ExpandableListItem from '../../components/ExpandableListItem'
|
|
import ExpandableListItemActions from '../../components/ExpandableListItemActions'
|
|
import ExpandableListItemKey from '../../components/ExpandableListItemKey'
|
|
import { Accounting } from '../../hooks/accounting'
|
|
import type { Token } from '../../models/Token'
|
|
|
|
interface Props {
|
|
isLoadingUncashed: boolean
|
|
totalUncashed: Token
|
|
accounting: Accounting[] | null
|
|
}
|
|
|
|
export default function PeerBalances({ accounting, isLoadingUncashed, totalUncashed }: Props): ReactElement | null {
|
|
return (
|
|
<ExpandableList
|
|
label={`Peers (${accounting?.length || 0})`}
|
|
info={`${totalUncashed.toFixedDecimal()} BZZ (uncashed)`}
|
|
>
|
|
<ExpandableListItem label="Uncashed Amount Total" value={`${totalUncashed.toFixedDecimal()} BZZ`} />
|
|
{accounting?.map(({ peer, balance, received, sent, uncashedAmount, total }) => (
|
|
<ExpandableList
|
|
key={peer}
|
|
label={`Peer ${peer.slice(0, 8)}[…]`}
|
|
level={1}
|
|
info={`${uncashedAmount.toFixedDecimal()} BZZ (uncashed)`}
|
|
>
|
|
<ExpandableListItemKey label="Peer ID" value={peer} />
|
|
<ExpandableListItem label="Outstanding Balance" value={`${balance.toFixedDecimal()} BZZ`} />
|
|
<ExpandableListItem
|
|
label="Settlements Sent / Received"
|
|
value={`-${sent.toFixedDecimal()} / ${received.toFixedDecimal()} BZZ`}
|
|
/>
|
|
<ExpandableListItem label="Total" value={`${total.toFixedDecimal()} BZZ`} />
|
|
<ExpandableListItem
|
|
label="Uncashed Amount"
|
|
value={isLoadingUncashed ? 'loading…' : `${uncashedAmount.toFixedDecimal()} BZZ`}
|
|
/>
|
|
{uncashedAmount.toBigNumber.isGreaterThan('0') && (
|
|
<ExpandableListItemActions>
|
|
<CashoutModal uncashedAmount={uncashedAmount.toFixedDecimal()} peerId={peer} />
|
|
</ExpandableListItemActions>
|
|
)}
|
|
</ExpandableList>
|
|
))}
|
|
</ExpandableList>
|
|
)
|
|
}
|