Refactor layout and home page for improved localization and session handling

- Updated RootLayout to include locale support and integrated ThemeProvider and LocaleProvider for better internationalization.
- Replaced static home page content with a redirect based on user session status, enhancing user experience by directing to the appropriate dashboard or login page.
- Switched font from Geist to Inter for improved typography consistency.
This commit is contained in:
smueller
2026-07-22 14:01:09 +02:00
parent 04e04eb11d
commit 84476e6277
30 changed files with 1073 additions and 128 deletions

View File

@@ -0,0 +1,28 @@
import { NextResponse, type NextRequest } from 'next/server';
// Kept as a literal (not imported from `lib/session.ts`) on purpose: the
// Edge middleware runtime cannot bundle the Redis/Node-only code that
// `lib/session.ts` pulls in, so this file must stay dependency-free.
const SESSION_COOKIE_NAME = 'nexumi_session';
/**
* Lightweight edge-safe guard: only checks that the session cookie exists.
* The actual session and permission validation happens in
* `requireAuthOrRedirect` / `requireGuildAccessOrRedirect` inside the
* dashboard layouts, since that requires Redis/Prisma access which is not
* available in the middleware runtime.
*/
export function middleware(request: NextRequest) {
const hasSession = request.cookies.has(SESSION_COOKIE_NAME);
if (!hasSession) {
const loginUrl = new URL('/login', request.url);
return NextResponse.redirect(loginUrl);
}
return NextResponse.next();
}
export const config = {
matcher: ['/dashboard/:path*']
};