Skip to content

Make the shared home mode-aware - #1790

Merged
BigSimmo merged 4 commits into
mainfrom
codex/chat-mode-home-copy-9d76
Aug 9, 2026
Merged

Make the shared home mode-aware#1790
BigSimmo merged 4 commits into
mainfrom
codex/chat-mode-home-copy-9d76

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Keep / as one lightweight shared home while updating its canonical icon, question title, supporting text, selector identity, and existing composer placeholder from the URL-owned mode.
  • Cover all 13 app modes through one exhaustive typed presentation map and the existing canonical mode icon/configuration sources.
  • Restore focus to the settled mode selector after keyboard or pointer selection without remounting the shared home or stealing deliberately moved focus.
  • Refine the shared home with stable desktop Clinical KB branding, unclipped 320px mode labels, stable narrow-phone hero geometry, and a shorter Formulation placeholder.
  • Preserve drafts, history length, one-composer ownership, standalone mode homes, and submission destinations.

Why

Mode selection on the shared home previously retargeted the search composer without changing the surrounding hero. Updating the existing shared surface in place makes the active clinical task immediately clear without adding routes, loading states, duplicated composers, or per-mode pages.

Areas touched

  • Shared-home presentation data and canonical icon selection.
  • ClinicalDashboard, SharedHomeEmptyState, ModeHomeTemplate, and MasterSearchHeader presentation/focus behavior.
  • Focused DOM, responsive Chromium, stress, smoke, and preference locators.

Verification

  • npm run format — passed; repository-wide Prettier completed before commit.
  • Focused ESLint over changed source/tests — passed.
  • npm run typecheck:source — passed.
  • npm test -- tests/shared-home-empty-state.dom.test.tsx tests/answer-preferences.dom.test.tsx tests/mode-menu-prefetch.dom.test.tsx tests/favourites-auth-gate.dom.test.tsx — 4 files passed, 36 tests passed.
  • npm run test:e2e:pr -- tests/ui-tools.spec.ts --grep "shared-home presentation|header mode switches" — isolated production build passed; 4 Chromium tests passed in 13.5s.
  • Live 320px inspection — full Formulation label fit at 90px/90px, Specifiers → Formulation composer top delta 0px, and document width 320px/320px.
  • git diff --check — passed before commit.

Checks not run

  • npm run verify:phone-chrome / full npm run verify:ui were not launched. Its dry run selected the entire Chromium suite; the changed desktop, 390px media, 320px geometry, focus, branding, and standalone Services behavior received direct production-style coverage instead.
  • npm run verify:pr-local was not repeated. An earlier broad verify:cheap attempt in this task was not green because of 31 unrelated Windows/bash/temp-directory/timeout/PDF-virtualization cases; focused changed behavior, lint, typecheck, production build, and browser checks are green.
  • Physical iPhone Safari and VoiceOver remain device acceptance checks; Chromium emulation is not claimed as physical-device evidence.
  • No provider-backed clinical, retrieval, Supabase, production, or deployment checks were run because this is presentation-only.

Risk and compatibility

  • No public API, route, schema, dependency, asset, retrieval, ranking, clinical-output, or submission-routing changes.
  • The shared home remains one mounted surface with URL-derived mode ownership and one composer.
  • The branch is intentionally opened as a draft and is behind current main; GitHub CI should validate the current merge result.

RAG impact: no retrieval behaviour change — shared-home copy, icons, focus, responsive presentation, and focused tests only; submission routing, retrieval, ranking, and answer generation are unchanged.

Closes #1744

Summary by CodeRabbit

  • New Features
    • Introduced a shared home experience across app modes, with mode-specific titles, subtitles, icons, and placeholders.
    • Preserved the shared composer and draft content when switching modes.
    • Improved focus restoration and mode selection behavior, including mobile transitions.
    • Added responsive layout stabilization for mobile home content.
  • Improvements
    • Updated shared home branding and refreshed empty-state messaging.
    • Shortened the formulation search placeholder for clarity.
  • Tests
    • Expanded coverage for mode switching, accessibility, responsive layouts, recent searches, focus, and URL-driven flows.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The dashboard replaces the answer-specific empty state with a shared home that derives its presentation from the active mode. The header adds shared branding and deferred focus restoration. Tests cover mode switching, responsive layout, recent queries, and standalone results.

Changes

Shared home experience

