import React, { useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { useTheme } from '../hooks/useTheme.ts'; import { useAuth } from '../hooks/index.ts'; import { logoutAndNotify } from '../utils/index.ts'; import ThemeToggle from '../components/common/ThemeToggle.tsx'; import Navigation from '../components/navigation/Navigation.tsx'; import logo from '../../logo.png'; type MainLayoutProps = { children?: any; }; const MainLayout = ({ children }: MainLayoutProps) => { const { theme } = useTheme(); const { isAuthenticated } = useAuth(); const navigate = useNavigate(); const handleLogout = () => { logoutAndNotify(); navigate('/'); }; useEffect(() => { // Ensure theme is applied on mount const root = document.documentElement; if (theme === 'dark') { root.classList.add('dark'); } else { root.classList.remove('dark'); } }, [theme]); return (