Skip to content

Commit

Permalink
cancel success status
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh committed Sep 14, 2023
1 parent f06886c commit 70e4369
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/components/swapv2/LimitOrder/Modals/CancelStatusCountDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ import { Flex, Text } from 'rebass'
import styled from 'styled-components'

import { ReactComponent as TimerIcon } from 'assets/svg/clock_timer.svg'
import { NotificationType } from 'components/Announcement/type'
import { Clock } from 'components/Icons'
import WarningIcon from 'components/Icons/WarningIcon'
import Loader from 'components/Loader'
import { CancelStatus } from 'components/swapv2/LimitOrder/Modals/CancelOrderModal'
import useInterval from 'hooks/useInterval'
import useTheme from 'hooks/useTheme'
import { useNotify } from 'state/application/hooks'
import { ExternalLink } from 'theme'
import { TransactionFlowState } from 'types/TransactionFlowState'
import { friendlyError } from 'utils/errorMessage'
Expand Down Expand Up @@ -63,7 +61,6 @@ export default function CancelStatusCountDown({
const pendingText = flowState.pendingText || t`Canceling order`

const theme = useTheme()
const notify = useNotify()

const [remain, setRemain] = useState(0)

Expand All @@ -75,16 +72,11 @@ export default function CancelStatusCountDown({
const countdown = useCallback(() => {
setRemain(v => {
if (v - 1 === 0) {
setCancelStatus(CancelStatus.TIMEOUT)
notify({
summary: t`Your cancellation request has timed out.`,
title: t`Limit Order`,
type: NotificationType.ERROR,
})
setCancelStatus(CancelStatus.CANCEL_DONE)
}
return Math.max(0, v - 1)
})
}, [setCancelStatus, notify])
}, [setCancelStatus])

useInterval(countdown, remain > 0 && cancelStatus === CancelStatus.COUNTDOWN ? 1000 : null)

Expand Down

0 comments on commit 70e4369

Please sign in to comment.