Layer / File(s) Summary
Shared presentation and responsive copy
src/lib/ui-copy.ts, src/lib/app-modes.ts, src/components/mode-home-template.tsx, src/components/answer-home-proposal-mockups.tsx
Defines mode-specific shared home titles, subtitles, and icons. Adds optional phone-copy stabilization and updates the formulation placeholder.
Mode-aware shared empty state
src/components/clinical-dashboard/answer-status.tsx, src/components/ClinicalDashboard.tsx
Renames the component to SharedHomeEmptyState, accepts modeId, and renders mode-specific content while preserving composer and recent-query wiring.
Shared identity and mode focus restoration
src/components/clinical-dashboard/master-search-header.tsx
Adds shared Clinical KB branding and defers focus restoration across mode changes, same-mode selection, and phone sheet closure.
Shared home and navigation validation
tests/answer-preferences.dom.test.tsx, tests/mode-menu-prefetch.dom.test.tsx, tests/shared-home-empty-state.dom.test.tsx, tests/ui-smoke.spec.ts, tests/ui-stress.spec.ts, tests/ui-tools.spec.ts, tests/settings-inert-preferences.dom.test.tsx
Validates mode presentation, in-place updates, recent queries, focus, URL and history behavior, responsive layout, accessibility, and standalone results.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: codex

Suggested reviewers: claude, cursoragent, copilot

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements the shared home changes but does not provide evidence for all issue requirements, including dedicated homes, More modes navigation, and remembered-mode fixes. Address or explicitly defer the missing linked-issue requirements, and update the PR scope or issue linkage if this PR only covers shared-home presentation.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: making the shared home mode-aware.
Description check ✅ Passed The description covers the change, rationale, verification results, skipped checks, risks, compatibility, and linked issue.
Out of Scope Changes check ✅ Passed The source and test changes align with the shared-home mode-awareness, focus, branding, responsive layout, and placeholder objectives.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/chat-mode-home-copy-9d76

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 14:54
@BigSimmo
BigSimmo enabled auto-merge (squash) August 9, 2026 14:54
Comment thread src/components/clinical-dashboard/master-search-header.tsx

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

Updates the shared / home surface so its hero/branding/icon/copy stay in sync with the URL-owned mode, while keeping the single mounted composer and improving focus restoration after mode selection.

Changes:

  • Add a typed sharedHomePresentation map (covering all 13 modes) and switch the shared home empty state to render mode-aware title/subtitle/icon.
  • Improve mode-switch focus behavior in MasterSearchHeader by deferring focus restore until the URL-owned mode prop settles.
  • Expand/adjust DOM + Playwright coverage for shared-home presentation, focus, and narrow viewport geometry (390px/320px).

Reviewed changes

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

Show a summary per file
File Description
tests/ui-tools.spec.ts Adds/updates E2E coverage for mode-aware shared-home hero, focus restore, and 390px/320px layout stability.
tests/ui-stress.spec.ts Updates stress test selectors to the new shared-home test id.
tests/ui-smoke.spec.ts Updates smoke coverage to the new shared-home test ids and updated hero heading copy.
tests/shared-home-empty-state.dom.test.tsx New DOM test asserting per-mode presentation coverage and rerender-in-place behavior.
tests/settings-inert-preferences.dom.test.tsx Updates preference test commentary to reflect SharedHomeEmptyState naming.
tests/answer-preferences.dom.test.tsx Updates preference coverage to target shared-home recent-query chips/test ids.
src/lib/ui-copy.ts Introduces sharedHomePresentation map and shared-home empty-state copy labels.
src/lib/app-modes.ts Refines Formulation placeholder copy used by the shared composer.
src/components/mode-home-template.tsx Adds stabilizePhoneCopy option to stabilize phone hero geometry across copy changes.
src/components/ClinicalDashboard.tsx Switches shared-home rendering to SharedHomeEmptyState and passes sharedHomeIdentity into the header.
src/components/clinical-dashboard/master-search-header.tsx Adds stable shared-home branding variant and improves focus restore after mode selection.
src/components/clinical-dashboard/answer-status.tsx Replaces AnswerEmptyState with SharedHomeEmptyState driven by mode-aware presentation + canonical mode icons.
src/components/answer-home-proposal-mockups.tsx Updates pinned-copy comment to point at the new shared-home presentation source.

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

