diff --git a/src/components/Acknowledgement/Acknowledgement.tsx b/src/components/Acknowledgement/Acknowledgement.tsx index 7c841f46c0d..b039c7b54c2 100644 --- a/src/components/Acknowledgement/Acknowledgement.tsx +++ b/src/components/Acknowledgement/Acknowledgement.tsx @@ -1,86 +1,25 @@ -import type { BoxProps, ComponentWithAs, IconProps, ThemeTypings } from '@chakra-ui/react' -import { Box, Button, Checkbox, Link, useColorModeValue } from '@chakra-ui/react' -import type { AnimationDefinition, MotionStyle } from 'framer-motion' -import { AnimatePresence, motion } from 'framer-motion' +import type { ComponentWithAs, IconProps, ThemeTypings } from '@chakra-ui/react' +import { + Box, + Button, + Checkbox, + Link, + Modal, + ModalBody, + ModalContent, + ModalFooter, + ModalOverlay, + useColorModeValue, +} from '@chakra-ui/react' import type { InterpolationOptions } from 'node-polyglot' -import type { PropsWithChildren } from 'react' -import React, { useCallback, useEffect, useMemo, useState } from 'react' +import React, { useCallback, useMemo, useState } from 'react' import { FiAlertTriangle } from 'react-icons/fi' import { useTranslate } from 'react-polyglot' import { StreamIcon } from 'components/Icons/Stream' import { RawText, Text } from 'components/Text' import { formatSecondsToDuration } from 'lib/utils/time' -const initialProps = { opacity: 0 } -const animateProps = { opacity: 1 } -const exitProps = { opacity: 0, transition: { duration: 0.5 } } -const transitionProps = { delay: 0.2, duration: 0.1 } -const motionStyle: MotionStyle = { - backgroundColor: 'var(--chakra-colors-blanket)', - position: 'absolute', - top: 0, - bottom: 0, - left: 0, - right: 0, - zIndex: 4, -} - -const AcknowledgementOverlay: React.FC = ({ children }) => { - return ( - - {children} - - ) -} - -const popoverVariants = { - initial: { - y: '100%', - }, - animate: { - y: 0, - transition: { - type: 'spring', - bounce: 0.2, - duration: 0.55, - }, - }, - exit: { - y: '100%', - opacity: 0, - transition: { - duration: 0.2, - }, - }, -} - -const popoverStyle: MotionStyle = { - backgroundColor: 'var(--chakra-colors-background-surface-overlay-base)', - position: 'absolute', - borderTopLeftRadius: 'var(--chakra-radii-2xl)', - borderTopRightRadius: 'var(--chakra-radii-2xl)', - bottom: 0, - left: 0, - right: 0, - zIndex: 5, - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - paddingLeft: '2rem', - paddingRight: '2rem', - paddingBottom: '2rem', - paddingTop: '4rem', -} - type AcknowledgementProps = { - children: React.ReactNode content?: JSX.Element message: string | JSX.Element onAcknowledge: (() => void) | undefined @@ -91,7 +30,6 @@ type AcknowledgementProps = { buttonTranslation?: string | [string, InterpolationOptions] icon?: ComponentWithAs<'svg', IconProps> disableButton?: boolean - boxProps?: BoxProps } type StreamingAcknowledgementProps = Omit & { @@ -100,10 +38,8 @@ type StreamingAcknowledgementProps = Omit & { type ArbitrumAcknowledgementProps = Omit const cancelHoverProps = { bg: 'rgba(255, 255, 255, 0.2)' } -const boxBorderRadius = { base: 'none', md: 'xl' } export const Acknowledgement = ({ - children, content, message, onAcknowledge, @@ -114,10 +50,8 @@ export const Acknowledgement = ({ buttonTranslation, disableButton, icon: CustomIcon, - boxProps, }: AcknowledgementProps) => { const translate = useTranslate() - const [isShowing, setIsShowing] = useState(false) const understandHoverProps = useMemo( () => ({ bg: `${buttonColorScheme}.600` }), @@ -135,88 +69,51 @@ export const Acknowledgement = ({ setShouldShowAcknowledgement(false) }, [setShouldShowAcknowledgement]) - const handleAnimationComplete = useCallback((def: AnimationDefinition) => { - if (def === 'exit') { - setIsShowing(false) - } - }, []) - - useEffect(() => { - // enters with overflow: hidden - // exit after animation complete return to overflow: visible - if (shouldShowAcknowledgement) { - setIsShowing(true) - } - }, [shouldShowAcknowledgement]) - return ( - - - {shouldShowAcknowledgement && ( - - - {CustomIcon ? ( - - ) : ( - - )} - - - {message} - {content} - - - - - - )} - - - {children} - + + + + + {CustomIcon ? ( + + ) : ( + + )} + + + {message} + {content} + + + + + + + + + ) } diff --git a/src/components/MultiHopTrade/components/LimitOrder/LimitOrder.tsx b/src/components/MultiHopTrade/components/LimitOrder/LimitOrder.tsx index d378f512cb9..8db0a52def1 100644 --- a/src/components/MultiHopTrade/components/LimitOrder/LimitOrder.tsx +++ b/src/components/MultiHopTrade/components/LimitOrder/LimitOrder.tsx @@ -29,10 +29,6 @@ import { useAccountIds } from '../../hooks/useAccountIds' import { SharedTradeInput } from '../SharedTradeInput/SharedTradeInput' const votingPowerParams: { feeModel: ParameterModel } = { feeModel: 'SWAPPER' } -const acknowledgementBoxProps = { - display: 'flex', - justifyContent: 'center', -} type LimitOrderProps = { tradeInputRef: React.MutableRefObject @@ -157,13 +153,13 @@ export const LimitOrder = ({ isCompact, tradeInputRef, onChangeTab }: LimitOrder ) return ( - + <> + - + ) } diff --git a/src/components/MultiHopTrade/components/MultiHopTradeConfirm/MultiHopTradeConfirm.tsx b/src/components/MultiHopTrade/components/MultiHopTradeConfirm/MultiHopTradeConfirm.tsx index d6e7f6a573f..24795f80c49 100644 --- a/src/components/MultiHopTrade/components/MultiHopTradeConfirm/MultiHopTradeConfirm.tsx +++ b/src/components/MultiHopTrade/components/MultiHopTradeConfirm/MultiHopTradeConfirm.tsx @@ -111,40 +111,39 @@ export const MultiHopTradeConfirm = memo(() => { onAcknowledge={handleTradeConfirm} shouldShowAcknowledgement={shouldShowWarningAcknowledgement} setShouldShowAcknowledgement={setShouldShowWarningAcknowledgement} - > - - - - - - - - {isTradeComplete ? ( - - - - ) : ( - <> - - - -