disable bond button on incorrect data
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
ff9ca1bb79
commit
650feb01d7
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ghost-dao-interface",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.7.27",
|
"version": "0.7.28",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -89,6 +89,11 @@ const BondInputArea = ({
|
|||||||
: bond.capacity.inBaseToken
|
: bond.capacity.inBaseToken
|
||||||
), [bond]);
|
), [bond]);
|
||||||
|
|
||||||
|
const incorrectInputAmount = useMemo(() => {
|
||||||
|
if (!balance) return false;
|
||||||
|
return balance.lt(parsedAmount) || baseTokenString.lt(amountInBaseToken);
|
||||||
|
}, [amountInBaseToken, baseTokenString, balance, parsedAmount]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box minHeight="calc(100vh - 210px)" display="flex" flexDirection="column" justifyContent="center">
|
<Box minHeight="calc(100vh - 210px)" display="flex" flexDirection="column" justifyContent="center">
|
||||||
<Box display="flex" flexDirection="row" width="100%" justifyContent="center" mt="10px">
|
<Box display="flex" flexDirection="row" width="100%" justifyContent="center" mt="10px">
|
||||||
@ -158,7 +163,7 @@ const BondInputArea = ({
|
|||||||
)}
|
)}
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
fullWidth
|
fullWidth
|
||||||
disabled={bond.isSoldOut || (showDisclaimer && !checked)}
|
disabled={incorrectInputAmount || bond.isSoldOut || (showDisclaimer && !checked)}
|
||||||
onClick={() => setConfirmOpen(true)}
|
onClick={() => setConfirmOpen(true)}
|
||||||
>
|
>
|
||||||
Bond
|
Bond
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user