From 6377ad742d8702911f39e93feb6267adb5b7bea0 Mon Sep 17 00:00:00 2001
From: Neil <55785687+carkom@users.noreply.github.com>
Date: Mon, 5 Feb 2024 14:40:46 -0800
Subject: [PATCH] Custom Reports: add save reports menu (#2257)
* Add schema work
* notes
* merge fixes
* Add Reports Save Menu
* merge fixes
* updates
* notes
* updates
* updates
* save updates fix
* typecheck fixes
* merge fixes
* saveReport strict Typescript
* fix sidebar
* lint fix
* fixing functionality plus clean up
* clean up
---
.../src/components/reports/ReportOptions.ts | 3 -
.../src/components/reports/ReportSidebar.jsx | 15 +-
.../src/components/reports/ReportTopbar.jsx | 18 +-
.../src/components/reports/SaveReport.tsx | 176 ++++++++++++++----
.../src/components/reports/SaveReportMenu.tsx | 76 ++++++++
.../src/components/reports/SaveReportName.tsx | 74 ++++++++
.../reports/reports/CustomReport.jsx | 38 +++-
.../src/client/data-hooks/reports.ts | 8 +-
.../loot-core/src/types/models/reports.d.ts | 6 +-
upcoming-release-notes/2257.md | 6 +
10 files changed, 361 insertions(+), 59 deletions(-)
create mode 100644 packages/desktop-client/src/components/reports/SaveReportMenu.tsx
create mode 100644 packages/desktop-client/src/components/reports/SaveReportName.tsx
create mode 100644 upcoming-release-notes/2257.md
diff --git a/packages/desktop-client/src/components/reports/ReportOptions.ts b/packages/desktop-client/src/components/reports/ReportOptions.ts
index 8c2d361dbe6..a79c2059abf 100644
--- a/packages/desktop-client/src/components/reports/ReportOptions.ts
+++ b/packages/desktop-client/src/components/reports/ReportOptions.ts
@@ -11,8 +11,6 @@ const startDate = monthUtils.subMonths(monthUtils.currentMonth(), 5);
const endDate = monthUtils.currentMonth();
export const defaultReport: CustomReportEntity = {
- id: undefined,
- name: 'Default',
startDate,
endDate,
isDateStatic: false,
@@ -24,7 +22,6 @@ export const defaultReport: CustomReportEntity = {
showOffBudget: false,
showHiddenCategories: false,
showUncategorized: false,
- selectedCategories: [],
graphType: 'BarGraph',
conditions: [],
conditionsOp: 'and',
diff --git a/packages/desktop-client/src/components/reports/ReportSidebar.jsx b/packages/desktop-client/src/components/reports/ReportSidebar.jsx
index 0ccb5ef2bc9..46981a2c085 100644
--- a/packages/desktop-client/src/components/reports/ReportSidebar.jsx
+++ b/packages/desktop-client/src/components/reports/ReportSidebar.jsx
@@ -45,7 +45,7 @@ export function ReportSidebar({
}) {
const [menuOpen, setMenuOpen] = useState(false);
const onSelectRange = cond => {
- onReportChange(null, 'modify');
+ onReportChange({ type: 'modify' });
setDateRange(cond);
switch (cond) {
case 'All time':
@@ -79,7 +79,7 @@ export function ReportSidebar({
};
const onChangeMode = cond => {
- onReportChange(null, 'modify');
+ onReportChange({ type: 'modify' });
setMode(cond);
if (cond === 'time') {
if (customReportItems.graphType === 'TableGraph') {
@@ -110,7 +110,7 @@ export function ReportSidebar({
};
const onChangeSplit = cond => {
- onReportChange(null, 'modify');
+ onReportChange({ type: 'modify' });
setGroupBy(cond);
if (customReportItems.mode === 'total') {
if (customReportItems.graphType !== 'TableGraph') {
@@ -128,7 +128,7 @@ export function ReportSidebar({
};
const onChangeBalanceType = cond => {
- onReportChange(null, 'modify');
+ onReportChange({ type: 'modify' });
setBalanceType(cond);
};
@@ -275,6 +275,8 @@ export function ReportSidebar({
>