Adds front-end set-up

This commit is contained in:
2026-06-20 17:04:17 +02:00
parent efd1569c26
commit 7dfc3a9692
62 changed files with 6875 additions and 3 deletions
@@ -0,0 +1,37 @@
import { useEffect } from 'react';
import { Outlet, useNavigate } from '@tanstack/react-router';
import { useAuth } from '@/contexts/auth-context';
import { Sidebar } from '@/components/layout/Sidebar';
import { Topbar } from '@/components/layout/Topbar';
/**
* Shell for authenticated routes. Renders the persistent chrome and reacts to
* runtime auth loss (e.g. a failed refresh during an API call) by redirecting
* to /login (BR-U1-14).
*/
export function AppLayout() {
const { isAuthenticated, status } = useAuth();
const navigate = useNavigate();
useEffect(() => {
if (status === 'guest') {
void navigate({ to: '/login' });
}
}, [status, navigate]);
if (!isAuthenticated) {
return null;
}
return (
<div className="flex min-h-svh">
<Sidebar />
<div className="flex flex-1 flex-col">
<Topbar />
<main className="flex-1 p-6" data-testid="app-main">
<Outlet />
</main>
</div>
</div>
);
}