refactor: drop toast + over-engineered extras, add inline admin feedback
CI / quality (push) Waiting to run
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.
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
} from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
import { AdminFlash } from "@/components/admin/admin-flash";
|
||||
import { DashboardLayout } from "@/components/dashboard/dashboard-layout";
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { SidebarMaintenanceControl } from "@/components/admin/sidebar-maintenance-control";
|
||||
@@ -24,6 +25,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { buildSiteUrl, getAdminAppPath } from "@/lib/admin-routing";
|
||||
import { getMaintenanceMode, getSiteSettingsMediaBindings } from "@/lib/app-config";
|
||||
import { getAdminNavigation } from "@/lib/admin-navigation";
|
||||
import type { FlashMessages } from "@/lib/admin-feedback";
|
||||
|
||||
import { updateMaintenanceModeAction } from "@/app/_admin/maintenance/actions";
|
||||
|
||||
@@ -40,7 +42,6 @@ type AdminDashboardCopy = {
|
||||
localizationSettings?: string;
|
||||
marquee?: string;
|
||||
smtp?: string;
|
||||
contactProtection?: string;
|
||||
logout: string;
|
||||
backToSite: string;
|
||||
};
|
||||
@@ -48,9 +49,9 @@ type AdminDashboardCopy = {
|
||||
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";
|
||||
siteSettingsChild?: "brand" | "localization";
|
||||
flash?: FlashMessages;
|
||||
logoutAction: () => Promise<void>;
|
||||
headerTitle: string;
|
||||
headerDescription: string;
|
||||
@@ -63,9 +64,9 @@ type AdminDashboardShellProps = {
|
||||
export async function AdminDashboardShell({
|
||||
copy,
|
||||
active,
|
||||
smtpChild,
|
||||
portfolioChild,
|
||||
siteSettingsChild,
|
||||
flash,
|
||||
logoutAction,
|
||||
headerTitle,
|
||||
headerDescription,
|
||||
@@ -78,7 +79,7 @@ export async function AdminDashboardShell({
|
||||
getSiteSettingsMediaBindings(),
|
||||
getMaintenanceMode(),
|
||||
]);
|
||||
const sidebarItems = getAdminNavigation(copy, active, smtpChild, portfolioChild, siteSettingsChild);
|
||||
const sidebarItems = getAdminNavigation(copy, active, portfolioChild, siteSettingsChild);
|
||||
const normalizedSidebarItems = sidebarItems.filter(
|
||||
(item) =>
|
||||
item.href !== getAdminAppPath("/maintenance") &&
|
||||
@@ -155,18 +156,19 @@ export async function AdminDashboardShell({
|
||||
<SoundToggle
|
||||
ariaLabel="Mute sounds"
|
||||
mutedAriaLabel="Unmute sounds"
|
||||
mutedToastLabel="Sound muted"
|
||||
unmutedToastLabel="Sound enabled"
|
||||
/>
|
||||
<ThemeToggle
|
||||
ariaLabel="Theme wechseln"
|
||||
lightToastLabel="Light mode enabled"
|
||||
darkToastLabel="Dark mode enabled"
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{flash?.success || flash?.error ? (
|
||||
<MotionFade delay={0.05}>
|
||||
<AdminFlash success={flash.success} error={flash.error} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
{toolbar ? <MotionFade delay={0.05}>{toolbar}</MotionFade> : null}
|
||||
{children}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user