diff --git a/frontend/src/routes/_layout.tsx b/frontend/src/routes/_layout.tsx index f208679..fa27657 100644 --- a/frontend/src/routes/_layout.tsx +++ b/frontend/src/routes/_layout.tsx @@ -1,16 +1,23 @@ +import { useQuery } from "@tanstack/react-query" import { createFileRoute, Outlet, redirect, useRouterState, } from "@tanstack/react-router" +import { Bot } from "lucide-react" -import { ControlTrigger } from "@/components/Chat/ChatPanel" +import { + aiStatusQueryOptions, + ControlTrigger, +} from "@/components/Chat/ChatPanel" +import { chatStore } from "@/components/Chat/chatStore" import { ConnectionNotice } from "@/components/Common/ConnectionNotice" import ErrorComponent from "@/components/Common/ErrorComponent" import { Footer } from "@/components/Common/Footer" import { useFlowSocket } from "@/components/Flow/useFlowSocket" import AppSidebar from "@/components/Sidebar/AppSidebar" +import { Button } from "@/components/ui/button" import { SidebarInset, SidebarProvider, @@ -38,6 +45,8 @@ function Layout() { // here rather than only inside the editor. useFlowSocket() const home = useRouterState({ select: (s) => s.location.pathname === "/" }) + // Gated as the sidebar's entry is: with no provider there is nothing to open. + const assistant = useQuery(aiStatusQueryOptions()) return ( @@ -48,10 +57,25 @@ function Layout() { {/* The sidebar carries its own collapse control; a phone has no sidebar on screen to carry it. Home's chat sits opposite, where - the brain view has it on a wider screen. */} + the brain view has it on a wider screen, and the assistant in the + corner, one tap away rather than behind the sidebar sheet. */}
- {home ? : null} +
+ {home ? : null} + {assistant.data?.available ? ( + + ) : null} +