Commit ce7f94f1 authored by Moody Salem's avatar Moody Salem

hide max button appropriately

parent 124b83ae
......@@ -286,14 +286,8 @@ export default function CurrencyInputPanel({
: '-'}
</TYPE.body>
{showMaxButton && selectedCurrencyBalance ? (
<StyledBalanceMax disabled={!showMaxButton} onClick={onMax}>
(Max)
</StyledBalanceMax>
) : (
<StyledBalanceMax disabled={!showMaxButton} onClick={onMax}>
{''}
</StyledBalanceMax>
)}
<StyledBalanceMax onClick={onMax}>(Max)</StyledBalanceMax>
) : null}
</RowFixed>
)}
......
......@@ -223,7 +223,7 @@ export default function Swap({ history }: RouteComponentProps) {
}, [approvalState, approvalSubmitted])
const maxInputAmount: CurrencyAmount | undefined = maxAmountSpend(currencyBalances[Field.INPUT])
const atMaxInputAmount = Boolean(maxInputAmount && parsedAmounts[Field.INPUT]?.equalTo(maxInputAmount))
const showMaxButton = Boolean(maxInputAmount?.greaterThan(0) && !parsedAmounts[Field.INPUT]?.equalTo(maxInputAmount))
// the callback to execute the swap
const { callback: swapCallback, error: swapCallbackError } = useSwapCallback(
......@@ -361,7 +361,7 @@ export default function Swap({ history }: RouteComponentProps) {
<CurrencyInputPanel
label={independentField === Field.OUTPUT && !showWrap ? 'From (at most)' : 'From'}
value={formattedAmounts[Field.INPUT]}
showMaxButton={!atMaxInputAmount}
showMaxButton={showMaxButton}
currency={currencies[Field.INPUT]}
onUserInput={handleTypeInput}
onMax={handleMaxInput}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment