Fix shared root sidebar layout
CI / quality (push) Waiting to run

This commit is contained in:
MOH
2026-03-07 17:39:06 +01:00
parent 8606f6e315
commit 4f983f20b5
+10 -52
View File
@@ -2,13 +2,9 @@ import {
ExternalLink, ExternalLink,
FolderKanban, FolderKanban,
ImageIcon, ImageIcon,
LayoutDashboard,
LockKeyhole, LockKeyhole,
LogOut,
ShieldAlert, ShieldAlert,
Shapes, Shapes,
SwatchBook,
ArrowLeft,
} from "lucide-react"; } from "lucide-react";
import Link from "next/link"; import Link from "next/link";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
@@ -16,8 +12,7 @@ import { redirect } from "next/navigation";
import { Container } from "@/components/layout/container"; import { Container } from "@/components/layout/container";
import { MotionFade } from "@/components/motion-fade"; import { MotionFade } from "@/components/motion-fade";
import { DashboardCard } from "@/components/dashboard/dashboard-card"; import { DashboardCard } from "@/components/dashboard/dashboard-card";
import { DashboardLayout } from "@/components/dashboard/dashboard-layout"; import { RootDashboardShell } from "@/components/root/root-dashboard-shell";
import { ThemeToggle } from "@/components/theme-toggle";
import { Badge, type BadgeProps } from "@/components/ui/badge"; import { Badge, type BadgeProps } from "@/components/ui/badge";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
@@ -43,13 +38,11 @@ import {
setAdminSessionCookie, setAdminSessionCookie,
} from "@/lib/admin-auth"; } from "@/lib/admin-auth";
import { getMaintenanceMode } from "@/lib/app-config"; import { getMaintenanceMode } from "@/lib/app-config";
import { getLocalizedPath } from "@/lib/locale";
import { getAdminMediaAssets } from "@/lib/media"; import { getAdminMediaAssets } from "@/lib/media";
import { import {
getAdminPortfolioCategories, getAdminPortfolioCategories,
getAdminPortfolioProjects, getAdminPortfolioProjects,
} from "@/lib/portfolio"; } from "@/lib/portfolio";
import { getRootNavigation } from "@/lib/root-navigation";
type RootPageProps = { type RootPageProps = {
searchParams?: { searchParams?: {
@@ -220,7 +213,6 @@ export default async function RootPage({ searchParams }: RootPageProps) {
getAdminMediaAssets(), getAdminMediaAssets(),
]); ]);
const publishedProjects = projects.filter((project) => project.isPublished).length; const publishedProjects = projects.filter((project) => project.isPublished).length;
const rootNavigation = getRootNavigation(copy, "overview");
const authHealthy = authConfigured && basicConfigured; const authHealthy = authConfigured && basicConfigured;
const sectionRows: Array<{ const sectionRows: Array<{
label: string; label: string;
@@ -265,52 +257,18 @@ export default async function RootPage({ searchParams }: RootPageProps) {
]; ];
return ( return (
<DashboardLayout <RootDashboardShell
title={copy.title} copy={copy}
description={copy.subtitle} active="overview"
icon={LayoutDashboard} logoutAction={logoutAction}
items={rootNavigation} headerTitle={copy.title}
sidebarFooter={ headerDescription={copy.subtitle}
<>
<Button
asChild
variant={maintenanceEnabled ? "default" : "outline"}
className="w-full justify-between"
>
<Link href="/root/maintenance">
{copy.maintenance}
<ShieldAlert className="h-4 w-4" />
</Link>
</Button>
<Button asChild variant="outline" className="w-full justify-between">
<Link href="/root/ui-kit">
{copy.uiKit}
<SwatchBook className="h-4 w-4" />
</Link>
</Button>
</>
}
headerActions={ headerActions={
<div className="flex flex-wrap items-center justify-end gap-2"> maintenanceEnabled ? (
{maintenanceEnabled ? (
<Button asChild variant="destructive" className="hidden sm:inline-flex"> <Button asChild variant="destructive" className="hidden sm:inline-flex">
<Link href="/root/maintenance">{copy.maintenanceVisitorsClosed}</Link> <Link href="/root/maintenance">{copy.maintenanceVisitorsClosed}</Link>
</Button> </Button>
) : null} ) : null
<ThemeToggle ariaLabel="Theme wechseln" />
<Button asChild variant="outline" size="sm">
<Link href={getLocalizedPath("de")}>
<ArrowLeft className="h-4 w-4" />
{copy.backToSite}
</Link>
</Button>
<form action={logoutAction}>
<Button type="submit" variant="ghost" size="sm" className="text-destructive hover:bg-destructive/10 hover:text-destructive">
<LogOut className="h-4 w-4" />
{copy.logout}
</Button>
</form>
</div>
} }
> >
<div className="space-y-6"> <div className="space-y-6">
@@ -433,6 +391,6 @@ export default async function RootPage({ searchParams }: RootPageProps) {
</div> </div>
</section> </section>
</div> </div>
</DashboardLayout> </RootDashboardShell>
); );
} }