From cd385c13edbdc4182dcf2bc4e8b9794f0ab78cf2 Mon Sep 17 00:00:00 2001 From: Jan Langheimer Date: Mon, 20 Nov 2023 13:56:32 +0000 Subject: [PATCH] remove limit orders --- src/elements/swapHeader/SwapHeader.tsx | 27 +-------- src/elements/swapWidget/SwapWidget.tsx | 77 +++----------------------- src/pages/Swap.tsx | 8 --- 3 files changed, 10 insertions(+), 102 deletions(-) diff --git a/src/elements/swapHeader/SwapHeader.tsx b/src/elements/swapHeader/SwapHeader.tsx index a26fe4de..984623cc 100644 --- a/src/elements/swapHeader/SwapHeader.tsx +++ b/src/elements/swapHeader/SwapHeader.tsx @@ -1,38 +1,15 @@ -import { classNameGenerator } from 'utils/pureFunctions'; import 'elements/swapHeader/SwapHeader.css'; import { SwapSwitch } from 'elements/swapSwitch/SwapSwitch'; import { PopoverV3 } from 'components/popover/PopoverV3'; import { ReactComponent as IconSettings } from 'assets/icons/settings.svg'; import { SlippageSettings } from 'elements/settings/SlippageSettings'; -interface SwapHeaderProps { - isLimit: boolean; - setIsLimit: Function; -} - -export const SwapHeader = ({ isLimit, setIsLimit }: SwapHeaderProps) => { - const marketActive = classNameGenerator({ - 'swap-header-active': !isLimit, - }); - - const limitActive = classNameGenerator({ - 'swap-header-active': isLimit, - }); - +export const SwapHeader = () => { return (
- - - + Market
diff --git a/src/elements/swapWidget/SwapWidget.tsx b/src/elements/swapWidget/SwapWidget.tsx index ac493add..cb1cd7f1 100644 --- a/src/elements/swapWidget/SwapWidget.tsx +++ b/src/elements/swapWidget/SwapWidget.tsx @@ -1,33 +1,21 @@ import { useCallback, useEffect, useState } from 'react'; import { SwapHeader } from 'elements/swapHeader/SwapHeader'; -import { SwapLimit } from 'elements/swapLimit/SwapLimit'; import { TokenMinimal } from 'services/observables/tokens'; import { useAppSelector } from 'store'; import { ethToken } from 'services/web3/config'; import { Insight } from 'elements/swapInsights/Insight'; import { IntoTheBlock, intoTheBlockByToken } from 'services/api/intoTheBlock'; import { useAsyncEffect } from 'use-async-effect'; -import { useNavigation } from 'hooks/useNavigation'; import { TradeWidget } from 'elements/trade/TradeWidget'; import { getTradeTokensWithExternal } from 'store/bancor/bancor'; interface SwapWidgetProps { - isLimit: boolean; - setIsLimit: Function; from: string | null; to: string | null; limit: string | null; - refreshLimit: Function; } -export const SwapWidget = ({ - isLimit, - setIsLimit, - from, - to, - limit, - refreshLimit, -}: SwapWidgetProps) => { +export const SwapWidget = ({ from, to, limit }: SwapWidgetProps) => { const tokens = useAppSelector(getTradeTokensWithExternal); const ethOrFirst = useCallback(() => { @@ -54,10 +42,8 @@ export const SwapWidget = ({ if (toToken) setToToken(toToken); else setToToken(undefined); } else setToToken(undefined); - - setIsLimit(limit); } - }, [from, to, limit, tokens, setIsLimit, ethOrFirst]); + }, [from, to, limit, tokens, ethOrFirst]); useAsyncEffect( async (isMounted) => { @@ -83,66 +69,19 @@ export const SwapWidget = ({ [toToken] ); - const { goToPage } = useNavigation(); - return (
- - goToPage.trade({ - from: fromToken?.address, - to: toToken?.address, - limit, - }) - } - /> +
- {isLimit ? ( - - goToPage.trade({ - from: from.address, - to: toToken?.address, - limit: true, - }) - } - toToken={toToken} - setToToken={(to: TokenMinimal) => - goToPage.trade({ - from: fromToken?.address, - to: to.address, - limit: true, - }) - } - switchTokens={() => - goToPage.trade({ - from: toToken?.address, - to: fromToken?.address, - limit: true, - }) - } - refreshLimit={refreshLimit} - /> - ) : ( - - )} +
- {isLimit ? ( -
- Limit orders are powered by Rook -
- ) : ( - '' - )}
{ - const [isLimit, setIsLimit] = useState(false); - const [SwapLimitTable, refreshLimit] = useSwapLimitTable(); const query = useQuery(); return (
- {isLimit && SwapLimitTable ? SwapLimitTable : ''}
); };