44 * On the Chat page, shows session selector, refresh, thinking toggle, and new session.
55 */
66import { useLocation } from 'react-router-dom' ;
7+ import { Terminal } from 'lucide-react' ;
78import { ChatToolbar } from '@/pages/Chat/ChatToolbar' ;
9+ import { Button } from '@/components/ui/button' ;
810
911// Page titles mapping
1012const pageTitles : Record < string , string > = {
@@ -20,13 +22,40 @@ export function Header() {
2022 const location = useLocation ( ) ;
2123 const currentTitle = pageTitles [ location . pathname ] || 'ClawX' ;
2224 const isChatPage = location . pathname === '/' ;
25+ const isDashboard = location . pathname === '/dashboard' ;
26+
27+ const handleOpenDevConsole = async ( ) => {
28+ try {
29+ const result = await window . electron . ipcRenderer . invoke ( 'gateway:getControlUiUrl' ) as { success : boolean ; url ?: string ; error ?: string } ;
30+ if ( result . success && result . url ) {
31+ window . electron . openExternal ( result . url ) ;
32+ } else {
33+ console . error ( 'Failed to get Dev Console URL:' , result . error ) ;
34+ }
35+ } catch ( err ) {
36+ console . error ( 'Error opening Dev Console:' , err ) ;
37+ }
38+ } ;
2339
2440 return (
2541 < header className = "flex h-14 items-center justify-between border-b bg-background px-6" >
2642 < h2 className = "text-lg font-semibold" > { currentTitle } </ h2 >
2743
2844 { /* Chat-specific controls */ }
2945 { isChatPage && < ChatToolbar /> }
46+
47+ { /* Dashboard specific controls - Dev Console Button */ }
48+ { isDashboard && (
49+ < Button
50+ variant = "ghost"
51+ size = "sm"
52+ className = "h-7 gap-1.5 rounded-full border border-neutral-200 px-3 text-xs font-normal text-neutral-500 hover:bg-neutral-50 hover:text-neutral-700 dark:border-neutral-800 dark:text-neutral-400 dark:hover:bg-neutral-900 dark:hover:text-neutral-200"
53+ onClick = { handleOpenDevConsole }
54+ >
55+ < Terminal className = "h-3.5 w-3.5" />
56+ Gateway
57+ </ Button >
58+ ) }
3059 </ header >
3160 ) ;
3261}
0 commit comments