From 77128a0124c06c1e1e50647a42b0f729d7f00c01 Mon Sep 17 00:00:00 2001 From: carkom Date: Mon, 21 Oct 2024 09:51:06 +0100 Subject: [PATCH] defualt show spending graph --- .../src/components/reports/Overview.tsx | 19 +------------------ .../1722804019000_create_dashboard_table.js | 3 ++- packages/loot-core/src/shared/dashboard.ts | 8 ++++++++ 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/packages/desktop-client/src/components/reports/Overview.tsx b/packages/desktop-client/src/components/reports/Overview.tsx index bb0441cb0c5..c21661e9567 100644 --- a/packages/desktop-client/src/components/reports/Overview.tsx +++ b/packages/desktop-client/src/components/reports/Overview.tsx @@ -102,24 +102,7 @@ export function Overview() { return true; }); - const layout = - !isDashboardsFeatureEnabled && - !baseLayout.find(({ type }) => type === 'spending-card') - ? [ - ...baseLayout, - { - i: 'spending', - type: 'spending-card' as const, - x: 0, - y: Math.max(...baseLayout.map(({ y }) => y), 0) + 2, - w: 4, - h: 2, - minW: 3, - minH: 2, - meta: null, - }, - ] - : baseLayout; + const layout = baseLayout; const closeNotifications = () => { dispatch(removeNotification('import')); diff --git a/packages/loot-core/migrations/1722804019000_create_dashboard_table.js b/packages/loot-core/migrations/1722804019000_create_dashboard_table.js index 228b85ede0d..fbed322fce5 100644 --- a/packages/loot-core/migrations/1722804019000_create_dashboard_table.js +++ b/packages/loot-core/migrations/1722804019000_create_dashboard_table.js @@ -17,7 +17,8 @@ export default async function runMigration(db) { INSERT INTO dashboard (id, type, width, height, x, y) VALUES ('${uuidv4()}','net-worth-card', 8, 2, 0, 0), - ('${uuidv4()}', 'cash-flow-card', 4, 2, 8, 0); + ('${uuidv4()}', 'cash-flow-card', 4, 2, 8, 0), + ('${uuidv4()}', 'spending-card', 4, 2, 0, 2); `); // Add custom reports to the dashboard diff --git a/packages/loot-core/src/shared/dashboard.ts b/packages/loot-core/src/shared/dashboard.ts index 1479d9b3b4b..e5fbe9da282 100644 --- a/packages/loot-core/src/shared/dashboard.ts +++ b/packages/loot-core/src/shared/dashboard.ts @@ -17,4 +17,12 @@ export const DEFAULT_DASHBOARD_STATE: NewWidget[] = [ y: 0, meta: null, }, + { + type: 'spending-card', + width: 4, + height: 2, + x: 0, + y: 2, + meta: null, + }, ];