import { ReactNode } from 'react' import { Outlet, useLocation } from 'react-router-dom' import HeaderBar from '../components/HeaderBar' import { Container } from '../components/Container' import { useLanguage } from '../contexts/LanguageContext' import { useAuth } from '../contexts/AuthContext' import { t } from '../i18n/translations' interface MainLayoutProps { children?: ReactNode } export default function MainLayout({ children }: MainLayoutProps) { const { language, setLanguage } = useLanguage() const { user, logout } = useAuth() const location = useLocation() // 根据路径自动判断当前页面 const getCurrentPage = (): 'competition' | 'traders' | 'trader' | 'faq' => { if (location.pathname === '/faq') return 'faq' if (location.pathname === '/traders') return 'traders' if (location.pathname === '/dashboard') return 'trader' if (location.pathname === '/competition') return 'competition' return 'competition' // 默认 } return (
{ // React Router handles navigation now }} /> {/* Main Content */} {children || } {/* Footer */}
) }