feat(settings): nine groups, module pages and one switch per state

Settings now reads as nine groups: Account, Tracking, Arrangement,
Notifications, Health profile, AI, Connections, Data and System. On a
phone one button names the current section and opens the grouped list,
replacing the strip of every section.

What moved, every old address still working:
- Sessions, trusted devices and security activity sit under Security;
  the privacy page anchors forward there.
- Notifications holds every reminder kind: the Coach nudges and the
  checkup reminder switches joined, and a card names the reminders set
  where their subject lives (dose times, cycle reminders).
- Arrangement holds order and view only. Mood tags, the labs biomarker
  catalog and on-device text recognition, and the injection sites live on
  module pages under /settings/modules/<id>, linked from each Modules row
  and from the module's own wrench. /settings/layout/mood redirects.
- The timezone saves on change in the Display card, with a one-tap offer
  of the device zone.
- Screening hints sit beside the life circumstances they come from.
- System gains Preview features with the Topics switch.

Duplicates: the Coach and MCP pages show their state and link to the one
switch in Modules (turning MCP off keeps tokens), the Coach overlay shows
the provider and model with a link to Settings > AI instead of a second
set of selects, and the privacy page drops its copy of the export links.

A guard walks every historical /settings address through the redirects
and every forwarded anchor to a page that renders.
This commit is contained in:
Marc-André Bombeck committed 2026-10-21 19:43:02 +02:00
1 parent 3ebef19ac3
commit 71dbef1742
76 files changed
+2517 -1806

No files matched your search

