Open History to see the last commit
1import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
2import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
3import { useCallback, useEffect, useRef, useState } from "react";
4import { ActivityIndicator, Platform, View } from "react-native";
5import { useSafeAreaInsets } from "react-native-safe-area-context";
6import Svg, { Defs, LinearGradient, Rect, Stop } from "react-native-svg";
7import {
8 EnvironmentId,
9 type ProjectListEntriesResult,
10 type ProjectReadFileResult,
11 ThreadId,
12} from "@t3tools/contracts";
13
14import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
15import { SymbolView } from "../../components/AppSymbol";
16import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
17import { EmptyState } from "../../components/EmptyState";
18import { LoadingScreen } from "../../components/LoadingScreen";
19import { resolveFileSelectionNavigationAction } from "../../lib/adaptive-navigation";
20import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic";
21import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
22import { useThemeColor } from "../../lib/useThemeColor";
23import { useThreadSelection } from "../../state/use-thread-selection";
24import { useSelectedThreadWorktree } from "../../state/use-selected-thread-worktree";
25import { useEnvironmentQuery } from "../../state/query";
26import { projectEnvironment } from "../../state/projects";
27import {
28 useAdaptiveWorkspaceLayout,
29 useAdaptiveWorkspacePaneRole,
30 useRegisterWorkspaceInspector,
31} from "../layout/AdaptiveWorkspaceLayout";
32import {
33 createNativeMailSearchToolbarItem,
34 NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED,
35} from "../layout/native-mail-search-toolbar";
36import { WorkspaceSidebarToolbar } from "../layout/workspace-sidebar-toolbar";
37import { ReviewHighlighterProvider } from "../review/ReviewHighlighterProvider";
38import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
39import { ThreadRouteScreen } from "../threads/ThreadRouteScreen";
40import { FileMarkdownPreview } from "./FileMarkdownPreview";
41import { FileTreeBrowser } from "./FileTreeBrowser";
42import { preloadWorkspaceFileContents } from "./preload-workspace-file";
43import { SourceFileSurface } from "./SourceFileSurface";
44import { ThreadFileNavigatorPane } from "./thread-file-navigator-pane";
45import { WorkspaceFileImagePreview } from "./WorkspaceFileImagePreview";
46import { WorkspaceFileWebPreview } from "./WorkspaceFileWebPreview";
47import {
48 basename,
49 isBrowserPreviewFile,
50 isImagePreviewFile,
51 isMarkdownPreviewFile,
52 isSvgImagePreviewFile,
53} from "./filePath";
54import { useWorkspaceFileAssetUrl } from "./workspaceFileAssetUrl";
55
56type FileViewMode = "preview" | "source";
57
58function firstRouteParam(value: string | string[] | undefined): string | null {
59 if (Array.isArray(value)) {
60 return value[0] ?? null;
61 }
62
63 return value ?? null;
64}
65
66function normalizeRoutePath(value: string | string[] | undefined): string | null {
67 const path = Array.isArray(value) ? value.join("/") : value;
68 if (path === undefined || path.trim().length === 0) {
69 return null;
70 }
71 return path;
72}
73
74function normalizeRouteLine(value: string | null): number | null {
75 if (value === null) {
76 return null;
77 }
78 const parsed = Number(value);
79 return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
80}
81
82function defaultViewMode(path: string | null): FileViewMode {
83 return path !== null && (isBrowserPreviewFile(path) || isImagePreviewFile(path))
84 ? "preview"
85 : "source";
86}
87
88function FileContent(props: {
89 readonly activeMode: FileViewMode;
90 readonly previewUri: string | null;
91 readonly fileContents: string | null;
92 readonly fileError: string | null;
93 readonly relativePath: string;
94 readonly initialLine: number | null;
95 readonly truncated: boolean;
96 readonly onRefresh?: () => Promise<void> | void;
97}) {
98 const isMarkdown = isMarkdownPreviewFile(props.relativePath);
99 const isBrowserFile = isBrowserPreviewFile(props.relativePath);
100 const isImageFile = isImagePreviewFile(props.relativePath);
101
102 if (props.activeMode === "preview" && isImageFile) {
103 if (isSvgImagePreviewFile(props.relativePath)) {
104 return <WorkspaceFileWebPreview uri={props.previewUri} />;
105 }
106 return (
107 <WorkspaceFileImagePreview
108 accessibilityLabel={basename(props.relativePath)}
109 uri={props.previewUri}
110 />
111 );
112 }
113
114 if (props.activeMode === "preview" && isBrowserFile) {
115 return <WorkspaceFileWebPreview uri={props.previewUri} />;
116 }
117
118 if (props.fileError && props.fileContents === null) {
119 return (
120 <View className="flex-1 items-center justify-center bg-sheet px-6">
121 <EmptyState title="File unavailable" detail={props.fileError} />
122 </View>
123 );
124 }
125
126 if (props.fileContents === null) {
127 return (
128 <View className="flex-1 items-center justify-center gap-3 bg-sheet px-6">
129 <ActivityIndicator />
130 <Text className="text-center text-sm text-foreground-muted">Loading file...</Text>
131 </View>
132 );
133 }
134
135 return (
136 <View className="flex-1 bg-sheet">
137 {props.truncated ? (
138 <View className="border-b border-amber-200 bg-amber-50 px-4 py-2 dark:border-amber-900/60 dark:bg-amber-950/40">
139 <Text className="text-2xs font-t3-bold uppercase text-amber-700 dark:text-amber-300">
140 Partial file
141 </Text>
142 <Text className="text-xs leading-snug text-amber-800 dark:text-amber-200">
143 Preview limited to the first 1 MB of a truncated file.
144 </Text>
145 </View>
146 ) : null}
147 {props.activeMode === "preview" && isMarkdown ? (
148 <FileMarkdownPreview markdown={props.fileContents} onRefresh={props.onRefresh} />
149 ) : (
150 <SourceFileSurface
151 contents={props.fileContents}
152 path={props.relativePath}
153 initialLine={props.initialLine}
154 onRefresh={props.onRefresh}
155 />
156 )}
157 </View>
158 );
159}
160
161type ThreadFilesRouteScreenProps = StaticScreenProps<{
162 readonly environmentId: string;
163 readonly threadId: string;
164}>;
165
166type ThreadFileRouteScreenProps = StaticScreenProps<{
167 readonly environmentId: string;
168 readonly threadId: string;
169 readonly path: string[];
170 readonly line?: string;
171}>;
172
173function useThreadFilesWorkspace(params: {
174 readonly environmentId?: string | string[];
175 readonly threadId?: string | string[];
176}) {
177 const routeEnvironmentId = firstRouteParam(params.environmentId);
178 const routeThreadId = firstRouteParam(params.threadId);
179 const { selectedThread, selectedThreadProject } = useThreadSelection();
180 const { selectedThreadCwd } = useSelectedThreadWorktree();
181 const environmentId =
182 routeEnvironmentId !== null
183 ? EnvironmentId.make(routeEnvironmentId)
184 : (selectedThread?.environmentId ?? null);
185 const threadId = routeThreadId !== null ? ThreadId.make(routeThreadId) : null;
186 const project = selectedThreadProject as {
187 readonly title?: string;
188 readonly workspaceRoot?: string;
189 } | null;
190
191 return {
192 cwd: selectedThreadCwd ?? project?.workspaceRoot ?? null,
193 environmentId,
194 projectName: project?.title ?? "Files",
195 selectedThread,
196 threadId,
197 };
198}
199
200function FilesUnavailable() {
201 return (
202 <View className="flex-1 items-center justify-center bg-sheet px-6">
203 <NativeStackScreenOptions options={{ title: "Files" }} />
204 <EmptyState
205 title="Files unavailable"
206 detail="This thread does not have an active workspace path."
207 />
208 </View>
209 );
210}
211
212function FilesToolbarBottomFade() {
213 const sheetColor = String(useThemeColor("--color-sheet"));
214
215 if (process.env.EXPO_OS !== "ios") {
216 return null;
217 }
218
219 return (
220 <View
221 pointerEvents="none"
222 accessibilityElementsHidden
223 importantForAccessibility="no-hide-descendants"
224 className="absolute inset-x-0 bottom-0 z-[1] h-28"
225 >
226 <Svg width="100%" height="100%">
227 <Defs>
228 <LinearGradient id="files-toolbar-bottom-fade" x1="0%" x2="0%" y1="0%" y2="100%">
229 <Stop offset="0%" stopColor={sheetColor} stopOpacity={0} />
230 <Stop offset="58%" stopColor={sheetColor} stopOpacity={0.72} />
231 <Stop offset="100%" stopColor={sheetColor} stopOpacity={0.96} />
232 </LinearGradient>
233 </Defs>
234 <Rect width="100%" height="100%" fill="url(#files-toolbar-bottom-fade)" />
235 </Svg>
236 </View>
237 );
238}
239
240export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
241 useAdaptiveWorkspacePaneRole("inspector");
242 const navigation = useNavigation();
243 const { fileInspector, layout, panes, showAuxiliaryPane, togglePrimarySidebar } =
244 useAdaptiveWorkspaceLayout();
245 const [searchQuery, setSearchQuery] = useState("");
246 const isAndroid = Platform.OS === "android";
247 const { themeAppearance: highlightTheme } = useAppearancePreferences();
248 const iconColor = String(useThemeColor("--color-icon-muted"));
249 const sheetSurfaceColor = String(useThemeColor("--color-sheet-solid"));
250 const { cwd, environmentId, projectName, selectedThread, threadId } = useThreadFilesWorkspace(
251 props.route.params,
252 );
253 const revealedInspectorRef = useRef(false);
254 const entriesQuery = useEnvironmentQuery(
255 environmentId !== null && cwd !== null && !fileInspector.supported
256 ? projectEnvironment.listEntries({
257 environmentId,
258 input: { cwd },
259 })
260 : null,
261 );
262 const entriesData = entriesQuery.data as ProjectListEntriesResult | null;
263 const handleReturnToThread = useCallback(() => {
264 if (navigation.canGoBack()) {
265 navigation.goBack();
266 return;
267 }
268 if (environmentId !== null && threadId !== null) {
269 navigation.dispatch(
270 StackActions.replace("Thread", {
271 environmentId: String(environmentId),
272 threadId: String(threadId),
273 }),
274 );
275 }
276 }, [environmentId, navigation, threadId]);
277
278 const handleSelectFile = useCallback(
279 (path: string) => {
280 if (environmentId === null || threadId === null) {
281 return;
282 }
283 const params = {
284 environmentId: String(environmentId),
285 threadId: String(threadId),
286 path: path.split("/").filter((segment) => segment.length > 0),
287 };
288 const navigationAction = resolveFileSelectionNavigationAction({
289 hasPersistentFileInspector: fileInspector.supported,
290 });
291 if (navigationAction === "replace") {
292 navigation.dispatch(StackActions.replace("ThreadFile", params));
293 return;
294 }
295 navigation.navigate("ThreadFile", params);
296 },
297 [environmentId, fileInspector.supported, navigation, threadId],
298 );
299 const renderInspector = useCallback(
300 (headerInset: number) =>
301 environmentId !== null && cwd !== null ? (
302 <ThreadFileNavigatorPane
303 cwd={cwd}
304 environmentId={environmentId}
305 headerInset={headerInset}
306 projectName={projectName}
307 selectedPath={null}
308 onSelectFile={handleSelectFile}
309 />
310 ) : null,
311 [cwd, environmentId, handleSelectFile, projectName],
312 );
313 const handlePreviewFile = useCallback(
314 (relativePath: string) => {
315 if (environmentId === null || cwd === null) {
316 return;
317 }
318 preloadWorkspaceFileContents({
319 cwd,
320 environmentId,
321 relativePath,
322 theme: highlightTheme,
323 });
324 },
325 [cwd, environmentId, highlightTheme],
326 );
327 useEffect(() => {
328 if (fileInspector.supported && cwd !== null && !revealedInspectorRef.current) {
329 revealedInspectorRef.current = true;
330 showAuxiliaryPane("inspector");
331 }
332 }, [cwd, fileInspector.supported, showAuxiliaryPane]);
333
334 if (selectedThread === null || environmentId === null || threadId === null) {
335 if (fileInspector.supported) {
336 return (
337 <ThreadRouteScreen
338 onReturnToThread={handleReturnToThread}
339 renderInspector={renderInspector}
340 route={props.route}
341 />
342 );
343 }
344 return <LoadingScreen message="Opening files..." messagePlacement="above-spinner" />;
345 }
346
347 if (cwd === null) {
348 return <FilesUnavailable />;
349 }
350
351 if (fileInspector.supported) {
352 return (
353 <ThreadRouteScreen
354 onReturnToThread={handleReturnToThread}
355 renderInspector={renderInspector}
356 route={props.route}
357 />
358 );
359 }
360
361 const usesCompactMailToolbar =
362 Platform.OS === "ios" && !layout.usesSplitView && NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED;
363
364 return (
365 <>
366 {/* Static header config (glass preset and title) lives in Stack.tsx. The
367 live sheet color stays dynamic here so the FlatList can remain the
368 direct scene child for native scroll-edge sampling. */}
369 <NativeStackScreenOptions
370 options={{
371 contentStyle: { backgroundColor: sheetSurfaceColor },
372 headerShown: !isAndroid,
373 unstable_headerSubtitle:
374 Platform.OS === "ios" && projectName.length > 0 ? projectName : undefined,
375 // No refresh button: the list already supports pull-to-refresh.
376 unstable_headerToolbarItems: usesCompactMailToolbar
377 ? () => [
378 createNativeMailSearchToolbarItem({
379 onSearchTextChange: setSearchQuery,
380 placeholder: "Search files",
381 searchTextChangeId: "files-search-text",
382 }),
383 ]
384 : undefined,
385 headerSearchBarOptions: usesCompactMailToolbar
386 ? undefined
387 : {
388 allowToolbarIntegration: true,
389 autoCapitalize: "none",
390 hideNavigationBar: false,
391 placeholder: "Search files",
392 onChangeText: (event) => {
393 setSearchQuery(event.nativeEvent.text);
394 },
395 onCancelButtonPress: () => {
396 setSearchQuery("");
397 },
398 },
399 }}
400 />
401 {isAndroid ? (
402 <>
403 <AndroidScreenHeader
404 title="Files"
405 subtitle={projectName}
406 onBack={handleReturnToThread}
407 actions={[
408 {
409 accessibilityLabel: "Refresh files",
410 icon: "arrow.clockwise",
411 onPress: entriesQuery.refresh,
412 },
413 ]}
414 />
415 <View className="flex-row items-center gap-2 border-b border-border px-3 py-2">
416 <SymbolView name="magnifyingglass" size={17} tintColor={iconColor} type="monochrome" />
417 <TextInput
418 accessibilityLabel="Search files"
419 autoCapitalize="none"
420 autoCorrect={false}
421 className="min-h-10 flex-1 rounded-xl py-2 text-sm"
422 placeholder="Search files"
423 value={searchQuery}
424 onChangeText={setSearchQuery}
425 />
426 </View>
427 </>
428 ) : (
429 <>
430 {layout.usesSplitView ? (
431 <NativeHeaderToolbar placement="left">
432 <NativeHeaderToolbar.Button
433 accessibilityLabel={panes.primarySidebarVisible ? "Maximize files" : "Show threads"}
434 icon={
435 panes.primarySidebarVisible
436 ? "arrow.up.left.and.arrow.down.right"
437 : "sidebar.left"
438 }
439 onPress={togglePrimarySidebar}
440 separateBackground
441 />
442 </NativeHeaderToolbar>
443 ) : null}
444 {usesCompactMailToolbar ? null : (
445 <NativeHeaderToolbar placement="bottom">
446 <NativeHeaderToolbar.SearchBarSlot />
447 </NativeHeaderToolbar>
448 )}
449 </>
450 )}
451 <FileTreeBrowser
452 entries={entriesData?.entries ?? []}
453 error={entriesQuery.error}
454 isPending={entriesQuery.isPending}
455 searchQuery={searchQuery}
456 selectedPath={null}
457 onPreviewFile={handlePreviewFile}
458 onRefresh={entriesQuery.refresh}
459 onSelectFile={handleSelectFile}
460 />
461 <FilesToolbarBottomFade />
462 </>
463 );
464}
465
466export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
467 useAdaptiveWorkspacePaneRole("inspector");
468 const navigation = useNavigation();
469 const { fileInspector, panes, toggleAuxiliaryPane } = useAdaptiveWorkspaceLayout();
470 const iconColor = useThemeColor("--color-icon");
471 const params = props.route.params;
472 const relativePath = normalizeRoutePath(params.path);
473 const targetLine = normalizeRouteLine(firstRouteParam(params.line));
474 const { cwd, environmentId, projectName, selectedThread, threadId } = useThreadFilesWorkspace(
475 props.route.params,
476 );
477 const [modeOverride, setModeOverride] = useState<{
478 readonly path: string;
479 readonly mode: FileViewMode;
480 } | null>(null);
481 const [previewRevision, setPreviewRevision] = useState(0);
482 const isBrowserFile = relativePath !== null && isBrowserPreviewFile(relativePath);
483 const isImageFile = relativePath !== null && isImagePreviewFile(relativePath);
484 const canPreview =
485 relativePath !== null && (isMarkdownPreviewFile(relativePath) || isBrowserFile || isImageFile);
486 const activeMode =
487 relativePath !== null && modeOverride?.path === relativePath
488 ? modeOverride.mode
489 : defaultViewMode(relativePath);
490 const resolvedActiveMode = canPreview ? activeMode : "source";
491 const assetPreviewPath = isBrowserFile || isImageFile ? relativePath : null;
492 const assetPreviewUri = useWorkspaceFileAssetUrl({
493 cwd,
494 environmentId,
495 relativePath: assetPreviewPath,
496 threadId,
497 });
498 const previewUri =
499 assetPreviewUri === null || previewRevision === 0
500 ? assetPreviewUri
501 : `${assetPreviewUri}${assetPreviewUri.includes("?") ? "&" : "?"}revision=${previewRevision}`;
502 const needsFileContents =
503 relativePath !== null &&
504 (resolvedActiveMode === "source" || isMarkdownPreviewFile(relativePath));
505 const fileQuery = useEnvironmentQuery(
506 environmentId !== null && cwd !== null && relativePath !== null && needsFileContents
507 ? projectEnvironment.readFile({
508 environmentId,
509 input: { cwd, relativePath },
510 })
511 : null,
512 );
513 const fileData = fileQuery.data as ProjectReadFileResult | null;
514
515 const handleSelectFile = useCallback(
516 (path: string) => {
517 navigation.navigate("ThreadFile", {
518 environmentId: String(environmentId),
519 threadId: String(threadId),
520 path: path.split("/").filter(Boolean),
521 });
522 },
523 [environmentId, navigation, threadId],
524 );
525 const renderInspector = useCallback(
526 (headerInset: number) =>
527 fileInspector.supported && environmentId !== null && cwd !== null ? (
528 <ThreadFileNavigatorPane
529 cwd={cwd}
530 environmentId={environmentId}
531 headerInset={headerInset}
532 projectName={projectName}
533 selectedPath={relativePath}
534 onSelectFile={handleSelectFile}
535 />
536 ) : undefined,
537 [cwd, environmentId, fileInspector.supported, handleSelectFile, projectName, relativePath],
538 );
539 // The workspace inspector column spans the full window height. On iOS the
540 // pane brings its own nested native header; elsewhere it pads itself below
541 // the top inset.
542 const safeAreaInsets = useSafeAreaInsets();
543 const inspectorHeaderInset = Platform.OS === "ios" ? 0 : safeAreaInsets.top;
544 // Hand the file navigator to the workspace so it renders beside the
545 // navigator, outside this screen's native header.
546 const renderWorkspaceInspector = useCallback(
547 () => renderInspector(inspectorHeaderInset),
548 [inspectorHeaderInset, renderInspector],
549 );
550 useRegisterWorkspaceInspector(fileInspector.supported ? renderWorkspaceInspector : undefined);
551
552 if (selectedThread === null || environmentId === null || threadId === null) {
553 return <LoadingScreen message="Opening file..." messagePlacement="above-spinner" />;
554 }
555
556 if (cwd === null) {
557 return <FilesUnavailable />;
558 }
559
560 if (relativePath === null) {
561 return (
562 <View className="flex-1 items-center justify-center bg-sheet px-6">
563 <NativeStackScreenOptions options={{ title: "Files" }} />
564 <EmptyState title="File unavailable" detail="This file path is invalid." />
565 </View>
566 );
567 }
568
569 const parentDir = relativePath.split("/").slice(0, -1).join("/");
570 const headerSubtitle = [projectName, parentDir].filter(Boolean).join(" · ");
571
572 return (
573 <ReviewHighlighterProvider>
574 <View className="flex-1 bg-sheet">
575 <NativeStackScreenOptions
576 options={{
577 // Static header config lives in Stack.tsx (SOLID_HEADER_OPTIONS: solid
578 // sheet-colored header — this route's content scrolls internally, so
579 // there is nothing for glass to sample). Only dynamic values here.
580 headerTintColor: iconColor,
581 headerTitle: basename(relativePath),
582 title: basename(relativePath),
583 unstable_headerSubtitle:
584 Platform.OS === "ios" && headerSubtitle.length > 0 ? headerSubtitle : undefined,
585 }}
586 />
587 <WorkspaceSidebarToolbar>
588 {fileInspector.supported ? (
589 <NativeHeaderToolbar.Button
590 accessibilityLabel="Return to chat"
591 icon="chevron.left"
592 onPress={() => {
593 navigation.dispatch(
594 StackActions.replace("Thread", {
595 environmentId: String(environmentId),
596 threadId: String(threadId),
597 }),
598 );
599 }}
600 />
601 ) : null}
602 </WorkspaceSidebarToolbar>
603 <NativeHeaderToolbar placement="right">
604 {fileInspector.supported ? (
605 <NativeHeaderToolbar.Button
606 accessibilityLabel={
607 panes.auxiliaryPaneVisible ? "Hide file navigator" : "Show file navigator"
608 }
609 icon="sidebar.right"
610 onPress={toggleAuxiliaryPane}
611 separateBackground
612 />
613 ) : null}
614 <NativeHeaderToolbar.Menu accessibilityLabel="File actions" icon="ellipsis">
615 {canPreview && !isImageFile ? (
616 <NativeHeaderToolbar.Menu inline>
617 <NativeHeaderToolbar.MenuAction
618 icon="eye"
619 isOn={resolvedActiveMode === "preview"}
620 onPress={() => setModeOverride({ path: relativePath, mode: "preview" })}
621 >
622 Preview
623 </NativeHeaderToolbar.MenuAction>
624 <NativeHeaderToolbar.MenuAction
625 icon="doc.text"
626 isOn={resolvedActiveMode === "source"}
627 onPress={() => setModeOverride({ path: relativePath, mode: "source" })}
628 >
629 Source
630 </NativeHeaderToolbar.MenuAction>
631 </NativeHeaderToolbar.Menu>
632 ) : null}
633 <NativeHeaderToolbar.MenuAction
634 icon="doc.on.doc"
635 onPress={() => copyTextWithHaptic(relativePath)}
636 >
637 Copy path
638 </NativeHeaderToolbar.MenuAction>
639 {isBrowserFile && typeof assetPreviewUri === "string" ? (
640 <NativeHeaderToolbar.MenuAction
641 icon="safari"
642 onPress={() => {
643 void tryOpenExternalUrl(assetPreviewUri, "file-preview");
644 }}
645 >
646 Open in Safari
647 </NativeHeaderToolbar.MenuAction>
648 ) : null}
649 {resolvedActiveMode === "preview" && (isBrowserFile || isImageFile) ? (
650 <NativeHeaderToolbar.MenuAction
651 icon="arrow.clockwise"
652 onPress={() => {
653 setPreviewRevision((current) => current + 1);
654 }}
655 >
656 Refresh
657 </NativeHeaderToolbar.MenuAction>
658 ) : null}
659 </NativeHeaderToolbar.Menu>
660 </NativeHeaderToolbar>
661 <FileContent
662 activeMode={resolvedActiveMode}
663 previewUri={previewUri}
664 fileContents={fileData?.contents ?? null}
665 fileError={fileQuery.error}
666 initialLine={targetLine}
667 relativePath={relativePath}
668 truncated={fileData?.truncated ?? false}
669 onRefresh={() => fileQuery.refresh()}
670 />
671 </View>
672 </ReviewHighlighterProvider>
673 );
674}