Skip to content

Commit

Permalink
feat: shared limit and twap settings
Browse files Browse the repository at this point in the history
  • Loading branch information
fairlighteth committed Dec 12, 2024
1 parent 782aa32 commit 0d92de2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
limitOrdersSettingsAtom,
updateLimitOrdersSettingsAtom,
} from 'modules/limitOrders/state/limitOrdersSettingsAtom'
import { ORDERS_TABLE_SETTINGS } from 'modules/trade/const/common'
import { SettingsBox, SettingsContainer, SettingsTitle } from 'modules/trade/pure/Settings'

import { AdvancedOrdersSettingsState } from '../../state/advancedOrdersSettingsAtom'
Expand All @@ -30,8 +31,8 @@ export function Settings({ state, onStateChanged }: SettingsProps) {
/>

<SettingsBox
title="Desktop: Left-Aligned Orders Table"
tooltip="When enabled, the orders table will be displayed on the left side on desktop screens. On mobile, the orders table will always be stacked below."
title={ORDERS_TABLE_SETTINGS.LEFT_ALIGNED.title}
tooltip={ORDERS_TABLE_SETTINGS.LEFT_ALIGNED.tooltip}
value={limitOrdersSettings.ordersTableOnLeft}
toggle={() => updateLimitOrdersSettings({ ordersTableOnLeft: !limitOrdersSettings.ordersTableOnLeft })}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { HelpTooltip } from '@cowprotocol/ui'

import styled from 'styled-components/macro'

import { ORDERS_TABLE_SETTINGS } from 'modules/trade/const/common'
import { SettingsBox, SettingsContainer, SettingsTitle } from 'modules/trade/pure/Settings'

import { LimitOrdersSettingsState } from '../../state/limitOrdersSettingsAtom'
Expand Down Expand Up @@ -182,8 +183,8 @@ export function Settings({ state, onStateChanged }: SettingsProps) {
/>

<SettingsBox
title="Desktop: Left-Aligned Orders Table"
tooltip="When enabled, the orders table will be displayed on the left side on desktop screens. On mobile, the orders table will always be stacked below."
title={ORDERS_TABLE_SETTINGS.LEFT_ALIGNED.title}
tooltip={ORDERS_TABLE_SETTINGS.LEFT_ALIGNED.tooltip}
value={ordersTableOnLeft}
toggle={() => onStateChanged({ ordersTableOnLeft: !ordersTableOnLeft })}
/>
Expand Down
8 changes: 8 additions & 0 deletions apps/cowswap-frontend/src/modules/trade/const/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ export const TradeTypeToUiOrderType: Record<TradeType, UiOrderType> = {
[TradeType.ADVANCED_ORDERS]: UiOrderType.TWAP,
[TradeType.YIELD]: UiOrderType.YIELD,
}

export const ORDERS_TABLE_SETTINGS = {
LEFT_ALIGNED: {
title: 'Desktop: Left-Aligned Orders Table',
tooltip:
'When enabled, the orders table will be displayed on the left side on desktop screens. On mobile, the orders table will always be stacked below.',
},
} as const

0 comments on commit 0d92de2

Please sign in to comment.