Skip to content

Commit ca71ef9

Browse files
authored
feat: add Gateway button to dashboard header (#10)
lgtm
1 parent de445ae commit ca71ef9

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
name: Release
55

66
on:
7-
pull_request:
8-
branches:
9-
- main
107
push:
118
tags:
129
- 'v*'

src/components/layout/Header.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
* On the Chat page, shows session selector, refresh, thinking toggle, and new session.
55
*/
66
import { useLocation } from 'react-router-dom';
7+
import { Terminal } from 'lucide-react';
78
import { ChatToolbar } from '@/pages/Chat/ChatToolbar';
9+
import { Button } from '@/components/ui/button';
810

911
// Page titles mapping
1012
const 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

Comments
 (0)