Fix main layout

This commit is contained in:
Logan Cusano
2025-07-13 20:06:30 -04:00
parent c379bfae6f
commit 52373e60a8

View File

@@ -1,42 +1,16 @@
const RootLayout = ({ children }) => (
import { AuthProvider } from '@/lib/auth';
import './globals.css';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
<AuthProvider>
{children}
</AuthProvider>
<AuthProvider>{children}</AuthProvider>
</body>
</html>
);
// Main App component to simulate routing
export default function App() {
const [route, setRoute] = useState('/login'); // Default route
// Simulate navigation for the demo
useEffect(() => {
const handleHashChange = () => {
setRoute(window.location.hash.replace('#', '') || '/');
};
window.addEventListener('hashchange', handleHashChange);
handleHashChange(); // Initial check
return () => window.removeEventListener('hashchange', handleHashChange);
}, []);
const renderPage = () => {
switch (route) {
case '/login':
return <LoginPage />;
case '/admin':
return <MainLayout><AdminPage /></MainLayout>;
case '/':
default:
return <MainLayout><VotingPage /></MainLayout>;
}
};
return (
<RootLayout>
{renderPage()}
</RootLayout>
);
}
}