import { AgentSidebar, AgentToggleButton, focusAgentChat, isAgentChatHomeHandoffActive, navigateWithAgentChatViewTransition, useAgentChatHomeHandoff, useAgentChatHomeHandoffLinks, } from "@agent-native/core/client/agent-chat"; import { useT } from "@agent-native/core/client/i18n"; import { openCommandMenu } from "@agent-native/core/client/navigation"; import { IconMenu2, IconSearch } from "@tabler/icons-react"; import { useEffect, useState } from "react"; import { useLocation, useNavigate } from "react-router"; import { CrmSidebar } from "@/components/layout/CrmSidebar"; import { Button } from "@/components/ui/button"; import { Sheet, SheetContent, SheetDescription, SheetTitle, } from "@/components/ui/sheet"; import { TAB_ID } from "@/lib/tab-id"; export function CrmLayout({ children }: { children: React.ReactNode }) { const t = useT(); const location = useLocation(); const navigate = useNavigate(); const [mobileOpen, setMobileOpen] = useState(false); const isAskRoute = location.pathname === "/ask"; const handoffActive = useAgentChatHomeHandoff({ storageKey: "crm", activePath: location.pathname, enabled: !isAskRoute, }); const handoffPending = isAgentChatHomeHandoffActive("crm"); useAgentChatHomeHandoffLinks({ storageKey: "crm", chatPath: "/ask", requireActiveHandoff: false, }); useEffect(() => setMobileOpen(false), [location.pathname]); const shell = (
CRM
{!isAskRoute ?