diff --git a/apps/trading/pages/markets/trade-grid.tsx b/apps/trading/pages/markets/trade-grid.tsx index d6ff4036a..aa793fce4 100644 --- a/apps/trading/pages/markets/trade-grid.tsx +++ b/apps/trading/pages/markets/trade-grid.tsx @@ -1,8 +1,8 @@ import classNames from 'classnames'; import AutoSizer from 'react-virtualized-auto-sizer'; import { useState, ReactNode } from 'react'; +import { TradingView, TradingViews } from '@vegaprotocol/react-helpers'; import { Market_market } from './__generated__/Market'; -import { View, Views } from './trading-components'; import { GridTab, GridTabs } from './grid-tabs'; interface TradeGridProps { @@ -22,10 +22,10 @@ export const TradeGrid = ({ market }: TradeGridProps) => {

Market: {market.name}

- + - + @@ -33,20 +33,20 @@ export const TradeGrid = ({ market }: TradeGridProps) => {
{JSON.stringify(market.trades, null, 2)}
- +
- + - + - + @@ -79,10 +79,10 @@ interface TradePanelsProps { } export const TradePanels = ({ market }: TradePanelsProps) => { - const [view, setView] = useState('chart'); + const [view, setView] = useState('chart'); const renderView = () => { - const Component = Views[view]; + const Component = TradingViews[view]; if (!Component) { throw new Error(`No component for view: ${view}`); @@ -104,7 +104,7 @@ export const TradePanels = ({ market }: TradePanelsProps) => {
- {Object.keys(Views).map((key: View) => { + {Object.keys(TradingViews).map((key: TradingView) => { const className = classNames( 'p-8', 'border-t', diff --git a/libs/react-helpers/src/index.ts b/libs/react-helpers/src/index.ts index f9a52e847..afaebe2fe 100644 --- a/libs/react-helpers/src/index.ts +++ b/libs/react-helpers/src/index.ts @@ -1 +1,2 @@ export * from './lib/react-helpers'; +export * from './lib/trading'; diff --git a/apps/trading/pages/markets/trading-components.tsx b/libs/react-helpers/src/lib/trading/index.tsx similarity index 84% rename from apps/trading/pages/markets/trading-components.tsx rename to libs/react-helpers/src/lib/trading/index.tsx index d3eb01041..ad460b543 100644 --- a/apps/trading/pages/markets/trading-components.tsx +++ b/libs/react-helpers/src/lib/trading/index.tsx @@ -5,9 +5,9 @@ export const Orders = () =>
TODO: Orders
; export const Positions = () =>
TODO: Positions
; export const Collateral = () =>
TODO: Collateral
; -export type View = keyof typeof Views; +export type TradingView = keyof typeof TradingViews; -export const Views = { +export const TradingViews = { chart: Chart, ticket: Ticket, orderbook: Orderbook,