Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(desktop): add pages for Home, Tools, and Skills with routing
Jiang Bohan391bf3262533
diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsxindex bd26458bce..df6ae8b16f 100644--- a/apps/desktop/src/App.tsx+++ b/apps/desktop/src/App.tsx@@ -1,10 +1,21 @@import { createHashRouter, RouterProvider } from 'react-router-dom'+import Layout from './pages/layout'import HomePage from './pages/home'import ChatPage from './pages/chat'+import ToolsPage from './pages/tools'+import SkillsPage from './pages/skills'const router = createHashRouter([- { path: '/', element: <HomePage /> },- { path: '/chat', element: <ChatPage /> },+ {+ path: '/',+ element: <Layout />,+ children: [+ { index: true, element: <HomePage /> },+ { path: 'chat', element: <ChatPage /> },+ { path: 'tools', element: <ToolsPage /> },+ { path: 'skills', element: <SkillsPage /> },+ ],+ },])export default function App() {diff --git a/apps/desktop/src/pages/home.tsx b/apps/desktop/src/pages/home.tsxindex c804251142..31cddf40fa 100644--- a/apps/desktop/src/pages/home.tsx+++ b/apps/desktop/src/pages/home.tsx@@ -1,12 +1,174 @@import { useNavigate } from 'react-router-dom'import { Button } from '@multica/ui/components/ui/button'+import { HugeiconsIcon } from '@hugeicons/react'+import {+ Comment01Icon,+ LinkSquare01Icon,+ Loading03Icon,+ AlertCircleIcon,+} from '@hugeicons/core-free-icons'+import { ConnectionQRCode } from '../components/qr-code'+import { useHub } from '../hooks/use-hub'export default function HomePage() {const navigate = useNavigate()+ const { hubInfo, agents, loading, error } = useHub()++ // Get the first agent (or create one if none exists)+ const primaryAgent = agents[0]++ // Connection state indicator+ // Note: 'registered' means fully connected and registered with Gateway+ const connectionState = hubInfo?.connectionState ?? 'disconnected'+ const isConnected = connectionState === 'connected' || connectionState === 'registered'++ // Loading state+ if (loading) {+ return (+ <div className="h-full flex items-center justify-center">+ <div className="flex items-center gap-3 text-muted-foreground">+ <HugeiconsIcon icon={Loading03Icon} className="size-5 animate-spin" />+ <span>Connecting to Hub...</span>+ </div>+ </div>+ )+ }++ // Error state+ if (error) {+ return (+ <div className="h-full flex items-center justify-center">+ <div className="flex flex-col items-center gap-3 text-destructive">+ <HugeiconsIcon icon={AlertCircleIcon} className="size-8" />+ <span className="font-medium">Connection Error</span>+ <span className="text-sm text-muted-foreground">{error}</span>+ </div>+ </div>+ )+ }return (- <div className="flex h-screen items-center justify-center">- <Button onClick={() => navigate('/chat')}>Open Chat</Button>+ <div className="h-full flex flex-col">+ {/* Main content - QR + Status */}+ <div className="flex-1 flex gap-8 p-2">+ {/* Left: QR Code */}+ <div className="flex-1 flex flex-col items-center justify-center">+ <ConnectionQRCode+ gateway={hubInfo?.url ?? 'http://localhost:3000'}+ hubId={hubInfo?.hubId ?? 'unknown'}+ agentId={primaryAgent?.id}+ expirySeconds={300}+ size={180}+ />+ </div>++ {/* Right: Hub Status */}+ <div className="flex-1 flex flex-col justify-center">+ <div className="space-y-6">+ {/* Hub Header */}+ <div>+ <div className="flex items-center gap-2 mb-1">+ <span className="relative flex size-2.5">+ {isConnected ? (+ <>+ <span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" />+ <span className="relative inline-flex rounded-full size-2.5 bg-green-500" />+ </>+ ) : connectionState === 'connecting' || connectionState === 'reconnecting' ? (+ <>+ <span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-yellow-400 opacity-75" />+ <span className="relative inline-flex rounded-full size-2.5 bg-yellow-500" />+ </>+ ) : (+ <span className="relative inline-flex rounded-full size-2.5 bg-red-500" />+ )}+ </span>+ <span className={`text-sm font-medium ${+ isConnected+ ? 'text-green-600 dark:text-green-400'+ : connectionState === 'connecting' || connectionState === 'reconnecting'+ ? 'text-yellow-600 dark:text-yellow-400'+ : 'text-red-600 dark:text-red-400'+ }`}>+ {isConnected+ ? 'Hub Connected'+ : connectionState === 'connecting'+ ? 'Connecting...'+ : connectionState === 'reconnecting'+ ? 'Reconnecting...'+ : 'Disconnected'}+ </span>+ </div>+ <h2 className="text-2xl font-semibold tracking-tight">+ Local Hub+ </h2>+ <p className="text-sm text-muted-foreground font-mono">+ {hubInfo?.hubId ?? 'Initializing...'}+ </p>+ </div>++ {/* Stats Grid */}+ <div className="grid grid-cols-2 gap-4">+ <div className="p-4 rounded-lg bg-muted/50 border border-border/50">+ <p className="text-xs text-muted-foreground uppercase tracking-wider mb-1">+ Gateway+ </p>+ <p className="font-medium text-sm truncate" title={hubInfo?.url}>+ {hubInfo?.url ?? '-'}+ </p>+ </div>+ <div className="p-4 rounded-lg bg-muted/50 border border-border/50">+ <p className="text-xs text-muted-foreground uppercase tracking-wider mb-1">+ Connection+ </p>+ <p className="font-medium capitalize">{connectionState}</p>+ </div>+ <div className="p-4 rounded-lg bg-muted/50 border border-border/50">+ <p className="text-xs text-muted-foreground uppercase tracking-wider mb-1">+ Active Agents+ </p>+ <p className="font-medium">{hubInfo?.agentCount ?? 0}</p>+ </div>+ <div className="p-4 rounded-lg bg-muted/50 border border-border/50">+ <p className="text-xs text-muted-foreground uppercase tracking-wider mb-1">+ Primary Agent+ </p>+ <p className="font-medium text-sm font-mono truncate" title={primaryAgent?.id}>+ {primaryAgent?.id ?? 'None'}+ </p>+ </div>+ </div>+ </div>+ </div>+ </div>++ {/* Bottom: Actions */}+ <div className="border-t p-4">+ <div className="flex items-center justify-between">+ {/* Primary Action: Chat */}+ <Button+ size="lg"+ className="gap-2 px-6"+ onClick={() => navigate('/chat')}+ disabled={!isConnected}+ >+ <HugeiconsIcon icon={Comment01Icon} className="size-5" />+ Open Chat+ </Button>++ {/* Secondary: Connect to Remote */}+ <Button+ variant="ghost"+ size="sm"+ className="text-muted-foreground gap-1.5"+ disabled+ >+ <HugeiconsIcon icon={LinkSquare01Icon} className="size-4" />+ Connect to Remote Agent+ <span className="text-xs opacity-60">(Coming soon)</span>+ </Button>+ </div>+ </div></div>)}diff --git a/apps/desktop/src/pages/layout.tsx b/apps/desktop/src/pages/layout.tsxnew file mode 100644index 0000000000..e0922413f9--- /dev/null+++ b/apps/desktop/src/pages/layout.tsx@@ -0,0 +1,63 @@+import { Outlet, NavLink, useLocation } from 'react-router-dom'+import { Button } from '@multica/ui/components/ui/button'+import { HugeiconsIcon } from '@hugeicons/react'+import {+ Settings02Icon,+ Home01Icon,+ CodeIcon,+ PlugIcon,+ Comment01Icon,+} from '@hugeicons/core-free-icons'+import { cn } from '@multica/ui/lib/utils'++const tabs = [+ { path: '/', label: 'Home', icon: Home01Icon, exact: true },+ { path: '/chat', label: 'Chat', icon: Comment01Icon },+ { path: '/tools', label: 'Tools', icon: CodeIcon },+ { path: '/skills', label: 'Skills', icon: PlugIcon },+]++export default function Layout() {+ const location = useLocation()++ return (+ <div className="h-dvh flex flex-col bg-background">+ {/* Header */}+ <header className="flex items-center justify-between px-4 py-3 border-b">+ <div className="flex items-center gap-2">+ <span className="text-lg font-semibold">Multica</span>+ </div>+ <Button variant="ghost" size="icon">+ <HugeiconsIcon icon={Settings02Icon} className="size-5" />+ </Button>+ </header>++ {/* Tabs */}+ <nav className="flex gap-1 px-4 py-2 border-b">+ {tabs.map((tab) => {+ const isActive = tab.exact+ ? location.pathname === tab.path+ : location.pathname.startsWith(tab.path)++ return (+ <NavLink key={tab.path} to={tab.path}>+ <Button+ variant={isActive ? 'secondary' : 'ghost'}+ size="sm"+ className={cn('gap-2', isActive && 'bg-secondary')}+ >+ <HugeiconsIcon icon={tab.icon} className="size-4" />+ {tab.label}+ </Button>+ </NavLink>+ )+ })}+ </nav>++ {/* Content */}+ <main className="flex-1 overflow-auto p-4">+ <Outlet />+ </main>+ </div>+ )+}diff --git a/apps/desktop/src/pages/skills.tsx b/apps/desktop/src/pages/skills.tsxnew file mode 100644index 0000000000..fde22b9e88--- /dev/null+++ b/apps/desktop/src/pages/skills.tsx@@ -0,0 +1,42 @@+import {+ Card,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+} from '@multica/ui/components/ui/card'+import { useSkills } from '../hooks/use-skills'+import { SkillList } from '../components/skill-list'++export default function SkillsPage() {+ const {+ skills,+ loading,+ error,+ toggleSkill,+ refresh,+ } = useSkills()++ return (+ <div className="max-w-4xl mx-auto">+ <Card>+ <CardHeader>+ <CardTitle>Skills</CardTitle>+ <CardDescription>+ Manage agent skills. Skills provide specialized capabilities like Git integration,+ code review, and file manipulation. Toggle skills on/off to control agent behavior.+ </CardDescription>+ </CardHeader>+ <CardContent>+ <SkillList+ skills={skills}+ loading={loading}+ error={error}+ onToggleSkill={toggleSkill}+ onRefresh={refresh}+ />+ </CardContent>+ </Card>+ </div>+ )+}diff --git a/apps/desktop/src/pages/tools.tsx b/apps/desktop/src/pages/tools.tsxnew file mode 100644index 0000000000..6825db55fd--- /dev/null+++ b/apps/desktop/src/pages/tools.tsx@@ -0,0 +1,44 @@+import {+ Card,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+} from '@multica/ui/components/ui/card'+import { useTools } from '../hooks/use-tools'+import { ToolList } from '../components/tool-list'++export default function ToolsPage() {+ const {+ tools,+ groups,+ loading,+ error,+ toggleTool,+ refresh,+ } = useTools()++ return (+ <div className="max-w-4xl mx-auto">+ <Card>+ <CardHeader>+ <CardTitle>Tools</CardTitle>+ <CardDescription>+ Configure which tools are available to the Agent. Toggle individual tools on/off.+ Changes apply immediately to the running Agent.+ </CardDescription>+ </CardHeader>+ <CardContent>+ <ToolList+ tools={tools}+ groups={groups}+ loading={loading}+ error={error}+ onToggleTool={toggleTool}+ onRefresh={refresh}+ />+ </CardContent>+ </Card>+ </div>+ )+}