diff --git a/src/components/cycle/__tests__/phase-education-card.test.tsx b/src/components/cycle/__tests__/phase-education-card.test.tsx index 7e18e0ae1..35fcb715b 100644 --- a/src/components/cycle/__tests__/phase-education-card.test.tsx +++ b/src/components/cycle/__tests__/phase-education-card.test.tsx @@ -103,18 +103,16 @@ describe("", () => { expect(off).toContain("Still learning your cycle"); }); - it("omits the chip row in the compact variant", () => { + it("renders the chip row when the user has symptoms clustering in this phase", () => { const html = render( , ); expect(html).toContain("progesterone"); - expect(html).not.toContain("cycle-phase-education-chips"); - // The compact variant still carries the log nudge. + expect(html).toContain("cycle-phase-education-chips"); expect(html).toContain("Log today"); }); }); diff --git a/src/components/cycle/__tests__/predictions-panel.test.tsx b/src/components/cycle/__tests__/predictions-panel.test.tsx index af2b832d4..c1b91adb1 100644 --- a/src/components/cycle/__tests__/predictions-panel.test.tsx +++ b/src/components/cycle/__tests__/predictions-panel.test.tsx @@ -37,12 +37,13 @@ const emptyHistory: CycleHistoryResponse = { }; describe("", () => { - it("renders the next-period range + the fixed disclaimer", () => { + it("renders the next-period range and shows the disclaimer under the AVOID_PREGNANCY goal", () => { const html = render( , ); expect(html).toContain('data-slot="cycle-disclaimer"'); @@ -51,6 +52,21 @@ describe("", () => { expect(html).toContain("–"); }); + it("suppresses the generic estimate disclaimer for non-AVOID_PREGNANCY goals", () => { + const html = render( + , + ); + expect(html).not.toContain('data-slot="cycle-disclaimer"'); + expect(html).not.toContain("Estimates only, not medical advice."); + // The range still renders. + expect(html).toContain("–"); + }); + it("renders the fertile window only when the prediction carries one", () => { const withFertile: CyclePrediction = { ...basePrediction, diff --git a/src/components/cycle/cycle-phase-crosstab.tsx b/src/components/cycle/cycle-phase-crosstab.tsx index 8c337d73c..69c9bbe07 100644 --- a/src/components/cycle/cycle-phase-crosstab.tsx +++ b/src/components/cycle/cycle-phase-crosstab.tsx @@ -215,9 +215,6 @@ export function CyclePhaseCrosstab({ ); })} -

- {t("cycle.insights.crosstab.footer")} -

); } diff --git a/src/components/cycle/cycle-settings.tsx b/src/components/cycle/cycle-settings.tsx index 2197832d4..74497fa78 100644 --- a/src/components/cycle/cycle-settings.tsx +++ b/src/components/cycle/cycle-settings.tsx @@ -18,7 +18,7 @@ import { NativeSelect } from "@/components/ui/native-select"; import { Separator } from "@/components/ui/separator"; import { useTranslations } from "@/lib/i18n/context"; import type { CycleGoal, CycleProfileDTO } from "./types"; -import { useUpdateCyclePrefs, useDeleteAllCycleData } from "./use-cycle"; +import { useUpdateCyclePrefs } from "./use-cycle"; /** * v1.15.0 — the single-page cycle settings form. @@ -50,8 +50,6 @@ function numOrEmpty(v: number | null): string { export function CycleSettings({ profile }: { profile: CycleProfileDTO }) { const { t } = useTranslations(); const update = useUpdateCyclePrefs(); - const purge = useDeleteAllCycleData(); - const [confirmingPurge, setConfirmingPurge] = useState(false); const [goal, setGoal] = useState(profile.goal); const [rawChartMode, setRawChartMode] = useState(profile.rawChartMode); @@ -228,87 +226,10 @@ export function CycleSettings({ profile }: { profile: CycleProfileDTO }) { ) : null} - - - {/* Data export / delete */} -
-

{t("cycle.settings.dataTitle")}

-

- {t("cycle.settings.dataDescription")} -

-
- - -
- - {/* Cycle-only hard purge (post-Dobbs threat model): removes every - cycle row + the cycle audit trail + reminder ledger, distinct - from the account-level delete. Two-step confirm — no accidental - destructive tap. */} -
-

- {t("cycle.settings.purgeDescription")} -

- {confirmingPurge ? ( -
- - {t("cycle.settings.purgeConfirm")} - - - -
- ) : ( - - )} - {purge.isSuccess ? ( - - {t("cycle.settings.purgeDone")} - - ) : null} - {purge.isError ? ( - - {t("cycle.settings.purgeError")} - - ) : null} -
-
+ {/* Cycle data export + delete live with the main Settings → Export and + Account surfaces (cycle rows ride the full-backup export and the + account-level delete), so the standalone affordances are not + duplicated here. */}
{update.isSuccess ? ( diff --git a/src/components/cycle/cycle-view.tsx b/src/components/cycle/cycle-view.tsx index 6e14876fc..5fd17b3dd 100644 --- a/src/components/cycle/cycle-view.tsx +++ b/src/components/cycle/cycle-view.tsx @@ -208,11 +208,11 @@ export function CycleView() { ) : null}
- {/* Compact phase-education card beneath the wheel — chip row omitted - here (compact); the full card lives on the calendar tab. */} + {/* Phase-education card beneath the wheel — the single instance, + including the "you often notice this here" chip row sourced from + the user's own symptom-by-phase history. */} {!loading && !calendarError ? ( - {!loading && !calendarError ? ( - openSheet(today)} - /> - ) : null} {loading ? ( @@ -292,6 +282,7 @@ export function CycleView() { rawChartMode={calendar.data?.profile.rawChartMode ?? false} history={history.data} fallbackDisclaimer={disclaimerText} + goal={goal} /> void; /** Ride the wheel's once-per-session reveal — no independent animation. */ animate?: boolean; - /** Compact variant beneath the wheel (tighter padding, no chip row). */ - compact?: boolean; className?: string; } @@ -64,7 +62,6 @@ export function PhaseEducationCard({ cyclesObserved, onLogToday, animate = false, - compact = false, className, }: PhaseEducationCardProps) { const { t } = useTranslations(); @@ -118,8 +115,7 @@ export function PhaseEducationCard({ aria-label={t("cycle.phaseEducation.title")} style={{ "--tile-hue": hue } as React.CSSProperties} className={cn( - "wellness-tile rounded-xl", - compact ? "px-4 py-4" : "px-5 py-5", + "wellness-tile rounded-xl px-5 py-5", animate && "wellness-tile-rise", className, )} @@ -159,10 +155,9 @@ export function PhaseEducationCard({ {t(PHASE_WHATS_HAPPENING_KEY[phase as CyclePhase])}

- {/* Zone 3 — the user's OWN clustered symptoms for this phase. The - compact variant under the wheel omits the chip row to stay light; - the calendar-tab variant shows it. */} - {!compact && chips.length > 0 ? ( + {/* Zone 3 — the user's OWN clustered symptoms for this phase + ("you often notice this here"). */} + {chips.length > 0 ? (

{t("cycle.phaseEducation.commonHere")} diff --git a/src/components/cycle/predictions-panel.tsx b/src/components/cycle/predictions-panel.tsx index 5dfd7b204..12752eb12 100644 --- a/src/components/cycle/predictions-panel.tsx +++ b/src/components/cycle/predictions-panel.tsx @@ -53,6 +53,10 @@ export interface PredictionsPanelProps { history: CycleHistoryResponse | undefined; /** Fallback disclaimer when no prediction carries one. */ fallbackDisclaimer?: string; + /** The active cycle goal — only AVOID_PREGNANCY surfaces the (deliberate) + * contraceptive-safety caveat here; every other goal drops the generic + * "predictions are estimates" line so it does not repeat under every graph. */ + goal?: string; } export function PredictionsPanel({ @@ -60,10 +64,18 @@ export function PredictionsPanel({ rawChartMode, history, fallbackDisclaimer, + goal, }: PredictionsPanelProps) { const { t } = useTranslations(); - const disclaimer = prediction?.disclaimer ?? fallbackDisclaimer ?? ""; + // Only the AVOID_PREGNANCY goal shows a disclaimer here: it surfaces the + // fertile window, so the stronger "not a contraceptive method" caveat is a + // deliberate medical safety note. For all other goals the generic + // estimate-caveat is suppressed (it already lives once with the data). + const disclaimer = + goal === "AVOID_PREGNANCY" + ? (prediction?.disclaimer ?? fallbackDisclaimer ?? "") + : ""; return (

diff --git a/src/components/cycle/use-cycle.ts b/src/components/cycle/use-cycle.ts index 8b811c1b5..4a3441386 100644 --- a/src/components/cycle/use-cycle.ts +++ b/src/components/cycle/use-cycle.ts @@ -335,27 +335,6 @@ export function useDeleteDayLog() { }); } -/** - * Hard-delete EVERY cycle row the user owns (day-logs, cycles, predictions, - * the cycle audit trail, and the cycle reminder-delivery ledger rows). The - * privacy "purge" the post-Dobbs threat model promises — distinct from the - * per-row soft-delete. Invalidates the whole cycle prefix + the nav gate. - */ -export function useDeleteAllCycleData() { - const qc = useQueryClient(); - return useMutation({ - mutationFn: async () => { - const res = await fetch("/api/cycle/all", { method: "DELETE" }); - if (!res.ok) throw new Error(`Request failed: ${res.status}`); - return unwrap<{ purged: boolean }>(res); - }, - onSuccess: () => { - void invalidateKeys(qc, cycleDependentKeys); - void qc.invalidateQueries({ queryKey: queryKeys.authMe() }); - }, - }); -} - export interface CyclePrefsPatch { enabled?: boolean; goal?: CycleProfileDTO["goal"]; diff --git a/src/components/settings/_card-header.tsx b/src/components/settings/_card-header.tsx index 1198dec7d..29d5bf0c1 100644 --- a/src/components/settings/_card-header.tsx +++ b/src/components/settings/_card-header.tsx @@ -66,22 +66,32 @@ export function SettingsCardHeader({ className, }: SettingsCardHeaderProps) { return ( -
-
-
-