feat(desktop): add log viewer entry points (NavRail + Help menu)

This commit is contained in:
zhayujie
2026-06-22 16:30:11 +08:00
parent c432681b2b
commit 215ed24401
3 changed files with 25 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ import type { MenuItemConstructorOptions } from 'electron'
const isMac = process.platform === 'darwin'
const SKILL_HUB_URL = 'https://skills.cowagent.ai/'
const DOCS_URL = 'https://docs.cowagent.ai'
// Send a menu-triggered action to the renderer (e.g. new chat, open settings).
function emit(win: BrowserWindow | null, action: string) {
@@ -90,7 +91,12 @@ export function buildAppMenu(getWindow: () => BrowserWindow | null) {
const helpMenu: MenuItemConstructorOptions = {
label: 'Help',
submenu: [{ label: 'Skill Hub', click: () => shell.openExternal(SKILL_HUB_URL) }],
submenu: [
{ label: 'View Logs', click: () => emit(win(), 'view-logs') },
{ type: 'separator' },
{ label: 'Documentation', click: () => shell.openExternal(DOCS_URL) },
{ label: 'Skill Hub', click: () => shell.openExternal(SKILL_HUB_URL) },
],
}
const template: MenuItemConstructorOptions[] = [

View File

@@ -40,6 +40,8 @@ const App: React.FC = () => {
navigate('/')
} else if (action === 'open-settings') {
navigate('/settings')
} else if (action === 'view-logs') {
navigate('/logs')
}
})
return off

View File

@@ -12,6 +12,7 @@ import {
PanelLeftOpen,
Sun,
Moon,
ScrollText,
} from 'lucide-react'
import type { LucideIcon } from 'lucide-react'
import { t, getLang, setLang, Lang } from '../i18n'
@@ -88,6 +89,14 @@ const NavRail: React.FC<NavRailProps> = ({ onLangChange }) => {
{/* Footer actions */}
<div className={`flex-shrink-0 px-2 py-2 border-t border-subtle ${collapsed ? 'space-y-0.5' : 'flex items-center gap-1'}`}>
<FooterBtn
collapsed={collapsed}
onClick={() => navigate('/logs')}
title={t('menu_logs')}
active={location.pathname === '/logs'}
>
<ScrollText size={17} />
</FooterBtn>
<FooterBtn collapsed={collapsed} onClick={toggleTheme} title={theme === 'dark' ? 'Light' : 'Dark'}>
{theme === 'dark' ? <Sun size={17} /> : <Moon size={17} />}
</FooterBtn>
@@ -108,14 +117,17 @@ const FooterBtn: React.FC<{
collapsed: boolean
onClick: () => void
title: string
active?: boolean
children: React.ReactNode
}> = ({ collapsed, onClick, title, children }) => (
}> = ({ collapsed, onClick, title, active, children }) => (
<button
onClick={onClick}
title={title}
className={`inline-flex items-center gap-1.5 rounded-btn text-content-tertiary hover:text-content hover:bg-surface-2 cursor-pointer transition-colors ${
collapsed ? 'w-full h-9 justify-center' : 'h-8 px-2'
}`}
className={`inline-flex items-center gap-1.5 rounded-btn cursor-pointer transition-colors ${
active
? 'bg-accent-soft text-accent'
: 'text-content-tertiary hover:text-content hover:bg-surface-2'
} ${collapsed ? 'w-full h-9 justify-center' : 'h-8 px-2'}`}
>
{children}
</button>