Skip to content

Compact document-viewer redesign: dedup chrome, honest cards, tighter PDF surface#509

Merged
BigSimmo merged 2 commits into
mainfrom
claude/document-viewer-design-review-4fc027
Jul 12, 2026
Merged

Compact document-viewer redesign: dedup chrome, honest cards, tighter PDF surface#509
BigSimmo merged 2 commits into
mainfrom
claude/document-viewer-design-review-4fc027

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

Implements a 20-point design review of the document viewer (src/components/DocumentViewer.tsx). All changes are isolated to that one file.

Navigation chrome

  • Removed the viewer's redundant Answer | Documents toggle and the ‹ Documents breadcrumb (the universal shell header already owns mode-switching). Header is now back-arrow + document title (h1) + scope + actions.
  • Mobile back button uses ArrowLeft on both breakpoints (was a Menu hamburger that sat under the shell's real hamburger).

Overview cards

  • Removed misleading right-chevrons that implied tappable/expandable cards.
  • Replaced the fake wireframe page thumbnails with real "Page N" jump chips (?page=N#pdf-preview-section).
  • De-duplicated the overview text (header teaser + the full structured profile in the rail, shown once).
  • Derived the type eyebrow via documentTypeEyebrow() instead of hardcoding "Clinical guideline".
  • Fixed uneven card heights (lg:items-stretchlg:items-start).

Actions

  • Rebalanced the landing action row to grid-cols-2 sm:grid-cols-4 (no orphaned button).
  • "Scope" → "Add to scope".

PDF surface

  • Toolbar collapsed to a single flex row; page indicator no longer stretches full-width.
  • Replaced the always-on helper paragraph + "canvas/browser" jargon with a "Sharper zoom" / "Standard view" toggle + tooltip.
  • Reduced reserved empty min-height under short pages.

Evidence, tables, layout

  • Empty pinned-evidence de-emphasised to a slim muted line.
  • Extracted table now leads; the raw table image collapses behind a "Show source image" disclosure when a structured table exists.
  • Summary rail flows with the page (removed nested sticky/max-h/overflow-y-auto), which also clears the composer overlap.

Verification

  • tsc --noEmit ✅, eslint ✅, prettier --check
  • The 7 tests/ui-smoke.spec.ts document-viewer tests pass (incl. @critical).
  • Re-screenshotted desktop + mobile + populated-evidence; verified the "Page N" chip actually jumps the PDF.
  • Preserves test invariants: h1 title, pinned-source-evidence/pdf-toolbar testids, viewer-nav anchors, fullscreen/"Answer from this" labels, static-on-mobile toolbar.

🤖 Generated with Claude Code

… PDF surface

Addresses a 20-point design review of the document viewer:

- Nav chrome: drop the redundant Answer|Documents toggle and the
  ‹Documents breadcrumb; header is now back-arrow + document <h1> title
  + scope + actions. Mobile back uses ArrowLeft (was a Menu hamburger).
- Overview cards: remove misleading chevrons; replace the fake wireframe
  page thumbnails with real "Page N" jump chips; de-dup the overview into
  a single header teaser; derive the type eyebrow instead of hardcoding
  "Clinical guideline"; fix uneven card heights.
- Actions: rebalance to a clean grid-cols-2 sm:grid-cols-4 row; relabel
  "Scope" to "Add to scope".
- PDF surface: collapse the toolbar to one row; stop the page indicator
  stretching full-width; replace the always-on helper paragraph and
  canvas/browser jargon with a "Sharper zoom"/"Standard view" toggle +
  tooltip; reduce reserved empty min-height.
- Evidence/tables/layout: de-emphasise the empty pinned-evidence state;
  let the extracted table lead with the raw image behind a "Show source
  image" disclosure; let the summary rail flow with the page (drop the
  nested sticky/overflow scroll), which also clears the composer overlap.

Preserves test invariants (h1 title, pinned-source-evidence/pdf-toolbar
testids, viewer-nav anchors, fullscreen/Answer labels, static mobile
toolbar). tsc/eslint/prettier clean; ui-smoke document-viewer suite green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@supabase

supabase Bot commented Jul 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 Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

DocumentViewer updates image/table presentation, document overview content and actions, PDF controls, header labels, and responsive layout behavior.

Changes

Document Viewer

Layer / File(s) Summary
Document image and evidence rendering
src/components/AccessibleTable.tsx, src/components/DocumentViewer.tsx
Renderable table detection, structured content presentation, shared image rendering, and compact empty pinned evidence were updated.
PDF viewer controls and responsive canvas
src/components/DocumentViewer.tsx
PDF toolbar controls, fullscreen styling, canvas sizing, and standard/sharper rendering mode labels were revised.
Document overview content and actions
src/components/DocumentViewer.tsx
Overview type labels, conditional text, useful-page links, and scope/question actions were updated.
Viewer shell labels and layout
src/components/DocumentViewer.tsx
Header and mobile action labels, navigation markup, and right-side layout classes were adjusted.

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


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 2 warnings)

