import classNames from 'clsx'; import React, { useEffect, useRef, useState } from 'react'; import { Stack } from 'soapbox/components/ui'; import { useChatContext } from 'soapbox/contexts/chat-context'; import ChatPageMain from './components/chat-page-main'; import ChatPageSidebar from './components/chat-page-sidebar'; const ChatPage = () => { const { chat } = useChatContext(); const containerRef = useRef(null); const [height, setHeight] = useState('100%'); const calculateHeight = () => { if (!containerRef.current) { return null; } const { top } = containerRef.current.getBoundingClientRect(); const fullHeight = document.body.offsetHeight; // On mobile, account for bottom navigation. const offset = document.body.clientWidth < 976 ? -61 : 0; setHeight(fullHeight - top + offset); }; useEffect(() => { calculateHeight(); }, [containerRef.current]); useEffect(() => { window.addEventListener('resize', calculateHeight); return () => { window.removeEventListener('resize', calculateHeight); }; }, []); return (
); }; export default ChatPage;