From 2d364297b94c995f8ad6384b9749099a824c4645 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi <90936742+Reckless-Satoshi@users.noreply.github.com> Date: Sun, 23 Oct 2022 18:29:39 +0000 Subject: [PATCH] Add depth widget. Fix style book. (#300) * Add depth widget. Fix style book. * Fix number of rows to window height --- frontend/src/components/BookTable/index.tsx | 10 ++- .../components/Charts/DepthChart/index.tsx | 56 ++++++++---- frontend/src/components/Icons/WorldFlags.tsx | 8 +- frontend/src/components/RobotAvatar/index.tsx | 6 +- frontend/src/pro/LandingDialog/index.tsx | 26 ++++-- frontend/src/pro/Main.tsx | 89 ++++++++++++------- frontend/src/pro/ToolBar/index.tsx | 15 ++-- frontend/src/pro/Widgets/Book.tsx | 16 ++-- frontend/src/pro/Widgets/Depth.tsx | 55 ++++++++++++ frontend/src/pro/Widgets/Maker.tsx | 2 +- frontend/src/pro/Widgets/Placeholder.tsx | 44 ++++++--- frontend/src/pro/Widgets/index.ts | 1 + 12 files changed, 236 insertions(+), 92 deletions(-) create mode 100644 frontend/src/pro/Widgets/Depth.tsx diff --git a/frontend/src/components/BookTable/index.tsx b/frontend/src/components/BookTable/index.tsx index b4bbdb6b..49310352 100644 --- a/frontend/src/components/BookTable/index.tsx +++ b/frontend/src/components/BookTable/index.tsx @@ -74,7 +74,7 @@ const BookTable = ({ // all sizes in 'em' const fontSize = theme.typography.fontSize; - const verticalHeightFrame = 3.625 + (showControls ? 3.7 : 0) + (showFooter ? 2.35 : 0); + const verticalHeightFrame = 3.25 + (showControls ? 3.7 : 0) + (showFooter ? 2.35 : 0); const verticalHeightRow = 3.25; const defaultPageSize = Math.max( Math.floor( @@ -500,7 +500,7 @@ const BookTable = ({ priority: 2, order: 5, normal: { - width: 5.8, + width: 5.9, object: currencyObj, }, }, @@ -706,7 +706,7 @@ const BookTable = ({ const gridComponents = function () { const components: GridComponentProps = { LoadingOverlay: LinearProgress, - NoResultsOverlay: NoResultsOverlay, + NoResultsOverlay, NoRowsOverlay: NoResultsOverlay, }; @@ -731,6 +731,8 @@ const BookTable = ({ > = ({ @@ -46,6 +48,8 @@ const DepthChart: React.FC = ({ limits, maxWidth, maxHeight, + fillContainer = false, + elevation = 6, }) => { const { t } = useTranslation(); const history = useHistory(); @@ -97,8 +101,13 @@ const DepthChart: React.FC = ({ setCenter(medianValue); setXRange(maxRange); setRangeSteps(rangeSteps); - } else if (lastDayPremium != undefined) { - setCenter(lastDayPremium); + } else { + if (lastDayPremium === undefined) { + const premiums: number[] = enrichedOrders.map((order) => order?.premium || 0); + setCenter(~~median(premiums)); + } else { + setCenter(lastDayPremium); + } setXRange(8); setRangeSteps(0.5); } @@ -276,22 +285,30 @@ const DepthChart: React.FC = ({ history.push('/order/' + point.data?.order?.id); }; + const em = theme.typography.fontSize; return ( - - + + {center == undefined || enrichedOrders.length < 1 ? (
) : ( - + = ({ container justifyContent='flex-start' alignItems='flex-start' - style={{ paddingLeft: 20 }} + style={{ paddingLeft: '1em' }} >