Files
twimg-frontend/app/layout.tsx
Logan Cusano 7d3f08cae9 init
2025-07-13 19:03:13 -04:00

42 lines
1.2 KiB
TypeScript

const RootLayout = ({ children }) => (
<html lang="en">
<body>
<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>
);
}