// App shell migrated from A2A learning/apps/console/src/App.tsx. import { useCallback, useEffect, useState } from 'react'; import { Button, Dropdown } from 'antd'; import { ChevronUp, LogOut, Moon, Sun, UserRound } from 'lucide-react'; import { SidebarNavigation } from './components/SidebarNavigation'; import { ManagedCampaignListPage } from './pages/LearningCampaignPages'; import { ProgressPage } from './pages/ProgressPage'; import { TaskDetailPage } from './pages/TaskDetailPage'; import { CandidatesPage } from './pages/CandidatesPage'; import { TestsPage } from './pages/TestsPage'; import type { AuthStatus } from './types'; function routePath() { return location.hash.slice(1) || '/tasks'; } export function A2AWorkbench({ auth, onLogout, dark, onTheme }: { auth: AuthStatus; onLogout: () => void; dark: boolean; onTheme: () => void }) { const [path, setPath] = useState(routePath); useEffect(() => { const update = () => setPath(routePath()); window.addEventListener('hashchange', update); return () => window.removeEventListener('hashchange', update); }, []); const navigate = useCallback((next: string) => { location.hash = next; }, []); const category = path.split('/')[1] || 'tasks'; const detailId = path.split('/')[2]; const accountName = auth.user?.display_name || auth.user?.username || '维护者'; let content = ; if (category === 'tasks' && detailId) content = ; if (category === 'overview') content = ; if (category === 'candidates') content = ; if (category === 'validations') content = ; return
学习管理 / {({ tasks: '学习批次', overview: '账本总览', candidates: '能力实体', validations: '脚本测试' } as Record)[category] || '学习批次'}
{content}
; }