refactor(cycle): wire the phase-correlation card into the insights tab

The cycle insights tab rendered an empty placeholder while the phase-contrast
card + its `/api/cycle/insights` feed sat unused. Wire them together: a
`useCycleInsights` read drives the headline finding + the luteal-vs-follicular
crosstab on the insights tab, matching the mood-factor crosstab styling. Drops
the placeholder card + a duplicate disclaimer component in favour of the ones
already in use, and removes the unused recency/phase-result/label exports.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.8 committed 2026-06-06 10:26:13 +02:00
1 parent e984ada5f1
commit 55f40df0ac
9 files changed
+33 -213

No files matched your search

@@ -1,43 +0,0 @@
import { describe, it, expect } from "vitest";
import { renderToStaticMarkup } from "react-dom/server";
import { CycleInsights } from "../cycle-insights";
import { I18nProvider } from "@/lib/i18n/context";
function render(node: React.ReactNode) {
return renderToStaticMarkup(
<I18nProvider initialLocale="en">{node}</I18nProvider>,
);
}
describe("<CycleInsights>", () => {
it("renders the empty-state when no cards are surfaced", () => {
const html = render(<CycleInsights cards={[]} />);
expect(html).toContain("Phase insights appear here");
expect(html).not.toContain('data-slot="cycle-insights"');
});
it("renders the card list with the open statistics when cards are present", () => {
const html = render(
<CycleInsights
cards={[
{
id: "rhr-luteal",
title: "Resting heart rate runs higher in your luteal phase",
body: "Across your logged cycles RHR is ~3 bpm higher in luteal vs follicular days.",
n: 42,
effectSize: 0.61,
qValue: 0.04,
caveat: "Descriptive only.",
},
]}
/>,
);
expect(html).toContain('data-slot="cycle-insights"');
expect(html).toContain("Resting heart rate runs higher");
expect(html).toContain("n = 42");
expect(html).toContain("0.61");
expect(html).toContain("0.040");
expect(html).toContain("Descriptive only.");
});
});