disable bond button on incorrect data

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-04-28 14:11:11 +03:00
parent ff9ca1bb79
commit 650feb01d7
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
2 changed files with 7 additions and 2 deletions

View File

@ -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",

View File

@ -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