// layout/MainLayout.jsx import Sidebar from '../components/Sidebar' import Topbar from '../components/Topbar' import { Outlet } from 'react-router-dom'; import {useEffect, useState} from "react"; import { useAuth } from "../auth/useAuth"; import { getStreamStatus } from "../utils/api/stream"; const MainLayout = () => { const [sidebarToggled, setSidebarToggled] = useState(false); const [isStreaming, setIsStreaming] = useState(false); const { user } = useAuth(); useEffect(() => { if (!user) return; const poll = () => getStreamStatus().then(setIsStreaming).catch(() => {}); poll(); const interval = setInterval(poll, 10000); return () => clearInterval(interval); }, [user]); return (
); }; export default MainLayout;