Skip to content

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

Go

refactor(web): move sidebar layout shell to layout.tsx

Naiyuan Qinge3643514d477
diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx
index 08c187da73..42055417d5 100644
--- a/apps/web/app/layout.tsx
+++ b/apps/web/app/layout.tsx
@@ -1,7 +1,8 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono, Inter } from "next/font/google";
import "@multica/ui/globals.css";
-import { SidebarProvider } from "@multica/ui/components/ui/sidebar";
+import { SidebarProvider, SidebarInset, SidebarTrigger } from "@multica/ui/components/ui/sidebar";
+import { AppSidebar } from "@multica/ui/components/app-sidebar";
const inter = Inter({subsets:['latin'],variable:'--font-sans'});
@@ -20,6 +21,12 @@ export const metadata: Metadata = {
description: "Generated by create next app",
};
+const NAV_ITEMS = [
+ { title: "Home", url: "#" },
+ { title: "Documents", url: "#" },
+ { title: "Settings", url: "#" },
+];
+
export default function RootLayout({
children,
}: Readonly<{
@@ -31,7 +38,17 @@ export default function RootLayout({
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<SidebarProvider>
- {children}
+ <AppSidebar items={NAV_ITEMS} />
+ <SidebarInset>
+ <div className="flex h-dvh overflow-hidden">
+ <header className="flex items-center p-2">
+ <SidebarTrigger />
+ </header>
+ <div className="flex-1">
+ {children}
+ </div>
+ </div>
+ </SidebarInset>
</SidebarProvider>
</body>
</html>
diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx
index 723829f381..0aabd23b6c 100644
--- a/apps/web/app/page.tsx
+++ b/apps/web/app/page.tsx
@@ -1,25 +1,5 @@
-"use client"
-
-import { AppSidebar } from "@multica/ui/components/app-sidebar"
-import { SidebarInset, SidebarTrigger } from "@multica/ui/components/ui/sidebar"
-import { Chat } from "./components/chat"
-
-const NAV_ITEMS = [
- { title: "Home", url: "#" },
- { title: "Documents", url: "#" },
- { title: "Settings", url: "#" },
-]
+import { Chat } from "./components/chat";
export default function Page() {
- return (
- <>
- <AppSidebar items={NAV_ITEMS} />
- <SidebarInset>
- <header className="flex h-12 items-center border-b px-4">
- <SidebarTrigger />
- </header>
- <Chat />
- </SidebarInset>
- </>
- )
+ return <Chat />;
}