Comment thread src/components/clinical-dashboard/master-search-header.tsx
BigSimmo and others added 2 commits August 9, 2026 23:31
Same-mode picks on the shared home keep an identical replaceState URL, so
searchMode never changes and the pending-focus effect can lose the restore
while the phone sheet still mounts #app-mode-menu. Retry after teardown and
cover with a DOM regression test.

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

@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

🧹 Nitpick comments (1)
src/components/clinical-dashboard/master-search-header.tsx (1)

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

Move the phone reserve into a theme token.

Line 2176 adds 9rem as a hardcoded design value. Define the reserve in src/app/globals.css with @theme, then reference that token in the width calculation.

As per coding guidelines, use Tailwind 4 @theme tokens instead of hardcoded design values.

🤖 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/clinical-dashboard/master-search-header.tsx` at line 2176,
Replace the hardcoded 9rem phone reserve in the master-search-header width
calculation with a Tailwind 4 theme token. Define the reserve in the `@theme`
section of globals.css, then reference that token in the responsive width class
while preserving the existing sizing behavior.

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/clinical-dashboard/master-search-header.tsx`:
- Around line 853-879: Remove the modeButtonRef focus fallback after
restoreFocusUnlessMoved in the same-mode branch of the mode selection handler,
so deferred restoration never overrides deliberate focus movement. Keep the
existing restoreFocusUnlessMoved call and pending-focus cleanup, and add a test
that moves focus to another control before deferred restoration and verifies
that control retains focus.

In `@src/components/mode-home-template.tsx`:
- Around line 90-102: Replace the hardcoded 2lh utility in the title and
description className expressions of the mode-home template with a semantic
Tailwind token. Define that token in the `@theme` section of globals.css, then
reference it through the existing max-sm:min-h utility while preserving the
current conditional layout behavior.

---

Nitpick comments:
In `@src/components/clinical-dashboard/master-search-header.tsx`:
- Line 2176: Replace the hardcoded 9rem phone reserve in the
master-search-header width calculation with a Tailwind 4 theme token. Define the
reserve in the `@theme` section of globals.css, then reference that token in the
responsive width class while preserving the existing sizing behavior.
🪄 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: 9c490454-4a36-4ac3-94a1-8804f4e99e4b

📥 Commits

Reviewing files that changed from the base of the PR and between 2341f4c and 1d32ce6.

📒 Files selected for processing (14)
  • src/components/ClinicalDashboard.tsx
  • src/components/answer-home-proposal-mockups.tsx
  • src/components/clinical-dashboard/answer-status.tsx
  • src/components/clinical-dashboard/master-search-header.tsx
  • src/components/mode-home-template.tsx
  • src/lib/app-modes.ts
  • src/lib/ui-copy.ts
  • tests/answer-preferences.dom.test.tsx
  • tests/mode-menu-prefetch.dom.test.tsx
  • tests/settings-inert-preferences.dom.test.tsx
  • tests/shared-home-empty-state.dom.test.tsx
  • tests/ui-smoke.spec.ts
  • tests/ui-stress.spec.ts
  • tests/ui-tools.spec.ts

Comment thread src/components/clinical-dashboard/master-search-header.tsx
Comment thread src/components/mode-home-template.tsx
@BigSimmo
BigSimmo merged commit d812c76 into main Aug 9, 2026
41 checks passed
@BigSimmo
BigSimmo deleted the codex/chat-mode-home-copy-9d76 branch August 9, 2026 16:03
cursor Bot pushed a commit that referenced this pull request Aug 10, 2026
* fix: honor restoreFocusUnlessMoved on same-mode reselect

PR #1790 landed with a force-focus fallback that could override deliberate
focus moves after the mode menu closed. Keep only restoreFocusUnlessMoved
and cover the no-steal path with a DOM test. Records the #1790 babysit
ledger row.

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

* fix(ci): drop deprecated baseUrl from isolated Playwright tsconfigs

Next 16.3 surfaces TS5101 when the Playwright/Lighthouse run-root
tsconfig still injects baseUrl. Resolve @/* with root-relative paths
instead so Production UI critical can typecheck again after the main sync.

* fix(ci): align Playwright tsconfig contracts with #1798

Unit coverage failed after merging #1798: runners keep baseUrl +
ignoreDeprecations, but this branch still asserted root-relative paths.
Update the two contract tests to match the kept runner shape.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
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.

3 participants