From 64ae00a847b7bfa97cf19cb0f571ae8bf76a95f4 Mon Sep 17 00:00:00 2001 From: le king fu Date: Tue, 7 Jul 2026 18:58:25 -0400 Subject: [PATCH] bugfix(reports): open Trends on byCategory + table by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Trends report previously opened on the global monthly chart, which has no income section — so a user's revenue (e.g. their pay) was hidden until they manually switched to the "By category" table view. Open the report on byCategory + table by default so the income section (and therefore payroll) is visible immediately. Two scoped call-site changes: - useTrends initial subView: "global" -> "byCategory" - ReportsTrendsPage viewMode fallback: readViewMode(key, "table") Both defaults are scoped to Trends. The real-vs-real compare report (distinct "reports-viewmode-compare" storage key) is unaffected, and a user's own persisted view choice still wins over the new fallback. Resolves #262 Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.fr.md | 4 ++++ CHANGELOG.md | 4 ++++ src/hooks/useTrends.ts | 2 +- src/pages/ReportsTrendsPage.tsx | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.fr.md b/CHANGELOG.fr.md index e3b1917..ec4e236 100644 --- a/CHANGELOG.fr.md +++ b/CHANGELOG.fr.md @@ -6,6 +6,10 @@ - Rapports → Comparaison : les deux rapports comparables hiérarchiques (réel vs réel et réel vs budget) permettent désormais de **replier ou déplier les sous-catégories de chaque catégorie parente**. Un chevron sur chaque catégorie de premier niveau masque son détail tout en gardant sa ligne de sous-total visible, et un bouton « Tout déplier / Tout replier » les bascule ensemble. Les groupes s'ouvrent **repliés** pour un aperçu compact au niveau des sous-totaux ; ce que vous dépliez est mémorisé par rapport (#254). +### Modifié + +- Rapports → Tendances : le rapport **s'ouvre désormais sur la vue « Par catégorie » en tableau** par défaut, au lieu du graphique mensuel global. Le tableau par catégorie comporte une section revenus, donc une catégorie de revenu (ex. votre paie) apparaît d'emblée — sans changer de vue au préalable. La vue que vous choisissez vous-même reste mémorisée (#262). + ## [0.12.0] - 2026-07-05 ### Modifié diff --git a/CHANGELOG.md b/CHANGELOG.md index 665c32c..e7677ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - Reports → Compare: the two hierarchical comparable reports (real-vs-real and real-vs-budget) now let you **collapse or expand each parent category's sub-categories**. A chevron on every top-level category folds its breakdown away while keeping the category's subtotal row in view, and an "Expand all / Collapse all" button toggles them together. Groups start **collapsed** so the report opens on a compact, subtotal-level overview; whatever you expand is remembered per report (#254). +### Changed + +- Reports → Trends: the report now **opens on the "By category" table view** by default, instead of the global monthly chart. The by-category table has an income section, so a revenue category (e.g. your pay) shows up straight away — no need to switch views first. Whatever view you pick yourself is still remembered (#262). + ## [0.12.0] - 2026-07-05 ### Changed diff --git a/src/hooks/useTrends.ts b/src/hooks/useTrends.ts index bf1ba2e..b9a968f 100644 --- a/src/hooks/useTrends.ts +++ b/src/hooks/useTrends.ts @@ -21,7 +21,7 @@ type Action = | { type: "SET_ERROR"; payload: string }; const initialState: State = { - subView: "global", + subView: "byCategory", monthlyTrends: [], categoryOverTime: { categories: [], data: [], colors: {}, categoryIds: {}, types: {} }, isLoading: false, diff --git a/src/pages/ReportsTrendsPage.tsx b/src/pages/ReportsTrendsPage.tsx index f4e61ef..2c2cac0 100644 --- a/src/pages/ReportsTrendsPage.tsx +++ b/src/pages/ReportsTrendsPage.tsx @@ -23,7 +23,7 @@ export default function ReportsTrendsPage() { const { t } = useTranslation(); const { period, setPeriod, from, to, setCustomDates } = useReportsPeriod(); const { subView, setSubView, monthlyTrends, categoryOverTime, isLoading, error } = useTrends(); - const [viewMode, setViewMode] = useState(() => readViewMode(STORAGE_KEY)); + const [viewMode, setViewMode] = useState(() => readViewMode(STORAGE_KEY, "table")); const [chartType, setChartType] = useState(() => readTrendsChartType()); const [hiddenCategories, setHiddenCategories] = useState>(new Set()); -- 2.45.2