Skip to content

fix(mockups): perfect Therapy Compass detail dedup + wire placeholder controls#664

Merged
BigSimmo merged 1 commit into
mainfrom
claude/therapy-compass-pages-rz0m5l
Jul 14, 2026
Merged

fix(mockups): perfect Therapy Compass detail dedup + wire placeholder controls#664
BigSimmo merged 1 commit into
mainfrom
claude/therapy-compass-pages-rz0m5l

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 14, 2026

Copy link
Copy Markdown
Owner

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 + robots disallow); no production surface, data, schema, or governance change.

Detail screen — remove duplicated content

  • clinicalSummary was 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.
  • Quick tiles are now glance-sized (first sentence) so they no longer repeat the full body sections verbatim; the full text stays in the body sections.
  • Removed the rail's "Best used for" row — it was a verbatim copy of the "USE WHEN" tile.
  • "Safety & cautions" no longer echoes itself: the limitations field frequently repeats the tail of contraindicationsOrCautions, 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)

  • Brief "Copy step" / "Copy intervention" now copy to the clipboard with transient feedback (shared useClipboard hook + CheckIcon).
  • Dead "Save set" (Compare) → working "Copy set"; "Save workflow" (Recommend) → working "Copy shortlist" (real text exports).
  • Removed placeholders that can't act in a client-only mockup: "Save draft" (Sheets), "Save brief" (Brief, redundant), "Filters" (Search, redundant with the always-visible chips/toggles).
  • Compare add-picker now disables and explains at the 4-therapy limit instead of silently no-op'ing.

Consistency

  • Normalized 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 new use-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 ran npm run verify:cheap green (runtime, GH-actions pin, sitemap, brand, check:type-scale, check:icon-scale, lint, typecheck, 2313 unit tests) plus Prettier --check. CI Build / Static PR checks cover 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. CI Critical UI smoke / UI regression run the full Chromium suite.
  • npm run eval:retrieval:qualityN/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-readinessN/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 clinicalSummary duplication; 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

    • Added copy-to-clipboard actions for intervention steps, therapy comparisons, and recommendation shortlists, with confirmation feedback.
    • Added limits and disabled-state messaging when the maximum number of therapies is selected for comparison.
    • Added printable/PDF output as the primary action for therapy sheets.
  • Updates

    • Simplified search controls by removing the Filters button.
    • Improved detail-page summaries and removed redundant clinical information.
    • Refined caution text to prevent duplicated guidance.

… 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
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b53d364a-14bc-4d2b-82d1-fffed5f9582c

📥 Commits

Reviewing files that changed from the base of the PR and between 061a1ef and d0826ad.

📒 Files selected for processing (10)
  • src/components/therapy-compass/bindings.tsx
  • src/components/therapy-compass/icons.tsx
  • src/components/therapy-compass/screens/brief-screen.tsx
  • src/components/therapy-compass/screens/compare-screen.tsx
  • src/components/therapy-compass/screens/detail-screen.tsx
  • src/components/therapy-compass/screens/home-screen.tsx
  • src/components/therapy-compass/screens/recommend-screen.tsx
  • src/components/therapy-compass/screens/search-screen.tsx
  • src/components/therapy-compass/screens/sheets-screen.tsx
  • src/components/therapy-compass/use-clipboard.ts

📝 Walkthrough

Walkthrough

Changes

Therapy Compass interaction updates

Layer / File(s) Summary
Clipboard utility and icon foundation
src/components/therapy-compass/use-clipboard.ts, src/components/therapy-compass/icons.tsx
Adds guarded clipboard writing, keyed copied-state reset handling, and a reusable check icon.
Screen copy workflows
src/components/therapy-compass/screens/brief-screen.tsx, src/components/therapy-compass/screens/compare-screen.tsx, src/components/therapy-compass/screens/recommend-screen.tsx
Replaces save actions with copy actions for intervention, comparison, and shortlist text, including copied-state feedback.
Comparison selection limit
src/components/therapy-compass/bindings.tsx, src/components/therapy-compass/screens/compare-screen.tsx
Exports MAX_COMPARE and disables further comparison additions when the limit is reached.
Detail content and safety rendering
src/components/therapy-compass/screens/detail-screen.tsx
Summarizes quick-tile content, removes selected detail rows, and prevents duplicated limitation text.
Screen controls and React typings
src/components/therapy-compass/screens/home-screen.tsx, src/components/therapy-compass/screens/search-screen.tsx, src/components/therapy-compass/screens/sheets-screen.tsx, src/components/therapy-compass/screens/recommend-screen.tsx
Removes obsolete Search and Sheets controls and updates component children types to use ReactNode.

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
Loading

Possibly related PRs

  • BigSimmo/Database#646: Introduced the related Therapy Compass mockup screens and save-to-copy interaction changes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/therapy-compass-pages-rz0m5l

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Comment @coderabbitai help to get the list of available commands.

@supabase

supabase Bot commented Jul 14, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@BigSimmo
BigSimmo marked this pull request as ready for review July 14, 2026 13:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/components/therapy-compass/use-clipboard.ts
@BigSimmo

Copy link
Copy Markdown
Owner Author

@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.

@BigSimmo
BigSimmo enabled auto-merge (squash) July 14, 2026 14:04
@BigSimmo
BigSimmo merged commit 5d9b043 into main Jul 14, 2026
20 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

Testing

  • npm install — installed missing local dependencies with Node 24.15.0; reverted the incidental package-lock.json rewrite because this fix does not change dependencies.
  • npm run test -- tests/therapy-compass-use-clipboard.dom.test.tsx
  • npm run typecheck
  • npx prettier --check src/components/therapy-compass/use-clipboard.ts src/components/therapy-compass/screens/brief-screen.tsx src/components/therapy-compass/screens/compare-screen.tsx src/components/therapy-compass/screens/recommend-screen.tsx tests/therapy-compass-use-clipboard.dom.test.tsx

View task →

BigSimmo pushed a commit that referenced this pull request Jul 14, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants