Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions frontend/ui/src/components/layout/app-layout.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -30,6 +30,13 @@ export function AppLayout({ children }: { children: React.ReactNode }) {
const [headerContent, setHeaderContent] = useState<ReactNode>(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/")) {
Expand Down Expand Up @@ -60,15 +67,17 @@ export function AppLayout({ children }: { children: React.ReactNode }) {
</Button>
{headerContent}
<div className="ml-auto">
<Button
variant="ghost"
size="icon"
className="h-8 w-8 shrink-0"
onClick={() => setAiPanelOpen(!aiPanelOpen)}
title="AI Assistant"
>
<BotMessageSquare className="h-4 w-4" />
</Button>
{isProjectPage && (
<Button
variant="ghost"
size="icon"
className="h-8 w-8 shrink-0"
onClick={() => setAiPanelOpen(!aiPanelOpen)}
title="AI Assistant"
>
<BotMessageSquare className="h-4 w-4" />
</Button>
)}
</div>
</header>
<main className="flex-1 overflow-hidden">{children}</main>
Expand Down
Loading