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..d53b6b2f6b 100644 --- a/src/components/swapv2/LimitOrder/EditOrderModal.tsx +++ b/src/components/swapv2/LimitOrder/EditOrderModal.tsx @@ -118,6 +118,7 @@ export default function EditOrderModal({ const hasChangeInfo = step === Steps.EDIT_ORDER ? ref.current?.hasChangedOrderInfo?.() : true const disabledGasLessCancel = !hasChangeInfo || !supportGasLessCancel || flowState.attemptingTxn const disabledHardCancel = !hasChangeInfo || flowState.attemptingTxn + if (!ref.current?.canSubmitOrder?.()) return null return ( <> {isReviewOrder && ( diff --git a/src/components/swapv2/LimitOrder/LimitOrderForm.tsx b/src/components/swapv2/LimitOrder/LimitOrderForm.tsx index dcdacc5228..6350cde0f1 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 + canSubmitOrder: () => 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 || @@ -606,6 +606,9 @@ const LimitOrderForm = forwardRef(function LimitOrd defaultExpire?.getTime() !== expiredAt) ) }, + canSubmitOrder() { + return isEdit && !hasInputError && !showApproveFlow + }, })) const renderConfirmModal = (showConfirmContent = false) => (