Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

refactor(apps): simplify layout components to pure navigation shells

Naiyuan Qing972c887b43a2
diff --git a/apps/desktop/src/pages/layout.tsx b/apps/desktop/src/pages/layout.tsx
index 48d167ffb9..63a536b20c 100644
--- a/apps/desktop/src/pages/layout.tsx
+++ b/apps/desktop/src/pages/layout.tsx
@@ -1,5 +1,4 @@
import { Outlet, NavLink, useLocation } from 'react-router-dom'
-import { useHubInit, useGatewayStore, useHubStore, clearConnection } from '@multica/store'
import { Toaster } from '@multica/ui/components/ui/sonner'
import { Button } from '@multica/ui/components/ui/button'
import { HugeiconsIcon } from '@hugeicons/react'
@@ -20,20 +19,8 @@ const tabs = [
]
export default function Layout() {
- useHubInit()
const location = useLocation()
- const gwState = useGatewayStore((s) => s.connectionState)
- const hubId = useGatewayStore((s) => s.hubId)
- const activeAgentId = useHubStore((s) => s.activeAgentId)
- const isConnected = gwState === 'registered' && !!hubId && !!activeAgentId
-
- const handleDisconnect = () => {
- useGatewayStore.getState().disconnect()
- useHubStore.getState().reset()
- clearConnection()
- }
-
return (
<div className="h-dvh flex flex-col bg-background">
{/* Header */}
@@ -42,16 +29,6 @@ export default function Layout() {
<span className="text-lg font-semibold">Multica</span>
</div>
<div className="flex items-center gap-1">
- {isConnected && (
- <Button
- variant="ghost"
- size="sm"
- onClick={handleDisconnect}
- className="text-xs text-muted-foreground"
- >
- Disconnect
- </Button>
- )}
<Button variant="ghost" size="icon">
<HugeiconsIcon icon={Settings02Icon} className="size-5" />
</Button>
diff --git a/apps/web/app/app-header.tsx b/apps/web/app/app-header.tsx
index e6052a26f5..63b4fa4bdb 100644
--- a/apps/web/app/app-header.tsx
+++ b/apps/web/app/app-header.tsx
@@ -1,28 +1,9 @@
"use client";
-import {
- useHubInit,
- useGatewayStore,
- useHubStore,
- clearConnection,
-} from "@multica/store";
import { Button } from "@multica/ui/components/ui/button";
import { ThemeToggle } from "./theme-toggle";
export function AppHeader({ children }: { children: React.ReactNode }) {
- useHubInit();
-
- const gwState = useGatewayStore((s) => s.connectionState);
- const hubId = useGatewayStore((s) => s.hubId);
- const activeAgentId = useHubStore((s) => s.activeAgentId);
- const isConnected = gwState === "registered" && !!hubId && !!activeAgentId;
-
- const handleDisconnect = () => {
- useGatewayStore.getState().disconnect();
- useHubStore.getState().reset();
- clearConnection();
- };
-
return (
<>
<header>
@@ -35,16 +16,6 @@ export function AppHeader({ children }: { children: React.ReactNode }) {
</div>
<div className="flex items-center gap-1">
<ThemeToggle />
- {isConnected && (
- <Button
- variant="ghost"
- size="sm"
- onClick={handleDisconnect}
- className="text-xs text-muted-foreground"
- >
- Disconnect
- </Button>
- )}
</div>
</div>
</header>