Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(staking): Enable deposit button even if wallet is empty #1897

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading