From 9130c8b15a22dbbc965464a247ae930c04f2da62 Mon Sep 17 00:00:00 2001 From: BigSimmo <87357024+BigSimmo@users.noreply.github.com> Date: Sat, 11 Jul 2026 10:50:01 +0800 Subject: [PATCH 1/7] redesign(documents): document-first viewer with sticky evidence rail - Desktop: widen evidence rail 420->480px, make it sticky with internal scroll; widen page container to 1440px and centre the document column; hero info cards flow 3-up. - Tablet (md): deliberate layout instead of the phone stack - full-width PDF, evidence + indexed text 2-up, details/summary 2-up. - Phone: document-first order (anchors, PDF, evidence, collapsible text). - Remove the Index health block and duplicated actions (preview-toolbar Open/Download, per-chunk Open source); keep the Canvas/Browser toggle as a single quiet control. - Fix latent shell bug: overflow-x-hidden on #main-content made it the sticky scrollport while the window scrolls, disabling every sticky descendant on sm+; use overflow-x-clip there instead. - Update ui-smoke ordering assertions for the document-first phone flow. Co-Authored-By: Claude Fable 5 --- src/components/DocumentViewer.tsx | 188 ++++++------------ .../global-mockup-search-shell.tsx | 6 +- tests/ui-smoke.spec.ts | 6 +- 3 files changed, 64 insertions(+), 136 deletions(-) diff --git a/src/components/DocumentViewer.tsx b/src/components/DocumentViewer.tsx index d996899da2..21a068d85e 100644 --- a/src/components/DocumentViewer.tsx +++ b/src/components/DocumentViewer.tsx @@ -151,13 +151,6 @@ type DocumentSearchResult = { score: number; }; -type DocumentIndexHealth = { - extractionQuality?: string | null; - indexedAt?: string | null; - indexVersion?: string | null; - warnings?: unknown; -}; - const profileSectionLabels: Array<{ key: keyof Omit; label: string; @@ -542,8 +535,8 @@ function DocumentViewerAnchors({ className?: string; }) { const anchors = [ - { label: "Evidence", href: evidenceHref, icon: Quote }, { label: "PDF", href: "#pdf-preview-section", icon: FileText }, + { label: "Evidence", href: evidenceHref, icon: Quote }, { label: "Text", href: textHref, icon: Search }, { label: "Summary", href: "#source-summary", icon: Sparkles }, { label: "Images", href: "#source-images", icon: FileImage }, @@ -1033,12 +1026,6 @@ function IndexedTextPanel({ compact /> )} -
- - - Open source - -
)) @@ -1764,16 +1751,16 @@ function DocumentOverviewLanding({ const documentType = compactDocumentType(document); return ( -
+
Documents -
+
(null); const [loadingSummary, setLoadingSummary] = useState(false); const [summaryError, setSummaryError] = useState(null); - const [indexHealth, setIndexHealth] = useState(null); const [previewAttempt, setPreviewAttempt] = useState(0); const [sourceSearch, setSourceSearch] = useState(""); const [documentSearchResults, setDocumentSearchResults] = useState([]); @@ -2133,14 +2119,12 @@ export function DocumentViewer({ setImages(detail.images ?? []); setTableFacts(detail.tableFacts ?? []); setChunks(detail.chunks ?? []); - setIndexHealth(detail.indexHealth ?? null); } else { setDocument(null); setPages([]); setImages([]); setTableFacts([]); setChunks([]); - setIndexHealth(null); const message = detailResult.reason instanceof Error ? detailResult.reason.message : "Document could not be loaded."; if (!canUsePrivateApis && !clientDemoMode && message === "Document not found.") { @@ -2409,7 +2393,7 @@ export function DocumentViewer({ className={cn(appBackdrop, "min-h-[100dvh] overflow-x-clip text-[color:var(--text)] focus:outline-none")} >
-
+
) : null} -
+
{(summary || summaryError) && (
{summary && ( @@ -2619,49 +2603,8 @@ export function DocumentViewer({
) : null} -
-
- - -
- -
- - - - - - - Indexed page text - - {effectiveLoadingDocument - ? "Loading indexed page text" - : `Page ${selectedPage?.page_number ?? initialPage} extracted text`} - - - - - -
- -
-
+
+
@@ -2728,7 +2671,10 @@ export function DocumentViewer({
) : signedUrl && document?.file_type === "application/pdf" ? ( <> -
+
+

+ Browser PDF mode keeps heavy-zoom pages crisp and is recommended when zoom quality looks soft. +

- - - Open PDF - Open original PDF - - {downloadSignedUrl ? ( - - - Download - Download PDF - - ) : null}
-

- Browser PDF mode keeps heavy-zoom pages crisp and is recommended when zoom quality looks soft. -

{useNativePdfViewer ? ( ) : ( @@ -2792,6 +2712,47 @@ export function DocumentViewer({
+
+ +
+ + + + + + + Indexed page text + + {effectiveLoadingDocument + ? "Loading indexed page text" + : `Page ${selectedPage?.page_number ?? initialPage} extracted text`} + + + + + +
+ +
+
+
+
-
{document ? ( @@ -2947,7 +2871,7 @@ export function DocumentViewer({
) : null} -
+