From 546835a9372b01bc0571161f439504021ddd8544 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?=
Date: Sat, 6 Jun 2026 20:10:15 +0200
Subject: [PATCH] fix(cycle): trim duplicate phase card, drop redundant
disclaimers, tidy settings
Remove the duplicate phase-education card from the calendar tab, keeping the
single instance under the wheel and surfacing its "you often notice this here"
chip row there. Drop the generic prediction-estimate caption on the predictions
tab for every goal except AVOID_PREGNANCY, where the contraceptive-safety caveat
stays as a deliberate medical note. Stop rendering the associations-not-causes
footer on the insights crosstab. In the cycle settings, align card-header
descriptions with their titles, and remove the standalone cycle export + purge
affordances now that cycle data rides the main export and account-level delete.
Move the web-push enable action into the card header row.
---
.../__tests__/phase-education-card.test.tsx | 6 +-
.../__tests__/predictions-panel.test.tsx | 18 ++-
src/components/cycle/cycle-phase-crosstab.tsx | 3 -
src/components/cycle/cycle-settings.tsx | 89 +------------
src/components/cycle/cycle-view.tsx | 17 +--
src/components/cycle/phase-education-card.tsx | 13 +-
src/components/cycle/predictions-panel.tsx | 14 +-
src/components/cycle/use-cycle.ts | 21 ---
src/components/settings/_card-header.tsx | 38 ++++--
src/components/settings/web-push-card.tsx | 123 +++++++++---------
10 files changed, 134 insertions(+), 208 deletions(-)
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. */}
-
+ {/* 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. */}
- {/* 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 (
-
-
-
-
-
- {title}
-
- {titleAccessory}
+
+
+ {/* Title + description share one column to the RIGHT of the icon, so the
+ description left-aligns with the title rather than slipping back under
+ the icon gutter. */}
+
+
+
+
+ {title}
+
+ {titleAccessory}
+
+ {status ? (
+
{status}
+ ) : null}
- {status ?
{status}
: null}
+ {description ? (
+
+ {description}
+
+ ) : null}
- {description ? (
-
- {description}
-
- ) : null}
);
}
diff --git a/src/components/settings/web-push-card.tsx b/src/components/settings/web-push-card.tsx
index ccf3a50e3..9e4491cfe 100644
--- a/src/components/settings/web-push-card.tsx
+++ b/src/components/settings/web-push-card.tsx
@@ -155,73 +155,80 @@ export function WebPushCard() {
}
}
+ // The primary action sits in the header row (right of the title) rather than
+ // bottom-left, so an inactive card does not waste a wide empty band before
+ // its enable button. The loading spinner rides the same slot; the
+ // unsupported / denied notices stay in the body.
+ const headerAction = loading ? (
+
+ ) : !isSupported || isDenied ? null : (
+