From c21422ba3ab4281af4fd01eaa520a689d99c9899 Mon Sep 17 00:00:00 2001 From: kamaldeen Aliyu Date: Mon, 30 Mar 2026 11:43:22 +0100 Subject: [PATCH] Implemented the Disable state on swap button for max --- src/components/SwapInterface.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/SwapInterface.tsx b/src/components/SwapInterface.tsx index dd1dc35..894cadf 100644 --- a/src/components/SwapInterface.tsx +++ b/src/components/SwapInterface.tsx @@ -205,6 +205,16 @@ export default function SwapInterface() { const isAnyModalOpen = isSettingsOpen || isHighSlippageWarningOpen || isTradeReviewOpen || isSuccessModalOpen; const isSwapValid = fromAmount && parseFloat(fromAmount) > 0 && !isSubmitting; + // Determine button state based on slippage tolerance + const isSlippageExceeded = priceImpact > slippageTolerance; + const buttonState = { + disabled: !isSwapValid || isSlippageExceeded, + text: isSlippageExceeded ? "Slippage Tolerance Exceeded" : "Swap", + className: isSlippageExceeded + ? "bg-slate-700 cursor-not-allowed" + : "bg-blue-600 hover:bg-blue-700" + }; + // Dynamic Price Impact color logic const getPriceImpactColor = () => { if (priceImpact < 1) {