@@ -75,6 +75,7 @@ type ThreadGitHeaderActionItems = {
7575 readonly terminal : HeaderItem ;
7676 readonly files : HeaderItem ;
7777 readonly git : HeaderItem ;
78+ readonly mergeBack : HeaderItem | null ;
7879} ;
7980type QuickActionIcon =
8081 | "arrow.down.circle"
@@ -394,6 +395,18 @@ function useThreadGitHeaderActionItems(props: ThreadGitControlsProps): ThreadGit
394395 type : "button" ,
395396 variant : "plain" ,
396397 } ,
398+ mergeBack : props . onMergeBack
399+ ? {
400+ accessibilityLabel : "Merge back to source" ,
401+ icon : { name : "arrow.triangle.merge" , type : "sfSymbol" } ,
402+ identifier : "thread-right-merge-back" ,
403+ label : "Merge back" ,
404+ onPress : props . onMergeBack ,
405+ sharesBackground : true ,
406+ type : "button" ,
407+ variant : "plain" ,
408+ }
409+ : null ,
397410 } ) ,
398411 [
399412 model . openFiles ,
@@ -402,6 +415,7 @@ function useThreadGitHeaderActionItems(props: ThreadGitControlsProps): ThreadGit
402415 props . canOpenTerminal ,
403416 props . canOperateTerminal ,
404417 props . onOpenNewTerminal ,
418+ props . onMergeBack ,
405419 props . onOpenTerminal ,
406420 props . onRunProjectScript ,
407421 props . projectScripts ,
@@ -412,12 +426,30 @@ function useThreadGitHeaderActionItems(props: ThreadGitControlsProps): ThreadGit
412426
413427export function useThreadGitRightHeaderItems ( props : ThreadGitControlsProps ) : HeaderItems {
414428 const actionItems = useThreadGitHeaderActionItems ( props ) ;
415- return [ actionItems . git , actionItems . files , actionItems . terminal ] as HeaderItems ;
429+ return useMemo (
430+ ( ) =>
431+ [
432+ ...( actionItems . mergeBack ? [ actionItems . mergeBack ] : [ ] ) ,
433+ actionItems . git ,
434+ actionItems . files ,
435+ actionItems . terminal ,
436+ ] as HeaderItems ,
437+ [ actionItems ] ,
438+ ) ;
416439}
417440
418441export function useThreadGitCenterHeaderItems ( props : ThreadGitControlsProps ) : HeaderItems {
419442 const actionItems = useThreadGitHeaderActionItems ( props ) ;
420- return [ actionItems . files , actionItems. git , actionItems . terminal ] as HeaderItems;
443+ return useMemo (
444+ ( ) =>
445+ [
446+ actionItems . files ,
447+ actionItems. git ,
448+ ...( actionItems . mergeBack ? [ actionItems . mergeBack ] : [ ] ) ,
449+ actionItems. terminal ,
450+ ] as HeaderItems,
451+ [ actionItems ] ,
452+ ) ;
421453}
422454
423455export function ThreadGitControls ( props : ThreadGitControlsProps ) {
0 commit comments