diff --git a/apps/web/app/(app)/[emailAccountId]/assistant/RulesTabNew.tsx b/apps/web/app/(app)/[emailAccountId]/assistant/RulesTabNew.tsx index 8f5ac2b2c5..369d86a2e1 100644 --- a/apps/web/app/(app)/[emailAccountId]/assistant/RulesTabNew.tsx +++ b/apps/web/app/(app)/[emailAccountId]/assistant/RulesTabNew.tsx @@ -5,7 +5,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; export function RulesTab() { return ( -
+
diff --git a/apps/web/app/(app)/layout.tsx b/apps/web/app/(app)/layout.tsx index 2341119e15..410594bf7e 100644 --- a/apps/web/app/(app)/layout.tsx +++ b/apps/web/app/(app)/layout.tsx @@ -71,12 +71,7 @@ export default async function AppLayout({ - {/* - - */} ); } - -// const CrispWithNoSSR = dynamic(() => import("@/components/CrispChat")); diff --git a/apps/web/components/CrispChat.tsx b/apps/web/components/CrispChat.tsx index 94d1258137..7a6d2217b3 100644 --- a/apps/web/components/CrispChat.tsx +++ b/apps/web/components/CrispChat.tsx @@ -2,13 +2,15 @@ import { useEffect, useState } from "react"; import { Crisp } from "crisp-sdk-web"; -import { usePathname } from "next/navigation"; import { env } from "@/env"; +import { useSidebar } from "@/components/ui/sidebar"; +import { useAccount } from "@/providers/EmailAccountProvider"; -const CrispChat = ({ email }: { email?: string }) => { - const pathname = usePathname(); +const CrispChat = () => { + const { state } = useSidebar(); const [isConfigured, setIsConfigured] = useState(false); + const isChatOpen = state.includes("chat-sidebar"); useEffect(() => { if (!env.NEXT_PUBLIC_CRISP_WEBSITE_ID) return; @@ -18,25 +20,23 @@ const CrispChat = ({ email }: { email?: string }) => { setIsConfigured(true); }, []); + const { userEmail } = useAccount(); + useEffect(() => { if (!env.NEXT_PUBLIC_CRISP_WEBSITE_ID || !isConfigured) return; - if (email) Crisp.user.setEmail(email); - }, [email, isConfigured]); + if (userEmail) Crisp.user.setEmail(userEmail); + }, [userEmail, isConfigured]); useEffect(() => { if (!env.NEXT_PUBLIC_CRISP_WEBSITE_ID || !isConfigured) return; - if ( - pathname.includes("/assistant") || - pathname.includes("/automation") || - pathname.includes("/reply-zero") - ) { + if (isChatOpen) { Crisp.chat.hide(); } else { Crisp.chat.show(); } - }, [pathname, isConfigured]); + }, [isConfigured, isChatOpen]); return null; }; diff --git a/apps/web/components/SideNavWithTopNav.tsx b/apps/web/components/SideNavWithTopNav.tsx index 8822e9a815..96674d1b83 100644 --- a/apps/web/components/SideNavWithTopNav.tsx +++ b/apps/web/components/SideNavWithTopNav.tsx @@ -1,5 +1,7 @@ "use client"; +import { Suspense } from "react"; +import dynamic from "next/dynamic"; import { usePathname } from "next/navigation"; import { Toaster } from "@/components/Toast"; import { NavBottom } from "@/components/NavBottom"; @@ -12,6 +14,8 @@ import { SideNav } from "@/components/SideNav"; import { SidebarRight } from "@/components/SidebarRight"; import { cn } from "@/utils"; +const CrispWithNoSSR = dynamic(() => import("@/components/CrispChat")); + function ContentWrapper({ children }: { children: React.ReactNode }) { const { state } = useSidebar(); const isRightSidebarOpen = state.includes("chat-sidebar"); @@ -33,6 +37,9 @@ function ContentWrapper({ children }: { children: React.ReactNode }) {
+ + +
); } diff --git a/version.txt b/version.txt index 8bfc76e4ee..841c56f2d0 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v2.6.12 \ No newline at end of file +v2.6.13 \ No newline at end of file