fix: show a loading state of the trading chart (#610)
* fix: show a loading state of the trading chart * tidy: refactor
This commit is contained in:
parent
cb1827d990
commit
dd48841504
@ -106,7 +106,7 @@ export const TVChartContainer = (props: Props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Card title='Trading Chart' contentClassName='px-0.5 pb-0.5 h-full'>
|
<Card title='Trading Chart' contentClassName='px-0.5 pb-0.5 h-full'>
|
||||||
<div ref={chartContainerRef} className='h-full' />
|
<div ref={chartContainerRef} className='h-full overflow-hidden rounded-b-base' />
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@ import dynamic from 'next/dynamic'
|
|||||||
import Script from 'next/script'
|
import Script from 'next/script'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
|
|
||||||
|
import { CircularProgress } from 'components/CircularProgress'
|
||||||
|
import Card from 'components/Card'
|
||||||
|
|
||||||
const TVChartContainer = dynamic(
|
const TVChartContainer = dynamic(
|
||||||
() => import('components/Trade/TradeChart/TVChartContainer').then((mod) => mod.TVChartContainer),
|
() => import('components/Trade/TradeChart/TVChartContainer').then((mod) => mod.TVChartContainer),
|
||||||
{ ssr: false },
|
{ ssr: false },
|
||||||
@ -24,7 +27,15 @@ export default function TradeChart(props: Props) {
|
|||||||
setIsScriptReady(true)
|
setIsScriptReady(true)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{isScriptReady && <TVChartContainer buyAsset={props.buyAsset} sellAsset={props.sellAsset} />}
|
{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>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@ module.exports = {
|
|||||||
axlusdc: '#478edc',
|
axlusdc: '#478edc',
|
||||||
body: '#0D0012',
|
body: '#0D0012',
|
||||||
'body-dark': '#141621',
|
'body-dark': '#141621',
|
||||||
|
chart: '#220e1d',
|
||||||
error: '#F04438',
|
error: '#F04438',
|
||||||
'error-bg': '#FDA29B',
|
'error-bg': '#FDA29B',
|
||||||
green: '#039855',
|
green: '#039855',
|
||||||
|
Loading…
Reference in New Issue
Block a user