From 2d492e1f68f91baa648e6c26dbaffa34c3746fca Mon Sep 17 00:00:00 2001 From: carkom Date: Thu, 26 Oct 2023 11:13:57 +0100 Subject: [PATCH] data display adjustments --- .../src/components/reports/ReportTable.tsx | 43 +++++++++---------- .../reports/graphs/StackedBarGraph.tsx | 30 ++++++++----- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/packages/desktop-client/src/components/reports/ReportTable.tsx b/packages/desktop-client/src/components/reports/ReportTable.tsx index def27e33630..8e20b4d7698 100644 --- a/packages/desktop-client/src/components/reports/ReportTable.tsx +++ b/packages/desktop-client/src/components/reports/ReportTable.tsx @@ -47,6 +47,9 @@ const TableRow = memo( })} @@ -94,28 +97,24 @@ export function TableTotals({ data, scrollWidth, totalItem, mode }) { }} > - {mode === 'time' ? ( - <> - {data.monthData.map(item => { - return ( - - ); - })} - - - ) : ( - - )} + {mode === 'time' && + data.monthData.map(item => { + return ( + + ); + })} + + {scrollWidth > 0 && } ); diff --git a/packages/desktop-client/src/components/reports/graphs/StackedBarGraph.tsx b/packages/desktop-client/src/components/reports/graphs/StackedBarGraph.tsx index 09e33fb36b9..d53acadfc06 100644 --- a/packages/desktop-client/src/components/reports/graphs/StackedBarGraph.tsx +++ b/packages/desktop-client/src/components/reports/graphs/StackedBarGraph.tsx @@ -60,12 +60,6 @@ function StackedBarGraph({ }; }; - type CustomTooltipProps = { - active?: boolean; - payload?: PayloadItem[]; - label?: string; - }; - type CustomLegendProps = { active?: boolean; payload?: PayloadItem[]; @@ -85,8 +79,15 @@ function StackedBarGraph({ return
; }; + type CustomTooltipProps = { + active?: boolean; + payload?: PayloadItem[]; + label?: string; + }; + const CustomTooltip = ({ active, payload, label }: CustomTooltipProps) => { if (active && payload && payload.length) { + let sumTotals = 0; return (
+ .map(pay => { + sumTotals += pay.value; + return ( pay.value !== 0 && ( - ), - )} + ) + ); + })} +