Skip to content

Commit

Permalink
Merge pull request #261 from mrgnlabs/j/fix-close-action
Browse files Browse the repository at this point in the history
fix: close button disabled bug
  • Loading branch information
jkbpvsc authored Oct 4, 2023
2 parents 81fbb89 + 4b5a63e commit 6c46f6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,10 @@ const AssetRow: FC<{
onClick={currentAction === "Connect" ? openWalletSelector : isDust ? closeBalance : borrowOrLend}
disabled={
currentAction !== "Connect" &&
((isDust && uiToNative(bank.userInfo.tokenAccount.balance, bank.info.state.mintDecimals).isZero()) ||
maxAmount === 0)
((isDust &&
uiToNative(bank.userInfo.tokenAccount.balance, bank.info.state.mintDecimals).isZero() &&
currentAction == ActionType.Borrow) ||
(!isDust && maxAmount === 0))
}
>
{isDust ? "Close" : currentAction}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,9 @@ const UserPositionRow: FC<UserPositionRowProps> = ({ activeBankInfo, marginfiAcc
uiToNative(
activeBankInfo.userInfo.tokenAccount.balance,
activeBankInfo.info.state.mintDecimals
).isZero()) ||
maxAmount === 0
).isZero() &&
!activeBankInfo.position.isLending) ||
(!isDust && maxAmount === 0)
}
>
{isDust ? "Close" : activeBankInfo.position.isLending ? "Withdraw" : "Repay"}
Expand Down

3 comments on commit 6c46f6a

@vercel
Copy link

@vercel vercel bot commented on 6c46f6a Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

marginfi-landing-page – ./apps/marginfi-landing-page

marginfi-landing-page-mrgn.vercel.app
marginfi-landing-page.vercel.app
marginfi-landing-page-git-production-mrgn.vercel.app
www.marginfi.com
marginfi.com

@vercel
Copy link

@vercel vercel bot commented on 6c46f6a Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

omni – ./apps/omni

omni-mrgn.vercel.app
omni-one.vercel.app
omni-git-production-mrgn.vercel.app
omni.marginfi.com

@vercel
Copy link

@vercel vercel bot commented on 6c46f6a Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.