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 { useUniwindTheme } from "../../lib/useUniwindTheme";
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-adaptive-amber-200-900-a60 bg-adaptive-amber-50-950-a40 px-4 py-2">
139 <Text className="text-2xs font-t3-bold uppercase text-adaptive-amber-700-300">
140 Partial file
141 </Text>
142 <Text className="text-xs leading-snug text-adaptive-amber-800-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(useUniwindTheme()["--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 theme = useUniwindTheme();
249 const sheetSurfaceColor = theme["--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
417 name="magnifyingglass"
418 size={17}
419 tintColorClassName={"accent-icon-muted"}
420 type="monochrome"
421 />
422 <TextInput
423 accessibilityLabel="Search files"
424 autoCapitalize="none"
425 autoCorrect={false}
426 className="min-h-10 flex-1 rounded-xl py-2 text-sm"
427 placeholder="Search files"
428 value={searchQuery}
429 onChangeText={setSearchQuery}
430 />
431 </View>
432 </>
433 ) : (
434 <>
435 {layout.usesSplitView ? (
436 <NativeHeaderToolbar placement="left">
437 <NativeHeaderToolbar.Button
438 accessibilityLabel={panes.primarySidebarVisible ? "Maximize files" : "Show threads"}
439 icon={
440 panes.primarySidebarVisible
441 ? "arrow.up.left.and.arrow.down.right"
442 : "sidebar.left"
443 }
444 onPress={togglePrimarySidebar}
445 separateBackground
446 />
447 </NativeHeaderToolbar>
448 ) : null}
449 {usesCompactMailToolbar ? null : (
450 <NativeHeaderToolbar placement="bottom">
451 <NativeHeaderToolbar.SearchBarSlot />
452 </NativeHeaderToolbar>
453 )}
454 </>
455 )}
456 <FileTreeBrowser
457 entries={entriesData?.entries ?? []}
458 error={entriesQuery.error}
459 isPending={entriesQuery.isPending}
460 searchQuery={searchQuery}
461 selectedPath={null}
462 onPreviewFile={handlePreviewFile}
463 onRefresh={entriesQuery.refresh}
464 onSelectFile={handleSelectFile}
465 />
466 <FilesToolbarBottomFade />
467 </>
468 );
469}
470
471export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
472 useAdaptiveWorkspacePaneRole("inspector");
473 const navigation = useNavigation();
474 const { fileInspector, panes, toggleAuxiliaryPane } = useAdaptiveWorkspaceLayout();
475 const iconColor = useUniwindTheme()["--color-icon"];
476 const params = props.route.params;
477 const relativePath = normalizeRoutePath(params.path);
478 const targetLine = normalizeRouteLine(firstRouteParam(params.line));
479 const { cwd, environmentId, projectName, selectedThread, threadId } = useThreadFilesWorkspace(
480 props.route.params,
481 );
482 const [modeOverride, setModeOverride] = useState<{
483 readonly path: string;
484 readonly mode: FileViewMode;
485 } | null>(null);
486 const [previewRevision, setPreviewRevision] = useState(0);
487 const isBrowserFile = relativePath !== null && isBrowserPreviewFile(relativePath);
488 const isImageFile = relativePath !== null && isImagePreviewFile(relativePath);
489 const canPreview =
490 relativePath !== null && (isMarkdownPreviewFile(relativePath) || isBrowserFile || isImageFile);
491 const activeMode =
492 relativePath !== null && modeOverride?.path === relativePath
493 ? modeOverride.mode
494 : defaultViewMode(relativePath);
495 const resolvedActiveMode = canPreview ? activeMode : "source";
496 const assetPreviewPath = isBrowserFile || isImageFile ? relativePath : null;
497 const assetPreviewUri = useWorkspaceFileAssetUrl({
498 cwd,
499 environmentId,
500 relativePath: assetPreviewPath,
501 threadId,
502 });
503 const previewUri =
504 assetPreviewUri === null || previewRevision === 0
505 ? assetPreviewUri
506 : `${assetPreviewUri}${assetPreviewUri.includes("?") ? "&" : "?"}revision=${previewRevision}`;
507 const needsFileContents =
508 relativePath !== null &&
509 (resolvedActiveMode === "source" || isMarkdownPreviewFile(relativePath));
510 const fileQuery = useEnvironmentQuery(
511 environmentId !== null && cwd !== null && relativePath !== null && needsFileContents
512 ? projectEnvironment.readFile({
513 environmentId,
514 input: { cwd, relativePath },
515 })
516 : null,
517 );
518 const fileData = fileQuery.data as ProjectReadFileResult | null;
519
520 const handleSelectFile = useCallback(
521 (path: string) => {
522 navigation.navigate("ThreadFile", {
523 environmentId: String(environmentId),
524 threadId: String(threadId),
525 path: path.split("/").filter(Boolean),
526 });
527 },
528 [environmentId, navigation, threadId],
529 );
530 const renderInspector = useCallback(
531 (headerInset: number) =>
532 fileInspector.supported && environmentId !== null && cwd !== null ? (
533 <ThreadFileNavigatorPane
534 cwd={cwd}
535 environmentId={environmentId}
536 headerInset={headerInset}
537 projectName={projectName}
538 selectedPath={relativePath}
539 onSelectFile={handleSelectFile}
540 />
541 ) : undefined,
542 [cwd, environmentId, fileInspector.supported, handleSelectFile, projectName, relativePath],
543 );
544 // The workspace inspector column spans the full window height. On iOS the
545 // pane brings its own nested native header; elsewhere it pads itself below
546 // the top inset.
547 const safeAreaInsets = useSafeAreaInsets();
548 const inspectorHeaderInset = Platform.OS === "ios" ? 0 : safeAreaInsets.top;
549 // Hand the file navigator to the workspace so it renders beside the
550 // navigator, outside this screen's native header.
551 const renderWorkspaceInspector = useCallback(
552 () => renderInspector(inspectorHeaderInset),
553 [inspectorHeaderInset, renderInspector],
554 );
555 useRegisterWorkspaceInspector(fileInspector.supported ? renderWorkspaceInspector : undefined);
556
557 if (selectedThread === null || environmentId === null || threadId === null) {
558 return <LoadingScreen message="Opening file..." messagePlacement="above-spinner" />;
559 }
560
561 if (cwd === null) {
562 return <FilesUnavailable />;
563 }
564
565 if (relativePath === null) {
566 return (
567 <View className="flex-1 items-center justify-center bg-sheet px-6">
568 <NativeStackScreenOptions options={{ title: "Files" }} />
569 <EmptyState title="File unavailable" detail="This file path is invalid." />
570 </View>
571 );
572 }
573
574 const parentDir = relativePath.split("/").slice(0, -1).join("/");
575 const headerSubtitle = [projectName, parentDir].filter(Boolean).join(" · ");
576
577 return (
578 <ReviewHighlighterProvider>
579 <View className="flex-1 bg-sheet">
580 <NativeStackScreenOptions
581 options={{
582 // Static header config lives in Stack.tsx (SOLID_HEADER_OPTIONS: solid
583 // sheet-colored header — this route's content scrolls internally, so
584 // there is nothing for glass to sample). Only dynamic values here.
585 headerTintColor: iconColor,
586 headerTitle: basename(relativePath),
587 title: basename(relativePath),
588 unstable_headerSubtitle:
589 Platform.OS === "ios" && headerSubtitle.length > 0 ? headerSubtitle : undefined,
590 }}
591 />
592 <WorkspaceSidebarToolbar>
593 {fileInspector.supported ? (
594 <NativeHeaderToolbar.Button
595 accessibilityLabel="Return to chat"
596 icon="chevron.left"
597 onPress={() => {
598 navigation.dispatch(
599 StackActions.replace("Thread", {
600 environmentId: String(environmentId),
601 threadId: String(threadId),
602 }),
603 );
604 }}
605 />
606 ) : null}
607 </WorkspaceSidebarToolbar>
608 <NativeHeaderToolbar placement="right">
609 {fileInspector.supported ? (
610 <NativeHeaderToolbar.Button
611 accessibilityLabel={
612 panes.auxiliaryPaneVisible ? "Hide file navigator" : "Show file navigator"
613 }
614 icon="sidebar.right"
615 onPress={toggleAuxiliaryPane}
616 separateBackground
617 />
618 ) : null}
619 <NativeHeaderToolbar.Menu accessibilityLabel="File actions" icon="ellipsis">
620 {canPreview && !isImageFile ? (
621 <NativeHeaderToolbar.Menu inline>
622 <NativeHeaderToolbar.MenuAction
623 icon="eye"
624 isOn={resolvedActiveMode === "preview"}
625 onPress={() => setModeOverride({ path: relativePath, mode: "preview" })}
626 >
627 Preview
628 </NativeHeaderToolbar.MenuAction>
629 <NativeHeaderToolbar.MenuAction
630 icon="doc.text"
631 isOn={resolvedActiveMode === "source"}
632 onPress={() => setModeOverride({ path: relativePath, mode: "source" })}
633 >
634 Source
635 </NativeHeaderToolbar.MenuAction>
636 </NativeHeaderToolbar.Menu>
637 ) : null}
638 <NativeHeaderToolbar.MenuAction
639 icon="doc.on.doc"
640 onPress={() => copyTextWithHaptic(relativePath)}
641 >
642 Copy path
643 </NativeHeaderToolbar.MenuAction>
644 {isBrowserFile && typeof assetPreviewUri === "string" ? (
645 <NativeHeaderToolbar.MenuAction
646 icon="safari"
647 onPress={() => {
648 void tryOpenExternalUrl(assetPreviewUri, "file-preview");
649 }}
650 >
651 Open in Safari
652 </NativeHeaderToolbar.MenuAction>
653 ) : null}
654 {resolvedActiveMode === "preview" && (isBrowserFile || isImageFile) ? (
655 <NativeHeaderToolbar.MenuAction
656 icon="arrow.clockwise"
657 onPress={() => {
658 setPreviewRevision((current) => current + 1);
659 }}
660 >
661 Refresh
662 </NativeHeaderToolbar.MenuAction>
663 ) : null}
664 </NativeHeaderToolbar.Menu>
665 </NativeHeaderToolbar>
666 <FileContent
667 activeMode={resolvedActiveMode}
668 previewUri={previewUri}
669 fileContents={fileData?.contents ?? null}
670 fileError={fileQuery.error}
671 initialLine={targetLine}
672 relativePath={relativePath}
673 truncated={fileData?.truncated ?? false}
674 onRefresh={() => fileQuery.refresh()}
675 />
676 </View>
677 </ReviewHighlighterProvider>
678 );
679}