CI / quality (push) Waiting to run
Phase 1 cleanup of the personal-site revamp. Backend/architecture untouched; changes are limited to removing unused complexity and restoring feedback. Removals - Toast system: delete react-hot-toast, Toaster, QueryToastBridge, lib/toast, the toggle/easter-egg calls, related i18n keys and the dependency. - Contact protection: remove Turnstile + per-IP rate limiting (lib/contact-guard, lib/contact-protection, admin screen, form widget, app-config wiring, nav entry, test). - Speculative specs: delete orders, products, downloads, project-inquiry. Inline feedback (replaces toast, no new deps) - Add lib/admin-feedback (withFlash/readFlash) and components/admin/admin-flash, rendered centrally by AdminDashboardShell. - Emit success/error messages for media, site-settings, portfolio, smtp, marquee and maintenance actions; pages read them via searchParams. - Contact form shows validation/delivery errors inline; success still redirects to /success. Docs - Fix stale paths in frontend-system-* (components/root -> components/admin, lib/root-navigation -> lib/admin-navigation, drop phantom src/) and remove contact-protection references from docs and CLAUDE.md. - Add docs/PHASE0_DIAGNOSIS.md (diagnosis report). Note: proxy.ts self-fetch kept intentionally; it also drives maintenance mode.
133 lines
3.4 KiB
TypeScript
133 lines
3.4 KiB
TypeScript
import {
|
|
FolderKanban,
|
|
Globe2,
|
|
ImageIcon,
|
|
Languages,
|
|
LayoutDashboard,
|
|
Mail,
|
|
Palette,
|
|
PlusSquare,
|
|
ShieldAlert,
|
|
SwatchBook,
|
|
Tags,
|
|
Type,
|
|
type LucideIcon,
|
|
} from "lucide-react";
|
|
import { getAdminAppPath } from "@/lib/admin-routing";
|
|
|
|
type AdminNavigationCopy = {
|
|
overview: string;
|
|
maintenance: string;
|
|
uiKit: string;
|
|
portfolio: string;
|
|
media: string;
|
|
siteSettings: string;
|
|
brandSettings?: string;
|
|
localizationSettings?: string;
|
|
marquee?: string;
|
|
smtp?: string;
|
|
};
|
|
|
|
export type AdminNavItem = {
|
|
label: string;
|
|
href: string;
|
|
icon: LucideIcon;
|
|
active?: boolean;
|
|
expanded?: boolean;
|
|
children?: AdminNavItem[];
|
|
};
|
|
|
|
export function getAdminNavigation(
|
|
copy: AdminNavigationCopy,
|
|
active: "overview" | "maintenance" | "ui-kit" | "portfolio" | "media" | "site-settings" | "smtp" | "marquee",
|
|
portfolioChild?: "overview" | "projects" | "new-project" | "categories",
|
|
siteSettingsChild?: "brand" | "localization",
|
|
): AdminNavItem[] {
|
|
return [
|
|
{
|
|
label: copy.overview,
|
|
href: getAdminAppPath("/"),
|
|
icon: LayoutDashboard,
|
|
active: active === "overview",
|
|
},
|
|
{
|
|
label: copy.maintenance,
|
|
href: getAdminAppPath("/maintenance"),
|
|
icon: ShieldAlert,
|
|
active: active === "maintenance",
|
|
},
|
|
{
|
|
label: copy.uiKit,
|
|
href: getAdminAppPath("/ui-kit"),
|
|
icon: SwatchBook,
|
|
active: active === "ui-kit",
|
|
},
|
|
{
|
|
label: copy.media,
|
|
href: getAdminAppPath("/media"),
|
|
icon: ImageIcon,
|
|
active: active === "media",
|
|
},
|
|
{
|
|
label: copy.siteSettings,
|
|
href: getAdminAppPath("/site-settings/brand"),
|
|
icon: Globe2,
|
|
active: active === "site-settings" && !siteSettingsChild,
|
|
expanded: active === "site-settings",
|
|
children: [
|
|
{
|
|
label: copy.brandSettings ?? "Brand",
|
|
href: getAdminAppPath("/site-settings/brand"),
|
|
icon: Palette,
|
|
active: siteSettingsChild === "brand",
|
|
},
|
|
{
|
|
label: copy.localizationSettings ?? "Localization",
|
|
href: getAdminAppPath("/site-settings/localization"),
|
|
icon: Languages,
|
|
active: siteSettingsChild === "localization",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: copy.marquee ?? "Marquee",
|
|
href: getAdminAppPath("/marquee"),
|
|
icon: Type,
|
|
active: active === "marquee",
|
|
},
|
|
{
|
|
label: copy.smtp ?? "SMTP",
|
|
href: getAdminAppPath("/smtp"),
|
|
icon: Mail,
|
|
active: active === "smtp",
|
|
},
|
|
{
|
|
label: copy.portfolio,
|
|
href: getAdminAppPath("/portfolio"),
|
|
icon: FolderKanban,
|
|
active: active === "portfolio" && !portfolioChild,
|
|
expanded: active === "portfolio",
|
|
children: [
|
|
{
|
|
label: "Projects",
|
|
href: getAdminAppPath("/portfolio"),
|
|
icon: FolderKanban,
|
|
active: portfolioChild === "overview" || portfolioChild === "projects",
|
|
},
|
|
{
|
|
label: "Add Project",
|
|
href: getAdminAppPath("/portfolio/projects/new"),
|
|
icon: PlusSquare,
|
|
active: portfolioChild === "new-project",
|
|
},
|
|
{
|
|
label: "Categories",
|
|
href: getAdminAppPath("/portfolio/categories"),
|
|
icon: Tags,
|
|
active: portfolioChild === "categories",
|
|
},
|
|
].filter((item, index, array) => array.findIndex((entry) => entry.href === item.href) === index),
|
|
},
|
|
];
|
|
}
|