diff --git a/frontend/ui/src/components/layout/app-layout.tsx b/frontend/ui/src/components/layout/app-layout.tsx index 69d4e22a..d6e7e4df 100644 --- a/frontend/ui/src/components/layout/app-layout.tsx +++ b/frontend/ui/src/components/layout/app-layout.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState, createContext, useContext, ReactNode } from "react"; +import { useState, useEffect, createContext, useContext, ReactNode } from "react"; import { usePathname } from "next/navigation"; import { Sidebar } from "./sidebar"; import { Button } from "@/components/ui/button"; @@ -30,6 +30,13 @@ export function AppLayout({ children }: { children: React.ReactNode }) { const [headerContent, setHeaderContent] = useState(null); const [aiPanelOpen, setAiPanelOpen] = useState(false); const pathname = usePathname(); + const isProjectPage = pathname?.includes("/projects/"); + + useEffect(() => { + if (!isProjectPage) { + setAiPanelOpen(false); + } + }, [isProjectPage]); // Don't show layout on auth pages if (pathname.startsWith("/auth/")) { @@ -60,15 +67,17 @@ export function AppLayout({ children }: { children: React.ReactNode }) { {headerContent}
- + {isProjectPage && ( + + )}
{children}