From e31010d038576f77e968e6cdf82c00e7a5f015a5 Mon Sep 17 00:00:00 2001 From: Connor Prussin Date: Wed, 11 Sep 2024 14:19:11 -0700 Subject: [PATCH] fix(staking): Enable deposit button even if wallet is empty --- apps/staking/src/components/AccountSummary/index.tsx | 1 + apps/staking/src/components/TransferButton/index.tsx | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/staking/src/components/AccountSummary/index.tsx b/apps/staking/src/components/AccountSummary/index.tsx index cdb0a17ba..737970e1b 100644 --- a/apps/staking/src/components/AccountSummary/index.tsx +++ b/apps/staking/src/components/AccountSummary/index.tsx @@ -117,6 +117,7 @@ export const AccountSummary = ({ actionName="Add Tokens" max={walletAmount} transfer={api.deposit} + enableWithZeroMax /> diff --git a/apps/staking/src/components/TransferButton/index.tsx b/apps/staking/src/components/TransferButton/index.tsx index bd00a03ba..fba6ccab4 100644 --- a/apps/staking/src/components/TransferButton/index.tsx +++ b/apps/staking/src/components/TransferButton/index.tsx @@ -23,6 +23,7 @@ import { Tokens } from "../Tokens"; import PythTokensIcon from "../Tokens/pyth.svg"; type Props = Omit, "children"> & { + enableWithZeroMax?: boolean | undefined; actionName: ReactNode; actionDescription: ReactNode; title?: ReactNode | undefined; @@ -37,6 +38,7 @@ type Props = Omit, "children"> & { }; export const TransferButton = ({ + enableWithZeroMax, actionName, submitButtonText, actionDescription, @@ -49,7 +51,9 @@ export const TransferButton = ({ }: Props) => { const [closeDisabled, setCloseDisabled] = useState(false); - return transfer === undefined || isDisabled === true || max === 0n ? ( + return transfer === undefined || + isDisabled === true || + (max === 0n && !enableWithZeroMax) ? (