@@ -19,14 +19,14 @@ import { cn } from "~/lib/utils";
1919import { readNativeApi } from "../nativeApi" ;
2020import { resolvePathLinkTarget } from "../terminal-links" ;
2121import { parseDiffRouteSearch , stripDiffSearchParams } from "../diffRouteSearch" ;
22- import { isElectron } from "../env" ;
2322import { useTheme } from "../hooks/useTheme" ;
2423import { buildPatchCacheKey } from "../lib/diffRendering" ;
2524import { resolveDiffThemeName } from "../lib/diffRendering" ;
2625import { useTurnDiffSummaries } from "../hooks/useTurnDiffSummaries" ;
2726import { useStore } from "../store" ;
2827import { useAppSettings } from "../appSettings" ;
2928import { formatShortTimestamp } from "../timestampFormat" ;
29+ import { DiffPanelLoadingState , DiffPanelShell , type DiffPanelMode } from "./DiffPanelShell" ;
3030import { ToggleGroup , Toggle } from "./ui/toggle-group" ;
3131
3232type DiffRenderMode = "stacked" | "split" ;
@@ -152,7 +152,7 @@ function buildFileDiffRenderKey(fileDiff: FileDiffMetadata): string {
152152}
153153
154154interface DiffPanelProps {
155- mode ?: "inline" | "sheet" | "sidebar" ;
155+ mode ?: DiffPanelMode ;
156156}
157157
158158export { DiffWorkerPoolProvider } from "./DiffWorkerPoolProvider" ;
@@ -398,7 +398,6 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
398398 selectedChip ?. scrollIntoView ( { block : "nearest" , inline : "nearest" , behavior : "smooth" } ) ;
399399 } , [ selectedTurn ?. turnId , selectedTurnId ] ) ;
400400
401- const shouldUseDragRegion = isElectron && mode !== "sheet" ;
402401 const headerRow = (
403402 < >
404403 < div className = "relative min-w-0 flex-1 [-webkit-app-region:no-drag]" >
@@ -512,28 +511,9 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
512511 </ ToggleGroup >
513512 </ >
514513 ) ;
515- const headerRowClassName = cn (
516- "flex items-center justify-between gap-2 px-4" ,
517- shouldUseDragRegion ? "drag-region h-[52px] border-b border-border" : "h-12" ,
518- ) ;
519514
520515 return (
521- < div
522- className = { cn (
523- "flex h-full min-w-0 flex-col bg-background" ,
524- mode === "inline"
525- ? "w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border"
526- : "w-full" ,
527- ) }
528- >
529- { shouldUseDragRegion ? (
530- < div className = { headerRowClassName } > { headerRow } </ div >
531- ) : (
532- < div className = "border-b border-border" >
533- < div className = { headerRowClassName } > { headerRow } </ div >
534- </ div >
535- ) }
536-
516+ < DiffPanelShell mode = { mode } header = { headerRow } >
537517 { ! activeThread ? (
538518 < div className = "flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70" >
539519 Select a thread to inspect turn diffs.
@@ -558,15 +538,17 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
558538 </ div >
559539 ) }
560540 { ! renderablePatch ? (
561- < div className = "flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70" >
562- < p >
563- { isLoadingCheckpointDiff
564- ? "Loading checkpoint diff..."
565- : hasNoNetChanges
541+ isLoadingCheckpointDiff ? (
542+ < DiffPanelLoadingState label = "Loading checkpoint diff..." />
543+ ) : (
544+ < div className = "flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70" >
545+ < p >
546+ { hasNoNetChanges
566547 ? "No net changes in this selection."
567548 : "No patch available for this selection." }
568- </ p >
569- </ div >
549+ </ p >
550+ </ div >
551+ )
570552 ) : renderablePatch . kind === "files" ? (
571553 < Virtualizer
572554 className = "diff-render-surface h-full min-h-0 overflow-auto px-2 pb-2"
@@ -622,6 +604,6 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
622604 </ div >
623605 </ >
624606 ) }
625- </ div >
607+ </ DiffPanelShell >
626608 ) ;
627609}
0 commit comments