Skip to content

Commit

Permalink
feat: use hideOrdersTable widget param
Browse files Browse the repository at this point in the history
  • Loading branch information
alfetopito committed Oct 15, 2024
1 parent d91064d commit c811c16
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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))
Expand Down
16 changes: 11 additions & 5 deletions apps/cowswap-frontend/src/pages/AdvancedOrders/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -19,6 +20,7 @@ import {
} from 'modules/twap'
import { TwapFormState } from 'modules/twap/pure/PrimaryActionButton/getTwapFormState'


export default function AdvancedOrdersPage() {
const { isUnlocked } = useAtomValue(advancedOrdersAtom)

Expand All @@ -32,6 +34,8 @@ export default function AdvancedOrdersPage() {

const advancedWidgetParams = { disablePriceImpact }

const { hideOrdersTable } = useInjectedWidgetParams()

return (
<>
<FillAdvancedOrdersDerivedStateUpdater slippage={twapSlippage} />
Expand All @@ -50,11 +54,13 @@ export default function AdvancedOrdersPage() {
</styledEl.PrimaryWrapper>

<styledEl.SecondaryWrapper>
<OrdersTableWidget
displayOrdersOnlyForSafeApp={true}
orderType={TabOrderTypes.ADVANCED}
orders={allEmulatedOrders}
/>
{!hideOrdersTable && (
<OrdersTableWidget
displayOrdersOnlyForSafeApp={true}
orderType={TabOrderTypes.ADVANCED}
orders={allEmulatedOrders}
/>
)}
</styledEl.SecondaryWrapper>
</styledEl.PageWrapper>
</>
Expand Down
15 changes: 10 additions & 5 deletions apps/cowswap-frontend/src/pages/LimitOrders/RegularLimitOrders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<styledEl.PageWrapper isUnlocked={isUnlocked}>
Expand All @@ -19,11 +22,13 @@ export function RegularLimitOrders() {
</styledEl.PrimaryWrapper>

<styledEl.SecondaryWrapper>
<OrdersTableWidget
displayOrdersOnlyForSafeApp={false}
orderType={TabOrderTypes.LIMIT}
orders={allLimitOrders}
/>
{!hideOrdersTable && (
<OrdersTableWidget
displayOrdersOnlyForSafeApp={false}
orderType={TabOrderTypes.LIMIT}
orders={allLimitOrders}
/>
)}
</styledEl.SecondaryWrapper>
</styledEl.PageWrapper>
)
Expand Down

0 comments on commit c811c16

Please sign in to comment.