Check name Status Explanation Resolution
Verification Claims ❌ Error The PR note claims TypeScript/ESLint/Prettier and smoke tests passed, but it doesn’t give exact run commands/results. Rewrite verification claims as exact commands with outcomes (e.g. Ran npm run ...: passed) or explicitly mark Not run: reason.
Description check ⚠️ Warning The description is detailed, but it omits the required Clinical Governance Preflight and Notes sections from the template. Add the missing Clinical Governance Preflight section and a Notes section, and complete any required checkboxes relevant to source rendering and clinical viewer behavior.
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 70.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (8 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the PR’s main document-viewer redesign and stays specific and concise.
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.
Generated And Sensitive Files ✅ Passed Only two source TSX files changed; diff shows UI/helper code only, with no committed secrets or generated/artifact files found.
Risky Git Or Deployment Actions ✅ Passed PR only changes two TSX UI files; no new force-push/reset/deploy/destructive instructions appear in the touched files.
Supabase Project And Schema Safety ✅ Passed Only src/components/DocumentViewer.tsx and AccessibleTable.tsx changed; no Supabase config, migrations, RLS, or schema files were touched.
Runtime And Package Manager Integrity ✅ Passed Only src/components/DocumentViewer.tsx and AccessibleTable.tsx changed; package.json, lockfile, .npmrc, and Node version files were untouched, so workflow integrity is preserved.
Api Route Failure Handling ✅ Passed Only UI/table-rendering code changed; no API route, server action, RAG/search/ingestion, or provider integration logic was modified.
✨ 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/document-viewer-design-review-4fc027
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/document-viewer-design-review-4fc027

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

coderabbitai[bot]
coderabbitai Bot previously requested changes Jul 11, 2026

@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 `@src/components/DocumentViewer.tsx`:
- Around line 519-555: The structured-table rendering must pass imageBlock as
lowConfidenceFallback to AccessibleTable so low-confidence tables keep the
source image visible. Also update the hasStructuredTable condition to require
usable table data—rows or markdown, not columns alone—or otherwise route to the
existing image branch, preventing an empty caption and collapsed source image.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 00b598ef-5ead-439c-b174-06d97766f0c9

📥 Commits

Reviewing files that changed from the base of the PR and between 9f384d5 and 52e4707.

📒 Files selected for processing (1)
  • src/components/DocumentViewer.tsx

Comment thread src/components/DocumentViewer.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: 52e4707c50

ℹ️ 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/DocumentViewer.tsx
Addresses CodeRabbit/Codex review on #509: the table-leads branch collapsed
the source image behind a disclosure whenever any table metadata was present,
but AccessibleTable renders nothing for columns-only input or unparseable
markdown — leaving an empty caption above a hidden image.

- Add exported hasRenderableAccessibleTable() mirroring AccessibleTable's own
  parse+normalize so the layout decision can't diverge from what it renders;
  columns-only / unparseable-markdown tables now route to the image-first branch.
- Pass the source image as lowConfidenceFallback so a table that normalizes but
  can't be confidently reconstructed shows the image inline instead of a
  misleading grid.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@BigSimmo
BigSimmo dismissed coderabbitai[bot]’s stale review July 12, 2026 15:23

Finding addressed in a82f7c3 (hasRenderableAccessibleTable() drives the table-leads branch; source image kept via lowConfidenceFallback). Both review threads resolved and CI is green.

@BigSimmo
BigSimmo merged commit 2e7f373 into main Jul 12, 2026
17 checks passed
@BigSimmo
BigSimmo deleted the claude/document-viewer-design-review-4fc027 branch July 13, 2026 16:35
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.

1 participant