@@ -5,17 +5,11 @@ import { stackedThreadToast, toastManager } from "./ui/toast";
55import { ComposerContextLabel } from "./ComposerContextLabel" ;
66import { scopeProjectRef , scopeThreadRef } from "@t3tools/client-runtime/environment" ;
77import type { EnvironmentId , ProjectId , ThreadId } from "@t3tools/contracts" ;
8- import {
9- ChevronDownIcon ,
10- FolderGit2Icon ,
11- FolderGitIcon ,
12- FolderIcon ,
13- PlusIcon ,
14- ScaleIcon ,
15- } from "lucide-react" ;
8+ import { FolderGit2Icon , FolderGitIcon , FolderIcon , PlusIcon , ScaleIcon } from "lucide-react" ;
169import {
1710 type Ref ,
1811 type MouseEvent as ReactMouseEvent ,
12+ type ReactNode ,
1913 memo ,
2014 useImperativeHandle ,
2115 useRef ,
@@ -72,8 +66,6 @@ import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
7266import { MiddleTruncate } from "./ui/middle-truncate" ;
7367import { ComposerSurface } from "./chat/ComposerSurface" ;
7468import { useComposerMenuProps } from "./chat/composerEventScope" ;
75- import { measureRestingComposerControls } from "./chat/restingComposerControlsMeasurement" ;
76- import { resolveRestingComposerControlsNaturalWidth } from "./composerFooterLayout" ;
7769import { cn } from "~/lib/utils" ;
7870import { observeResize } from "~/lib/observeResize" ;
7971
@@ -105,10 +97,10 @@ interface BranchToolbarProps {
10597 envLocked : boolean ;
10698 onCheckoutPullRequestRequest ?: ( reference : string ) => void ;
10799 onComposerFocusRequest ?: ( ) => void ;
100+ /** Shown at the end of the composer strip, such as the new thread's permissions. */
101+ trailing ?: ReactNode ;
108102 availableEnvironments ?: readonly EnvironmentOption [ ] ;
109103 onEnvironmentChange ?: ( environmentId : EnvironmentId ) => void ;
110- composerControlsHostRef ?: ( element : HTMLDivElement | null ) => void ;
111- contextStripVisible ?: boolean ;
112104}
113105
114106function showWorkspaceContextMenu ( event : ReactMouseEvent , workspacePath : string ) {
@@ -317,7 +309,6 @@ const RunContextSelector = memo(function RunContextSelector({
317309 ] . join ( " " ) }
318310 >
319311 { triggerContent }
320- { ! isPanel ? < ChevronDownIcon className = "size-3 shrink-0 mx-0!" /> : null }
321312 </ MenuTrigger >
322313 < MenuPopup
323314 align = "start"
@@ -544,16 +535,7 @@ function useLabelsOverflow(): readonly [
544535 let groups = 0 ;
545536 for ( const child of current . children ) {
546537 if ( ! ( child instanceof HTMLElement ) ) continue ;
547- // Reserve overflowed controls' width to prevent repeated hiding and expansion.
548- const hostedControls = child . matches ( '[data-chat-resting-composer-controls-host="true"]' )
549- ? child . querySelector < HTMLElement > ( '[data-chat-composer-resting-controls="true"]' )
550- : null ;
551- const hostedMeasurement = hostedControls
552- ? measureRestingComposerControls ( hostedControls )
553- : null ;
554- const width = hostedMeasurement
555- ? resolveRestingComposerControlsNaturalWidth ( hostedMeasurement )
556- : contentWidth ( hostedControls ?? child ) ;
538+ const width = contentWidth ( child ) ;
557539 if ( width <= 1 ) continue ;
558540 groups += 1 ;
559541 needed += width ;
@@ -585,7 +567,6 @@ function useLabelsOverflow(): readonly [
585567 [
586568 current ,
587569 ...Array . from ( current . children ) ,
588- ...Array . from ( current . querySelectorAll ( "[data-chat-composer-resting-controls='true']" ) ) ,
589570 ...Array . from ( current . querySelectorAll ( COMPOSER_CONTEXT_LABEL_SELECTOR ) ) ,
590571 ] ,
591572 measure ,
@@ -640,8 +621,7 @@ export const BranchToolbar = memo(function BranchToolbar({
640621 onComposerFocusRequest,
641622 availableEnvironments,
642623 onEnvironmentChange,
643- composerControlsHostRef,
644- contextStripVisible = true ,
624+ trailing,
645625} : BranchToolbarProps ) {
646626 const branchSelectorRef = useRef < BranchToolbarBranchSelectorHandle > ( null ) ;
647627 const threadRef = scopeThreadRef ( environmentId , threadId ) ;
@@ -764,11 +744,7 @@ export const BranchToolbar = memo(function BranchToolbar({
764744 < ComposerSurface . ContextStrip
765745 ref = { attachStrip }
766746 data-compact = { labelsOverflow ? "" : undefined }
767- className = { cn (
768- "gap-1 text-xs font-normal text-foreground/70 dark:text-muted-foreground" ,
769- // Hide empty non-Git strips while retaining host width so controls can reappear as the chat grows.
770- ! contextStripVisible && "pointer-events-none invisible absolute inset-x-0 top-full" ,
771- ) }
747+ className = { cn ( "gap-1 text-xs font-normal text-foreground/70 dark:text-muted-foreground" ) }
772748 >
773749 { showGitControls ? (
774750 < div className = "contents @3xl/composer-surface:hidden" >
@@ -799,7 +775,7 @@ export const BranchToolbar = memo(function BranchToolbar({
799775 className = { cn (
800776 "min-h-7 min-w-10 items-center gap-1 sm:min-h-6" ,
801777 showGitControls ? "hidden @3xl/composer-surface:flex" : "flex" ,
802- composerControlsHostRef ? "shrink" : "flex-1" ,
778+ "flex-1" ,
803779 ) }
804780 >
805781 { showEnvironmentIndicator && availableEnvironments && (
@@ -837,15 +813,6 @@ export const BranchToolbar = memo(function BranchToolbar({
837813 </ div >
838814 ) : null }
839815
840- { composerControlsHostRef ? (
841- < div
842- ref = { composerControlsHostRef }
843- data-composer-context-control
844- data-chat-resting-composer-controls-host = "true"
845- className = "flex min-w-0 flex-1 items-center justify-start overflow-x-clip overflow-y-visible"
846- />
847- ) : null }
848-
849816 { showGitControls ? (
850817 < BranchToolbarBranchSelector
851818 forceNewWorktree = { forceNewWorktree }
@@ -864,6 +831,7 @@ export const BranchToolbar = memo(function BranchToolbar({
864831 { ...( onComposerFocusRequest ? { onComposerFocusRequest } : { } ) }
865832 />
866833 ) : null }
834+ { trailing }
867835 </ ComposerSurface . ContextStrip >
868836 ) ;
869837} ) ;
0 commit comments