Skip to content

Commit

Permalink
show max button on swap menu if its 0
Browse files Browse the repository at this point in the history
  • Loading branch information
yvesfracari committed Apr 29, 2024
1 parent 5ec2470 commit bf858f0
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions src/components/menus/SwapMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,34 +101,35 @@ export function SwapMenu({
type="number"
step={1 / 10 ** amountDecimals}
/>
{walletAmount != "0" && (
<div className="flex gap-x-1 text-xs">

<div className="flex gap-x-1 text-xs">
<span>
<span>
<span>
Wallet Balance:{" "}
{formatNumber(
walletAmount,
4,
"decimal",
"standard",
0.0001
)}
</span>
Wallet Balance:{" "}
{walletAmount == "0"
? walletAmount
: formatNumber(
walletAmount,
4,
"decimal",
"standard",
0.0001
)}
</span>
<button
type="button"
className="text-accent outline-none hover:text-accent/70"
onClick={() => {
setValue(
"amount",
convertStringToNumberAndRoundDown(walletAmount)
);
}}
>
Max
</button>
</div>
)}
</span>
<button
type="button"
className="text-accent outline-none hover:text-accent/70"
onClick={() => {
setValue(
"amount",
convertStringToNumberAndRoundDown(walletAmount)
);
}}
>
Max
</button>
</div>
</div>
<TokenSelect
selectedToken={data.tokenSell}
Expand Down

0 comments on commit bf858f0

Please sign in to comment.