-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathindex.tsx
39 lines (33 loc) · 1.39 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Navigate } from 'react-router-dom'
import { AdvancedOrdersWidget } from 'modules/advancedOrders'
import { OrdersTableWidget } from 'modules/ordersTable'
import { useTradeRouteContext } from 'modules/trade/hooks/useTradeRouteContext'
import * as styledEl from 'modules/trade/pure/TradePageLayout'
import { parameterizeTradeRoute } from 'modules/trade/utils/parameterizeTradeRoute'
import { TwapFormWidget } from 'modules/twap'
import { Routes as RoutesEnum } from 'common/constants/routes'
import { useIsAdvancedOrdersEnabled } from 'common/hooks/useIsAdvancedOrdersEnabled'
export default function AdvancedOrdersPage() {
const isAdvancedOrdersEnabled = useIsAdvancedOrdersEnabled()
const tradeContext = useTradeRouteContext()
if (!isAdvancedOrdersEnabled) {
// To prevent direct access when the flag is off
return <Navigate to={parameterizeTradeRoute(tradeContext, RoutesEnum.SWAP)} />
}
return (
<>
{/*TODO: add isUnlocked value*/}
<styledEl.PageWrapper isUnlocked={true}>
<styledEl.PrimaryWrapper>
<AdvancedOrdersWidget>
{/*TODO: conditionally display a widget for current advanced order type*/}
<TwapFormWidget />
</AdvancedOrdersWidget>
</styledEl.PrimaryWrapper>
<styledEl.SecondaryWrapper>
<OrdersTableWidget />
</styledEl.SecondaryWrapper>
</styledEl.PageWrapper>
</>
)
}