Skip to content

A local-first personal finance app

[AI] Allow cash flow and summary cards to resize to 2 columns wide (#9202)

James N107aebbff304
diff --git a/packages/desktop-client/src/components/reports/Overview.tsx b/packages/desktop-client/src/components/reports/Overview.tsx
index 08a0cd80f4..7b0594f1c5 100644
--- a/packages/desktop-client/src/components/reports/Overview.tsx
+++ b/packages/desktop-client/src/components/reports/Overview.tsx
@@ -70,38 +70,31 @@ import { SankeyCard } from './reports/SankeyCard';
import { SpendingCard } from './reports/SpendingCard';
import { SummaryCard } from './reports/SummaryCard';
-function isCustomReportWidget(
- widget: DashboardWidgetEntity,
-): widget is CustomReportWidget {
- return widget.type === 'custom-report';
-}
-
function getWidgetMinHeight(widget: DashboardWidgetEntity) {
- if (
- isCustomReportWidget(widget) ||
- widget.type === 'markdown-card' ||
- widget.type === 'formula-card'
- ) {
- return 1;
- }
-
- if (widget.type === 'sankey-card') {
- return 3;
+ switch (widget.type) {
+ case 'custom-report':
+ case 'markdown-card':
+ case 'formula-card':
+ return 1;
+ case 'sankey-card':
+ return 3;
+ default:
+ return 2;
}
-
- return 2;
}
function getWidgetMinWidth(widget: DashboardWidgetEntity) {
- if (widget.type === 'formula-card') {
- return 1;
- }
-
- if (isCustomReportWidget(widget) || widget.type === 'markdown-card') {
- return 2;
+ switch (widget.type) {
+ case 'formula-card':
+ return 1;
+ case 'custom-report':
+ case 'markdown-card':
+ case 'cash-flow-card':
+ case 'summary-card':
+ return 2;
+ default:
+ return 3;
}
-
- return 3;
}
type OverviewProps = {
@@ -315,7 +308,7 @@ export function Overview({ dashboard }: OverviewProps) {
throw new Error(`Unable to query widget: ${item.i}`);
}
- if (isCustomReportWidget(widget)) {
+ if (widget.type === 'custom-report') {
const customReport = customReportMap.get(widget.meta.id);
if (!customReport) {
diff --git a/upcoming-release-notes/resize-cash-flow-summary-cards.md b/upcoming-release-notes/resize-cash-flow-summary-cards.md
new file mode 100644
index 0000000000..8a28b8d8a1
--- /dev/null
+++ b/upcoming-release-notes/resize-cash-flow-summary-cards.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [RandomSpaceship]
+---
+
+Allow cash flow and summary dashboard cards to be resized narrower