Skip to content

Document viewer: compact indexed-source UI, 3-button action layout, and toggle/search fixes - #1818

Merged
BigSimmo merged 5 commits into
mainfrom
codex/optimize-layout-and-fix-toggle-bug
Aug 12, 2026
Merged

Document viewer: compact indexed-source UI, 3-button action layout, and toggle/search fixes#1818
BigSimmo merged 5 commits into
mainfrom
codex/optimize-layout-and-fix-toggle-bug

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Fix the pinned/source panel and rail layout so the source area no longer creates excess vertical space and so actions fit on a single line.
  • Reduce the visual weight of indexed-source content so previews don’t blow out the page and the full dump stays behind an explicit inspection action.
  • Repair toggle/opening logic (deep-link/search vs manual close) and ensure the document composer remains the single search owner.

Description

  • Shrink and compact the cited passage card by reducing blockquote padding, switching preview to a shorter clamp (line-clamp-2) and adding a stable id for aria-controls; make the toggle button smaller and add aria-expanded/aria-controls for accessibility.
  • Reflow the action row into a 3-column compact grid so three controls sit on one line and tightened button spacing/typography so the UI is denser on small viewports.
  • Harden panel open/close state: replace the ad-hoc prev-state mutation with a useRef + useEffect pattern to avoid racey toggles and to respect deep-link/search reveal rules.
  • Make onSearchChange optional on IndexedTextPanel and adjust the test expectation so the page-level composer is treated as the single search owner (the indexed-text panel no longer duplicates a large search field).
  • Minor spacing/summary tweaks (details/summary paddings, eyebrow/eyebrow-text spacing, line-clamp/truncation adjustments) to reduce vertical footprint.
  • Files changed: src/components/document-viewer/source-panels.tsx, tests/ui-smoke.spec.ts (test expectation adjusted).

Testing

  • Ran the focused unit test for the indexed-panel: npm run test -- tests/document-section-summary.dom.test.tsx (Vitest focused selection); result: 1 test file passed, 8 tests passed.
  • Ran the same spec through the normal Vitest run and TypeScript typecheck: npm run test for the file and npm run typecheck; result: unit tests passed and typecheck succeeded.
  • Ran the Playwright e2e smoke selection for the document viewer scenario touched by the change (tests/ui-smoke.spec.ts — "document viewer puts the PDF preview first with pinned evidence after it on mobile"); result: the targeted Playwright test passed (1 passed).
  • Ran npm run ensure / local-server check and npm run format; both completed without error.

Codex Task

Summary by CodeRabbit

  • New Features

    • Improved the document viewer’s evidence and source panels with a more compact layout, clearer labels, and streamlined passage previews.
    • Updated search controls so document search is managed in one location without duplicate search fields.
    • Added clearer controls for expanding and collapsing full passages.
  • Bug Fixes

    • Search-result navigation now resets correctly when the search query or result ordering changes.
    • Improved accessibility state reporting for expandable evidence content.

@supabase

supabase Bot commented Aug 11, 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 ↗︎.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The document viewer now uses the document composer for search input, resets indexed-text result navigation when queries change, and updates evidence controls, passage disclosure behavior, spacing, and regression tests.

Changes

Document viewer search and evidence

Layer / File(s) Summary
Evidence controls and compact presentation
src/components/document-viewer/source-panels.tsx
Pinned evidence uses compact controls, updated labels, tighter spacing, smaller passage teasers, and revised disclosure presentation.
Indexed-text search ownership and state
src/components/document-viewer/source-panels.tsx
IndexedTextPanel.onSearchChange is optional. Reveal state uses effect-based tracking. Active result navigation resets when the normalized query changes.
Search and disclosure regression coverage
tests/document-section-summary.dom.test.tsx, tests/ui-smoke.spec.ts
Tests cover query-change result resets, composer-owned search, removal of the duplicate search field, and passage expansion states.

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

Possibly related PRs

Suggested labels: skip-branch-sync

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the changes and testing, but it omits the required risk, rollout, clinical governance, and notes sections. Add the template sections for Risk and rollout, Clinical Governance Preflight, and Notes, and complete each applicable item with explicit verification evidence.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main document viewer UI, layout, toggle, and search changes.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/optimize-layout-and-fix-toggle-bug

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 failed: dependency version conflict. Check your lock file or package.json.


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

Comment thread src/components/document-viewer/source-panels.tsx

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

ℹ️ 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/document-viewer/source-panels.tsx
@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. The only repository destination is BigSimmo/Database, and the only branch destination is the pull request head branch codex/optimize-layout-and-fix-toggle-bug at starting commit e7a204f; never publish fixes to a detached or synthetic work branch and never create a stacked pull request. Use the authenticated GitHub connector to commit each approved fix to BigSimmo/Database:codex/optimize-layout-and-fix-toggle-bug, then verify that the pull request head contains the published commit before reporting success. 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. For a fixed thread, reply with as the first line and as the second line. For a no-code disposition, use followed by . These result markers authorize the workflow to close that exact thread only after it verifies a fixed commit is the pull request head; a local-only commit is not a fix. If publication or verification fails, do not use either result marker, do not claim success, and leave the thread open with the blocker. If human input or new authorization is required, do the same. 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: e7a204f3a6

