From faed2df96f02ff99afc75e60e8d5769f17dc34b2 Mon Sep 17 00:00:00 2001 From: Connor Barr Date: Thu, 22 Aug 2024 19:54:19 +0100 Subject: [PATCH] feat: added slippage warning for default too high --- packages/web/modals/review-order.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/web/modals/review-order.tsx b/packages/web/modals/review-order.tsx index 52f5b0a9ce..f065d1dc32 100644 --- a/packages/web/modals/review-order.tsx +++ b/packages/web/modals/review-order.tsx @@ -104,7 +104,11 @@ export function ReviewOrder({ ); const { isMobile } = useWindowSize(Breakpoint.sm); - const isManualSlippageTooHigh = +manualSlippage > 1; + const isManualSlippageTooHigh = + (!!manualSlippage && parseInt(manualSlippage) > 1) || + (!manualSlippage && + !!slippageConfig && + slippageConfig.slippage.toDec().gt(new Dec(0.01))); const isManualSlippageTooLow = manualSlippage !== "" && +manualSlippage < 0.1; //Value is memoized as it must be frozen when the component is mounted @@ -464,7 +468,8 @@ export function ReviewOrder({ inputClassName={classNames( "!bg-transparent focus:text-center text-right placeholder:text-wosmongton-300 transition-all focus-visible:outline-none", { - "text-rust-400": isManualSlippageTooHigh, + "text-rust-400 placeholder:text-rust-400": + isManualSlippageTooHigh, } )} value={manualSlippage}