website refactor

This commit is contained in:
2026-01-14 10:51:05 +01:00
parent 4522d41aef
commit 0d89ad027e
291 changed files with 6887 additions and 3685 deletions

View File

@@ -1,30 +1,9 @@
import { headers } from 'next/headers';
import { redirect } from 'next/navigation';
import { createRouteGuard } from '@/lib/auth/createRouteGuard';
import { DashboardLayoutWrapper } from '@/ui/DashboardLayoutWrapper';
interface DashboardLayoutProps {
export default function DashboardLayout({
children,
}: {
children: React.ReactNode;
}
/**
* Dashboard Layout
*
* Provides authentication protection for all dashboard routes.
* Uses RouteGuard to enforce access control server-side.
*/
export default async function DashboardLayout({ children }: DashboardLayoutProps) {
const headerStore = await headers();
const pathname = headerStore.get('x-pathname') || '/';
const guard = createRouteGuard();
const result = await guard.enforce({ pathname });
if (result.type === 'redirect') {
redirect(result.to);
}
return (
<div className="min-h-screen bg-deep-graphite">
{children}
</div>
);
}
}) {
return <DashboardLayoutWrapper>{children}</DashboardLayoutWrapper>;
}

View File

@@ -14,7 +14,7 @@ export default async function DashboardPage() {
} else if (error === 'redirect') {
redirect('/');
} else {
// DASHBOARD_FETCH_FAILED or UNKNOWN_ERROR
// serverError, networkError, unknown, validationError, unauthorized
console.error('Dashboard error:', error);
notFound();
}