diff --git a/packages/widget/src/components/GasSufficiencyMessage/GasSufficiencyMessage.tsx b/packages/widget/src/components/GasSufficiencyMessage/GasSufficiencyMessage.tsx index a6d52c5dd..93707c62f 100644 --- a/packages/widget/src/components/GasSufficiencyMessage/GasSufficiencyMessage.tsx +++ b/packages/widget/src/components/GasSufficiencyMessage/GasSufficiencyMessage.tsx @@ -14,18 +14,10 @@ export const GasSufficiencyMessage: React.FC<{ route?: Route } & BoxProps> = ({ const { t } = useTranslation(); const { insufficientFunds, insufficientGas } = useGasSufficiency(route); - if (!insufficientFunds || !insufficientGas.length) { + if (!insufficientFunds && !insufficientGas.length) { return null; } - let title; - let message; - if (insufficientFunds) { - message = t(`swap.warning.message.insufficientFunds`); - } else if (insufficientGas.length) { - title = t(`swap.warning.title.insufficientGas`); - message = t(`swap.warning.message.insufficientGas`); - } return ( = ({ }} /> - {title ? {title} : null} - - {message} - - {!insufficientFunds && insufficientGas.length + {insufficientGas.length ? ( + {t(`swap.warning.title.insufficientGas`)} + ) : null} + {insufficientFunds ? ( + + {insufficientFunds + ? t(`swap.warning.message.insufficientFunds`) + : null} + + ) : null} + {insufficientGas.length ? ( + + {t(`swap.warning.message.insufficientGas`)} + + ) : null} + {insufficientGas.length ? insufficientGas.map((item, index) => ( { const balance = Big( fromChainTokenBalances?.find((t) => t.address === fromToken)?.amount ?? 0, ); - return Big(fromAmount).gte(balance); + return Big(fromAmount).gt(balance); }, [account.isActive, fromAmount, fromChainTokenBalances, fromToken]); return { diff --git a/packages/widget/src/pages/MainPage/SwapRoutes.tsx b/packages/widget/src/pages/MainPage/SwapRoutes.tsx index d5c6ee21e..778d2b75f 100644 --- a/packages/widget/src/pages/MainPage/SwapRoutes.tsx +++ b/packages/widget/src/pages/MainPage/SwapRoutes.tsx @@ -106,9 +106,10 @@ export const SwapRoutes: React.FC = (props) => { - {!isFetching ? ( - - ) : null} + ); };