From 5decb985f19d55157b705190726bd0cf4e44304a Mon Sep 17 00:00:00 2001 From: le king fu Date: Sun, 18 Oct 2026 18:12:35 -0400 Subject: [PATCH] fix: list the System sections on the Settings home in the page's order (#372) Self-review of PR #470: the System card of the Settings home lists the page's sections as chips, still with the version history before the logs. The chips now follow the page (version, update, logs, history), and a test renders the page and compares its section headings with the card, so the two cannot drift apart again. SECTIONS is exported for that test, as DocsContent exports its own. The /settings/systems row of docs/architecture.md names both unreleased headings and the card. Resolves #372 Co-Authored-By: Claude Opus 5.5 --- docs/architecture.md | 2 +- src/pages/settings/SettingsHomePage.tsx | 5 +++-- src/pages/settings/SystemsSettingsPage.test.tsx | 12 ++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index e741b41..5bb4c61 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -580,7 +580,7 @@ Les modules payants sont enveloppés dans des **layout-routes pathless `RequireF | `/settings` | `SettingsLayout` (layout) + `SettingsHomePage` (index) | Hub des paramètres : 3 cards-cluster vers les sous-pages. Le layout monte `TokenStoreFallbackBanner` une seule fois, partagé par les 4 routes principales | | `/settings/users` | `UsersSettingsPage` | Comptes (Maximus), licences et guide d'utilisation (rendu inline depuis `DocsContent`) | | `/settings/data` | `DataSettingsPage` | Catégories (avec liens vers `/settings/categories/standard` et `/settings/categories/migrate`), backup chiffré et confidentialité de la récupération de prix | -| `/settings/systems` | `SystemsSettingsPage` | Version, mise à jour (`UpdateCard`), journaux + commentaires (`LogViewerCard`), puis historique des versions (`ChangelogContent`), dans cet ordre : le Journal ne descend plus sous l'historique, qui s'allonge à chaque release (#372). `ChangelogContent` n'est monté qu'une fois `getVersion()` résolu (ou en échec : version inconnue, écrite au Journal) ; il ouvre les notes de la version installée et replie les autres, chaque titre de version étant un bouton (`aria-expanded`, chevron), avec un bouton « Tout déplier / Tout replier » ; un « Unreleased » vide est masqué | +| `/settings/systems` | `SystemsSettingsPage` | Version, mise à jour (`UpdateCard`), journaux + commentaires (`LogViewerCard`), puis historique des versions (`ChangelogContent`), dans cet ordre : le Journal ne descend plus sous l'historique, qui s'allonge à chaque release (#372). `ChangelogContent` n'est monté qu'une fois `getVersion()` résolu (ou en échec : version inconnue, écrite au Journal) ; il ouvre les notes de la version installée et replie les autres, chaque titre de version étant un bouton (`aria-expanded`, chevron), avec un bouton « Tout déplier / Tout replier » ; l'en-tête non publié (« Unreleased », « Non publié ») est masqué quand il est vide. La carte Système de `SettingsHomePage` liste ces sections dans le même ordre | | `/settings/categories/standard` | `CategoriesStandardGuidePage` | Guide imprimable de la structure de catégories standard (route flat, hors `SettingsLayout`) | | `/settings/categories/migrate` | `CategoriesMigrationPage` | Flux de migration v1→v2 (route flat, hors `SettingsLayout`) | | `/docs` | `DocsPage` | Redirige vers `/settings/users` (rétrocompatibilité bookmarks) | diff --git a/src/pages/settings/SettingsHomePage.tsx b/src/pages/settings/SettingsHomePage.tsx index 622d673..d4bb531 100644 --- a/src/pages/settings/SettingsHomePage.tsx +++ b/src/pages/settings/SettingsHomePage.tsx @@ -11,7 +11,8 @@ interface SectionCard { itemKeys: string[]; } -const SECTIONS: SectionCard[] = [ +/** The three cards of the hub; each lists its page's sections, in the page's order. */ +export const SECTIONS: SectionCard[] = [ { to: "/settings/users", titleKey: "settings.users.title", @@ -42,8 +43,8 @@ const SECTIONS: SectionCard[] = [ itemKeys: [ "settings.systems.sections.version", "settings.systems.sections.update", - "settings.systems.sections.changelog", "settings.systems.sections.logs", + "settings.systems.sections.changelog", ], }, ]; diff --git a/src/pages/settings/SystemsSettingsPage.test.tsx b/src/pages/settings/SystemsSettingsPage.test.tsx index 6d4b267..4fd377e 100644 --- a/src/pages/settings/SystemsSettingsPage.test.tsx +++ b/src/pages/settings/SystemsSettingsPage.test.tsx @@ -29,6 +29,7 @@ import { hookHarness } from "../../test/hookHarness"; import { logWarn } from "../../services/logService"; import ChangelogContent from "../../components/settings/ChangelogContent"; import SystemsSettingsPage from "./SystemsSettingsPage"; +import { SECTIONS } from "./SettingsHomePage"; const harness = hookHarness(); @@ -77,6 +78,17 @@ describe("SystemsSettingsPage — order of the sections (#372)", () => { ]; expect(order).toEqual([...order].sort((a, b) => a - b)); }); + + it("lists, on the System card of the Settings home, the page's sections in the page's order", () => { + harness.slots[0] = "0.17.2"; + const html = renderToStaticMarkup(render()); + const headings = [...html.matchAll(/]*>t\((settings\.systems\.sections\.[a-zA-Z]+)\)<\/h2>/g)].map( + (match) => match[1], + ); + expect(headings).toHaveLength(4); + const card = SECTIONS.find((section) => section.to === "/settings/systems"); + expect(card?.itemKeys).toEqual(headings); + }); }); describe("SystemsSettingsPage — the version history waits for the version (#372)", () => {