From 0609a298f1391a7285fb53e52872d2a119fb29bb Mon Sep 17 00:00:00 2001 From: Lasse Rune Hansen Date: Sun, 14 Jun 2026 20:05:44 +0200 Subject: [PATCH] fix(frontend/admin): Fix admin routing - remove duplicate AdminLayout wrappers PROBLEM: - /admin redirects to / (home page) - Admin pages were wrapping themselves in - This caused double-nested layout (header, nav, footer twice) ROOT CAUSE: Admin pages (AdminDashboardPage, AdminUsersPage, etc.) were individually wrapping their content in component. But the App.tsx routing already renders as the parent element for all /admin routes, and AdminLayout uses to render child routes. This created a nested structure: AppLayout -> AdminLayout (from routing) -> AdminLayout (from page) -> Page Content SOLUTION: - Removed wrappers from all admin pages - AdminLayout now always uses instead of {children || } - Removed unused 'children' parameter from AdminLayout - Admin pages now render directly in the Outlet of AdminLayout CHANGES: - AdminDashboardPage.tsx: Removed AdminLayout import and all tags - AdminUsersPage.tsx: Removed AdminLayout import and all tags - AdminUserDetailPage.tsx: Removed AdminLayout import and all tags - AdminReportsPage.tsx: Removed AdminLayout import and all tags - AdminStoryGeneratorPage.tsx: Removed AdminLayout import and all tags - AdminLayout.tsx: Removed unused children parameter, always use Now /admin will correctly render the AdminLayout with nested admin pages. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- .../components/features/admin/AdminLayout.tsx | 5 ++--- .../src/pages/AdminDashboardPage.tsx | 19 ++++++------------- .../src/pages/AdminReportsPage.tsx | 9 ++++----- .../src/pages/AdminStoryGeneratorPage.tsx | 9 ++++----- .../src/pages/AdminUserDetailPage.tsx | 17 ++++++++--------- .../src/pages/AdminUsersPage.tsx | 9 ++++----- 6 files changed, 28 insertions(+), 40 deletions(-) diff --git a/german-app-frontend/src/components/features/admin/AdminLayout.tsx b/german-app-frontend/src/components/features/admin/AdminLayout.tsx index fd7ccf0..8c09108 100644 --- a/german-app-frontend/src/components/features/admin/AdminLayout.tsx +++ b/german-app-frontend/src/components/features/admin/AdminLayout.tsx @@ -5,9 +5,8 @@ import { NavLink, Outlet, useNavigate } from 'react-router-dom'; import { useAuth } from '@/stores/authStore'; -import type { ReactNode } from 'react'; -export function AdminLayout({ children }: { children?: ReactNode }) { +export function AdminLayout() { const { user, logout } = useAuth(); const navigate = useNavigate(); @@ -53,7 +52,7 @@ export function AdminLayout({ children }: { children?: ReactNode }) {
- {children || } +