import React, { useState, useEffect } from 'react'; import { ChatbotProvider } from '@site/src/contexts/ChatbotContext'; import FloatingChatIcon from '@site/src/components/Chatbot/FloatingChatIcon'; import ChatbotInterface from '@site/src/components/Chatbot/ChatbotInterface'; // Global state provider component const Root = ({ children }) => { const [showChatbot, setShowChatbot] = useState(false); const [isClient, setIsClient] = useState(false); useEffect(() => { // Set isClient to true after component mounts on client setIsClient(true); }, []); const toggleChatbot = () => { setShowChatbot(!showChatbot); }; return ( {children} {isClient && ( <> setShowChatbot(false)} /> )} ); }; export default Root;