Skip to content

Commit

Permalink
Merge pull request #1897 from cprussin/always-enable-deposit
Browse files Browse the repository at this point in the history
fix(staking): Enable deposit button even if wallet is empty
  • Loading branch information
cprussin authored Sep 11, 2024
2 parents b4ffa77 + e31010d commit 2edeeba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/staking/src/components/AccountSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export const AccountSummary = ({
actionName="Add Tokens"
max={walletAmount}
transfer={api.deposit}
enableWithZeroMax
/>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion apps/staking/src/components/TransferButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { Tokens } from "../Tokens";
import PythTokensIcon from "../Tokens/pyth.svg";

type Props = Omit<ComponentProps<typeof Button>, "children"> & {
enableWithZeroMax?: boolean | undefined;
actionName: ReactNode;
actionDescription: ReactNode;
title?: ReactNode | undefined;
Expand All @@ -37,6 +38,7 @@ type Props = Omit<ComponentProps<typeof Button>, "children"> & {
};

export const TransferButton = ({
enableWithZeroMax,
actionName,
submitButtonText,
actionDescription,
Expand All @@ -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) ? (
<Button isDisabled={true} {...props}>
{actionName}
</Button>
Expand Down

0 comments on commit 2edeeba

Please sign in to comment.