@@ -8,14 +8,15 @@ import { Spinner } from "@opencode-ai/ui/spinner"
88import { showToast } from "@opencode-ai/ui/toast"
99import { Tooltip , TooltipKeybind } from "@opencode-ai/ui/tooltip"
1010import { getFilename } from "@opencode-ai/shared/util/path"
11- import { createEffect , createMemo , For , Show } from "solid-js"
11+ import { createEffect , createMemo , createSignal , For , onMount , Show } from "solid-js"
1212import { createStore } from "solid-js/store"
1313import { Portal } from "solid-js/web"
1414import { useCommand } from "@/context/command"
1515import { useLanguage } from "@/context/language"
1616import { useLayout } from "@/context/layout"
1717import { usePlatform } from "@/context/platform"
1818import { useServer } from "@/context/server"
19+ import { useSettings } from "@/context/settings"
1920import { useSync } from "@/context/sync"
2021import { useTerminal } from "@/context/terminal"
2122import { focusTerminalById } from "@/pages/session/helpers"
@@ -134,6 +135,7 @@ export function SessionHeader() {
134135 const server = useServer ( )
135136 const platform = usePlatform ( )
136137 const language = useLanguage ( )
138+ const settings = useSettings ( )
137139 const sync = useSync ( )
138140 const terminal = useTerminal ( )
139141 const { params, view } = useSessionLayout ( )
@@ -151,6 +153,11 @@ export function SessionHeader() {
151153 } )
152154 const hotkey = createMemo ( ( ) => command . keybind ( "file.open" ) )
153155 const os = createMemo ( ( ) => detectOS ( platform ) )
156+ const isDesktopBeta = platform . platform === "desktop" && import . meta. env . VITE_OPENCODE_CHANNEL === "beta"
157+ const search = createMemo ( ( ) => ! isDesktopBeta || settings . general . showSearch ( ) )
158+ const tree = createMemo ( ( ) => ! isDesktopBeta || settings . general . showFileTree ( ) )
159+ const term = createMemo ( ( ) => ! isDesktopBeta || settings . general . showTerminal ( ) )
160+ const status = createMemo ( ( ) => ! isDesktopBeta || settings . general . showStatus ( ) )
154161
155162 const [ exists , setExists ] = createStore < Partial < Record < OpenApp , boolean > > > ( {
156163 finder : true ,
@@ -262,12 +269,16 @@ export function SessionHeader() {
262269 . catch ( ( err : unknown ) => showRequestError ( language , err ) )
263270 }
264271
265- const centerMount = createMemo ( ( ) => document . getElementById ( "opencode-titlebar-center" ) )
266- const rightMount = createMemo ( ( ) => document . getElementById ( "opencode-titlebar-right" ) )
272+ const [ centerMount , setCenterMount ] = createSignal < HTMLElement | null > ( null )
273+ const [ rightMount , setRightMount ] = createSignal < HTMLElement | null > ( null )
274+ onMount ( ( ) => {
275+ setCenterMount ( document . getElementById ( "opencode-titlebar-center" ) )
276+ setRightMount ( document . getElementById ( "opencode-titlebar-right" ) )
277+ } )
267278
268279 return (
269280 < >
270- < Show when = { centerMount ( ) } >
281+ < Show when = { search ( ) && centerMount ( ) } >
271282 { ( mount ) => (
272283 < Portal mount = { mount ( ) } >
273284 < Button
@@ -415,24 +426,28 @@ export function SessionHeader() {
415426 </ div >
416427 </ Show >
417428 < div class = "flex items-center gap-1" >
418- < Tooltip placement = "bottom" value = { language . t ( "status.popover.trigger" ) } >
419- < StatusPopover />
420- </ Tooltip >
421- < TooltipKeybind
422- title = { language . t ( "command.terminal.toggle" ) }
423- keybind = { command . keybind ( "terminal.toggle" ) }
424- >
425- < Button
426- variant = "ghost"
427- class = "group/terminal-toggle titlebar-icon w-8 h-6 p-0 box-border shrink-0"
428- onClick = { toggleTerminal }
429- aria-label = { language . t ( "command.terminal.toggle" ) }
430- aria-expanded = { view ( ) . terminal . opened ( ) }
431- aria-controls = "terminal-panel"
429+ < Show when = { status ( ) } >
430+ < Tooltip placement = "bottom" value = { language . t ( "status.popover.trigger" ) } >
431+ < StatusPopover />
432+ </ Tooltip >
433+ </ Show >
434+ < Show when = { term ( ) } >
435+ < TooltipKeybind
436+ title = { language . t ( "command.terminal.toggle" ) }
437+ keybind = { command . keybind ( "terminal.toggle" ) }
432438 >
433- < Icon size = "small" name = { view ( ) . terminal . opened ( ) ? "terminal-active" : "terminal" } />
434- </ Button >
435- </ TooltipKeybind >
439+ < Button
440+ variant = "ghost"
441+ class = "group/terminal-toggle titlebar-icon w-8 h-6 p-0 box-border shrink-0"
442+ onClick = { toggleTerminal }
443+ aria-label = { language . t ( "command.terminal.toggle" ) }
444+ aria-expanded = { view ( ) . terminal . opened ( ) }
445+ aria-controls = "terminal-panel"
446+ >
447+ < Icon size = "small" name = { view ( ) . terminal . opened ( ) ? "terminal-active" : "terminal" } />
448+ </ Button >
449+ </ TooltipKeybind >
450+ </ Show >
436451
437452 < div class = "hidden md:flex items-center gap-1 shrink-0" >
438453 < TooltipKeybind
@@ -451,30 +466,32 @@ export function SessionHeader() {
451466 </ Button >
452467 </ TooltipKeybind >
453468
454- < TooltipKeybind
455- title = { language . t ( "command.fileTree.toggle" ) }
456- keybind = { command . keybind ( "fileTree.toggle" ) }
457- >
458- < Button
459- variant = "ghost"
460- class = "titlebar-icon w-8 h-6 p-0 box-border"
461- onClick = { ( ) => layout . fileTree . toggle ( ) }
462- aria-label = { language . t ( "command.fileTree.toggle" ) }
463- aria-expanded = { layout . fileTree . opened ( ) }
464- aria-controls = "file-tree-panel"
469+ < Show when = { tree ( ) } >
470+ < TooltipKeybind
471+ title = { language . t ( "command.fileTree.toggle" ) }
472+ keybind = { command . keybind ( "fileTree.toggle" ) }
465473 >
466- < div class = "relative flex items-center justify-center size-4" >
467- < Icon
468- size = "small"
469- name = { layout . fileTree . opened ( ) ? "file-tree-active" : "file-tree" }
470- classList = { {
471- "text-icon-strong" : layout . fileTree . opened ( ) ,
472- "text-icon-weak" : ! layout . fileTree . opened ( ) ,
473- } }
474- />
475- </ div >
476- </ Button >
477- </ TooltipKeybind >
474+ < Button
475+ variant = "ghost"
476+ class = "titlebar-icon w-8 h-6 p-0 box-border"
477+ onClick = { ( ) => layout . fileTree . toggle ( ) }
478+ aria-label = { language . t ( "command.fileTree.toggle" ) }
479+ aria-expanded = { layout . fileTree . opened ( ) }
480+ aria-controls = "file-tree-panel"
481+ >
482+ < div class = "relative flex items-center justify-center size-4" >
483+ < Icon
484+ size = "small"
485+ name = { layout . fileTree . opened ( ) ? "file-tree-active" : "file-tree" }
486+ classList = { {
487+ "text-icon-strong" : layout . fileTree . opened ( ) ,
488+ "text-icon-weak" : ! layout . fileTree . opened ( ) ,
489+ } }
490+ />
491+ </ div >
492+ </ Button >
493+ </ TooltipKeybind >
494+ </ Show >
478495 </ div >
479496 </ div >
480497 </ div >
0 commit comments