Skip to content

Compact therapy search result cards - #1783

Merged
BigSimmo merged 11 commits into
mainfrom
cursor/therapy-card-densify-e975
Aug 9, 2026
Merged

Compact therapy search result cards#1783
BigSimmo merged 11 commits into
mainfrom
cursor/therapy-card-densify-e975

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix the flush/overlap gap between the therapy search results band and the first result card (space-y-2.5 sm:space-y-3, trim filter-strip bottom margin).
  • Keep result-card tags on a single row with a trailing +N, prioritizing active filters and query matches before catalogue order.
  • Densify ResultCard: pin the favourite control to the card top-right, drop the heart-only grid column, keep Open/Compare/Sheet in one three-column footer (short phone labels), omit title-redundant subtitles, and summarise/clamp WHY / AVOID / BEST FIT copy.
  • Merged latest origin/main: keep densified layout and adopt fix(a11y): make unavailable placeholder buttons reachable by keyboard #1778 keyboard-reachable aria-disabled placeholders (ignoreUnavailableActivation for Favourite; early-return + aria-disabled for unavailable Patient sheet).

Verification

  • Focused unit tests after main merge: tests/therapy-card-preview.test.ts, tests/therapy-compass-responsive-contract.test.ts, tests/therapy-compass-mode-wiring.test.ts, tests/require-button-wiring.test.ts41 passed
  • git merge-tree --write-tree origin/main HEAD — clean
  • Prior npm run verify:pr-local on densify tip; main merge resolution re-checked with focused tests above
  • UI verification on densify tip: npm run ensure/therapy-compass/search?q=CBT&run=1 phone + desktop

Therapy search phone densify
Therapy search desktop densify

Risk and rollout

  • Risk: Low — presentation-only Therapy Compass search cards, plus adopting main’s existing unavailable-control a11y pattern.
  • Rollback: Revert this PR.
  • Provider or production effects: None

Notes

  • Favourite remains unavailable via aria-disabled + ignoreUnavailableActivation (keyboard-reachable placeholder; not native disabled).

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Summary by CodeRabbit

  • New Features

    • Therapy search cards now provide compact previews, prioritized tags, concise match details, and clearer best-fit and avoidance guidance.
    • Added responsive card actions, patient-sheet availability labels, and a Favourite control.
    • Tags can display in a single row with visible overflow indicators.
  • Style

    • Improved spacing and responsive layouts across search results on mobile and desktop.
  • Tests

    • Added coverage for preview text, tag prioritization, responsive card behavior, and search-result spacing.

Close the band/results gap, keep tags on one relevance-sorted row, move the favourite control beside the title, and summarise match-cell copy so cards use less vertical space on phone and desktop.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 35 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b8b2dfd3-95ba-4d2a-87f1-040168a4494f

📥 Commits

Reviewing files that changed from the base of the PR and between 9ea4e52 and 0b5584f.

📒 Files selected for processing (1)
  • docs/branch-review-ledger.md
📝 Walkthrough

Walkthrough

Therapy Compass now uses sentence-limited previews, prioritized tags, denser responsive result cards, and adjusted search spacing. Tests cover helper behavior, card layout, tag overflow, and production spacing.

Changes

Therapy Compass card UI

Layer / File(s) Summary
Preview and tag-ranking logic
src/components/therapy-compass/data/select.ts, tests/therapy-card-preview.test.ts
Added helpers that remove repeated therapy titles, limit preview sentences, and prioritize active or query-matching tags. Added unit coverage.
Result-card presentation
src/components/therapy-compass/therapy-card.tsx, src/components/therapy-compass/ui.tsx, tests/therapy-compass-responsive-contract.test.ts
Updated ResultCard with compact text, prioritized single-row tags, responsive actions, three-column summaries, and a disabled Favourite control. Added responsive contract coverage.
Search-screen spacing
src/components/therapy-compass/screens/search-screen.tsx, tests/therapy-compass-mode-wiring.test.ts
Adjusted responsive section and quick-filter spacing. Added a wiring assertion for the results band.
Review ledger update
docs/branch-review-ledger.md
Added a review-ledger entry for PR #1777 with coverage and verification details.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: cursoragent

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the summary, verification, risks, rollback, and production effects, but it omits the required Clinical Governance Preflight for search and ranking changes. Add the Clinical Governance Preflight section and record each applicable governance check, including source verification, privacy, environment, metadata, and clinical impact checks.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change to make Therapy Compass search result cards more compact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/therapy-card-densify-e975

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

@supabase

supabase Bot commented Aug 9, 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 August 9, 2026 10:58
Comment thread src/components/therapy-compass/ui.tsx Outdated

@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: ea4a86f836

ℹ️ 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/data/select.ts Outdated
cursoragent and others added 3 commits August 9, 2026 11:19
Absolute-position the disabled heart at the top-right of ResultCard and keep Open/Compare/Sheet in a three-column footer with short phone labels so mobile cards stay shorter.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Resolve therapy-card.tsx by keeping the densified ResultCard layout and adopting main's keyboard-reachable aria-disabled placeholders from #1778.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@BigSimmo
BigSimmo enabled auto-merge (squash) August 9, 2026 11:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Compacts Therapy Compass search cards while preserving key tags, actions, and clinical previews.

Changes:

  • Prioritizes relevant tags and shortens repetitive preview text.
  • Densifies card layout and improves result-band spacing.
  • Adds focused helper and responsive-contract tests.

