Refactor: Implement DashboardLayout, fix mobile nav, and resolve scroll issues

This commit is contained in:
ren
2026-01-29 14:41:46 +01:00
parent 0a04e0817d
commit 811c78ffa5
171 changed files with 1678 additions and 23983 deletions

34
middleware.ts Normal file
View File

@@ -0,0 +1,34 @@
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
export function middleware(request: NextRequest) {
const token = request.cookies.get('auth_token')
// Public paths that don't require authentication
if (
request.nextUrl.pathname.startsWith('/_next') ||
request.nextUrl.pathname.startsWith('/static') ||
request.nextUrl.pathname === '/login' ||
request.nextUrl.pathname === '/favicon.ico' ||
request.nextUrl.pathname.startsWith('/api/auth')
) {
// If user is already logged in and tries to access login, redirect to dashboard
if (token && request.nextUrl.pathname === '/login') {
return NextResponse.redirect(new URL('/', request.url))
}
return NextResponse.next()
}
// If no token, redirect to login
if (!token) {
return NextResponse.redirect(new URL('/login', request.url))
}
return NextResponse.next()
}
export const config = {
matcher: [
'/((?!_next/static|_next/image|favicon.ico).*)',
],
}