fix(mockups): perfect Therapy Compass detail dedup + wire placeholder controls#664
Conversation
… controls Follow-up polish to the merged Therapy Compass tool (#650), from a targeted bug-hunt over the module. Detail screen - Stop rendering `clinicalSummary` twice: it appeared in both the hero and a "Clinical snapshot" body row (every record has one, so it duplicated on 100% of pages). Dropped the redundant body row. - Make the quick tiles glance-sized (first sentence) so they no longer repeat the full body sections; the full text stays in the body. - Remove the rail's "Best used for" row — it was a verbatim copy of the "USE WHEN" tile. - Dedupe "Safety & cautions": `limitations` often repeats the tail of `contraindicationsOrCautions`, so only append it when it adds something new. - "When to use" shows `indications` rather than mirroring the tile fallback. Controls - Wire the Brief "Copy step" / "Copy intervention" buttons to the clipboard with transient feedback (shared `useClipboard` hook + `CheckIcon`). - Relabel the dead "Save set" (Compare) and "Save workflow" (Recommend) to working "Copy set" / "Copy shortlist" exports. - Remove non-functional placeholders that can't act in a client-only mockup: "Save draft" (Sheets), "Save brief" (Brief), "Filters" (Search, redundant with the always-visible chips). - Compare add-picker now disables and explains at the 4-therapy limit instead of silently no-op'ing. Consistency - Normalize `React.ReactNode` (UMD global) to `import type { ReactNode }` in the home/recommend/sheets screens, matching the rest of the module. Verified: typecheck, lint, prettier, and verify:cheap (2313 unit tests) green; Chromium walkthrough of Detail/Compare/Brief/Search with no console errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TJaXJntdH7Q98ejoSZF46K
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughChangesTherapy Compass interaction updates
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant TherapyCompassScreen
participant useClipboard
participant BrowserClipboard
User->>TherapyCompassScreen: Select copy action
TherapyCompassScreen->>useClipboard: copy(text, key)
useClipboard->>BrowserClipboard: writeText(text)
BrowserClipboard-->>useClipboard: clipboard write result
useClipboard-->>TherapyCompassScreen: copied key
TherapyCompassScreen-->>User: Show copied label and check icon
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Comment |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0826adc42
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
|
Summary
Testing
|
Addresses a Codex review finding on #664's `use-clipboard.ts`: `copyText` fired `navigator.clipboard.writeText` and returned `true` synchronously, so a rejected write (permission denied, lost focus, blocked gesture) still flipped the button to "Copied" and left the promise rejection unhandled. - `copyText` is now async: it awaits the write and resolves `false` on rejection instead of throwing, so callers never signal a copy that didn't happen. - `useClipboard` sets `copied` only after a successful write, and guards against a state update after unmount. - Adds tests that mock `writeText` resolving/rejecting: `copyText` reports real success/failure without throwing, and `copied` stays unset when the write rejects. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TJaXJntdH7Q98ejoSZF46K
Summary
Follow-up polish to the merged Therapy Compass mockup (#650), from a targeted bug-hunt over
src/components/therapy-compass. Dev-only route (/mockups/therapy-compass, production 404 +robotsdisallow); no production surface, data, schema, or governance change.Detail screen — remove duplicated content
clinicalSummarywas rendered twice (the hero and a "Clinical snapshot" body row); every record has one, so it duplicated on 100% of detail pages. Removed the redundant body row.limitationsfield frequently repeats the tail ofcontraindicationsOrCautions, so it is only appended when it adds something new.Wire / clean up placeholder controls (a cluster of buttons that looked actionable but did nothing)
useClipboardhook +CheckIcon).Consistency
React.ReactNode(UMD global) →import type { ReactNode }in the home/recommend/sheets screens, matching the rest of the module.Confined to
src/components/therapy-compass/**— 9 files changed + one newuse-clipboard.ts.Verification
npm run verify:pr-local— not run to completion in this sandbox (its typecheck step trips on optional deps not installed here). Instead rannpm run verify:cheapgreen (runtime, GH-actions pin, sitemap, brand,check:type-scale,check:icon-scale, lint, typecheck, 2313 unit tests) plus Prettier--check. CIBuild/Static PR checkscover the full install.npm run verify:ui(equivalent) — drove the mockup in Chromium/Playwright across Detail, Compare, Brief and Search: summary renders once, glance tiles + deduped Safety confirmed, Copy buttons + 4-therapy limit work, no stale placeholder buttons, no console errors. CICritical UI smoke/UI regressionrun the full Chromium suite.npm run eval:retrieval:quality— N/A. No retrieval, ranking, selection, chunking, or scoring change. Therapy Compass search is an isolated in-memory scorer over static JSON, not the live RAG retrieval/ranking pipeline.npm run check:production-readiness— N/A. No clinical workflow, privacy, environment, Supabase, source-governance, or deployment change.Clinical Governance Preflight
N/A for production surfaces — this is a static, dev-only mockup. It does not touch ingestion, answer generation, search/ranking of live documents, document access, privacy, production env, Supabase, or clinical output. Bundled content is unchanged;
reviewStatus, warnings, sources and needs-review indicators remain surfaced (not presented as validated). No schema, RLS, or service-role changes.Notes
Found via a bug-hunt pass after #650 merged. The only functional defect was the detail-screen
clinicalSummaryduplication; the rest are placeholder-control wiring and repetition cleanups toward a polished demo. Each Copy/export action uses the shared clipboard helper, consistent with the existing pathway "Copy pathway".🤖 Generated with Claude Code
https://claude.ai/code/session_01TJaXJntdH7Q98ejoSZF46K
Generated by Claude Code
Summary by CodeRabbit
New Features
Updates