From ae608f0cb8396623aec4adbf925af07377af96d3 Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins <matiss@mja.lv> Date: Wed, 28 Aug 2024 21:02:47 +0100 Subject: [PATCH] :bug: (dashboards) add back spending report if dashboards feature is not enabled (#3323) --- .../src/components/reports/Overview.tsx | 21 ++++++++++++++++++- upcoming-release-notes/3323.md | 6 ++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 upcoming-release-notes/3323.md diff --git a/packages/desktop-client/src/components/reports/Overview.tsx b/packages/desktop-client/src/components/reports/Overview.tsx index 0587f6dc7..faec350ce 100644 --- a/packages/desktop-client/src/components/reports/Overview.tsx +++ b/packages/desktop-client/src/components/reports/Overview.tsx @@ -96,7 +96,26 @@ export function Overview() { const isDashboardsFeatureEnabled = useFeatureFlag('dashboards'); const spendingReportFeatureFlag = useFeatureFlag('spendingReport'); - const layout = useWidgetLayout(widgets); + const baseLayout = useWidgetLayout(widgets); + const layout = + spendingReportFeatureFlag && + !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 closeNotifications = () => { dispatch(removeNotification('import')); diff --git a/upcoming-release-notes/3323.md b/upcoming-release-notes/3323.md new file mode 100644 index 000000000..8807a5a09 --- /dev/null +++ b/upcoming-release-notes/3323.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [MatissJanis] +--- + +Dashboards: add back spending report if dashboards are not enabled -- GitLab