Skip to content

Commit

Permalink
fix set max bug
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalpha0123 committed Apr 3, 2020
1 parent 35e7ecb commit 90cc017
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/frontend/features/swap-tokens/SwapOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ const SwapOptions = () => {
const disableConfirm =
!hasProxy || // not connected or no smart wallet
fromTokenStr === toTokenStr || // same token
!isAmountAvailable || // amount not available
amountToSwap === "" || // no amount specified
!isAmountAvailable; // amount not available
amountToSwap === "0";

const setMax = () => {
if (!disableConfirm) return;
if (!hasProxy) return;
setAmountToSwap(canSwapAmount.toString());
};

Expand Down Expand Up @@ -130,7 +131,7 @@ const SwapOptions = () => {
onChange={e => setAmountToSwap(e.target.value.toString())}
/>
</Field>
<Text textAlign="right">
<Text textAlign="right" opacity={!hasProxy ? "0.5" : "1"}>
<Link onClick={setMax}>Set max</Link>
</Text>
</Box>
Expand Down

0 comments on commit 90cc017

Please sign in to comment.