Refactor admin area and remove legacy root paths
CI / quality (push) Waiting to run

This commit is contained in:
MOH
2026-03-13 16:14:04 +01:00
parent e32ac4cacb
commit db897e22bf
65 changed files with 216 additions and 140 deletions
@@ -15,17 +15,17 @@ import Link from "next/link";
import { DashboardLayout } from "@/components/dashboard/dashboard-layout";
import { MotionFade } from "@/components/motion-fade";
import { SidebarMaintenanceControl } from "@/components/root/sidebar-maintenance-control";
import { SidebarMaintenanceControl } from "@/components/admin/sidebar-maintenance-control";
import { SoundToggle } from "@/components/sound-toggle";
import { ThemeToggle } from "@/components/theme-toggle";
import { Button } from "@/components/ui/button";
import { buildSiteUrl } from "@/lib/admin-routing";
import { getMaintenanceMode, getSiteSettingsMediaBindings } from "@/lib/app-config";
import { getRootNavigation } from "@/lib/root-navigation";
import { getAdminNavigation } from "@/lib/admin-navigation";
import { updateMaintenanceModeAction } from "@/app/root/maintenance/actions";
import { updateMaintenanceModeAction } from "@/app/_admin/maintenance/actions";
type RootDashboardCopy = {
type AdminDashboardCopy = {
title: string;
subtitle: string;
overview: string;
@@ -41,8 +41,8 @@ type RootDashboardCopy = {
backToSite: string;
};
type RootDashboardShellProps = {
copy: RootDashboardCopy;
type AdminDashboardShellProps = {
copy: AdminDashboardCopy;
active: "overview" | "maintenance" | "ui-kit" | "portfolio" | "media" | "site-settings" | "smtp" | "marquee";
smtpChild?: "settings" | "contact-protection";
portfolioChild?: "overview" | "projects" | "new-project" | "categories";
@@ -55,7 +55,7 @@ type RootDashboardShellProps = {
children: ReactNode;
};
export async function RootDashboardShell({
export async function AdminDashboardShell({
copy,
active,
smtpChild,
@@ -67,12 +67,12 @@ export async function RootDashboardShell({
sidebarTopContent,
toolbar,
children,
}: RootDashboardShellProps) {
}: AdminDashboardShellProps) {
const [mediaBindings, maintenanceEnabled] = await Promise.all([
getSiteSettingsMediaBindings(),
getMaintenanceMode(),
]);
const sidebarItems = getRootNavigation(copy, active, smtpChild, portfolioChild);
const sidebarItems = getAdminNavigation(copy, active, smtpChild, portfolioChild);
const normalizedSidebarItems = sidebarItems.filter(
(item) =>
item.href !== "/maintenance" &&
@@ -28,7 +28,7 @@ import { Label } from "@/components/ui/label";
import { Table, TableBody, TableCell, TableRow } from "@/components/ui/table";
import { cn } from "@/lib/utils";
import { createMediaAssetAction, deleteMediaAssetAction } from "@/app/root/media/actions";
import { createMediaAssetAction, deleteMediaAssetAction } from "@/app/_admin/media/actions";
const copy = {
addMedia: "Upload Media File",
@@ -13,7 +13,7 @@ import {
Trash2,
} from "lucide-react";
import type { deleteCategoryAction, upsertCategoryAction } from "@/app/root/portfolio/actions";
import type { deleteCategoryAction, upsertCategoryAction } from "@/app/_admin/portfolio/actions";
import { StatsCard } from "@/components/dashboard/stats-card";
import { AppCard } from "@/components/ui/app-card";
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";
@@ -4,7 +4,7 @@ import { FolderKanban, MoreVertical, Trash2 } from "lucide-react";
import Link from "next/link";
import { useState } from "react";
import { deleteProjectAction } from "@/app/root/portfolio/actions";
import { deleteProjectAction } from "@/app/_admin/portfolio/actions";
import { Button } from "@/components/ui/button";
import {
Dialog,
@@ -15,7 +15,7 @@ import {
} from "lucide-react";
import { type ReactNode, useEffect, useRef, useState } from "react";
import { MediaFieldPicker, type MediaFieldState } from "@/components/root/media-field-picker";
import { MediaFieldPicker, type MediaFieldState } from "@/components/admin/media-field-picker";
import { AppCard } from "@/components/ui/app-card";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
@@ -3,7 +3,7 @@ import Link from "next/link";
import { StatsCard } from "@/components/dashboard/stats-card";
import { MotionFade } from "@/components/motion-fade";
import { PortfolioProjectActions } from "@/components/root/portfolio-project-actions";
import { PortfolioProjectActions } from "@/components/admin/portfolio-project-actions";
import { AppCard } from "@/components/ui/app-card";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
+3 -3
View File
@@ -11,18 +11,18 @@ import {
SheetTitle,
SheetTrigger,
} from "@/components/ui/sheet";
import type { RootNavItem } from "@/lib/root-navigation";
import type { AdminNavItem } from "@/lib/admin-navigation";
type DashboardLayoutProps = {
title: string;
description: string;
icon?: LucideIcon;
items: RootNavItem[];
items: AdminNavItem[];
sidebarIconSrc?: string;
sidebarBrandHref?: string;
sidebarBrandHoverLabel?: string;
sidebarTop?: ReactNode;
sidebarFooterItems?: RootNavItem[];
sidebarFooterItems?: AdminNavItem[];
sidebarFooter?: ReactNode;
headerActions?: ReactNode;
children: ReactNode;
+1 -1
View File
@@ -66,7 +66,7 @@ export function AppSidebar({
<AppCard className="overflow-hidden bg-sidebar text-sidebar-foreground shadow-sidebar">
<CardHeader className="pb-4">
<p className="text-xs font-semibold uppercase tracking-[0.24em] text-sidebar-foreground/56">
Root Access
Admin Access
</p>
<CardTitle className="text-base font-semibold">{title}</CardTitle>
<p className="text-sm leading-6 text-sidebar-foreground/72">{description}</p>
+1 -1
View File
@@ -36,7 +36,7 @@ export function SiteFooter({ isAdmin = false }: SiteFooterProps) {
))}
{isAdmin ? (
<a href={buildAdminUrl()} className="text-muted-foreground hover:text-foreground">
{tNav("root")}
{tNav("admin")}
</a>
) : null}
</nav>
+2 -2
View File
@@ -315,7 +315,7 @@ export function SiteHeader({
/>
{isAdmin ? (
<Button asChild variant="ghost" size="icon" className={desktopControlButtonClassName}>
<Link href={buildAdminUrl()} aria-label={t("root")}>
<Link href={buildAdminUrl()} aria-label={t("admin")}>
<LayoutDashboard className="h-4 w-4 transition-transform duration-300 ease-out hover:scale-110" />
</Link>
</Button>
@@ -465,7 +465,7 @@ export function SiteHeader({
/>
{isAdmin ? (
<Button asChild variant="ghost" size="icon" className={mobileControlButtonClassName}>
<Link href={buildAdminUrl()} aria-label={t("root")} onClick={() => setIsOpen(false)}>
<Link href={buildAdminUrl()} aria-label={t("admin")} onClick={() => setIsOpen(false)}>
<LayoutDashboard className="h-4 w-4 transition-transform duration-300 ease-out hover:scale-110" />
</Link>
</Button>