From e135932f899084f8998809696a134ab6b650361e Mon Sep 17 00:00:00 2001 From: fairlight <31534717+fairlighteth@users.noreply.github.com> Date: Thu, 16 Jan 2025 16:50:38 +0000 Subject: [PATCH] feat: hide orders table widget (#5303) * feat: hide orders table widget * feat: hide orders table widget for limit and twap --- .../trade/pure/TradePageLayout/index.tsx | 20 ++++++++++++------- .../src/pages/AdvancedOrders/index.tsx | 9 +++++---- .../pages/LimitOrders/RegularLimitOrders.tsx | 15 +++++++++----- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/apps/cowswap-frontend/src/modules/trade/pure/TradePageLayout/index.tsx b/apps/cowswap-frontend/src/modules/trade/pure/TradePageLayout/index.tsx index 7e48603ae6..26f05e9e45 100644 --- a/apps/cowswap-frontend/src/modules/trade/pure/TradePageLayout/index.tsx +++ b/apps/cowswap-frontend/src/modules/trade/pure/TradePageLayout/index.tsx @@ -5,29 +5,35 @@ import { WIDGET_MAX_WIDTH } from 'theme' const DEFAULT_MAX_WIDTH = '1500px' -export const PageWrapper = styled.div<{ isUnlocked: boolean; secondaryOnLeft?: boolean; maxWidth?: string }>` +export const PageWrapper = styled.div<{ + isUnlocked: boolean + secondaryOnLeft?: boolean + maxWidth?: string + hideOrdersTable?: boolean +}>` width: 100%; display: grid; max-width: ${({ maxWidth = DEFAULT_MAX_WIDTH }) => maxWidth}; margin: 0 auto; grid-template-columns: 1fr; - grid-template-rows: auto auto; - grid-template-areas: 'primary' 'secondary'; + grid-template-rows: auto; + grid-template-areas: ${({ hideOrdersTable }) => (hideOrdersTable ? '"primary"' : '"primary" "secondary"')}; gap: 20px; ${Media.LargeAndUp()} { - grid-template-columns: ${({ isUnlocked, secondaryOnLeft }) => - isUnlocked + grid-template-columns: ${({ isUnlocked, hideOrdersTable, secondaryOnLeft }) => + isUnlocked && !hideOrdersTable ? secondaryOnLeft ? '1fr minmax(auto, ' + WIDGET_MAX_WIDTH.swap.replace('px', '') + 'px)' : 'minmax(auto, ' + WIDGET_MAX_WIDTH.swap.replace('px', '') + 'px) 1fr' : '1fr'}; grid-template-rows: 1fr; - grid-template-areas: ${({ secondaryOnLeft }) => (secondaryOnLeft ? '"secondary primary"' : '"primary secondary"')}; + grid-template-areas: ${({ secondaryOnLeft, hideOrdersTable }) => + hideOrdersTable ? '"primary"' : secondaryOnLeft ? '"secondary primary"' : '"primary secondary"'}; } > div:last-child { - display: ${({ isUnlocked }) => (isUnlocked ? '' : 'none')}; + display: ${({ isUnlocked }) => (!isUnlocked ? 'none' : '')}; } ` diff --git a/apps/cowswap-frontend/src/pages/AdvancedOrders/index.tsx b/apps/cowswap-frontend/src/pages/AdvancedOrders/index.tsx index 7c629bf4f4..c5b28c7a60 100644 --- a/apps/cowswap-frontend/src/pages/AdvancedOrders/index.tsx +++ b/apps/cowswap-frontend/src/pages/AdvancedOrders/index.tsx @@ -51,6 +51,7 @@ export default function AdvancedOrdersPage() { isUnlocked={isUnlocked} maxWidth={ADVANCED_ORDERS_MAX_WIDTH} secondaryOnLeft={ordersTableOnLeft} + hideOrdersTable={hideOrdersTable} > {isFallbackHandlerRequired && pendingOrders.length > 0 && } @@ -69,15 +70,15 @@ export default function AdvancedOrdersPage() { - - {!hideOrdersTable && ( + {!hideOrdersTable && ( + - )} - + + )} ) diff --git a/apps/cowswap-frontend/src/pages/LimitOrders/RegularLimitOrders.tsx b/apps/cowswap-frontend/src/pages/LimitOrders/RegularLimitOrders.tsx index 2254eb869b..24f37d3b9a 100644 --- a/apps/cowswap-frontend/src/pages/LimitOrders/RegularLimitOrders.tsx +++ b/apps/cowswap-frontend/src/pages/LimitOrders/RegularLimitOrders.tsx @@ -20,20 +20,25 @@ export function RegularLimitOrders() { const { ordersTableOnLeft } = useAtomValue(limitOrdersSettingsAtom) return ( - + - - {!hideOrdersTable && ( + {!hideOrdersTable && ( + - )} - + + )} ) }