A local-first personal finance app
Add colors to ReportTable "Totals" row (#5104)
POGMAN82a3c97222ba
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.pngindex 11a23f205b..f3fa4d36a3 100644Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-2-chromium-linux.pngindex a4814df625..1a2f068f6f 100644Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-2-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-2-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-3-chromium-linux.pngindex 338bb7cb01..1ec401b348 100644Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-3-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-3-chromium-linux.png differdiff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsxindex 4c30a16808..b8b5b6af2c 100644--- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx+++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx@@ -132,6 +132,7 @@ export function ReportTable({handleScroll={handleScroll}height={32 + scrollWidthTotals}interval={interval}+ colorized={true}/>);},diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsxindex 2ca507f3e7..d750596f8e 100644--- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx+++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx@@ -46,6 +46,12 @@ type ReportTableRowProps = {totalScrollRef?: RefObject<HTMLDivElement | null>;handleScroll?: UIEventHandler<HTMLDivElement>;height?: number;+ colorized?: boolean;+};++const getAmountColor = (amount: number) => {+ if (amount === 0) return undefined;+ return amount > 0 ? theme.noticeText : theme.errorText;};export const ReportTableRow = memo(@@ -68,6 +74,7 @@ export const ReportTableRow = memo(handleScroll,height,interval,+ colorized,}: ReportTableRowProps) => {const average = amountToInteger(item[balanceTypeOp]) / intervalsCount;const groupByItem = groupBy === 'Interval' ? 'date' : 'name';@@ -135,6 +142,9 @@ export const ReportTableRow = memo(key={index}style={{minWidth: compact ? 50 : 85,+ ...(colorized && {+ color: getAmountColor(intervalItem[balanceTypeOp]),+ }),}}unexposedContent={({ value }) => (<Text style={hoverUnderline}>{value}</Text>@@ -185,6 +195,9 @@ export const ReportTableRow = memo(privacyFilterstyle={{minWidth: compact ? 50 : 85,+ ...(colorized && {+ color: getAmountColor(item.totalAssets),+ }),}}unexposedContent={({ value }) => (<Text style={hoverUnderline}>{value}</Text>@@ -222,6 +235,9 @@ export const ReportTableRow = memo(privacyFilterstyle={{minWidth: compact ? 50 : 85,+ ...(colorized && {+ color: getAmountColor(item.totalDebts),+ }),}}unexposedContent={({ value }) => (<Text style={hoverUnderline}>{value}</Text>@@ -260,6 +276,7 @@ export const ReportTableRow = memo(style={{fontWeight: 600,minWidth: compact ? 50 : 85,+ ...(colorized && { color: getAmountColor(item[balanceTypeOp]) }),}}unexposedContent={({ value }) => (<Text style={hoverUnderline}>{value}</Text>@@ -298,6 +315,7 @@ export const ReportTableRow = memo(style={{fontWeight: 600,minWidth: compact ? 50 : 85,+ ...(colorized && { color: getAmountColor(average) }),}}valueStyle={compactStyle}width="flex"diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsxindex 78da2f5cc5..733ed395b2 100644--- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx+++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx@@ -93,8 +93,8 @@ export function ReportTableTotals({borderTopWidth: 1,borderColor: theme.tableBorder,justifyContent: 'center',- color: theme.tableHeaderText,- backgroundColor: theme.tableHeaderBackground,+ color: theme.tableRowHeaderText,+ backgroundColor: theme.tableRowHeaderBackground,fontWeight: 600,...style,};diff --git a/upcoming-release-notes/5104.md b/upcoming-release-notes/5104.mdnew file mode 100644index 0000000000..b708a05041--- /dev/null+++ b/upcoming-release-notes/5104.md@@ -0,0 +1,6 @@+---+category: Enhancements+authors: [pogman-code]+---++Add colors to ReportTable "Totals" row