fix: sensible deposit and swap (#448)

* fix: indicate and lower minimum xdai to deposit

* fix: take user input on swap page

* fix: change minimum_dai to minimum_bzz

* fix: token naming convention

* refactor: use constants

* fix: check for positive decimal
This commit is contained in:
Cafe137
2022-06-28 15:24:33 +02:00
committed by GitHub
parent 56f207d6a6
commit 26ce0efc0b
3 changed files with 50 additions and 10 deletions
+7 -3
View File
@@ -1,7 +1,7 @@
import { Box, Grid, Typography } from '@material-ui/core'
import { ReactElement, useContext } from 'react'
import Check from 'remixicon-react/CheckLineIcon'
import { useNavigate } from 'react-router'
import Check from 'remixicon-react/CheckLineIcon'
import ExpandableListItem from '../../components/ExpandableListItem'
import ExpandableListItemKey from '../../components/ExpandableListItemKey'
import { HistoryHeader } from '../../components/HistoryHeader'
@@ -11,6 +11,8 @@ import { SwarmDivider } from '../../components/SwarmDivider'
import { Context } from '../../providers/Bee'
import { TopUpProgressIndicator } from './TopUpProgressIndicator'
const MINIMUM_XDAI = '0.5'
interface Props {
header: string
title: string
@@ -26,7 +28,7 @@ export default function Index({ header, title, p, next }: Props): ReactElement {
return <Loading />
}
const disabled = balance.dai.toDecimal.lte(1)
const disabled = balance.dai.toDecimal.lt(MINIMUM_XDAI)
return (
<>
@@ -49,7 +51,9 @@ export default function Index({ header, title, p, next }: Props): ReactElement {
<SwarmButton iconType={Check} onClick={() => navigate(next)} disabled={disabled}>
Proceed
</SwarmButton>
{disabled ? <Typography>Please deposit xDAI to the address above in order to proceed.</Typography> : null}
{disabled ? (
<Typography>Please deposit at least {MINIMUM_XDAI} xDAI to the address above in order to proceed.</Typography>
) : null}
</Grid>
</>
)