Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(desktop): add title bar, dashboard shell, sidebar, and shared components
Naiyuan Qingdafd51e3276d
diff --git a/apps/desktop/src/renderer/src/components/app-sidebar.tsx b/apps/desktop/src/renderer/src/components/app-sidebar.tsxnew file mode 100644index 0000000000..22d4ed8960--- /dev/null+++ b/apps/desktop/src/renderer/src/components/app-sidebar.tsx@@ -0,0 +1,236 @@+import React from "react";+import { AppLink } from "@multica/views/navigation";+import { useNavigation } from "@multica/views/navigation";+import {+ Inbox,+ ListTodo,+ Bot,+ Monitor,+ ChevronDown,+ Settings,+ LogOut,+ Plus,+ Check,+ BookOpenText,+ SquarePen,+ CircleUser,+} from "lucide-react";+import { WorkspaceAvatar } from "@multica/views/workspace/workspace-avatar";+import { useIssueDraftStore } from "@multica/core/issues/stores/draft-store";+import {+ Sidebar,+ SidebarContent,+ SidebarGroup,+ SidebarGroupContent,+ SidebarHeader,+ SidebarFooter,+ SidebarMenu,+ SidebarMenuButton,+ SidebarMenuItem,+ SidebarRail,+} from "@multica/ui/components/ui/sidebar";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuGroup,+ DropdownMenuItem,+ DropdownMenuLabel,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@multica/ui/components/ui/dropdown-menu";+import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";+import { useAuthStore } from "@/platform/auth";+import { useWorkspaceStore } from "@/platform/workspace";+import { useQuery } from "@tanstack/react-query";+import { inboxKeys, deduplicateInboxItems } from "@multica/core/inbox/queries";+import { api } from "@/platform/api";+import { useModalStore } from "@multica/core/modals";++const primaryNav = [+ { href: "/inbox", label: "Inbox", icon: Inbox },+ { href: "/my-issues", label: "My Issues", icon: CircleUser },+ { href: "/issues", label: "Issues", icon: ListTodo },+];++const workspaceNav = [+ { href: "/agents", label: "Agents", icon: Bot },+ { href: "/runtimes", label: "Runtimes", icon: Monitor },+ { href: "/skills", label: "Skills", icon: BookOpenText },+ { href: "/settings", label: "Settings", icon: Settings },+];++function DraftDot() {+ const hasDraft = useIssueDraftStore((s) => !!(s.draft.title || s.draft.description));+ if (!hasDraft) return null;+ return <span className="absolute top-0 right-0 size-1.5 rounded-full bg-brand" />;+}++export function AppSidebar() {+ const { pathname, push } = useNavigation();+ const user = useAuthStore((s) => s.user);+ const authLogout = useAuthStore((s) => s.logout);+ const workspace = useWorkspaceStore((s) => s.workspace);+ const workspaces = useWorkspaceStore((s) => s.workspaces);+ const switchWorkspace = useWorkspaceStore((s) => s.switchWorkspace);++ const wsId = workspace?.id;+ const { data: inboxItems = [] } = useQuery({+ queryKey: wsId ? inboxKeys.list(wsId) : ["inbox", "disabled"],+ queryFn: () => api.listInbox(),+ enabled: !!wsId,+ });+ const unreadCount = React.useMemo(+ () => deduplicateInboxItems(inboxItems).filter((i) => !i.read).length,+ [inboxItems],+ );++ const logout = () => {+ push("/");+ authLogout();+ useWorkspaceStore.getState().clearWorkspace();+ };++ return (+ <Sidebar variant="inset">+ {/* Workspace Switcher */}+ <SidebarHeader className="py-3">+ <div className="flex items-center gap-4">+ <SidebarMenu className="min-w-0 flex-1">+ <SidebarMenuItem>+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <SidebarMenuButton>+ <WorkspaceAvatar name={workspace?.name ?? "M"} size="sm" />+ <span className="flex-1 truncate font-medium">+ {workspace?.name ?? "Multica"}+ </span>+ <ChevronDown className="size-3 text-muted-foreground" />+ </SidebarMenuButton>+ }+ />+ <DropdownMenuContent+ className="w-52"+ align="start"+ side="bottom"+ sideOffset={4}+ >+ <DropdownMenuGroup>+ <DropdownMenuLabel className="text-xs text-muted-foreground">+ {user?.email}+ </DropdownMenuLabel>+ </DropdownMenuGroup>+ <DropdownMenuSeparator />+ <DropdownMenuGroup className="group/ws-section">+ <DropdownMenuLabel className="flex items-center text-xs text-muted-foreground">+ Workspaces+ <Tooltip>+ <TooltipTrigger+ className="ml-auto opacity-0 group-hover/ws-section:opacity-100 transition-opacity rounded hover:bg-accent p-0.5"+ onClick={() => useModalStore.getState().open("create-workspace")}+ >+ <Plus className="h-3.5 w-3.5" />+ </TooltipTrigger>+ <TooltipContent side="right">+ Create workspace+ </TooltipContent>+ </Tooltip>+ </DropdownMenuLabel>+ {workspaces.map((ws) => (+ <DropdownMenuItem+ key={ws.id}+ onClick={() => {+ if (ws.id !== workspace?.id) {+ push("/issues");+ switchWorkspace(ws.id);+ }+ }}+ >+ <WorkspaceAvatar name={ws.name} size="sm" />+ <span className="flex-1 truncate">{ws.name}</span>+ {ws.id === workspace?.id && (+ <Check className="h-3.5 w-3.5 text-primary" />+ )}+ </DropdownMenuItem>+ ))}+ </DropdownMenuGroup>+ <DropdownMenuSeparator />+ <DropdownMenuGroup>+ <DropdownMenuItem variant="destructive" onClick={logout}>+ <LogOut className="h-3.5 w-3.5" />+ Log out+ </DropdownMenuItem>+ </DropdownMenuGroup>+ </DropdownMenuContent>+ </DropdownMenu>+ </SidebarMenuItem>+ </SidebarMenu>+ <Tooltip>+ <TooltipTrigger+ className="relative flex h-7 w-7 items-center justify-center rounded-lg bg-background text-foreground shadow-sm hover:bg-accent"+ onClick={() => useModalStore.getState().open("create-issue")}+ >+ <SquarePen className="size-3.5" />+ <DraftDot />+ </TooltipTrigger>+ <TooltipContent side="bottom">New issue</TooltipContent>+ </Tooltip>+ </div>+ </SidebarHeader>++ {/* Navigation */}+ <SidebarContent>+ <SidebarGroup>+ <SidebarGroupContent>+ <SidebarMenu className="gap-0.5">+ {primaryNav.map((item) => {+ const isActive = pathname === item.href;+ return (+ <SidebarMenuItem key={item.href}>+ <SidebarMenuButton+ isActive={isActive}+ render={<AppLink href={item.href} />}+ className="text-muted-foreground hover:not-data-active:bg-sidebar-accent/70 data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground"+ >+ <item.icon />+ <span>{item.label}</span>+ {item.label === "Inbox" && unreadCount > 0 && (+ <span className="ml-auto text-xs">+ {unreadCount > 99 ? "99+" : unreadCount}+ </span>+ )}+ </SidebarMenuButton>+ </SidebarMenuItem>+ );+ })}+ </SidebarMenu>+ </SidebarGroupContent>+ </SidebarGroup>++ <SidebarGroup>+ <SidebarGroupContent>+ <SidebarMenu className="gap-0.5">+ {workspaceNav.map((item) => {+ const isActive = pathname === item.href;+ return (+ <SidebarMenuItem key={item.href}>+ <SidebarMenuButton+ isActive={isActive}+ render={<AppLink href={item.href} />}+ className="text-muted-foreground hover:not-data-active:bg-sidebar-accent/70 data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground"+ >+ <item.icon />+ <span>{item.label}</span>+ </SidebarMenuButton>+ </SidebarMenuItem>+ );+ })}+ </SidebarMenu>+ </SidebarGroupContent>+ </SidebarGroup>+ </SidebarContent>+ <SidebarFooter />+ <SidebarRail />+ </Sidebar>+ );+}diff --git a/apps/desktop/src/renderer/src/components/dashboard-shell.tsx b/apps/desktop/src/renderer/src/components/dashboard-shell.tsxnew file mode 100644index 0000000000..a0618002a2--- /dev/null+++ b/apps/desktop/src/renderer/src/components/dashboard-shell.tsx@@ -0,0 +1,74 @@+import { useEffect } from "react";+import { Outlet, useLocation, useNavigate } from "react-router-dom";+import { useNavigationStore } from "@multica/core/navigation";+import { SidebarProvider, SidebarInset } from "@multica/ui/components/ui/sidebar";+import { WorkspaceIdProvider } from "@multica/core/hooks";+import { ModalRegistry } from "@multica/views/modals/registry";+import { useAuthStore } from "@/platform/auth";+import { useWorkspaceStore } from "@/platform/workspace";+import { DesktopNavigationProvider } from "@/platform/navigation";+import { AuthInitializer } from "@/platform/auth-initializer";+import { DesktopWSProvider } from "@/platform/ws-provider";+import { TitleBar } from "./title-bar";+import { AppSidebar } from "./app-sidebar";+import { MulticaIcon } from "./multica-icon";++export function DashboardShell() {+ const navigate = useNavigate();+ const location = useLocation();+ const user = useAuthStore((s) => s.user);+ const isLoading = useAuthStore((s) => s.isLoading);+ const workspace = useWorkspaceStore((s) => s.workspace);++ useEffect(() => {+ if (!isLoading && !user) {+ navigate("/login", { replace: true });+ }+ }, [user, isLoading, navigate]);++ useEffect(() => {+ useNavigationStore.getState().onPathChange(location.pathname);+ }, [location.pathname]);++ if (isLoading) {+ return (+ <div className="flex h-screen flex-col">+ <TitleBar />+ <div className="flex flex-1 items-center justify-center">+ <MulticaIcon className="size-6" />+ </div>+ </div>+ );+ }++ if (!user) return null;++ return (+ <DesktopNavigationProvider>+ <AuthInitializer>+ <DesktopWSProvider>+ <div className="flex h-screen flex-col">+ <TitleBar />+ <div className="flex flex-1 min-h-0">+ <SidebarProvider className="flex-1">+ <AppSidebar />+ <SidebarInset className="overflow-hidden">+ {workspace ? (+ <WorkspaceIdProvider wsId={workspace.id}>+ <Outlet />+ <ModalRegistry />+ </WorkspaceIdProvider>+ ) : (+ <div className="flex flex-1 items-center justify-center">+ <MulticaIcon className="size-6 animate-pulse" />+ </div>+ )}+ </SidebarInset>+ </SidebarProvider>+ </div>+ </div>+ </DesktopWSProvider>+ </AuthInitializer>+ </DesktopNavigationProvider>+ );+}diff --git a/apps/desktop/src/renderer/src/components/multica-icon.tsx b/apps/desktop/src/renderer/src/components/multica-icon.tsxnew file mode 100644index 0000000000..52b0fe82f7--- /dev/null+++ b/apps/desktop/src/renderer/src/components/multica-icon.tsx@@ -0,0 +1,105 @@+import { useState, useEffect } from "react";+import { cn } from "@multica/ui/lib/utils";++interface MulticaIconProps extends React.ComponentProps<"span"> {+ /**+ * If true, play a one-time entrance spin animation.+ */+ animate?: boolean;+ /**+ * If true, disable hover spin animation.+ */+ noSpin?: boolean;+ /**+ * If true, show a border around the icon.+ */+ bordered?: boolean;+ /**+ * Size of the bordered icon: "sm" (default), "md", "lg"+ */+ size?: "sm" | "md" | "lg";+}++const borderedSizes = {+ sm: { wrapper: "p-1.5", icon: "size-3.5" },+ md: { wrapper: "p-2", icon: "size-4" },+ lg: { wrapper: "p-2.5", icon: "size-5" },+};++/**+ * Pure CSS 8-pointed asterisk icon matching the Multica logo.+ * Uses currentColor so it adapts to light/dark themes automatically.+ * Clip-path polygon traced from the original SVG path coordinates.+ */+export function MulticaIcon({+ className,+ animate = false,+ noSpin = false,+ bordered = false,+ size = "sm",+ ...props+}: MulticaIconProps) {+ const [entranceDone, setEntranceDone] = useState(!animate);++ useEffect(() => {+ if (!animate) return;+ const timer = setTimeout(() => setEntranceDone(true), 600);+ return () => clearTimeout(timer);+ }, [animate]);++ const clipPath = `polygon(+ 45% 62.1%, 45% 100%, 55% 100%, 55% 62.1%,+ 81.8% 88.9%, 88.9% 81.8%, 62.1% 55%, 100% 55%,+ 100% 45%, 62.1% 45%, 88.9% 18.2%, 81.8% 11.1%,+ 55% 37.9%, 55% 0%, 45% 0%, 45% 37.9%,+ 18.2% 11.1%, 11.1% 18.2%, 37.9% 45%, 0% 45%,+ 0% 55%, 37.9% 55%, 11.1% 81.8%, 18.2% 88.9%+ )`;++ if (bordered) {+ const sizeConfig = borderedSizes[size];+ return (+ <span+ className={cn(+ "inline-flex items-center justify-center border border-border rounded-md",+ sizeConfig.wrapper,+ className+ )}+ aria-hidden="true"+ {...props}+ >+ <span+ className={cn(+ "block",+ sizeConfig.icon,+ !entranceDone && "animate-entrance-spin",+ entranceDone && !noSpin && "hover:animate-spin"+ )}+ >+ <span+ className="block size-full bg-current"+ style={{ clipPath }}+ />+ </span>+ </span>+ );+ }++ return (+ <span+ className={cn(+ "inline-block size-[1em]",+ !entranceDone && "animate-entrance-spin",+ entranceDone && !noSpin && "hover:animate-spin",+ className+ )}+ aria-hidden="true"+ {...props}+ >+ <span+ className="block size-full bg-current"+ style={{ clipPath }}+ />+ </span>+ );+}diff --git a/apps/desktop/src/renderer/src/components/theme-provider.tsx b/apps/desktop/src/renderer/src/components/theme-provider.tsxnew file mode 100644index 0000000000..f002f090c6--- /dev/null+++ b/apps/desktop/src/renderer/src/components/theme-provider.tsx@@ -0,0 +1,21 @@+import { ThemeProvider as NextThemesProvider } from "next-themes";+import { TooltipProvider } from "@multica/ui/components/ui/tooltip";++export function ThemeProvider({+ children,+ ...props+}: React.ComponentProps<typeof NextThemesProvider>) {+ return (+ <NextThemesProvider+ attribute="class"+ defaultTheme="system"+ enableSystem+ disableTransitionOnChange+ {...props}+ >+ <TooltipProvider delay={500}>+ {children}+ </TooltipProvider>+ </NextThemesProvider>+ );+}diff --git a/apps/desktop/src/renderer/src/components/title-bar.tsx b/apps/desktop/src/renderer/src/components/title-bar.tsxnew file mode 100644index 0000000000..cd609df534--- /dev/null+++ b/apps/desktop/src/renderer/src/components/title-bar.tsx@@ -0,0 +1,17 @@+export function TitleBar() {+ return (+ <div+ className="h-11 shrink-0 flex items-center border-b bg-sidebar select-none"+ style={{ WebkitAppRegion: "drag" } as React.CSSProperties}+ >+ {/* Left: traffic light inset area (macOS) */}+ <div className="w-[78px] shrink-0" />++ {/* Center: reserved for future tabs */}+ <div className="flex-1 flex items-center px-2" />++ {/* Right: reserved for future window actions */}+ <div className="w-10 shrink-0" />+ </div>+ );+}