mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 12:22:03 +00:00
feat(settings): comparison-overlay becomes a global dashboard preference
Up to v1.4.21 the comparison-baseline toggle lived in two places: the canonical Settings → Dashboard picker (where it's persisted) and an on-surface duplicate above the Daily Briefing on `/insights`. Per the "no split" rule the duplicate is removed: the toggle is a global preference, so it belongs in Settings only. Every chart on `/insights` still consumes the resolved `comparisonBaseline` from the same dashboard-layout query the picker writes to, so flipping the Settings toggle keeps propagating to every overlay on next refetch — only the duplicate UI affordance is gone. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b39d5f890b
commit
706aa5fd73
2 files changed
+28
-2
No files matched your search
@@ -180,3 +180,31 @@ describe("v1.4.19 A3 — chart-token leak hardening", () => {
|
||||
expect(parseChartTokens("metric:WEIGHT")).toEqual(["metric:WEIGHT"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("v1.4.22 A3 — comparison toggle is global Settings only", () => {
|
||||
/**
|
||||
* The comparison-overlay toggle is a global preference. Up to v1.4.21
|
||||
* the toggle existed both in `/settings/dashboard` (canonical) and
|
||||
* `/insights` (via `<DailyBriefing metaSlot={<CompareToggle />} />`).
|
||||
* Per `feedback_settings_no_split.md` the toggle now lives in
|
||||
* Settings only — the on-surface affordance is gone from `/insights`.
|
||||
* Every chart still consumes the resolved `comparisonBaseline` value
|
||||
* the same way it did before, so flipping the Settings toggle still
|
||||
* propagates to the page on next refetch.
|
||||
*/
|
||||
it("/insights does NOT mount <CompareToggle /> anywhere", () => {
|
||||
const src = load(INSIGHTS_PATH);
|
||||
expect(src).not.toMatch(/<CompareToggle\b/);
|
||||
expect(src).not.toMatch(
|
||||
/from\s+["']@\/components\/comparison\/compare-toggle["']/,
|
||||
);
|
||||
});
|
||||
|
||||
it("/insights still consumes the resolved comparisonBaseline (only the UI is gone)", () => {
|
||||
// Drift guard — the page must still hand `compareBaseline` to every
|
||||
// chart so the global Settings toggle keeps driving the overlay.
|
||||
const src = load(INSIGHTS_PATH);
|
||||
expect(src).toContain("comparisonBaseline");
|
||||
expect(src).toContain("compareBaseline");
|
||||
});
|
||||
});
|
||||
@@ -49,7 +49,6 @@ import { CorrelationRow } from "@/components/insights/correlation-row";
|
||||
import { useInsightsAdvisorQuery } from "@/components/insights/use-insights-advisor";
|
||||
import type { CorrelationResult } from "@/lib/insights/correlations";
|
||||
import { toWeekISO } from "@/lib/insights/week-iso";
|
||||
import { CompareToggle } from "@/components/comparison/compare-toggle";
|
||||
// Recharts is ~108 KiB Brotli — defer-load it via a self-contained scatter
|
||||
// wrapper so the bundle only lands once a correlation card actually renders.
|
||||
// Every scatter card sits inside a `length >= 5` gate and below the fold,
|
||||
@@ -979,7 +978,6 @@ export default function InsightsPage() {
|
||||
loading={advisor.isLoading}
|
||||
onRegenerate={advisor.regenerate}
|
||||
regenerating={advisor.isRegenerating}
|
||||
metaSlot={<CompareToggle />}
|
||||
/>
|
||||
|
||||
{/* v1.4.20 phase B3 — Correlation discovery row. Three pre-defined
|
||||
|
||||
Reference in new issue
Block a user