"use client"; import type { ReactNode } from "react"; import { useState } from "react"; import { ModeToggle } from "./mode-toggle"; import { useFrontendTool } from "@copilotkit/react-core/v2"; interface ExampleLayoutProps { chatContent: ReactNode; appContent: ReactNode; } export function ExampleLayout({ chatContent, appContent }: ExampleLayoutProps) { const [mode, setMode] = useState<"chat" | "app">("chat"); useFrontendTool({ name: "enableAppMode", description: "Enable app mode, make sure its open when interacting with todos.", handler: async () => { setMode("app"); }, }); useFrontendTool({ name: "enableChatMode", description: "Enable chat mode", handler: async () => { setMode("chat"); }, }); return (
{/* Chat Content */}
{/* max-lg:pl-24 clears the threads drawer's floating launcher pill, which is fixed at the top-left corner below 1024px. max-lg:pt-2.5 + pb-0 vertically centers the logo with that launcher and the top-right Chat/App toggle (both pinned at top-2). */}
CopilotKit CopilotKit
{chatContent}
{/* State Panel */}
{appContent}
); }