@@ -24,7 +24,6 @@ export const CheckpointMenu = ({ ts, commitHash, currentHash, checkpoint }: Chec
2424 const isCurrent = currentHash === commitHash
2525 const isFirst = checkpoint . isFirst
2626 const isDiffAvailable = ! isFirst
27- const isRestoreAvailable = ! isFirst || ! isCurrent
2827
2928 const previousCommitHash = checkpoint ?. from
3029
@@ -54,71 +53,67 @@ export const CheckpointMenu = ({ ts, commitHash, currentHash, checkpoint }: Chec
5453 </ Button >
5554 </ StandardTooltip >
5655 ) }
57- { isRestoreAvailable && (
58- < Popover
59- open = { isOpen }
60- onOpenChange = { ( open ) => {
61- setIsOpen ( open )
62- setIsConfirming ( false )
63- } } >
64- < StandardTooltip content = { t ( "chat:checkpoint.menu.restore" ) } >
65- < PopoverTrigger asChild >
66- < Button variant = "ghost" size = "icon" >
67- < span className = "codicon codicon-history" />
68- </ Button >
69- </ PopoverTrigger >
70- </ StandardTooltip >
71- < PopoverContent align = "end" container = { portalContainer } >
72- < div className = "flex flex-col gap-2" >
73- { ! isCurrent && (
74- < div className = "flex flex-col gap-1 group hover:text-foreground" >
75- < Button variant = "secondary" onClick = { onPreview } >
76- { t ( "chat:checkpoint.menu.restoreFiles" ) }
77- </ Button >
78- < div className = "text-muted transition-colors group-hover:text-foreground" >
79- { t ( "chat:checkpoint.menu.restoreFilesDescription" ) }
80- </ div >
56+ < Popover
57+ open = { isOpen }
58+ onOpenChange = { ( open ) => {
59+ setIsOpen ( open )
60+ setIsConfirming ( false )
61+ } } >
62+ < StandardTooltip content = { t ( "chat:checkpoint.menu.restore" ) } >
63+ < PopoverTrigger asChild >
64+ < Button variant = "ghost" size = "icon" >
65+ < span className = "codicon codicon-history" />
66+ </ Button >
67+ </ PopoverTrigger >
68+ </ StandardTooltip >
69+ < PopoverContent align = "end" container = { portalContainer } >
70+ < div className = "flex flex-col gap-2" >
71+ { ! isCurrent && (
72+ < div className = "flex flex-col gap-1 group hover:text-foreground" >
73+ < Button variant = "secondary" onClick = { onPreview } >
74+ { t ( "chat:checkpoint.menu.restoreFiles" ) }
75+ </ Button >
76+ < div className = "text-muted transition-colors group-hover:text-foreground" >
77+ { t ( "chat:checkpoint.menu.restoreFilesDescription" ) }
8178 </ div >
82- ) }
83- { ! isFirst && (
84- < div className = "flex flex-col gap-1 group hover:text-foreground" >
85- < div className = "flex flex-col gap-1 group hover:text-foreground" >
86- { ! isConfirming ? (
87- < Button variant = "secondary" onClick = { ( ) => setIsConfirming ( true ) } >
88- { t ( "chat:checkpoint.menu.restoreFilesAndTask" ) }
89- </ Button >
90- ) : (
91- < >
92- < Button variant = "default" onClick = { onRestore } className = "grow" >
93- < div className = "flex flex-row gap-1" >
94- < CheckIcon />
95- < div > { t ( "chat:checkpoint.menu.confirm" ) } </ div >
96- </ div >
97- </ Button >
98- < Button variant = "secondary" onClick = { ( ) => setIsConfirming ( false ) } >
99- < div className = "flex flex-row gap-1" >
100- < Cross2Icon />
101- < div > { t ( "chat:checkpoint.menu.cancel" ) } </ div >
102- </ div >
103- </ Button >
104- </ >
105- ) }
106- { isConfirming ? (
107- < div className = "text-destructive font-bold" >
108- { t ( "chat:checkpoint.menu.cannotUndo" ) }
79+ </ div >
80+ ) }
81+ < div className = "flex flex-col gap-1 group hover:text-foreground" >
82+ < div className = "flex flex-col gap-1 group hover:text-foreground" >
83+ { ! isConfirming ? (
84+ < Button variant = "secondary" onClick = { ( ) => setIsConfirming ( true ) } >
85+ { t ( "chat:checkpoint.menu.restoreFilesAndTask" ) }
86+ </ Button >
87+ ) : (
88+ < >
89+ < Button variant = "default" onClick = { onRestore } className = "grow" >
90+ < div className = "flex flex-row gap-1" >
91+ < CheckIcon />
92+ < div > { t ( "chat:checkpoint.menu.confirm" ) } </ div >
10993 </ div >
110- ) : (
111- < div className = "text-muted transition-colors group-hover:text-foreground" >
112- { t ( "chat:checkpoint.menu.restoreFilesAndTaskDescription" ) }
94+ </ Button >
95+ < Button variant = "secondary" onClick = { ( ) => setIsConfirming ( false ) } >
96+ < div className = "flex flex-row gap-1" >
97+ < Cross2Icon />
98+ < div > { t ( "chat:checkpoint.menu.cancel" ) } </ div >
11399 </ div >
114- ) }
100+ </ Button >
101+ </ >
102+ ) }
103+ { isConfirming ? (
104+ < div className = "text-destructive font-bold" >
105+ { t ( "chat:checkpoint.menu.cannotUndo" ) }
115106 </ div >
116- </ div >
117- ) }
107+ ) : (
108+ < div className = "text-muted transition-colors group-hover:text-foreground" >
109+ { t ( "chat:checkpoint.menu.restoreFilesAndTaskDescription" ) }
110+ </ div >
111+ ) }
112+ </ div >
118113 </ div >
119- </ PopoverContent >
120- </ Popover >
121- ) }
114+ </ div >
115+ </ PopoverContent >
116+ </ Popover >
122117 </ div >
123118 )
124119}
0 commit comments