mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 23:33:29 +00:00
feat(cycle): predicted-period notifications + reproductive-data privacy docs
Add two cycle reminders through the existing notification cascade and the honest self-hosting privacy framing for reproductive-health data. Notifications: - New event types CYCLE_PERIOD_SOON (fires ~2 days before the predicted next-period start, from the cached prediction) and CYCLE_PERIOD_CONFIRM (a gentle "did your period start?" on/after the predicted start while no period is logged, within a short grace window). Both default OFF and are gated again on cycleTrackingEnabled — opt in twice for a sensitive surface. - A 15-minute pg-boss cron mirrors the mood-reminder worker: it scans users with cycle tracking enabled + predictionEnabled, computes who is in-window from the cached forecast, and dispatches one push per event per local day. Idempotency anchors on the push_attempts ledger (no new table). The queue is declared, registered in allQueues, scheduled, and wired to a boss.work handler, with a source-grep guard so it cannot ship unregistered. - Honours notificationPrefs.cycle.clientManaged (skip the server push when the device owns local reminders, with a suppressed annotation, mirroring the medication path) and CycleProfile.discreetNotifications (generic "HealthLog reminder" body so no cycle event is named on the lock screen). - Every attempt is recorded in push_attempts via the unchanged dispatcher. Privacy / disclaimer: - docs/self-hosting/reproductive-health-data.md — the "no cloud vendor to subpoena" framing with the honest residual-threat caveat (your own host, provider, backups, and devices remain part of the surface), citing the 2021 FTC settlement and 2025 verdict as public record only. - docs/security/cycle-data-threat-model.md — a compact "protects against / does not protect against" note, plus README pointers. - CyclePredictionDisclaimer component (reusing the GLP-1 estimate-disclaimer pattern) for every fertility/prediction surface: descriptive, not a contraceptive method, not medical advice, never a safe-to-have-unprotected -sex claim. 6-locale copy under cycle.disclaimer. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
77a652a47c
commit
6fdbb8d889
18 files changed
+1372
-8
No files matched your search
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Fixed non-medical disclaimer for every fertility / prediction surface.
|
||||
*
|
||||
* Mirrors the GLP-1 drug-level-estimate disclaimer pattern
|
||||
* (`DrugLevelChart`): a styled, always-attached note rendered as plain
|
||||
* React text children (no markdown), so it cannot be dismissed or styled
|
||||
* away and carries no XSS surface.
|
||||
*
|
||||
* The copy is deliberate and load-bearing: predictions are descriptive
|
||||
* estimates from the user's own logged data — never a contraceptive
|
||||
* method, never medical advice, and never a "safe to have unprotected
|
||||
* sex" signal. Drop this under any calendar, wheel, fertile-window, or
|
||||
* predicted-period surface. The copy lives in `messages/<locale>.json`
|
||||
* under `cycle.disclaimer` and is translated for all six locales.
|
||||
*/
|
||||
"use client";
|
||||
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export interface CyclePredictionDisclaimerProps {
|
||||
/** Optional extra classes for layout (margins, width) at the call site. */
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function CyclePredictionDisclaimer({
|
||||
className,
|
||||
}: CyclePredictionDisclaimerProps) {
|
||||
const { t } = useTranslations();
|
||||
return (
|
||||
<p
|
||||
className={cn(
|
||||
"text-foreground/80 border-border bg-muted/40 rounded-md border-l-2 px-3 py-2 text-xs font-medium",
|
||||
className,
|
||||
)}
|
||||
data-slot="cycle-prediction-disclaimer"
|
||||
>
|
||||
{t("cycle.disclaimer")}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user