Skip to content

A local-first personal finance app

Update default dashboard (#5924)

Matiss Janis Aboltins0af2c6c2fb86
diff --git a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-1-chromium-linux.png b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-1-chromium-linux.png
index 46b4d6a0ab..e9d9189109 100644
Binary files a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-1-chromium-linux.png and b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-2-chromium-linux.png b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-2-chromium-linux.png
index 0c913efc95..ad1eed71f5 100644
Binary files a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-2-chromium-linux.png and b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-3-chromium-linux.png b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-3-chromium-linux.png
index 35957fc64c..fb785594a7 100644
Binary files a/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-3-chromium-linux.png and b/packages/desktop-client/e2e/command-bar.test.ts-snapshots/Command-bar-Check-the-command-bar-search-works-correctly-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts b/packages/desktop-client/e2e/reports.test.ts
index f8aa3c110f..9c773031b2 100644
--- a/packages/desktop-client/e2e/reports.test.ts
+++ b/packages/desktop-client/e2e/reports.test.ts
@@ -33,7 +33,17 @@ test.describe.parallel('Reports', () => {
test('loads net worth and cash flow reports', async () => {
const reports = await reportsPage.getAvailableReportList();
- expect(reports).toEqual(['Net Worth', 'Cash Flow', 'Monthly Spending']);
+ expect(reports).toEqual([
+ 'Total Income (YTD)',
+ 'Total Expenses (YTD)',
+ 'Avg Per Month',
+ 'Avg Per Transaction',
+ 'Net Worth',
+ 'Cash Flow',
+ 'This Month',
+ 'Budget Overview',
+ '3-Month Average',
+ ]);
await expect(page).toMatchThemeScreenshots();
});
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-1-chromium-linux.png
index 777cb9631a..d2cadb2d10 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-1-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-2-chromium-linux.png
index 2c2a1c259f..b8e93418cf 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-2-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-3-chromium-linux.png
index f58acb0a3f..d48bae1450 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-3-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-cash-flow-graph-and-checks-visuals-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png
index 2271409569..25c063040a 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-2-chromium-linux.png
index 02b4733734..b5d1740c4f 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-2-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-3-chromium-linux.png
index da8c688ecc..6f4f5aa120 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-3-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-and-cash-flow-reports-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-1-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-1-chromium-linux.png
index 23b5300dea..175aac2b84 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-1-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-2-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-2-chromium-linux.png
index 8eb4880c25..9add928c01 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-2-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-3-chromium-linux.png b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-3-chromium-linux.png
index f515911c3f..8160a02309 100644
Binary files a/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-3-chromium-linux.png and b/packages/desktop-client/e2e/reports.test.ts-snapshots/Reports-loads-net-worth-graph-and-checks-visuals-3-chromium-linux.png differ
diff --git a/packages/loot-core/migrations/1722804019000_create_dashboard_table.js b/packages/loot-core/migrations/1722804019000_create_dashboard_table.js
index 7ccbafb982..b2039be93b 100644
--- a/packages/loot-core/migrations/1722804019000_create_dashboard_table.js
+++ b/packages/loot-core/migrations/1722804019000_create_dashboard_table.js
@@ -1,8 +1,16 @@
import { v4 as uuidv4 } from 'uuid';
+import { DEFAULT_DASHBOARD_STATE } from '../src/shared/dashboard';
+
/* eslint-disable actual/typography */
export default async function runMigration(db) {
db.transaction(() => {
+ const reports = db.runQuery(
+ 'SELECT id FROM custom_reports WHERE tombstone = 0 ORDER BY name COLLATE NOCASE ASC',
+ [],
+ true,
+ );
+
db.execQuery(`
CREATE TABLE dashboard
(id TEXT PRIMARY KEY,
@@ -13,20 +21,37 @@ export default async function runMigration(db) {
y INTEGER,
meta TEXT,
tombstone INTEGER DEFAULT 0);
+ `);
+ if (reports.length === 0) {
+ DEFAULT_DASHBOARD_STATE.forEach(widget => {
+ db.runQuery(
+ `INSERT INTO dashboard (id, type, width, height, x, y, meta) VALUES (?, ?, ?, ?, ?, ?, ?)`,
+ [
+ uuidv4(),
+ widget.type,
+ widget.width,
+ widget.height,
+ widget.x,
+ widget.y,
+ widget.meta !== undefined && widget.meta !== null
+ ? JSON.stringify(widget.meta)
+ : null,
+ ],
+ );
+ });
+ return;
+ }
+
+ db.execQuery(`
INSERT INTO dashboard (id, type, width, height, x, y)
VALUES
- ('${uuidv4()}','net-worth-card', 8, 2, 0, 0),
+ ('${uuidv4()}', 'net-worth-card', 8, 2, 0, 0),
('${uuidv4()}', 'cash-flow-card', 4, 2, 8, 0),
('${uuidv4()}', 'spending-card', 4, 2, 0, 2);
`);
// Add custom reports to the dashboard
- const reports = db.runQuery(
- 'SELECT id FROM custom_reports WHERE tombstone = 0 ORDER BY name COLLATE NOCASE ASC',
- [],
- true,
- );
reports.forEach((report, id) => {
db.runQuery(
`INSERT INTO dashboard (id, type, width, height, x, y, meta) VALUES (?, ?, ?, ?, ?, ?, ?)`,
diff --git a/packages/loot-core/src/shared/dashboard.ts b/packages/loot-core/src/shared/dashboard.ts
index e5fbe9da28..b62d93b044 100644
--- a/packages/loot-core/src/shared/dashboard.ts
+++ b/packages/loot-core/src/shared/dashboard.ts
@@ -1,28 +1,232 @@
import { type NewWidget } from '../types/models';
export const DEFAULT_DASHBOARD_STATE: NewWidget[] = [
+ // Top row: Key metrics at a glance
{
- type: 'net-worth-card',
- width: 8,
+ type: 'summary-card',
+ width: 3,
height: 2,
x: 0,
y: 0,
+ meta: {
+ name: 'Total Income (YTD)',
+ content: JSON.stringify({
+ type: 'sum',
+ fontSize: 20,
+ }),
+ timeFrame: {
+ start: '2024-01-01',
+ end: '2024-12-31',
+ mode: 'yearToDate',
+ },
+ conditions: [
+ {
+ field: 'amount',
+ op: 'gt',
+ value: 0,
+ },
+ {
+ field: 'account',
+ op: 'onBudget',
+ value: '',
+ },
+ ],
+ conditionsOp: 'and',
+ },
+ },
+ {
+ type: 'summary-card',
+ width: 3,
+ height: 2,
+ x: 3,
+ y: 0,
+ meta: {
+ name: 'Total Expenses (YTD)',
+ content: JSON.stringify({
+ type: 'sum',
+ fontSize: 20,
+ }),
+ timeFrame: {
+ start: '2024-01-01',
+ end: '2024-12-31',
+ mode: 'yearToDate',
+ },
+ conditions: [
+ {
+ field: 'amount',
+ op: 'lt',
+ value: 0,
+ },
+ {
+ field: 'account',
+ op: 'onBudget',
+ value: '',
+ },
+ ],
+ conditionsOp: 'and',
+ },
+ },
+ {
+ type: 'summary-card',
+ width: 3,
+ height: 2,
+ x: 6,
+ y: 0,
+ meta: {
+ name: 'Avg Per Month',
+ content: JSON.stringify({
+ type: 'avgPerMonth',
+ fontSize: 20,
+ }),
+ timeFrame: {
+ start: '2024-01-01',
+ end: '2024-12-31',
+ mode: 'yearToDate',
+ },
+ conditions: [
+ {
+ field: 'amount',
+ op: 'lt',
+ value: 0,
+ },
+ {
+ field: 'account',
+ op: 'onBudget',
+ value: '',
+ },
+ ],
+ conditionsOp: 'and',
+ },
+ },
+ {
+ type: 'summary-card',
+ width: 3,
+ height: 2,
+ x: 9,
+ y: 0,
+ meta: {
+ name: 'Avg Per Transaction',
+ content: JSON.stringify({
+ type: 'avgPerTransact',
+ fontSize: 20,
+ }),
+ timeFrame: {
+ start: '2024-01-01',
+ end: '2024-12-31',
+ mode: 'yearToDate',
+ },
+ conditions: [
+ {
+ field: 'amount',
+ op: 'lt',
+ value: 0,
+ },
+ {
+ field: 'account',
+ op: 'onBudget',
+ value: '',
+ },
+ ],
+ conditionsOp: 'and',
+ },
+ },
+ // Second row: Net worth and cash flow side by side
+ {
+ type: 'net-worth-card',
+ width: 6,
+ height: 2,
+ x: 0,
+ y: 2,
meta: null,
},
{
type: 'cash-flow-card',
- width: 4,
+ width: 6,
height: 2,
- x: 8,
- y: 0,
+ x: 6,
+ y: 2,
meta: null,
},
+ // Third row: Spending comparisons
{
type: 'spending-card',
width: 4,
height: 2,
x: 0,
- y: 2,
- meta: null,
+ y: 5,
+ meta: {
+ name: 'This Month',
+ mode: 'single-month',
+ },
+ },
+ {
+ type: 'spending-card',
+ width: 4,
+ height: 2,
+ x: 4,
+ y: 5,
+ meta: {
+ name: 'Budget Overview',
+ mode: 'budget',
+ },
+ },
+ {
+ type: 'spending-card',
+ width: 4,
+ height: 2,
+ x: 8,
+ y: 5,
+ meta: {
+ name: '3-Month Average',
+ mode: 'average',
+ },
+ },
+ // Fourth row: Calendar and savings rate
+ {
+ type: 'calendar-card',
+ width: 8,
+ height: 4,
+ x: 0,
+ y: 8,
+ meta: {
+ name: 'Transaction Calendar',
+ timeFrame: {
+ start: '2024-01-01',
+ end: '2024-03-31',
+ mode: 'sliding-window',
+ },
+ },
+ },
+ {
+ type: 'summary-card',
+ width: 4,
+ height: 2,
+ x: 8,
+ y: 8,
+ meta: {
+ name: 'Recent Net Worth Change',
+ content: JSON.stringify({
+ type: 'sum',
+ fontSize: 32,
+ }),
+ timeFrame: {
+ start: '2024-01-01',
+ end: '2024-03-31',
+ mode: 'sliding-window',
+ },
+ conditions: [],
+ conditionsOp: 'and',
+ },
+ },
+ {
+ type: 'markdown-card',
+ width: 4,
+ height: 2,
+ x: 8,
+ y: 10,
+ meta: {
+ content:
+ '## Dashboard Tips\n\nYou can add new widgets or edit existing widgets by using the buttons at the top of the page. Choose a widget type and customize it to fit your needs.\n\n**Moving cards:** Drag any card by its header to reposition it.\n\n**Deleting cards:** Click the three-dot menu on any card and select “Remove”.',
+ },
},
];
diff --git a/upcoming-release-notes/5924.md b/upcoming-release-notes/5924.md
new file mode 100644
index 0000000000..d10f020bd4
--- /dev/null
+++ b/upcoming-release-notes/5924.md
@@ -0,0 +1,7 @@
+---
+category: Enhancements
+authors: [MatissJanis]
+---
+
+Dashboard: Update default dashboard layout with more comprehensive widgets
+