import { ChatBubbleLeftRightIcon, ChevronDoubleRightIcon } from "@heroicons/react/20/solid"; import { createContext, useContext } from "react"; import { cn } from "~/utils/cn"; type DashboardAgentContextValue = { open: boolean; setOpen: (open: boolean) => void; }; const DashboardAgentContext = createContext(null); export const DashboardAgentProvider = DashboardAgentContext.Provider; // Null outside the env layout (no provider) or when the agent is gated off, so // the launcher self-hides everywhere it can't open. export function useDashboardAgent() { return useContext(DashboardAgentContext); } export function DashboardAgentLauncher() { const agent = useDashboardAgent(); if (!agent) { return null; } const { open, setOpen } = agent; return ( ); }