From c811c168ea2abee6fe89569556d24d5312535047 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Tue, 15 Oct 2024 18:48:02 +0100 Subject: [PATCH] feat: use hideOrdersTable widget param --- .../containers/TradeWidget/TradeWidgetForm.tsx | 3 ++- .../src/pages/AdvancedOrders/index.tsx | 16 +++++++++++----- .../src/pages/LimitOrders/RegularLimitOrders.tsx | 15 ++++++++++----- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/apps/cowswap-frontend/src/modules/trade/containers/TradeWidget/TradeWidgetForm.tsx b/apps/cowswap-frontend/src/modules/trade/containers/TradeWidget/TradeWidgetForm.tsx index bba2c13940..b9c48ad9d1 100644 --- a/apps/cowswap-frontend/src/modules/trade/containers/TradeWidget/TradeWidgetForm.tsx +++ b/apps/cowswap-frontend/src/modules/trade/containers/TradeWidget/TradeWidgetForm.tsx @@ -49,7 +49,7 @@ const scrollToMyOrders = () => { export function TradeWidgetForm(props: TradeWidgetProps) { const isInjectedWidgetMode = isInjectedWidget() - const { standaloneMode } = useInjectedWidgetParams() + const { standaloneMode, hideOrdersTable } = useInjectedWidgetParams() const isAlternativeOrderModalVisible = useIsAlternativeOrderModalVisible() const { pendingActivity } = useCategorizeRecentActivity() @@ -113,6 +113,7 @@ export function TradeWidgetForm(props: TradeWidgetProps) { const shouldShowMyOrdersButton = !alternativeOrderModalVisible && (!isInjectedWidgetMode && isConnectedSwapMode ? isUpToLarge : true) && + !hideOrdersTable && ((isConnectedSwapMode && standaloneMode !== true) || (isLimitOrderMode && isUpToLarge && isLimitOrdersUnlocked) || (isAdvancedMode && isUpToLarge && isAdvancedOrdersUnlocked)) diff --git a/apps/cowswap-frontend/src/pages/AdvancedOrders/index.tsx b/apps/cowswap-frontend/src/pages/AdvancedOrders/index.tsx index 72644944e9..c1b37aa56f 100644 --- a/apps/cowswap-frontend/src/pages/AdvancedOrders/index.tsx +++ b/apps/cowswap-frontend/src/pages/AdvancedOrders/index.tsx @@ -6,6 +6,7 @@ import { FillAdvancedOrdersDerivedStateUpdater, SetupAdvancedOrderAmountsFromUrlUpdater, } from 'modules/advancedOrders' +import { useInjectedWidgetParams } from 'modules/injectedWidget' import { OrdersTableWidget, TabOrderTypes } from 'modules/ordersTable' import * as styledEl from 'modules/trade/pure/TradePageLayout' import { @@ -19,6 +20,7 @@ import { } from 'modules/twap' import { TwapFormState } from 'modules/twap/pure/PrimaryActionButton/getTwapFormState' + export default function AdvancedOrdersPage() { const { isUnlocked } = useAtomValue(advancedOrdersAtom) @@ -32,6 +34,8 @@ export default function AdvancedOrdersPage() { const advancedWidgetParams = { disablePriceImpact } + const { hideOrdersTable } = useInjectedWidgetParams() + return ( <> @@ -50,11 +54,13 @@ export default function AdvancedOrdersPage() { - + {!hideOrdersTable && ( + + )} diff --git a/apps/cowswap-frontend/src/pages/LimitOrders/RegularLimitOrders.tsx b/apps/cowswap-frontend/src/pages/LimitOrders/RegularLimitOrders.tsx index e90cde808a..542305fa8f 100644 --- a/apps/cowswap-frontend/src/pages/LimitOrders/RegularLimitOrders.tsx +++ b/apps/cowswap-frontend/src/pages/LimitOrders/RegularLimitOrders.tsx @@ -3,14 +3,17 @@ import { useWalletInfo } from '@cowprotocol/wallet' import { useOrders } from 'legacy/state/orders/hooks' +import { useInjectedWidgetParams } from 'modules/injectedWidget' import { LimitOrdersWidget, useIsWidgetUnlocked } from 'modules/limitOrders' import { OrdersTableWidget, TabOrderTypes } from 'modules/ordersTable' import * as styledEl from 'modules/trade/pure/TradePageLayout' + export function RegularLimitOrders() { const isUnlocked = useIsWidgetUnlocked() const { chainId, account } = useWalletInfo() const allLimitOrders = useOrders(chainId, account, UiOrderType.LIMIT) + const { hideOrdersTable } = useInjectedWidgetParams() return ( @@ -19,11 +22,13 @@ export function RegularLimitOrders() { - + {!hideOrdersTable && ( + + )} )