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

Bean UI - Fixed input error on Swap page #648

Merged
merged 4 commits into from
Sep 24, 2023
Merged
Changes from 3 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
6 changes: 3 additions & 3 deletions projects/ui/src/components/Swap/Actions/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ const SwapForm: FC<
const handleChangeAmountIn = useCallback(
(_amountInClamped: BigNumber | undefined) => {
console.debug('[TokenInput] handleChangeAmountIn', _amountInClamped);
if (_amountInClamped) {
if (_amountInClamped && !_amountInClamped?.isNaN()) {
getAmountOut(tokenIn, _amountInClamped);
} else {
setFieldValue('tokenOut.amount', undefined);
Expand All @@ -284,7 +284,7 @@ const SwapForm: FC<
const handleChangeAmountOut = useCallback(
(_amountOutClamped: BigNumber | undefined) => {
console.debug('[TokenInput] handleChangeAmountOut', _amountOutClamped);
if (_amountOutClamped) {
if (_amountOutClamped && !_amountOutClamped?.isNaN()) {
console.debug('[TokenInput] getMinAmountIn', [
tokenOut,
_amountOutClamped,
Expand Down Expand Up @@ -533,7 +533,7 @@ const SwapForm: FC<
* an `amountIn` that is too high by typing in the second input,
* show a message and prompt them to use `max`.
*/}
{!noBalance && !enoughBalanceCheck ? (
{!noBalance && !enoughBalanceCheck && amountsCheck ? (
<Alert variant="standard" color="warning" icon={<WarningIcon />}>
Not enough {tokenIn.symbol}
{tokensMatch ? ` in your ${copy.MODES[modeIn]}` : ''} to execute
Expand Down
Loading