From 06cf65497fadd2dd407d69974ec0626145e6b785 Mon Sep 17 00:00:00 2001 From: Neil <55785687+carkom@users.noreply.github.com> Date: Fri, 19 Jan 2024 19:37:14 +0000 Subject: [PATCH 1/2] Custom Reports: fix broken table (#2249) * fix broken table * notes * error fixes --- .../reports/graphs/tableGraph/ReportTable.tsx | 3 +-- .../graphs/tableGraph/ReportTableList.tsx | 12 ++++----- .../graphs/tableGraph/ReportTableRow.tsx | 1 + .../graphs/tableGraph/ReportTableTotals.tsx | 25 +++++++++++-------- upcoming-release-notes/2249.md | 6 +++++ 5 files changed, 28 insertions(+), 19 deletions(-) create mode 100644 upcoming-release-notes/2249.md diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx index ca7f71188d9..4d380951f1d 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx @@ -50,10 +50,9 @@ export function ReportTable({ }); const renderItem = useCallback( - ({ item, groupByItem, mode, style, key, monthsCount }) => { + ({ item, groupByItem, mode, style, monthsCount }) => { return ( 100000 && - amountToCurrency(item[balanceTypeOp]) + Math.abs(item[balanceTypeOp]) > 100000 + ? amountToCurrency(item[balanceTypeOp]) + : undefined } width="flex" privacyFilter @@ -108,8 +109,9 @@ export function ReportTableTotals({ }} value={amountToCurrency(data.totalAssets)} title={ - Math.abs(data.totalAssets) > 100000 && - amountToCurrency(data.totalAssets) + Math.abs(data.totalAssets) > 100000 + ? amountToCurrency(data.totalAssets) + : undefined } width="flex" privacyFilter @@ -121,8 +123,9 @@ export function ReportTableTotals({ }} value={amountToCurrency(data.totalDebts)} title={ - Math.abs(data.totalDebts) > 100000 && - amountToCurrency(data.totalDebts) + Math.abs(data.totalDebts) > 100000 + ? amountToCurrency(data.totalDebts) + : undefined } width="flex" privacyFilter @@ -136,8 +139,9 @@ export function ReportTableTotals({ }} value={amountToCurrency(data[balanceTypeOp])} title={ - Math.abs(data[balanceTypeOp]) > 100000 && - amountToCurrency(data[balanceTypeOp]) + Math.abs(data[balanceTypeOp]) > 100000 + ? amountToCurrency(data[balanceTypeOp]) + : undefined } width="flex" privacyFilter @@ -149,8 +153,9 @@ export function ReportTableTotals({ }} value={integerToCurrency(Math.round(average))} title={ - Math.abs(Math.round(average / 100)) > 100000 && - integerToCurrency(Math.round(average)) + Math.abs(Math.round(average / 100)) > 100000 + ? integerToCurrency(Math.round(average)) + : undefined } width="flex" privacyFilter diff --git a/upcoming-release-notes/2249.md b/upcoming-release-notes/2249.md new file mode 100644 index 00000000000..b5607975078 --- /dev/null +++ b/upcoming-release-notes/2249.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [carkom] +--- + +Fixing a bug where custom reports table graph crashes due to a type mismatch error. From fbb1a9647dc32fa7378582bbd337530371b59c49 Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Fri, 19 Jan 2024 20:04:00 +0000 Subject: [PATCH 2/2] :bug: fix 'delete budget' button always deleting cloud file (#2251) Closes #2216 --- .../src/components/manager/DeleteFile.tsx | 30 +++++++++++-------- upcoming-release-notes/2251.md | 6 ++++ 2 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 upcoming-release-notes/2251.md diff --git a/packages/desktop-client/src/components/manager/DeleteFile.tsx b/packages/desktop-client/src/components/manager/DeleteFile.tsx index c8dff180cbd..29c3875b80b 100644 --- a/packages/desktop-client/src/components/manager/DeleteFile.tsx +++ b/packages/desktop-client/src/components/manager/DeleteFile.tsx @@ -26,17 +26,6 @@ export function DeleteFile({ modalProps, actions, file }: DeleteFileProps) { null, ); - async function onDelete() { - setLoadingState(isCloudFile ? 'cloud' : 'local'); - await actions.deleteBudget( - 'id' in file ? file.id : undefined, - isCloudFile ? file.cloudFileId : undefined, - ); - setLoadingState(null); - - modalProps.onBack(); - } - return ( { + setLoadingState('cloud'); + await actions.deleteBudget( + 'id' in file ? file.id : undefined, + file.cloudFileId, + ); + setLoadingState(null); + + modalProps.onBack(); + }} > Delete file from all devices @@ -125,7 +123,13 @@ export function DeleteFile({ modalProps, actions, file }: DeleteFileProps) { backgroundColor: theme.errorText, }), }} - onClick={onDelete} + onClick={async () => { + setLoadingState('local'); + await actions.deleteBudget(file.id); + setLoadingState(null); + + modalProps.onBack(); + }} > Delete file locally diff --git a/upcoming-release-notes/2251.md b/upcoming-release-notes/2251.md new file mode 100644 index 00000000000..145d3e73021 --- /dev/null +++ b/upcoming-release-notes/2251.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [MatissJanis] +--- + +Fix 'delete file' button always deleting the cloud file.