feat(settings): make medications a toggleable module

Medications graduated from the always-on core set (weight / blood
pressure / pulse stay core) to an opt-out module. The surface gates
off the resolved module map — the left-nav entry, the dashboard
medication widget, and the dedicated Medikamente settings entry hide
when the account turns the module off. The medication data routes stay
exempt from the gate (same data-layer reasoning as mood / labs): an
importer, a sync, and the user's ability to clean up entries keep
working while the surface is hidden, and re-enabling finds the
schedule and intake history intact.

Wire the module-route gate inventory, the dashboard widget/summary
maps, the PATCH allowlist, and the nav model; regenerate the OpenAPI
contract for the new module key.
This commit is contained in:
Marc-André Bombeck committed 2026-06-16 21:31:54 +02:00
1 parent 930c4a75dd
commit 559366e308
13 files changed
+119 -28

No files matched your search

+8 -6
View File
@@ -11,11 +11,12 @@
* core keys) and then invalidates the `authMe()` query so the nav, Insights
* pills, and dashboard tiles re-gate live off `useAuth().user.modules`.
*
* The four CORE domains (weight, blood pressure, pulse, medications) render
* as a separate read-only "always on" group — locked switches with a short
* note — so the always-on measurement engine + meds read as deliberately
* fixed, never disableable. Palette stays neutral throughout; this is a
* calm configuration surface, not an alarm panel.
* The three CORE domains (weight, blood pressure, pulse) render as a
* separate read-only "always on" group — locked switches with a short note —
* so the always-on measurement engine reads as deliberately fixed, never
* disableable. Palette stays neutral throughout; this is a calm
* configuration surface, not an alarm panel. (v1.18.1 D3 — medications
* graduated to the toggleable group above.)
*
* State source is `useAuth().user.modules` (the resolved `/auth/me` map).
* A module is enabled unless its key is explicitly `false` — default-on.
@@ -71,6 +72,8 @@ const MODULE_ICONS: Record<ModuleKey, LucideIcon> = {
achievements: Award,
coach: MessageCircleHeart,
insights: Sparkles,
// v1.18.1 (D3) — medications graduated from CORE to a toggleable module.
medications: Pill,
doctorReport: FileText,
};
@@ -79,7 +82,6 @@ const CORE_ICONS: Record<CoreDomainKey, LucideIcon> = {
weight: Scale,
bloodPressure: HeartPulse,
pulse: Activity,
medications: Pill,
};
export function ModulesSection() {
+5 -2
View File
@@ -124,12 +124,15 @@ export const SETTINGS_SECTIONS: readonly SettingsSection[] = [
icon: LayoutDashboard,
},
// v1.18.0 (S5) — Medikamente: medication-specific settings (list view +
// order + injection sites). Medications is a CORE domain, so the entry is
// always shown. Was a hidden child of the Layout hub.
// order + injection sites). Was a hidden child of the Layout hub.
// v1.18.1 (D3) — medications graduated from a CORE domain to a toggleable
// module, so this entry now hides when the account turns the module off
// (the medication data routes stay live; this only hides the surface).
{
slug: "medications",
titleKey: "settings.sections.medications.title",
icon: Pill,
moduleGate: "medications",
},
// v1.18.0 (S5) — Stimmung: the mood-tag management surface gets its own
// nav entry, shown only when the mood module is enabled. Was a hidden