From a879c65258d967945bbca47899b76d0d5d0444c7 Mon Sep 17 00:00:00 2001
From: BigSimmo <87357024+BigSimmo@users.noreply.github.com>
Date: Mon, 29 Jun 2026 11:21:33 +0800
Subject: [PATCH] feat: improve document viewer section navigation
---
src/components/DocumentViewer.tsx | 52 +++++++++++++++++++++----------
tests/ui-smoke.spec.ts | 5 +++
2 files changed, 40 insertions(+), 17 deletions(-)
diff --git a/src/components/DocumentViewer.tsx b/src/components/DocumentViewer.tsx
index b833d00509..7cfeed9833 100644
--- a/src/components/DocumentViewer.tsx
+++ b/src/components/DocumentViewer.tsx
@@ -474,16 +474,19 @@ function TableReviewPanel({
function DocumentViewerAnchors({
evidenceHref,
+ textHref,
className,
}: {
evidenceHref: "#source-evidence" | "#source-evidence-rail";
+ textHref: "#source-text-mobile" | "#source-text-desktop";
className?: string;
}) {
const anchors = [
- { label: "Evidence", href: evidenceHref },
- { label: "PDF", href: "#pdf-preview-section" },
- { label: "Summary", href: "#source-summary" },
- { label: "Images", href: "#source-images" },
+ { label: "Evidence", href: evidenceHref, icon: Quote },
+ { label: "PDF", href: "#pdf-preview-section", icon: FileText },
+ { label: "Text", href: textHref, icon: Search },
+ { label: "Summary", href: "#source-summary", icon: Sparkles },
+ { label: "Images", href: "#source-images", icon: FileImage },
];
return (
@@ -491,15 +494,19 @@ function DocumentViewerAnchors({
aria-label="Document viewer sections"
className={cn("flex gap-2 overflow-x-auto pb-1 polished-scroll", className)}
>
- {anchors.map((anchor) => (
-
- {anchor.label}
-
- ))}
+ {anchors.map((anchor) => {
+ const Icon = anchor.icon;
+ return (
+
+
+ {anchor.label}
+
+ );
+ })}
);
}
@@ -744,6 +751,7 @@ function IndexedTextPanel({
searchingDocument,
documentSearchError,
idPrefix,
+ sectionId,
selectedChunkId,
onSearchChange,
}: {
@@ -755,6 +763,7 @@ function IndexedTextPanel({
searchingDocument: boolean;
documentSearchError: string | null;
idPrefix: string;
+ sectionId?: "source-text-mobile" | "source-text-desktop";
selectedChunkId?: string;
onSearchChange: (value: string) => void;
}) {
@@ -804,7 +813,11 @@ function IndexedTextPanel({
}
return (
-
+
-
+
@@ -2475,6 +2488,7 @@ export function DocumentViewer({
searchingDocument={searchingDocument}
documentSearchError={documentSearchError}
idPrefix="desktop-chunk"
+ sectionId="source-text-desktop"
selectedChunkId={chunkId}
onSearchChange={setSourceSearch}
/>
@@ -2483,7 +2497,11 @@ export function DocumentViewer({