@@ -7,6 +7,7 @@ import en from "../../../../messages/en.json";
import {
SETTINGS_CARDS,
SETTINGS_LAYOUT_PAGES,
SETTINGS_MODULE_PAGES,
} from "@/lib/command-palette/settings-cards";
/**
@@ -63,7 +64,11 @@ describe("SETTINGS_CARDS", () => {
);
it("every title key resolves", () => {
const missing = [...SETTINGS_CARDS, ...SETTINGS_LAYOUT_PAGES]
const missing = [
...SETTINGS_CARDS,
...SETTINGS_LAYOUT_PAGES,
...SETTINGS_MODULE_PAGES,
]
.map((c) => c.titleKey)
.filter((key) => !hasKey(key));
expect(missing).toEqual([]);
+21 -1
View File
@@ -20,7 +20,11 @@ import { MODULE_REGISTRY, type ModuleKey } from "@/lib/modules/registry";
import { isSurfaceVisible, type SurfaceModuleMap } from "@/lib/modules/surface";
import type { ShareDomain } from "@/lib/sharing/scope";
import { SETTINGS_CARDS, SETTINGS_LAYOUT_PAGES } from "./settings-cards";
import {
SETTINGS_CARDS,
SETTINGS_LAYOUT_PAGES,
SETTINGS_MODULE_PAGES,
} from "./settings-cards";
import { PALETTE_SYNONYMS } from "./synonyms";
/**
@@ -244,6 +248,22 @@ export function buildPaletteIndex(input: PaletteIndexInput): PaletteEntry[] {
});
}
}
if (sectionVisible.has("modules")) {
const modulesTitle = sectionTitle.get("modules") ?? "";
for (const page of SETTINGS_MODULE_PAGES) {
if (modules?.[page.module] === false) continue;
const id = `settings:modules/${page.slug}`;
entries.push({
id,
group: "settings",
title: t(page.titleKey),
hint: modulesTitle,
keywords: keywordsFor(id, [modulesTitle]),
icon: MODULE_ICONS[page.module],
run: { kind: "href", href: `/settings/modules/${page.slug}` },
});
}
}
}
// ── Module switches. ──
+37 -16
View File
@@ -95,11 +95,6 @@ export const SETTINGS_CARDS: ReadonlyArray<SettingsCardEntry> = [
anchor: "retention",
titleKey: "settings.privacy.retention.title",
},
{
section: "privacy",
anchor: "your-data-export",
titleKey: "settings.privacy.export.title",
},
{
section: "privacy",
anchor: "delete-data",
@@ -111,17 +106,17 @@ export const SETTINGS_CARDS: ReadonlyArray<SettingsCardEntry> = [
titleKey: "settings.privacy.posture.title",
},
{
section: "privacy",
section: "security",
anchor: "sessions",
titleKey: "settings.security.sessionsTitle",
},
{
section: "privacy",
section: "security",
anchor: "trusted-devices",
titleKey: "settings.security.trustedDevices.title",
},
{
section: "privacy",
section: "security",
anchor: "security-activity",
titleKey: "settings.security.activityTitle",
},
@@ -260,6 +255,11 @@ export const SETTINGS_CARDS: ReadonlyArray<SettingsCardEntry> = [
titleKey: "notifications.lowStock.title",
modules: ["medications"],
},
{
section: "notifications",
anchor: "vorsorge-reminders",
titleKey: "notifications.checkupReminders.title",
},
// ── Anamnesis ──
{
section: "anamnesis",
@@ -355,7 +355,7 @@ export const SETTINGS_CARDS: ReadonlyArray<SettingsCardEntry> = [
{
section: "coach",
anchor: "coach-activate",
titleKey: "settings.coach.activate.title",
titleKey: "settings.coach.state.title",
},
{
section: "coach",
@@ -363,7 +363,7 @@ export const SETTINGS_CARDS: ReadonlyArray<SettingsCardEntry> = [
titleKey: "insights.coach.settingsTitle",
},
{
section: "coach",
section: "notifications",
anchor: "coach-nudge",
titleKey: "notifications.coachNudge.title",
},
@@ -429,7 +429,7 @@ export const SETTINGS_CARDS: ReadonlyArray<SettingsCardEntry> = [
];
/**
* The Appearance hub's sub-pages, each its own entry. A module's page shows
* The Arrangement hub's sub-pages, each its own entry. A module's page shows
* only while the module is on.
*/
export const SETTINGS_LAYOUT_PAGES: ReadonlyArray<{
@@ -444,11 +444,6 @@ export const SETTINGS_LAYOUT_PAGES: ReadonlyArray<{
titleKey: "settings.sections.layout.medications.title",
module: "medications",
},
{
slug: "mood",
titleKey: "settings.sections.layout.mood.title",
module: "mood",
},
{
slug: "labs",
titleKey: "settings.sections.layout.labs.title",
@@ -466,3 +461,29 @@ export const SETTINGS_LAYOUT_PAGES: ReadonlyArray<{
},
{ slug: "vorsorge", titleKey: "settings.sections.layout.vorsorge.title" },
];
/**
* The module pages under Settings > Modules (`/settings/modules/<slug>`),
* each its own entry while its module is on.
*/
export const SETTINGS_MODULE_PAGES: ReadonlyArray<{
slug: string;
titleKey: string;
module: ModuleKey;
}> = [
{
slug: "medications",
titleKey: "settings.sections.modules.pages.medications.title",
module: "medications",
},
{
slug: "mood",
titleKey: "settings.sections.modules.pages.mood.title",
module: "mood",
},
{
slug: "labs",
titleKey: "settings.sections.modules.pages.labs.title",
module: "labs",
},
];
@@ -48,6 +48,7 @@ import { NAV_DESTINATIONS } from "@/components/layout/nav-model";
import { CAPTURE_KIND_ORDER } from "@/components/layout/capture-picker";
import { SETTINGS_SECTIONS } from "@/components/settings/settings-shell";
import { LAYOUT_GROUP_IDS } from "@/components/settings/layout-groups";
import { MODULE_SETTINGS_PAGE_IDS } from "@/components/settings/module-settings-page-ids";
import {
DASHBOARD_WIDGET_CATALOGUE_IDS,
SCORE_RING_IDS,
@@ -160,6 +161,13 @@ describe("every surface id names a surface that exists", () => {
}
});
it("settings-module: a module page under Settings > Modules", () => {
const ids = new Set<string>(MODULE_SETTINGS_PAGE_IDS);
for (const id of localIds("settings-module")) {
expect(ids.has(id), id).toBe(true);
}
});
it("day-section: a section the day view renders", () => {
const keys = new Set<string>(DAY_SECTION_KEYS);
for (const id of localIds("day-section")) {
+7 -1
View File
@@ -46,6 +46,7 @@ import type { ModuleKey } from "@/lib/modules/registry";
* - `derived`: a derived score, by its `DerivedMetricId`.
* - `settings`: a Settings section, by its slug.
* - `settings-layout`: a Settings, Layout group, by its id.
* - `settings-module`: a module's own Settings page under Modules, by its id.
* - `correlation`: a correlation-discovery channel, by its channel key.
* - `score-ring`: a dashboard hero score ring, by its `ScoreRingId`.
* - `day-section`: a section of the day view, by its `DaySectionKey`. The
@@ -66,6 +67,7 @@ export const SURFACE_KINDS = [
"derived",
"settings",
"settings-layout",
"settings-module",
"correlation",
"score-ring",
"day-section",
@@ -200,11 +202,15 @@ const STATIC_SURFACE_MODULE = {
// ── Settings, Layout groups ──
"settings-layout:medications": "medications",
"settings-layout:mood": "mood",
"settings-layout:labs": "labs",
"settings-layout:illness": "illness",
"settings-layout:documents": "inboundDocuments",
// ── Settings, a module's own page under Modules ──
"settings-module:medications": "medications",
"settings-module:mood": "mood",
"settings-module:labs": "labs",
// ── Correlation channels ──
// Rated mood factors (`FACTOR:<key>`) are mood's too; see
// `correlationChannelSurfaceId`.
@@ -98,6 +98,7 @@ export const SETTINGS_DESTINATION_INVENTORY = {
export: PERSONAL,
advanced: PERSONAL,
privacy: PERSONAL,
preview: PERSONAL,
about: PERSONAL,
} as const satisfies Record<
SettingsSectionSlug,
-7
View File
@@ -76,13 +76,6 @@ export function moduleListDefaults(list: ModuleListKey): ModuleListPrefs {
return { ...defaults, order: [...defaults.order] };
}
export function isModuleListKey(value: unknown): value is ModuleListKey {
return (
typeof value === "string" &&
(MODULE_LIST_KEYS as readonly string[]).includes(value)
);
}
export function isModuleListView(value: unknown): value is ModuleListView {
return (
typeof value === "string" &&