@@ -6,11 +6,19 @@ import {
66 summarizeTurnDiffStats ,
77 type TurnDiffTreeNode ,
88} from "../../lib/turnDiffTree" ;
9- import { ChevronRightIcon , FolderIcon , FolderClosedIcon } from "lucide-react" ;
9+ import {
10+ ChevronsDownUpIcon ,
11+ ChevronsUpDownIcon ,
12+ ChevronRightIcon ,
13+ FileDiffIcon ,
14+ FolderIcon ,
15+ FolderClosedIcon ,
16+ } from "lucide-react" ;
1017import { cn } from "~/lib/utils" ;
1118import { DiffStatLabel , hasNonZeroStat } from "./DiffStatLabel" ;
1219import { PierreEntryIcon } from "./PierreEntryIcon" ;
1320import { Button } from "../ui/button" ;
21+ import { Tooltip , TooltipPopup , TooltipTrigger } from "../ui/tooltip" ;
1422
1523const EMPTY_DIRECTORY_OVERRIDES : Record < string , boolean > = { } ;
1624
@@ -33,10 +41,12 @@ export const ChangedFilesCard = memo(function ChangedFilesCard(props: {
3341 const summaryStat = useMemo ( ( ) => summarizeTurnDiffStats ( files ) , [ files ] ) ;
3442
3543 return (
36- < div className = "relative mt-4 rounded-2xl bg-card/40 shadow-xs/5 not-dark:bg-clip-padding after:pointer-events-none after:absolute after:inset-0 after:z-20 after:rounded-2xl after:border after:border-input" >
37- < div className = "sticky top-0 z-10 mb-3 flex items-center justify-between gap-2 rounded-t-2xl bg-card/72 p-3 backdrop-blur-md" >
38- < p className = "flex items-center gap-1 font-medium text-foreground text-xs leading-4" >
39- < span > { files . length } changed files</ span >
44+ < div className = "mt-4 rounded-2xl border border-input bg-background p-2 pt-4 shadow-xs/5 not-dark:bg-clip-padding dark:bg-input/32" >
45+ < div className = "sticky top-0 z-10 mb-3 flex items-center justify-between gap-2 bg-background px-2 before:absolute before:inset-x-0 before:-top-4 before:h-4 before:bg-background before:content-[''] dark:bg-[color-mix(in_srgb,var(--foreground)_2.5%,var(--background))] dark:before:bg-[color-mix(in_srgb,var(--foreground)_2.5%,var(--background))]" >
46+ < p className = "flex items-center gap-1 whitespace-nowrap font-medium text-foreground text-xs leading-4" >
47+ < span >
48+ { files . length } changed file{ files . length === 1 ? "" : "s" }
49+ </ span >
4050 { hasNonZeroStat ( summaryStat ) && (
4151 < DiffStatLabel
4252 additions = { summaryStat . additions }
@@ -47,35 +57,57 @@ export const ChangedFilesCard = memo(function ChangedFilesCard(props: {
4757 ) }
4858 </ p >
4959 < div className = "flex items-center gap-1.5" >
50- < Button
51- type = "button"
52- size = "xs"
53- variant = "outline"
54- data-scroll-anchor-ignore
55- onClick = { onToggleAllDirectories }
56- >
57- { allDirectoriesExpanded ? "Collapse all" : "Expand all" }
58- </ Button >
59- < Button
60- type = "button"
61- size = "xs"
62- variant = "outline"
63- onClick = { ( ) => onOpenTurnDiff ( turnId , files [ 0 ] ?. path ) }
64- >
65- View diff
66- </ Button >
60+ < Tooltip >
61+ < TooltipTrigger
62+ render = {
63+ < Button
64+ type = "button"
65+ size = "icon-xs"
66+ variant = "outline"
67+ className = "!size-[22px]"
68+ aria-label = { allDirectoriesExpanded ? "Collapse all" : "Expand all" }
69+ data-scroll-anchor-ignore
70+ onClick = { onToggleAllDirectories }
71+ />
72+ }
73+ >
74+ { allDirectoriesExpanded ? (
75+ < ChevronsDownUpIcon className = "size-3" />
76+ ) : (
77+ < ChevronsUpDownIcon className = "size-3" />
78+ ) }
79+ </ TooltipTrigger >
80+ < TooltipPopup side = "top" >
81+ { allDirectoriesExpanded ? "Collapse all" : "Expand all" }
82+ </ TooltipPopup >
83+ </ Tooltip >
84+ < Tooltip >
85+ < TooltipTrigger
86+ render = {
87+ < Button
88+ type = "button"
89+ size = "icon-xs"
90+ variant = "outline"
91+ className = "!size-[22px]"
92+ aria-label = "View diff"
93+ onClick = { ( ) => onOpenTurnDiff ( turnId , files [ 0 ] ?. path ) }
94+ />
95+ }
96+ >
97+ < FileDiffIcon className = "size-3" />
98+ </ TooltipTrigger >
99+ < TooltipPopup side = "top" > View diff</ TooltipPopup >
100+ </ Tooltip >
67101 </ div >
68102 </ div >
69- < div className = "px-2 pb-2" >
70- < ChangedFilesTree
71- key = { `changed-files-tree:${ turnId } ` }
72- turnId = { turnId }
73- files = { files }
74- allDirectoriesExpanded = { allDirectoriesExpanded }
75- resolvedTheme = { resolvedTheme }
76- onOpenTurnDiff = { onOpenTurnDiff }
77- />
78- </ div >
103+ < ChangedFilesTree
104+ key = { `changed-files-tree:${ turnId } ` }
105+ turnId = { turnId }
106+ files = { files }
107+ allDirectoriesExpanded = { allDirectoriesExpanded }
108+ resolvedTheme = { resolvedTheme }
109+ onOpenTurnDiff = { onOpenTurnDiff }
110+ />
79111 </ div >
80112 ) ;
81113} ) ;
0 commit comments