@@ -67,7 +67,7 @@ export function useTitlebarRightMount() {
6767 return mount
6868}
6969
70- export function Titlebar ( props : { update ?: TitlebarUpdate } ) {
70+ export function Titlebar ( props : { update ?: TitlebarUpdate ; debugTools ?: { visible : boolean ; toggle : ( ) => void } } ) {
7171 const layout = useLayout ( )
7272 const platform = usePlatform ( )
7373 const command = useCommand ( )
@@ -462,7 +462,7 @@ export function Titlebar(props: { update?: TitlebarUpdate }) {
462462 "md:pl-4" : ! mac ( ) ,
463463 } }
464464 >
465- < ChannelIndicator />
465+ < ChannelIndicator debugTools = { props . debugTools } />
466466 < Show when = { windows ( ) || linux ( ) } >
467467 < WindowsAppMenu command = { command } platform = { platform } variant = "v2" />
468468 </ Show >
@@ -660,9 +660,9 @@ export function Titlebar(props: { update?: TitlebarUpdate }) {
660660 </ div >
661661 </ Show >
662662 < div id = "opencode-titlebar-left" class = "flex items-center gap-3 min-w-0 px-2" />
663- < ChannelIndicator />
664663 </ div >
665664 </ div >
665+ < ChannelIndicator debugTools = { props . debugTools } />
666666 </ div >
667667 </ div >
668668
@@ -747,12 +747,27 @@ function TitlebarUpdateIconButton(props: { state: TitlebarUpdatePillState }) {
747747 )
748748}
749749
750- function ChannelIndicator ( ) {
750+ function ChannelIndicator ( props : { debugTools ?: { visible : boolean ; toggle : ( ) => void } } ) {
751+ const channel = import . meta. env . VITE_OPENCODE_CHANNEL
752+ if ( channel === "dev" && props . debugTools ) {
753+ return (
754+ < button
755+ type = "button"
756+ class = "bg-icon-interactive-base text-[#FFF] font-medium px-2 rounded-sm uppercase font-mono cursor-pointer"
757+ onClick = { props . debugTools . toggle }
758+ aria-label = "Toggle debug tools"
759+ aria-pressed = { props . debugTools . visible }
760+ >
761+ DEV
762+ </ button >
763+ )
764+ }
765+
751766 return (
752767 < >
753- { [ "beta" , "dev" ] . includes ( import . meta . env . VITE_OPENCODE_CHANNEL ) && (
768+ { [ "beta" , "dev" ] . includes ( channel ) && (
754769 < div class = "bg-icon-interactive-base text-[#FFF] font-medium px-2 rounded-sm uppercase font-mono" >
755- { import . meta . env . VITE_OPENCODE_CHANNEL . toUpperCase ( ) }
770+ { channel . toUpperCase ( ) }
756771 </ div >
757772 ) }
758773 </ >
0 commit comments