fix(dashboard): keep the derived score rings with AI analysis off

The hero rings read their owner from the surface map instead of their
own map, and the readiness, recovery and sleep score rings no longer
wait on the AI analysis switch: they are computed scores, not model
text. The dose ring still follows the medications module.
This commit is contained in:
Marc-André Bombeck committed 2026-09-24 09:58:27 +02:00
1 parent 2594045bef
commit 347e63d653
5 files changed
+52 -45

No files matched your search

@@ -48,7 +48,10 @@ 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 { DASHBOARD_WIDGET_CATALOGUE_IDS } from "@/lib/dashboard-layout";
import {
DASHBOARD_WIDGET_CATALOGUE_IDS,
SCORE_RING_IDS,
} from "@/lib/dashboard-layout";
import { SUMMARY_TYPE_MODULE } from "@/lib/dashboard/widget-modules";
import { ENVIRONMENT_FIELDS } from "@/lib/environment/fields";
import {
@@ -128,6 +131,17 @@ describe("every surface id names a surface that exists", () => {
for (const id of localIds("derived")) expect(ids.has(id), id).toBe(true);
});
it("score-ring: a hero score ring id, the derived ones owned like their score", () => {
const ids = new Set<string>(SCORE_RING_IDS);
for (const id of localIds("score-ring")) {
expect(ids.has(id), id).toBe(true);
const derivedOwner = surfaceModule(`derived:${id}`);
if (derivedOwner !== undefined) {
expect(surfaceModule(`score-ring:${id}`), id).toBe(derivedOwner);
}
}
});
it("settings: a Settings section slug", () => {
const slugs = new Set<string>(SETTINGS_SECTIONS.map((s) => s.slug));
for (const id of localIds("settings")) expect(slugs.has(id), id).toBe(true);
+10
View File
@@ -47,6 +47,7 @@ import type { ModuleKey } from "@/lib/modules/registry";
* - `settings`: a Settings section, by its slug.
* - `settings-layout`: a Settings, Layout group, by its id.
* - `correlation`: a correlation-discovery channel, by its channel key.
* - `score-ring`: a dashboard hero score ring, by its `ScoreRingId`.
*/
export const SURFACE_KINDS = [
"nav",
@@ -60,6 +61,7 @@ export const SURFACE_KINDS = [
"settings",
"settings-layout",
"correlation",
"score-ring",
] as const;
export type SurfaceKind = (typeof SURFACE_KINDS)[number];
@@ -163,6 +165,14 @@ const STATIC_SURFACE_MODULE = {
"derived:STRESS_SCORE": "recovery",
"derived:READINESS": "recovery",
// ── Dashboard hero score rings ──
// The three derived rings follow their derived score; the dose ring is
// medications'.
"score-ring:READINESS": "recovery",
"score-ring:RECOVERY_SCORE": "recovery",
"score-ring:SLEEP_SCORE": "sleep",
"score-ring:MED_COMPLIANCE": "medications",
// ── Settings sections ──
"settings:environment": "environment",
"settings:coach": "coach",