This commit is contained in:
parent
50da2a9d3c
commit
d6b362805e
@ -4,8 +4,8 @@ import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
|||||||
import {
|
import {
|
||||||
useDataProvider,
|
useDataProvider,
|
||||||
addDecimal,
|
addDecimal,
|
||||||
addDecimalsFormatNumber,
|
|
||||||
ThemeContext,
|
ThemeContext,
|
||||||
|
getNumberFormat,
|
||||||
} from '@vegaprotocol/react-helpers';
|
} from '@vegaprotocol/react-helpers';
|
||||||
import dataProvider from './market-depth-data-provider';
|
import dataProvider from './market-depth-data-provider';
|
||||||
import {
|
import {
|
||||||
@ -175,18 +175,25 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
|||||||
setPositionDecimalPlaces(data.positionDecimalPlaces);
|
setPositionDecimalPlaces(data.positionDecimalPlaces);
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
|
const volumeFormat = useCallback(
|
||||||
|
(volume: number) =>
|
||||||
|
getNumberFormat(data?.positionDecimalPlaces || 0).format(volume),
|
||||||
|
[data?.positionDecimalPlaces]
|
||||||
|
);
|
||||||
|
|
||||||
|
const priceFormat = useCallback(
|
||||||
|
(price: number) => getNumberFormat(data?.decimalPlaces || 0).format(price),
|
||||||
|
[data?.decimalPlaces]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AsyncRenderer loading={loading} error={error} data={data}>
|
<AsyncRenderer loading={loading} error={error} data={data}>
|
||||||
{depthData && (
|
{depthData && (
|
||||||
<DepthChart
|
<DepthChart
|
||||||
{...depthData}
|
{...depthData}
|
||||||
theme={theme}
|
theme={theme}
|
||||||
volumeFormat={(volume) =>
|
volumeFormat={volumeFormat}
|
||||||
addDecimalsFormatNumber(volume, data?.positionDecimalPlaces || 0)
|
priceFormat={priceFormat}
|
||||||
}
|
|
||||||
priceFormat={(price) =>
|
|
||||||
addDecimalsFormatNumber(price, data?.decimalPlaces || 0)
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</AsyncRenderer>
|
</AsyncRenderer>
|
||||||
|
Loading…
Reference in New Issue
Block a user