diff --git a/src/components/swapv2/LimitOrder/ActionButtonLimitOrder.tsx b/src/components/swapv2/LimitOrder/ActionButtonLimitOrder.tsx index bdf2c18562..4f488951df 100644 --- a/src/components/swapv2/LimitOrder/ActionButtonLimitOrder.tsx +++ b/src/components/swapv2/LimitOrder/ActionButtonLimitOrder.tsx @@ -56,7 +56,8 @@ export default function ActionButtonLimitOrder({ }) { const disableBtnApproved = approval === ApprovalState.PENDING || - ((approval !== ApprovalState.NOT_APPROVED || approvalSubmitted || !!hasInputError) && enoughAllowance) + !!hasInputError || + ((approval !== ApprovalState.NOT_APPROVED || approvalSubmitted) && enoughAllowance) const disableBtnReview = checkingAllowance || diff --git a/src/components/swapv2/LimitOrder/EditOrderModal.tsx b/src/components/swapv2/LimitOrder/EditOrderModal.tsx index 058d39bb91..9aa90444fc 100644 --- a/src/components/swapv2/LimitOrder/EditOrderModal.tsx +++ b/src/components/swapv2/LimitOrder/EditOrderModal.tsx @@ -113,11 +113,13 @@ export default function EditOrderModal({ const isWaiting = cancelStatus === CancelStatus.WAITING const showReview = isReviewOrder && isWaiting + // todo const ref = useRef(null) const renderCancelButtons = () => { const hasChangeInfo = step === Steps.EDIT_ORDER ? ref.current?.hasChangedOrderInfo?.() : true const disabledGasLessCancel = !hasChangeInfo || !supportGasLessCancel || flowState.attemptingTxn const disabledHardCancel = !hasChangeInfo || flowState.attemptingTxn + if (!ref.current?.isShowApprove?.()) return null return ( <> {isReviewOrder && ( diff --git a/src/components/swapv2/LimitOrder/LimitOrderForm.tsx b/src/components/swapv2/LimitOrder/LimitOrderForm.tsx index dcdacc5228..fadcca415e 100644 --- a/src/components/swapv2/LimitOrder/LimitOrderForm.tsx +++ b/src/components/swapv2/LimitOrder/LimitOrderForm.tsx @@ -111,6 +111,7 @@ const ExpiredInput = styled(InputWrapper)` ` export type LimitOrderFormHandle = { hasChangedOrderInfo: () => boolean + isShowApprove: () => boolean } const LimitOrderForm = forwardRef(function LimitOrderForm( { @@ -583,7 +584,6 @@ const LimitOrderForm = forwardRef(function LimitOrd !checkingAllowance && !showWrap && !isNotFillAllInput && - !hasInputError && (approval === ApprovalState.NOT_APPROVED || approval === ApprovalState.PENDING || !enoughAllowance || @@ -601,11 +601,15 @@ const LimitOrderForm = forwardRef(function LimitOrd hasChangedOrderInfo() { return ( isEdit && + !hasInputError && (defaultInputAmount !== inputAmount || defaultRate?.rate !== rateInfo.rate || defaultExpire?.getTime() !== expiredAt) ) }, + isShowApprove() { + return isEdit && !showApproveFlow + }, })) const renderConfirmModal = (showConfirmContent = false) => (