mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 14:32:03 +00:00
feat(mental-health): make the wellbeing check-in a standalone module page
Move the PHQ-9 / GAD-7 screener off `/insights/mental-wellbeing` to a top-level `/mental-wellbeing` route so it no longer borrows the Insights tab strip and layout shell. The page now uses the standard module-page frame at the wider content width the other module pages use. Replace the standing screening disclaimer block and the opt-in/private line in the header with an info icon after the page heading whose hover/focus tooltip carries the screening-not-a-diagnosis note. Drop the now-orphaned `disclaimer` / `optInNote` strings across all six locales and add the `infoTooltip` string in their place. The questionnaire, scoring, severity result, PHQ-9 item-9 crisis-resource handling, focus-on-submit, and 44px touch targets are unchanged. Repoint the module nav entry and the registry comments at the new route.
This commit is contained in:
1 parent
651b02bc1b
commit
37c977e3a4
10 files changed
+21
-28
No files matched your search
@@ -8,7 +8,8 @@ import { useAuth } from "@/hooks/use-auth";
|
||||
import { MentalWellbeing } from "@/components/mental-health/mental-wellbeing";
|
||||
|
||||
/**
|
||||
* v1.25.0 — `/insights/mental-wellbeing`.
|
||||
* `/mental-wellbeing` — standalone module page (moved off `/insights/*` in
|
||||
* v1.25.1 so it no longer borrows the Insights tab strip / layout shell).
|
||||
*
|
||||
* Opt-in PHQ-9 / GAD-7 screener surface, beside mood tracking. The screen owns
|
||||
* its own questionnaire + result + crisis-resource flow; it deliberately does
|
||||
@@ -87,10 +87,10 @@ export const NAV_DESTINATIONS: ReadonlyArray<NavDestination> = [
|
||||
// Born-gated: `requiresModule: "mentalHealth"` reads the opt-in (default-off)
|
||||
// key from the resolved module map, so the entry is absent until the account
|
||||
// turns the module on from the Modules hub. The destination is the dedicated
|
||||
// `/insights/mental-wellbeing` check-in surface (its own nav home — the
|
||||
// active-detection helper defers `/insights` to it on that path).
|
||||
// top-level `/mental-wellbeing` check-in surface (its own module page — it
|
||||
// no longer borrows the Insights tab strip / layout shell).
|
||||
{
|
||||
href: "/insights/mental-wellbeing",
|
||||
href: "/mental-wellbeing",
|
||||
tKey: "nav.mentalWellbeing",
|
||||
icon: Brain,
|
||||
tourId: "nav-mental-wellbeing",
|
||||
|
||||
@@ -21,6 +21,7 @@ import { apiGet, apiPost } from "@/lib/api/api-fetch";
|
||||
import { queryKeys } from "@/lib/query-keys";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { InfoHint } from "@/components/ui/info-hint";
|
||||
import {
|
||||
INSTRUMENTS,
|
||||
PHQ_GAD_ATTRIBUTION,
|
||||
@@ -122,20 +123,17 @@ export function MentalWellbeing() {
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex max-w-2xl flex-col gap-6">
|
||||
<div className="mx-auto flex max-w-3xl flex-col gap-6">
|
||||
<header className="flex flex-col gap-2">
|
||||
<h1 className="text-2xl font-semibold">
|
||||
{t("mentalHealth.pageTitle")}
|
||||
</h1>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<h1 className="text-2xl font-semibold">
|
||||
{t("mentalHealth.pageTitle")}
|
||||
</h1>
|
||||
<InfoHint label={t("mentalHealth.infoTooltip")} />
|
||||
</div>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
{t("mentalHealth.pageDescription")}
|
||||
</p>
|
||||
<p className="text-muted-foreground border-border/60 bg-muted/40 rounded-md border p-3 text-xs">
|
||||
{t("mentalHealth.disclaimer")}
|
||||
</p>
|
||||
<p className="text-muted-foreground text-xs">
|
||||
{t("mentalHealth.optInNote")}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
{phase === "choose" && (
|
||||
|
||||
@@ -140,7 +140,7 @@ export const MODULE_KEYS = [
|
||||
// tracking. OPT-IN (off by default): a depression / anxiety self-assessment
|
||||
// is at least as sensitive as mood, so it ships dark and the user turns it on
|
||||
// deliberately. The `optIn` marker inverts the per-user default; with it off
|
||||
// the `/insights/mental-wellbeing` surface is hidden from nav and the
|
||||
// the `/mental-wellbeing` surface is hidden from nav and the
|
||||
// assessment routes refuse server-side. Item answers are always encrypted and
|
||||
// always excluded from the AI Coach / MCP regardless of this toggle.
|
||||
"mentalHealth",
|
||||
@@ -313,7 +313,7 @@ export const MODULE_REGISTRY: Readonly<Record<ModuleKey, ModuleDefinition>> =
|
||||
category: "tracking",
|
||||
// Off by default: a depression / anxiety screener is highly sensitive, so
|
||||
// the surface ships dark and the user opts in deliberately. Turning it on
|
||||
// reveals the `/insights/mental-wellbeing` check-in and lets the screener
|
||||
// reveals the `/mental-wellbeing` check-in and lets the screener
|
||||
// total ride the doctor-report export; item answers stay encrypted and
|
||||
// off the AI Coach / MCP regardless.
|
||||
optIn: true,
|
||||
|
||||
Reference in new issue
Block a user