diff --git a/src/components/ChatBob.jsx b/src/components/ChatBob.jsx index 3232cdc6a..cd2d998ec 100644 --- a/src/components/ChatBob.jsx +++ b/src/components/ChatBob.jsx @@ -1,10 +1,30 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import Fab from '@mui/material/Fab'; import ChatIcon from '@mui/icons-material/Chat'; +import CloseIcon from '@mui/icons-material/Close'; export function ChatBob() { const [isVisible, setIsVisible] = useState(false); + const [isMobile, setIsMobile] = useState(false); + + useEffect(() => { + // Ensure window object is defined + if (typeof window !== 'undefined') { + setIsMobile(window.innerWidth <= 768); + + function handleResize() { + setIsMobile(window.innerWidth <= 768); + } + + window.addEventListener('resize', handleResize); + + // Cleanup + return () => { + window.removeEventListener('resize', handleResize); + }; + } + }, []); const toggleVisibility = () => { setIsVisible(!isVisible); @@ -12,7 +32,7 @@ export function ChatBob() { return ( <> - - - -
+ + )} +