@@ -167,6 +167,7 @@ import {
167167 WifiOffIcon ,
168168} from "lucide-react" ;
169169import { cn , randomHex } from "~/lib/utils" ;
170+ import { COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS } from "~/workspaceTitlebar" ;
170171import { stackedThreadToast , toastManager } from "./ui/toast" ;
171172import { decodeProjectScriptKeybindingRule } from "~/lib/projectScriptKeybindings" ;
172173import { type NewProjectScriptInput } from "./ProjectScriptsControl" ;
@@ -219,11 +220,7 @@ import {
219220import { appendPreviewAnnotationPrompt } from "../lib/previewAnnotation" ;
220221import { appendReviewCommentsToPrompt , type ReviewCommentContext } from "../reviewCommentContext" ;
221222import { environmentCatalog } from "../connection/catalog" ;
222- import {
223- selectThreadTerminalCustomLabels ,
224- selectThreadTerminalUiState ,
225- useTerminalUiStateStore ,
226- } from "../terminalUiStateStore" ;
223+ import { selectThreadTerminalUiState , useTerminalUiStateStore } from "../terminalUiStateStore" ;
227224import { useKnownTerminalSessions , useThreadRunningTerminalIds } from "../state/terminalSessions" ;
228225import { projectEnvironment } from "../state/projects" ;
229226import { useEnvironmentQuery } from "../state/query" ;
@@ -259,7 +256,6 @@ import { ChatHeader } from "./chat/ChatHeader";
259256import { PanelLayoutControls , RightPanelMaximizeControl } from "./chat/PanelLayoutControls" ;
260257import { type ExpandedImagePreview } from "./chat/ExpandedImagePreview" ;
261258import { NoActiveThreadState } from "./NoActiveThreadState" ;
262- import { WorkspacePageHeader } from "./WorkspacePageContainer" ;
263259import {
264260 resolveEffectiveEnvMode ,
265261 resolveLocalCheckoutBranchMismatch ,
@@ -657,7 +653,6 @@ interface PersistentThreadTerminalDrawerProps {
657653 newShortcutLabel : string | undefined ;
658654 closeShortcutLabel : string | undefined ;
659655 keybindings : ResolvedKeybindingsConfig ;
660- onHide : ( ) => void ;
661656 onAddTerminalContext : ( selection : TerminalContextSelection ) => void ;
662657}
663658
@@ -672,7 +667,6 @@ const PersistentThreadTerminalDrawer = memo(function PersistentThreadTerminalDra
672667 newShortcutLabel,
673668 closeShortcutLabel,
674669 keybindings,
675- onHide,
676670 onAddTerminalContext,
677671} : PersistentThreadTerminalDrawerProps ) {
678672 const openTerminal = useAtomCommand ( terminalEnvironment . open , "terminal open" ) ;
@@ -996,7 +990,6 @@ const PersistentThreadTerminalDrawer = memo(function PersistentThreadTerminalDra
996990 onSplitTerminal = { splitTerminal }
997991 onSplitTerminalVertical = { splitTerminalVertical }
998992 onNewTerminal = { createNewTerminal }
999- onHide = { onHide }
1000993 splitShortcutLabel = { visible ? splitShortcutLabel : undefined }
1001994 splitVerticalShortcutLabel = { visible ? splitVerticalShortcutLabel : undefined }
1002995 newShortcutLabel = { visible ? newShortcutLabel : undefined }
@@ -1547,16 +1540,6 @@ function ChatViewContent(props: ChatViewProps) {
15471540 const canCheckoutPullRequestIntoThread = isLocalDraftThread ;
15481541 const activeThreadId = activeThread ?. id ?? null ;
15491542 const activeThreadEnvironmentId = activeThread ?. environmentId ?? null ;
1550- const activeThreadRef = useMemo (
1551- ( ) =>
1552- activeThreadEnvironmentId && activeThreadId
1553- ? scopeThreadRef ( activeThreadEnvironmentId , activeThreadId )
1554- : null ,
1555- [ activeThreadEnvironmentId , activeThreadId ] ,
1556- ) ;
1557- const activeTerminalCustomLabels = useTerminalUiStateStore ( ( state ) =>
1558- selectThreadTerminalCustomLabels ( state . terminalCustomLabelsByThreadKey , activeThreadRef ) ,
1559- ) ;
15601543 const runningTerminalIds = useThreadRunningTerminalIds ( {
15611544 environmentId : activeThread ?. environmentId ?? null ,
15621545 threadId : activeThreadId ,
@@ -1586,15 +1569,18 @@ function ChatViewContent(props: ChatViewProps) {
15861569 for ( const session of activeThreadKnownSessions ) {
15871570 labels . set (
15881571 session . target . terminalId ,
1589- activeTerminalCustomLabels [ session . target . terminalId ] ??
1590- resolveTerminalSessionLabel ( session . target . terminalId , session . state . summary ) ,
1572+ resolveTerminalSessionLabel ( session . target . terminalId , session . state . summary ) ,
15911573 ) ;
15921574 }
1593- for ( const [ terminalId , label ] of Object . entries ( activeTerminalCustomLabels ) ) {
1594- if ( ! labels . has ( terminalId ) ) labels . set ( terminalId , label ) ;
1595- }
15961575 return labels ;
1597- } , [ activeTerminalCustomLabels , activeThreadKnownSessions ] ) ;
1576+ } , [ activeThreadKnownSessions ] ) ;
1577+ const activeThreadRef = useMemo (
1578+ ( ) =>
1579+ activeThreadEnvironmentId && activeThreadId
1580+ ? scopeThreadRef ( activeThreadEnvironmentId , activeThreadId )
1581+ : null ,
1582+ [ activeThreadEnvironmentId , activeThreadId ] ,
1583+ ) ;
15981584 const activeThreadKey = activeThreadRef ? scopedThreadKey ( activeThreadRef ) : null ;
15991585 const [ timelineAnchor , setTimelineAnchor ] = useState < {
16001586 readonly threadKey : string | null ;
@@ -2822,7 +2808,6 @@ function ChatViewContent(props: ChatViewProps) {
28222808 } ,
28232809 [ activeThreadRef , storeSetTerminalOpen ] ,
28242810 ) ;
2825- const hideTerminal = useCallback ( ( ) => setTerminalOpen ( false ) , [ setTerminalOpen ] ) ;
28262811 const toggleTerminalVisibility = useCallback ( ( ) => {
28272812 if ( ! activeThreadRef ) return ;
28282813 const nextOpen = ! terminalUiState . terminalOpen ;
@@ -6129,6 +6114,7 @@ function ChatViewContent(props: ChatViewProps) {
61296114 ? "thread"
61306115 : "page"
61316116 }
6117+ chromeVariant = "collapse"
61326118 composerDraftTarget = { composerDraftTarget }
61336119 onStateChange = { handlePullRequestTabStatusChange }
61346120 />
@@ -6174,11 +6160,20 @@ function ChatViewContent(props: ChatViewProps) {
61746160 data-chat-column-maximized-away = { rightPanelMaximized ? "true" : "false" }
61756161 >
61766162 { /* Top bar */ }
6177- < WorkspacePageHeader
6163+ < header
61786164 data-chat-header
6179- electron = { isElectron }
6180- reserveNativeControls = { reserveTitleBarControlInset && ! inlineRightPanelOwnsTitleBar }
6181- className = "relative bg-background"
6165+ className = { cn (
6166+ "bg-background transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none" ,
6167+ isElectron
6168+ ? cn (
6169+ "drag-region relative flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center px-3 sm:px-5" ,
6170+ reserveTitleBarControlInset &&
6171+ ! inlineRightPanelOwnsTitleBar &&
6172+ "wco:pr-[var(--workspace-native-controls-inset)]" ,
6173+ )
6174+ : "flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center pl-[calc(env(safe-area-inset-left)+0.75rem)] pr-[calc(env(safe-area-inset-right)+0.75rem)] sm:pl-[calc(env(safe-area-inset-left)+1.25rem)] sm:pr-[calc(env(safe-area-inset-right)+1.25rem)]" ,
6175+ COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS ,
6176+ ) }
61826177 >
61836178 { ! rightPanelOpen ? panelLayoutControls : null }
61846179 < ChatHeader
@@ -6209,7 +6204,7 @@ function ChatViewContent(props: ChatViewProps) {
62096204 onUpdateProjectScript = { updateProjectScript }
62106205 onDeleteProjectScript = { deleteProjectScript }
62116206 />
6212- </ WorkspacePageHeader >
6207+ </ header >
62136208
62146209 < ThreadErrorBanner
62156210 error = { visibleThreadError }
@@ -6547,7 +6542,6 @@ function ChatViewContent(props: ChatViewProps) {
65476542 newShortcutLabel = { newTerminalShortcutLabel ?? undefined }
65486543 closeShortcutLabel = { closeTerminalShortcutLabel ?? undefined }
65496544 keybindings = { keybindings }
6550- onHide = { hideTerminal }
65516545 onAddTerminalContext = { addTerminalContextToDraft }
65526546 />
65536547 ) ) }
0 commit comments