1249c0df71
* chore: initial commit * refactor: remove unnecessary wrappers * style: add missing newline * chore: bump bee-js * chore: ignore any cast in fdp * fix: remove cid import * fix: make TextEncoder and TextDecoder available in jest * refactor: dedupe stamp ttl second conversion * refactor: use convenience methods from bee-js * feat: update to bee-js for restored ens support * fix: bump bee-js to get download fix * fix: resolve feed before downloading reference * fix: fix token displays * fix: fix token input modal error message * refactor: remove wallet balance provider * chore: remove dead code * refactor: upcoming bee js 0.15.0 (#692) * chore: initial commit * fix: do not break page when duration seconds is 0 * ci: remove cache * chore: upgrade bee-js * feat: bee-js and bee v2.6 compatibility * chore: switch upcoming/bee-js to ethersphere/bee-js
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { BZZ } from '@ethersphere/bee-js'
|
|
import { useContext } from 'react'
|
|
import { useNavigate } from 'react-router'
|
|
import ExchangeFunds from 'remixicon-react/ExchangeFundsLineIcon'
|
|
import Card from '../../components/Card'
|
|
import { Context as BeeContext } from '../../providers/Bee'
|
|
import { ROUTES } from '../../routes'
|
|
|
|
export function ChequebookInfoCard() {
|
|
const { chequebookBalance } = useContext(BeeContext)
|
|
const navigate = useNavigate()
|
|
|
|
if (chequebookBalance?.availableBalance !== undefined && chequebookBalance?.availableBalance.gt(BZZ.fromPLUR('0'))) {
|
|
return (
|
|
<Card
|
|
buttonProps={{
|
|
iconType: ExchangeFunds,
|
|
children: 'Manage chequebook',
|
|
onClick: () => navigate(ROUTES.ACCOUNT_CHEQUEBOOK),
|
|
}}
|
|
icon={<ExchangeFunds />}
|
|
title={`${chequebookBalance?.availableBalance.toSignificantDigits(4)} xBZZ`}
|
|
subtitle="Network transfer balance."
|
|
status="ok"
|
|
/>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Card
|
|
buttonProps={{
|
|
iconType: ExchangeFunds,
|
|
children: 'Manage chequebook',
|
|
onClick: () => navigate(ROUTES.ACCOUNT_CHEQUEBOOK),
|
|
}}
|
|
icon={<ExchangeFunds />}
|
|
title={
|
|
chequebookBalance?.availableBalance
|
|
? `${chequebookBalance.availableBalance.toSignificantDigits(4)} xBZZ`
|
|
: 'No available balance.'
|
|
}
|
|
subtitle="Chequebook not setup."
|
|
status="error"
|
|
/>
|
|
)
|
|
}
|