Add patient safety plan generator mockup - #1015
Conversation
Add a design-exploration mockup for a clinician-facing "Safety plan generator" tool at /mockups/patient-safety-plan. - New component `patient-safety-plan-mockup.tsx`: a two-pane builder + live patient-copy preview based on the Stanley-Brown Safety Planning Intervention (six prioritised steps), plus reasons for living and a prominent emergency-escalation band. - New route and metadata under src/app/mockups/patient-safety-plan/. - Hide the shared bottom search composer for this route (it provides its own primary surfaces), matching the tool/favourites mockup treatment. - Regenerate docs/site-map.md for the new route. Uses the Clinical White / Aegean design tokens and shared ui-primitives throughout; Australian English and AU crisis resources per the Clinical KB voice. Light/dark, reduced-motion and forced-colors follow the shared system. Sample content is seeded and fully editable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019g9m5emoPKCmDDPeGrchYd
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a ChangesPatient Safety Plan Mockup
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Browser
participant PatientSafetyPlanRoute
participant MockupsLayoutClient
participant PatientSafetyPlanMockup
Browser->>PatientSafetyPlanRoute: request safety plan mockup
PatientSafetyPlanRoute->>MockupsLayoutClient: render route within mockup shell
MockupsLayoutClient->>PatientSafetyPlanMockup: render without shared search composer
PatientSafetyPlanMockup->>Browser: display builder and patient preview
PatientSafetyPlanMockup->>Browser: copy or print generated plan
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/components/patient-safety-plan-mockup.tsx (2)
196-260: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
AddRowinputs rely solely on placeholder text for their accessible name.Neither the primary nor secondary
<input>has an associated<label>oraria-label; screen-reader users get no persistent accessible name once the field has a value (placeholder text is not read as a label). Given this is a clinician tool for entering safety-critical information, consider addingaria-label={primaryPlaceholder}/aria-label={secondaryPlaceholder}.♿ Proposed fix
<input value={primary} onChange={(event) => setPrimary(event.target.value)} + aria-label={primaryPlaceholder} onKeyDown={(event) => {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/patient-safety-plan-mockup.tsx` around lines 196 - 260, Add persistent accessible names to both inputs in AddRow by setting aria-label from primaryPlaceholder and secondaryPlaceholder respectively. Keep the existing placeholder props and input behavior unchanged.
191-192: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueModule-level mutable counter persists across mounts.
seqlives at module scope, so if this component unmounts/remounts (route revisit) the id sequence keeps incrementing rather than resetting; harmless for a mockup but worth noting if this pattern is reused elsewhere.crypto.randomUUID()or a per-instanceuseRefcounter would avoid the shared mutable state.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/patient-safety-plan-mockup.tsx` around lines 191 - 192, Update the uid generation near uid so the counter is scoped per component instance rather than shared at module scope, using a per-instance useRef counter or crypto.randomUUID(). Remove the module-level mutable seq state while preserving the existing prefixed ID format and uniqueness within each mounted instance.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/patient-safety-plan-mockup.tsx`:
- Around line 419-472: Reset finalised to false whenever any plan content
changes, not only in addEntry and removeEntry. Update the handlers for patient
name, planDate, and reasons-for-living additions/removals to clear finalised,
while preserving their existing state updates and the current finalisation
behavior.
- Around line 432-452: Update the planText useMemo to include the
reasons-for-living entries from reasons, matching the live preview’s formatting
and placement, and add the Suicide Call Back Service crisis line alongside the
existing emergency lines. Keep Copy and Print/PDF output aligned with the
preview while preserving the existing section rendering and blank-line
normalization.
---
Nitpick comments:
In `@src/components/patient-safety-plan-mockup.tsx`:
- Around line 196-260: Add persistent accessible names to both inputs in AddRow
by setting aria-label from primaryPlaceholder and secondaryPlaceholder
respectively. Keep the existing placeholder props and input behavior unchanged.
- Around line 191-192: Update the uid generation near uid so the counter is
scoped per component instance rather than shared at module scope, using a
per-instance useRef counter or crypto.randomUUID(). Remove the module-level
mutable seq state while preserving the existing prefixed ID format and
uniqueness within each mounted instance.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 985d515b-fea3-46c7-8b5c-77ddaae32515
📒 Files selected for processing (4)
docs/site-map.mdsrc/app/mockups/mockups-layout-client.tsxsrc/app/mockups/patient-safety-plan/page.tsxsrc/components/patient-safety-plan-mockup.tsx
…, label add inputs - planText (Copy / Print–PDF) now includes the reasons-for-living section and the Suicide Call Back Service crisis line, so the copied/printed artefact matches the on-screen patient preview. - Reset the "Plan finalised" state when the patient name, date, or a reason-for-living changes — previously only the six steps cleared it, so the banner could go stale after a content edit. - Give the AddRow inputs persistent aria-labels (from their placeholders) so the accessible name survives once a value is entered. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019g9m5emoPKCmDDPeGrchYd
Summary
/mockups/patient-safety-plan(dev-only route; 404 in production, robots-disallowed).patient-safety-plan-mockup.tsx: a two-pane builder + live patient-copy preview based on the Stanley–Brown Safety Planning Intervention (six prioritised steps), plus a reasons-for-living callout and a prominent emergency-escalation band.mockups-layout-client.tsx.docs/site-map.mdfor the new route.ui-primitives; light/dark, reduced-motion and forced-colors follow the shared system. Australian English + AU crisis resources per the Clinical KB voice. Sample content is seeded and clearly labelled as editable.Verification
tsc --noEmit) — cleannpm run sitemap:check— passes (new route registered)tests/production-mockup-boundary.test.ts+tests/env-mockups-gate.test.ts— 7/7 passnpm run verify:ui/npm run verify:pr-localcannot compile in this environment due to a pre-existing Turbopack CSS-parse error in generated Tailwind output (::file-selector-buttonfromDocumentManagerPanel.tsx, unrelated to this change). This mockup adds nofile:utilities. A standalone rendered preview confirmed the layout.eval:retrieval:quality,eval:rag,eval:quality,check:production-readiness.Risk and rollout
Complete this section for clinical, data, API, auth/privacy, workflow, dependency, build, or deployment changes.
mockups-layout-client.tsx.Clinical Governance Preflight
This dev-only mockup renders static, clearly-labelled synthetic sample content and never queries live data or sources. Crisis contacts are editable placeholders a clinician confirms for their local service. No ingestion, answer generation, retrieval/ranking, source rendering, document access, privacy, production-env, or clinical-output behaviour is touched — all items below hold unchanged.
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes
🤖 Generated with Claude Code
https://claude.ai/code/session_019g9m5emoPKCmDDPeGrchYd
Summary by CodeRabbit
New Features
UI Improvements