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..100517aa7a 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) && + (isConnectedSwapMode || !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 && ( + + )} ) diff --git a/apps/widget-configurator/src/app/configurator/hooks/useWidgetParamsAndSettings.ts b/apps/widget-configurator/src/app/configurator/hooks/useWidgetParamsAndSettings.ts index 41c736f6d9..0e9c49a740 100644 --- a/apps/widget-configurator/src/app/configurator/hooks/useWidgetParamsAndSettings.ts +++ b/apps/widget-configurator/src/app/configurator/hooks/useWidgetParamsAndSettings.ts @@ -44,6 +44,7 @@ export function useWidgetParams(configuratorState: ConfiguratorState): CowSwapWi disableToastMessages, disableProgressBar, hideBridgeInfo, + hideOrdersTable, } = configuratorState const themeColors = { @@ -98,6 +99,7 @@ export function useWidgetParams(configuratorState: ConfiguratorState): CowSwapWi } : undefined, hideBridgeInfo, + hideOrdersTable, } return params diff --git a/apps/widget-configurator/src/app/configurator/index.tsx b/apps/widget-configurator/src/app/configurator/index.tsx index 5aed4286e6..cb387444d9 100644 --- a/apps/widget-configurator/src/app/configurator/index.tsx +++ b/apps/widget-configurator/src/app/configurator/index.tsx @@ -143,6 +143,9 @@ export function Configurator({ title }: { title: string }) { const [hideBridgeInfo, setHideBridgeInfo] = useState(false) const toggleHideBridgeInfo = useCallback(() => setHideBridgeInfo((curr) => !curr), []) + const [hideOrdersTable, setHideOrdersTable] = useState(false) + const toggleHideOrdersTable = useCallback(() => setHideOrdersTable((curr) => !curr), []) + const LINKS = [ { icon: , label: 'View embed code', onClick: () => handleDialogOpen() }, { icon: , label: 'Widget web', url: `https://cow.fi/widget/?${UTM_PARAMS}` }, @@ -177,6 +180,7 @@ export function Configurator({ title }: { title: string }) { disableToastMessages, disableProgressBar, hideBridgeInfo, + hideOrdersTable, } const computedParams = useWidgetParams(state) @@ -326,6 +330,14 @@ export function Configurator({ title }: { title: string }) { + + Hide orders table: + + } label="Show orders table" /> + } label="Hide orders table" /> + + + {isDrawerOpen && (