mango-v4-ui/components/trade/MobileTradeAdvancedPage.tsx

67 lines
2.2 KiB
TypeScript
Raw Normal View History

2022-10-25 18:37:59 -07:00
import { useState } from 'react'
2022-09-16 03:49:10 -07:00
import Orderbook from './Orderbook'
import AdvancedMarketHeader from './AdvancedMarketHeader'
import AdvancedTradeForm from './AdvancedTradeForm'
import TradeInfoTabs from './TradeInfoTabs'
2022-10-25 18:37:59 -07:00
import TabButtons from '@components/shared/TabButtons'
import { TABS } from './OrderbookAndTrades'
import RecentTrades from './RecentTrades'
2023-01-18 18:42:29 -08:00
import TradingChartContainer from './TradingChartContainer'
2023-02-13 18:53:13 -08:00
import FavoriteMarketsBar from './FavoriteMarketsBar'
2023-07-20 17:09:34 -07:00
import DepthChart from './DepthChart'
2022-09-16 03:49:10 -07:00
const MobileTradeAdvancedPage = () => {
2022-10-25 18:37:59 -07:00
const [activeTab, setActiveTab] = useState('trade:book')
2023-01-18 18:42:29 -08:00
const [showChart, setShowChart] = useState(false)
2022-09-16 03:49:10 -07:00
return (
<div className="grid grid-cols-2 sm:grid-cols-3">
2023-02-13 18:53:13 -08:00
<div className="col-span-2 sm:col-span-3">
<FavoriteMarketsBar />
</div>
2022-09-16 03:49:10 -07:00
<div className="col-span-2 border-b border-th-bkg-3 sm:col-span-3">
2023-01-18 18:42:29 -08:00
<AdvancedMarketHeader
showChart={showChart}
setShowChart={setShowChart}
/>
2022-09-16 03:49:10 -07:00
</div>
2023-01-18 18:42:29 -08:00
{showChart ? (
<div className="col-span-2 h-80 border-b border-th-bkg-3 sm:col-span-3">
<TradingChartContainer />
</div>
) : null}
2022-09-16 03:49:10 -07:00
<div className="col-span-1 pb-6 sm:col-span-2">
<AdvancedTradeForm />
</div>
<div className="col-span-1 border-l border-th-bkg-3">
2023-07-20 17:09:34 -07:00
<div className="hide-scroll overflow-x-auto border-b border-th-bkg-3">
2022-10-25 18:37:59 -07:00
<TabButtons
activeValue={activeTab}
onChange={(tab: string) => setActiveTab(tab)}
values={TABS}
fillWidth
2023-07-20 17:09:34 -07:00
showBorders
2022-10-25 18:37:59 -07:00
/>
</div>
2023-02-13 14:41:17 -08:00
<div className={activeTab === 'trade:book' ? 'visible' : 'hidden'}>
<Orderbook />
2022-10-25 18:37:59 -07:00
</div>
2023-07-20 17:09:34 -07:00
<div
className={`h-full ${
activeTab === 'trade:depth' ? 'visible' : 'hidden'
}`}
>
<DepthChart />
</div>
2023-02-13 14:41:17 -08:00
<div className={activeTab === 'trade:trades' ? 'visible' : 'hidden'}>
2022-10-25 18:37:59 -07:00
<RecentTrades />
</div>
2022-09-16 03:49:10 -07:00
</div>
<div className="col-span-2 border-t border-th-bkg-3 sm:col-span-3">
<TradeInfoTabs />
2022-09-16 03:49:10 -07:00
</div>
</div>
)
}
export default MobileTradeAdvancedPage