Blocking issue: The two-column layout overflows and clips content around 640–700px viewports.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/components/therapy-compass/data/select.ts Adds preview and tag-prioritization helpers.
src/components/therapy-compass/screens/search-screen.tsx Adjusts results spacing.
src/components/therapy-compass/therapy-card.tsx Densifies card content and actions.
src/components/therapy-compass/ui.tsx Supports non-wrapping tag rows.
tests/therapy-card-preview.test.ts Tests new helpers.
tests/therapy-compass-mode-wiring.test.ts Guards result spacing.
tests/therapy-compass-responsive-contract.test.ts Guards compact card structure.
docs/branch-review-ledger.md Records review and verification.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/components/therapy-compass/therapy-card.tsx Outdated
Co-authored-by: BigSimmo <87357024+BigSimmo@users.noreply.github.com>
auto-merge was automatically disabled August 9, 2026 13:09

Head branch was pushed to by a user without write access

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/therapy-compass/ui.tsx (1)

84-91: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep the +N indicator outside the clipped tag list.

When tags exceed the card width, this container clips later flex children. The trailing +N indicator can disappear.

Use a clipped inner container for shown tags. Render +N as a non-shrinking sibling so it remains visible.

🤖 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/therapy-compass/ui.tsx` around lines 84 - 91, Update the tag
layout around the shown.map rendering so only the shown tags are wrapped in an
inner container with the existing clipping behavior. Render the extra count Tag
as a sibling outside that clipped container, and make it non-shrinking so the +N
indicator remains visible when tags exceed the available width.
🧹 Nitpick comments (1)
src/components/therapy-compass/therapy-card.tsx (1)

59-59: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Replace new literal spacing values with theme tokens.

Lines 59 and 86 add literal rem and px values inside arbitrary classes. Express these offsets with repository Tailwind 4 theme spacing tokens.

As per coding guidelines, use “Tailwind 4 @theme tokens … rather than introducing hardcoded design values.”

Also applies to: 86-86

🤖 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/therapy-compass/therapy-card.tsx` at line 59, Update the
responsive grid className in the therapy card, including the corresponding
spacing at the second referenced line, to replace literal rem and px offsets in
the arbitrary padding values with existing Tailwind 4 `@theme` spacing tokens.
Preserve the current responsive layout and tap-spacing calculations while
reusing repository-defined tokens instead of introducing new hardcoded design
values.

Source: Coding guidelines

🤖 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/therapy-compass/data/select.ts`:
- Around line 60-64: Update the filtering logic in the useful parts calculation
to remove sentences beginning with the excluded title followed by a valid
boundary, including prose such as “Behavioural activation is…”, while preserving
unrelated words that merely share the title’s prefix. Add a regression test
covering a title followed by prose and verify that cardPreviewText excludes it.

In `@src/components/therapy-compass/therapy-card.tsx`:
- Around line 34-42: Update the whyMatched and bestFit expressions to call
cardPreviewText separately for each candidate field before applying fallbacks.
Chain the resulting previews with || so therapy.indications, patientPopulation,
and setting are evaluated when an earlier preview becomes empty after excluding
therapy.name; preserve the existing final default messages.

---

Outside diff comments:
In `@src/components/therapy-compass/ui.tsx`:
- Around line 84-91: Update the tag layout around the shown.map rendering so
only the shown tags are wrapped in an inner container with the existing clipping
behavior. Render the extra count Tag as a sibling outside that clipped
container, and make it non-shrinking so the +N indicator remains visible when
tags exceed the available width.

---

Nitpick comments:
In `@src/components/therapy-compass/therapy-card.tsx`:
- Line 59: Update the responsive grid className in the therapy card, including
the corresponding spacing at the second referenced line, to replace literal rem
and px offsets in the arbitrary padding values with existing Tailwind 4 `@theme`
spacing tokens. Preserve the current responsive layout and tap-spacing
calculations while reusing repository-defined tokens instead of introducing new
hardcoded design values.
🪄 Autofix

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

Run ID: 39fb4ef5-af91-4d34-b93c-3ead753dd8c6

📥 Commits

Reviewing files that changed from the base of the PR and between 122cddf and 3755fa2.

📒 Files selected for processing (8)
  • docs/branch-review-ledger.md
  • src/components/therapy-compass/data/select.ts
  • src/components/therapy-compass/screens/search-screen.tsx
  • src/components/therapy-compass/therapy-card.tsx
  • src/components/therapy-compass/ui.tsx
  • tests/therapy-card-preview.test.ts
  • tests/therapy-compass-mode-wiring.test.ts
  • tests/therapy-compass-responsive-contract.test.ts

Comment thread src/components/therapy-compass/data/select.ts Outdated
Comment thread src/components/therapy-compass/therapy-card.tsx Outdated
cursoragent and others added 3 commits August 9, 2026 13:24
Keep TagRow +N unclipped, exclude title/alias restatements and title-prefixed prose from card previews, and apply field fallbacks after preview filtering.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Resolve branch-review ledger via the ledger merge driver (union + exact-row dedupe).

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@BigSimmo
BigSimmo enabled auto-merge (squash) August 9, 2026 14:36
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

CI triage

CI failed on this PR. Automated classification of the 2 failed job(s):

  • Production UI (3)needs investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredmain-side: the same job also failed on the latest completed main CI run.

Compared with main CI run #9522 (failure).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

Resolve branch-review ledger via the ledger merge driver (union + exact-row dedupe).

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@BigSimmo
BigSimmo merged commit 2341f4c into main Aug 9, 2026
26 checks passed
@BigSimmo
BigSimmo deleted the cursor/therapy-card-densify-e975 branch August 9, 2026 15:08
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.

4 participants