ℹ️ 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".

@BigSimmo
BigSimmo enabled auto-merge August 11, 2026 15:41

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 the document viewer’s source UI while consolidating search ownership and improving disclosure behavior.

Changes:

  • Condenses cited passages and action controls.
  • Removes duplicate indexed-text search input.
  • Improves panel state handling and accessibility coverage.

Reviewed changes

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

File Description
src/components/document-viewer/source-panels.tsx Updates source panels, controls, and reveal state.
tests/ui-smoke.spec.ts Verifies composer ownership and passage toggling.

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

Comment thread src/components/document-viewer/source-panels.tsx
@BigSimmo

Copy link
Copy Markdown
Owner Author

babysit summary

  • PR Document viewer: compact indexed-source UI, 3-button action layout, and toggle/search fixes #1818 current head: 6e48bec (pushed to origin/codex/optimize-layout-and-fix-toggle-bug).
  • Merge-state snapshot: mergeable=MERGEABLE, mergeStateStatus=BEHIND.
  • Merge-tree vs
    efs/remotes/origin/main: unresolved due unrelated histories; git merge-tree refs/remotes/origin/main 6e48bec refuses to merge histories, so no clean merge-tree was possible without --allow-unrelated-histories (which caused widespread conflicts).
  • Required threads: Codex P2 comment on src/components/document-viewer/source-panels.tsx was fixed and dispositioned with markers referencing this head.
  • Decisive local proof:
    pm run test -- tests/document-section-summary.dom.test.tsx (1 file, 9/9 passed).
  • Required checks on this tip: Build, Static PR, PR mergeability, PR policy pass; Production UI jobs + Unit coverage currently pending on run 31545180207.
  • Residual risk: mergeability is BEHIND while merge-tree is blocked by unrelated-history divergence from current origin/main history.

Merge can be resumed once CI finishes; no additional blocker introduced by this tip.

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

🤖 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 `@tests/document-section-summary.dom.test.tsx`:
- Around line 206-211: Update the rerender case for IndexedTextPanel so changing
the search query to "head" preserves the original documentSearchResults array
and order. Keep this test focused on resetting the active hit due solely to the
query change, including the interim state where new-query results remain stale.
🪄 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: c3e92102-b775-4079-98bb-c6693776c1db

📥 Commits

Reviewing files that changed from the base of the PR and between fb54b4d and 986ebcf.

📒 Files selected for processing (3)
  • src/components/document-viewer/source-panels.tsx
  • tests/document-section-summary.dom.test.tsx
  • tests/ui-smoke.spec.ts

Comment thread tests/document-section-summary.dom.test.tsx
@BigSimmo
BigSimmo merged commit 6141ce1 into main Aug 12, 2026
26 checks passed
@BigSimmo
BigSimmo deleted the codex/optimize-layout-and-fix-toggle-bug branch August 12, 2026 00:31
@BigSimmo

Copy link
Copy Markdown
Owner Author

PR summary (babysit sweep)

Snapshot

  • PR: Document viewer: compact indexed-source UI, 3-button action layout, and toggle/search fixes #1818
  • Head: 0e45f80db96c43ba25e42051b4b36636c5ab6ba3
  • Merge state: MERGEABLE / mergeStateStatus UNKNOWN (per API)
  • Merge-tree vs origin/main: clean (no conflicts)
  • Behind/behind: origin/main→HEAD (0,6) from current worktree ref
  • Required checks on this head: Gitleaks pass, PR policy pass, PR required pass
  • Local proof: npm exec vitest run tests/document-section-summary.dom.test.tsx (1 file, 9/9 passed)

Fix / disposition

  • Fixed actionable P2 item by updating tests/document-section-summary.dom.test.tsx rerender to keep documentSearchResults={props.documentSearchResults} for search-change reset coverage.
  • Resolved PR thread: PRRT_kwDOSh5Fis6YSDXt
  • Resolved PR thread: PRRT_kwDOSh5Fis6YSDvw
  • Resolved PR thread: PRRT_kwDOSh5Fis6YSRxz
  • Resolved PR thread: PRRT_kwDOSh5Fis6YajKS
  • No new CodeRabbit findings in this sweep.

Ledger

  • Reviewed scope is appended in docs/branch-review-ledger.md (latest rows include this PR with checks/proof and no actionable threads).

Remaining

  • No remaining actionable review threads.
  • Merge blocked by non-check state only; no product blockers introduced by this sweep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants