From b94a1e6891cdf58a74a83b97f2ff2adb7df87534 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Jul 2026 04:46:36 +0000 Subject: [PATCH 1/4] feat(tools): add Safety plan generator as a Tools-page tool (not a mode) Promote the patient safety-plan generator from a /mockups prototype to a production Tools-page tool, reachable at /safety-plan without registering it as an app mode. - Rename patient-safety-plan-mockup.tsx -> patient-safety-plan.tsx and export PatientSafetyPlan; tokenise the two 44px tap classes (min-h-tap, size-tap) and add aria-hidden to a decorative icon now that the file is production (no longer mockup-exempt from the design-system/lint gates). - Add the /safety-plan route (src/app/safety-plan/page.tsx). - Retire the redundant /mockups/patient-safety-plan route and its mockups-layout-client special-case. - Add a "safety-plan" Tools catalog tile (href /safety-plan, care area, safety-first), its launcher icon, and a reachability fixture. - Regenerate docs/site-map.md and index the route in docs/codebase-index.md. app-modes.ts is intentionally untouched: this is a tool, not a mode. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_017Jurbrad9ZeWo45EQpxBzR --- docs/codebase-index.md | 1 + docs/site-map.md | 2 +- scripts/generate-site-map.ts | 1 + src/app/mockups/mockups-layout-client.tsx | 7 +---- src/app/mockups/patient-safety-plan/page.tsx | 13 --------- src/app/safety-plan/page.tsx | 13 +++++++++ src/components/applications-launcher-page.tsx | 1 + ...lan-mockup.tsx => patient-safety-plan.tsx} | 19 ++++++------ .../tools-page-mockups/tool-fixtures.ts | 11 ++++++- src/lib/tools-catalog.ts | 29 +++++++++++++++++++ 10 files changed, 67 insertions(+), 30 deletions(-) delete mode 100644 src/app/mockups/patient-safety-plan/page.tsx create mode 100644 src/app/safety-plan/page.tsx rename src/components/{patient-safety-plan-mockup.tsx => patient-safety-plan.tsx} (97%) diff --git a/docs/codebase-index.md b/docs/codebase-index.md index 0ad69d458..2a098ddde 100644 --- a/docs/codebase-index.md +++ b/docs/codebase-index.md @@ -62,6 +62,7 @@ Structured map for AI agents and onboarding. For live routes, see `docs/site-map | `/medications`, `/medications/[slug]` | `src/app/medications/` | | `/privacy` | `src/app/privacy/page.tsx` | | `/reference/colour-coding` | `src/app/reference/` | +| `/safety-plan` | `src/app/safety-plan/page.tsx` | | `/services`, `/services/[slug]` | `src/app/services/` | | `/therapy-compass` | `src/app/therapy-compass/` | | `/tools` | `src/app/tools/` | diff --git a/docs/site-map.md b/docs/site-map.md index 92210148a..be0f07045 100644 --- a/docs/site-map.md +++ b/docs/site-map.md @@ -25,6 +25,7 @@ This file is generated by `npm run sitemap:update`. Run `npm run sitemap:check` - `/formulation/map` - Formulation mechanism domain map. Source: `src/app/formulation/map/page.tsx`. - `/privacy` - Privacy and data-processing governance draft. Source: `src/app/privacy/page.tsx`. - `/reference/colour-coding` - Route discovered from app directory Source: `src/app/reference/colour-coding/page.tsx`. +- `/safety-plan` - Patient safety plan generator (Stanley-Brown six steps) — a Tools-page clinical tool. Source: `src/app/safety-plan/page.tsx`. - `/services` - Services home and search surface. Source: `src/app/services/page.tsx`. - `/specifiers` - Psychiatric specifier home and local search surface. Source: `src/app/specifiers/page.tsx`. - `/specifiers/builder` - Structured diagnostic wording builder. Source: `src/app/specifiers/builder/page.tsx`. @@ -1002,7 +1003,6 @@ This file is generated by `npm run sitemap:update`. Run `npm run sitemap:check` - `/mockups/favourites-set-navigator` - Route discovered from app directory Source: `src/app/mockups/favourites-set-navigator/page.tsx`. - `/mockups/medication-prescribing` - Route discovered from app directory Source: `src/app/mockups/medication-prescribing/page.tsx`. - `/mockups/mode-dropdown` - Route discovered from app directory Source: `src/app/mockups/mode-dropdown/page.tsx`. -- `/mockups/patient-safety-plan` - Route discovered from app directory Source: `src/app/mockups/patient-safety-plan/page.tsx`. - `/mockups/recent-searches-bottom` - Route discovered from app directory Source: `src/app/mockups/recent-searches-bottom/page.tsx`. - `/mockups/settings-search-clinical` - Route discovered from app directory Source: `src/app/mockups/settings-search-clinical/page.tsx`. - `/mockups/settings-search-general` - Route discovered from app directory Source: `src/app/mockups/settings-search-general/page.tsx`. diff --git a/scripts/generate-site-map.ts b/scripts/generate-site-map.ts index e19b99537..8c8ba019d 100644 --- a/scripts/generate-site-map.ts +++ b/scripts/generate-site-map.ts @@ -73,6 +73,7 @@ const routeDescriptions: Record = { "/medications": "Medication index redirect.", "/medications/[slug]": "Medication detail.", "/privacy": "Privacy and data-processing governance draft.", + "/safety-plan": "Patient safety plan generator (Stanley-Brown six steps) — a Tools-page clinical tool.", "/services": "Services home and search surface.", "/services/[slug]": "Registry-backed service detail.", "/formulation": "Clinical formulation home and local mechanism search surface.", diff --git a/src/app/mockups/mockups-layout-client.tsx b/src/app/mockups/mockups-layout-client.tsx index e9a3407fe..ed508daad 100644 --- a/src/app/mockups/mockups-layout-client.tsx +++ b/src/app/mockups/mockups-layout-client.tsx @@ -17,10 +17,6 @@ export function MockupsLayoutClient({ children }: { children: ReactNode }) { // at the bottom on phones), so the shared universal composer is suppressed here // to avoid a second, floating search bar. const isCalculatorsSearchPageMockup = pathname === "/mockups/calculators-search-page"; - // The safety-plan generator is a full builder workspace with its own primary - // surfaces, so it hides the shared bottom search composer (same treatment as - // the tool and favourites mockups). - const isSafetyPlanMockup = pathname === "/mockups/patient-safety-plan"; return ( diff --git a/src/app/mockups/patient-safety-plan/page.tsx b/src/app/mockups/patient-safety-plan/page.tsx deleted file mode 100644 index 1590ded1e..000000000 --- a/src/app/mockups/patient-safety-plan/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import type { Metadata } from "next"; - -import { PatientSafetyPlanMockup } from "@/components/patient-safety-plan-mockup"; - -export const metadata: Metadata = { - title: "Safety Plan Generator Mockup - Clinical KB", - description: - "Clinician-facing patient safety-plan generator mockup: build the Stanley-Brown six steps with a live patient copy to print or share.", -}; - -export default function PatientSafetyPlanMockupRoute() { - return ; -} diff --git a/src/app/safety-plan/page.tsx b/src/app/safety-plan/page.tsx new file mode 100644 index 000000000..689d65073 --- /dev/null +++ b/src/app/safety-plan/page.tsx @@ -0,0 +1,13 @@ +import type { Metadata } from "next"; + +import { PatientSafetyPlan } from "@/components/patient-safety-plan"; + +export const metadata: Metadata = { + title: "Safety plan generator - Clinical KB", + description: + "Build a patient safety plan with the Stanley-Brown six steps and a live patient copy to print, save as PDF, or hand over.", +}; + +export default function SafetyPlanPage() { + return ; +} diff --git a/src/components/applications-launcher-page.tsx b/src/components/applications-launcher-page.tsx index cf5a004e6..48d12bcd5 100644 --- a/src/components/applications-launcher-page.tsx +++ b/src/components/applications-launcher-page.tsx @@ -91,6 +91,7 @@ const launcherIconById: Record = { services: Users, forms: FileCheck2, "care-plans": ClipboardCheck, + "safety-plan": ClipboardList, monitoring: Waves, favourites: Star, }; diff --git a/src/components/patient-safety-plan-mockup.tsx b/src/components/patient-safety-plan.tsx similarity index 97% rename from src/components/patient-safety-plan-mockup.tsx rename to src/components/patient-safety-plan.tsx index 738fcbe0e..53e54f307 100644 --- a/src/components/patient-safety-plan-mockup.tsx +++ b/src/components/patient-safety-plan.tsx @@ -37,15 +37,16 @@ import { } from "@/components/ui-primitives"; /* - * Patient Safety Plan generator — design-exploration mockup. + * Patient Safety Plan generator — Tools-page clinical tool. * * A clinician builds an evidence-based safety plan *with* the patient (the * Stanley-Brown Safety Planning Intervention, six prioritised steps), and a * live patient-facing preview updates as they type — ready to print, save as * PDF, or hand over. Sample content is seeded so the layout reads fully; every - * field is editable. Australian English + AU crisis resources throughout, per - * the Clinical KB (en-AU) voice. All chrome is token-driven so light/dark, - * reduced-motion and forced-colors follow the shared design system. + * field is editable and "Clear all" empties the plan. Australian English + AU + * crisis resources throughout, per the Clinical KB (en-AU) voice. All chrome is + * token-driven so light/dark, reduced-motion and forced-colors follow the + * shared design system. */ const focusRing = @@ -324,7 +325,7 @@ function StepBuilderCard({ )} aria-hidden="true" > - +