Skip to content

Commit

Permalink
Bean UI - Fixed input error on Swap page (#648)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalecks committed Sep 24, 2023
2 parents e14ddc6 + 5a69ae7 commit cda0508
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci.ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,3 @@ jobs:
run: yarn ui:generate
- name: Unit Tests
run: yarn ui:test
- name: Browser Tests
uses: cypress-io/github-action@v4
with:
start: yarn ui:start
command: yarn test:browser
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

0 comments on commit cda0508

Please sign in to comment.