mars-v2-frontend/src/components/Trade/TradeChart/index.tsx
Linkie Link b0c9cca51c
v2.0.5 (#636)
* fix: fixed the trading chart load

* fix: prevent wrapped checkboxes to be double clicked

* fix: refactored funding account modal

* fix: fixed modal classes

* fix: adjusted width classes

* fix: fixed the slider masks

* listed: TIA and USDT

* fix: fixed the slider initial position

* env: version update
2023-11-15 16:27:05 +01:00

45 lines
1.2 KiB
TypeScript

import dynamic from 'next/dynamic'
import Script from 'next/script'
import { useState } from 'react'
import Card from 'components/Card'
import { CircularProgress } from 'components/CircularProgress'
const TVChartContainer = dynamic(
() => import('components/Trade/TradeChart/TVChartContainer').then((mod) => mod.TVChartContainer),
{ ssr: false },
)
interface Props {
buyAsset: Asset
sellAsset: Asset
}
export default function TradeChart(props: Props) {
const [isScriptReady, setIsScriptReady] = useState(false)
return (
<>
<Script
src='/datafeeds/udf/dist/bundle.js'
strategy='lazyOnload'
onReady={() => {
setIsScriptReady(true)
}}
onLoad={() => {
setIsScriptReady(true)
}}
/>
{isScriptReady ? (
<TVChartContainer buyAsset={props.buyAsset} sellAsset={props.sellAsset} />
) : (
<Card title='Trading Chart' contentClassName='px-0.5 pb-0.5 h-full'>
<div className='flex items-center justify-center w-full h-full rounded-b-base bg-chart'>
<CircularProgress size={60} className='opacity-50' />
</div>
</Card>
)}
</>
)
}