Add Sonner-based notifications and UX polish
This commit is contained in:
@@ -21,7 +21,10 @@ export async function updateMaintenanceModeAction(formData: FormData) {
|
||||
const nextValue = formData.get("enabled") === "true";
|
||||
const redirectPath = String(formData.get("redirectPath") ?? "/root");
|
||||
const redirectUrl = new URL(redirectPath, "http://localhost");
|
||||
redirectUrl.searchParams.set("__saved", "maintenance");
|
||||
redirectUrl.searchParams.set(
|
||||
"success",
|
||||
nextValue ? "Wartungsmodus aktiviert." : "Wartungsmodus deaktiviert.",
|
||||
);
|
||||
|
||||
await setMaintenanceMode(nextValue);
|
||||
revalidatePath("/", "layout");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { FlashMessage } from "@/components/root/flash-message";
|
||||
import { MarqueeSettingsForm } from "@/components/root/marquee-settings-form";
|
||||
import { RootDashboardShell } from "@/components/root/root-dashboard-shell";
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
@@ -26,16 +25,7 @@ const copy = {
|
||||
backToSite: "Zur Website",
|
||||
};
|
||||
|
||||
type RootMarqueePageProps = {
|
||||
searchParams?: {
|
||||
success?: string;
|
||||
error?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export default async function RootMarqueePage({
|
||||
searchParams,
|
||||
}: RootMarqueePageProps) {
|
||||
export default async function RootMarqueePage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
}
|
||||
@@ -57,21 +47,8 @@ export default async function RootMarqueePage({
|
||||
headerTitle={copy.title}
|
||||
headerDescription={copy.subtitle}
|
||||
saveFormId="marquee-settings-form"
|
||||
reloadDocumentOnSave
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{searchParams?.success ? (
|
||||
<MotionFade delay={0.08}>
|
||||
<FlashMessage type="success" message={searchParams.success} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
{searchParams?.error ? (
|
||||
<MotionFade delay={0.1}>
|
||||
<FlashMessage type="error" message={searchParams.error} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
<MotionFade delay={0.14}>
|
||||
<MarqueeSettingsForm
|
||||
action={saveMarqueeSettingsAction}
|
||||
|
||||
+1
-22
@@ -1,8 +1,6 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { FlashMessage } from "@/components/root/flash-message";
|
||||
import { MediaLibraryManager } from "@/components/root/media-library-manager";
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { RootDashboardShell } from "@/components/root/root-dashboard-shell";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { getAdminMediaAssets } from "@/lib/media";
|
||||
@@ -22,14 +20,7 @@ const copy = {
|
||||
backToSite: "Zur Website",
|
||||
};
|
||||
|
||||
type RootMediaPageProps = {
|
||||
searchParams?: {
|
||||
success?: string;
|
||||
error?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export default async function RootMediaPage({ searchParams }: RootMediaPageProps) {
|
||||
export default async function RootMediaPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
}
|
||||
@@ -52,18 +43,6 @@ export default async function RootMediaPage({ searchParams }: RootMediaPageProps
|
||||
headerDescription={copy.subtitle}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{searchParams?.success ? (
|
||||
<MotionFade delay={0.1}>
|
||||
<FlashMessage type="success" message={searchParams.success} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
{searchParams?.error ? (
|
||||
<MotionFade delay={0.12}>
|
||||
<FlashMessage type="error" message={searchParams.error} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
<MediaLibraryManager mediaAssets={mediaAssets} />
|
||||
</div>
|
||||
</RootDashboardShell>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { FlashMessage } from "@/components/root/flash-message";
|
||||
import { PortfolioCategoriesManager } from "@/components/root/portfolio-categories-manager";
|
||||
import { RootDashboardShell } from "@/components/root/root-dashboard-shell";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
@@ -24,16 +22,7 @@ const copy = {
|
||||
backToSite: "Zur Website",
|
||||
};
|
||||
|
||||
type RootPortfolioCategoriesPageProps = {
|
||||
searchParams?: {
|
||||
success?: string;
|
||||
error?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export default async function RootPortfolioCategoriesPage({
|
||||
searchParams,
|
||||
}: RootPortfolioCategoriesPageProps) {
|
||||
export default async function RootPortfolioCategoriesPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
}
|
||||
@@ -59,18 +48,6 @@ export default async function RootPortfolioCategoriesPage({
|
||||
headerDescription={copy.subtitle}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{searchParams?.success ? (
|
||||
<MotionFade delay={0.08}>
|
||||
<FlashMessage type="success" message={searchParams.success} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
{searchParams?.error ? (
|
||||
<MotionFade delay={0.1}>
|
||||
<FlashMessage type="error" message={searchParams.error} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
<PortfolioCategoriesManager
|
||||
categories={categories}
|
||||
activeCount={activeCount}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { RootDashboardShell } from "@/components/root/root-dashboard-shell";
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { FlashMessage } from "@/components/root/flash-message";
|
||||
import { PortfolioProjectsOverview } from "@/components/root/portfolio-projects-overview";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { getAdminPortfolioCategories, getAdminPortfolioProjects } from "@/lib/portfolio";
|
||||
@@ -67,18 +65,6 @@ export default async function RootPortfolioPage({ searchParams }: RootPortfolioP
|
||||
headerDescription={copy.subtitle}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{searchParams?.success ? (
|
||||
<MotionFade delay={0.08}>
|
||||
<FlashMessage type="success" message={searchParams.success} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
{searchParams?.error ? (
|
||||
<MotionFade delay={0.1}>
|
||||
<FlashMessage type="error" message={searchParams.error} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
<PortfolioProjectsOverview
|
||||
categories={categories}
|
||||
projects={projects}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { FlashMessage } from "@/components/root/flash-message";
|
||||
import { PortfolioProjectForm } from "@/components/root/portfolio-project-form";
|
||||
import { RootDashboardShell } from "@/components/root/root-dashboard-shell";
|
||||
import { AppCard } from "@/components/ui/app-card";
|
||||
@@ -39,15 +38,10 @@ type RootPortfolioProjectPageProps = {
|
||||
params: {
|
||||
id: string;
|
||||
};
|
||||
searchParams?: {
|
||||
success?: string;
|
||||
error?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export default async function RootPortfolioProjectPage({
|
||||
params,
|
||||
searchParams,
|
||||
}: RootPortfolioProjectPageProps) {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
@@ -82,18 +76,6 @@ export default async function RootPortfolioProjectPage({
|
||||
saveButtonLabel={copy.saveProject}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{searchParams?.success ? (
|
||||
<MotionFade delay={0.1}>
|
||||
<FlashMessage type="success" message={searchParams.success} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
{searchParams?.error ? (
|
||||
<MotionFade delay={0.12}>
|
||||
<FlashMessage type="error" message={searchParams.error} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
<MotionFade delay={0.15}>
|
||||
<PortfolioProjectForm
|
||||
action={saveProjectAction}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { FlashMessage } from "@/components/root/flash-message";
|
||||
import { PortfolioProjectForm } from "@/components/root/portfolio-project-form";
|
||||
import { RootDashboardShell } from "@/components/root/root-dashboard-shell";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
@@ -25,15 +24,7 @@ const copy = {
|
||||
backToSite: "Zur Website",
|
||||
};
|
||||
|
||||
type RootNewPortfolioProjectPageProps = {
|
||||
searchParams?: {
|
||||
error?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export default async function RootNewPortfolioProjectPage({
|
||||
searchParams,
|
||||
}: RootNewPortfolioProjectPageProps) {
|
||||
export default async function RootNewPortfolioProjectPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
}
|
||||
@@ -61,12 +52,6 @@ export default async function RootNewPortfolioProjectPage({
|
||||
saveFormId="portfolio-project-form"
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{searchParams?.error ? (
|
||||
<MotionFade delay={0.1}>
|
||||
<FlashMessage type="error" message={searchParams.error} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
<MotionFade delay={0.15}>
|
||||
<PortfolioProjectForm
|
||||
action={saveProjectAction}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { FlashMessage } from "@/components/root/flash-message";
|
||||
import { PortfolioProjectsOverview } from "@/components/root/portfolio-projects-overview";
|
||||
import { RootDashboardShell } from "@/components/root/root-dashboard-shell";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
@@ -26,8 +24,6 @@ type RootPortfolioProjectsPageProps = {
|
||||
searchParams?: {
|
||||
category?: string;
|
||||
status?: "all" | "draft" | "published";
|
||||
success?: string;
|
||||
error?: string;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -69,18 +65,6 @@ export default async function RootPortfolioProjectsPage({
|
||||
headerDescription={copy.subtitle}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{searchParams?.success ? (
|
||||
<MotionFade delay={0.08}>
|
||||
<FlashMessage type="success" message={searchParams.success} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
{searchParams?.error ? (
|
||||
<MotionFade delay={0.1}>
|
||||
<FlashMessage type="error" message={searchParams.error} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
<PortfolioProjectsOverview
|
||||
categories={categories}
|
||||
projects={projects}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { MediaKind } from "@prisma/client";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { FlashMessage } from "@/components/root/flash-message";
|
||||
import { SiteSettingsForm } from "@/components/root/site-settings-form";
|
||||
import { RootDashboardShell } from "@/components/root/root-dashboard-shell";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
@@ -30,16 +29,7 @@ const copy = {
|
||||
backToSite: "Zur Website",
|
||||
};
|
||||
|
||||
type RootSiteSettingsPageProps = {
|
||||
searchParams?: {
|
||||
success?: string;
|
||||
error?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export default async function RootSiteSettingsPage({
|
||||
searchParams,
|
||||
}: RootSiteSettingsPageProps) {
|
||||
export default async function RootSiteSettingsPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
}
|
||||
@@ -65,21 +55,8 @@ export default async function RootSiteSettingsPage({
|
||||
headerTitle={copy.title}
|
||||
headerDescription={copy.subtitle}
|
||||
saveFormId="site-settings-form"
|
||||
reloadDocumentOnSave
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{searchParams?.success ? (
|
||||
<MotionFade delay={0.1}>
|
||||
<FlashMessage type="success" message={searchParams.success} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
{searchParams?.error ? (
|
||||
<MotionFade delay={0.12}>
|
||||
<FlashMessage type="error" message={searchParams.error} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
<MotionFade delay={0.16}>
|
||||
<SiteSettingsForm
|
||||
action={saveSiteSettingsAction}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { redirect } from "next/navigation";
|
||||
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { ContactProtectionForm } from "@/components/root/contact-protection-form";
|
||||
import { FlashMessage } from "@/components/root/flash-message";
|
||||
import { RootDashboardShell } from "@/components/root/root-dashboard-shell";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { getContactProtectionFormValues } from "@/lib/app-config";
|
||||
@@ -26,16 +25,7 @@ const copy = {
|
||||
backToSite: "Zur Website",
|
||||
};
|
||||
|
||||
type RootSMTPProtectionPageProps = {
|
||||
searchParams?: {
|
||||
success?: string;
|
||||
error?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export default async function RootSMTPProtectionPage({
|
||||
searchParams,
|
||||
}: RootSMTPProtectionPageProps) {
|
||||
export default async function RootSMTPProtectionPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
}
|
||||
@@ -58,21 +48,8 @@ export default async function RootSMTPProtectionPage({
|
||||
headerTitle={copy.title}
|
||||
headerDescription={copy.subtitle}
|
||||
saveFormId="contact-protection-form"
|
||||
reloadDocumentOnSave
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{searchParams?.success ? (
|
||||
<MotionFade delay={0.1}>
|
||||
<FlashMessage type="success" message={searchParams.success} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
{searchParams?.error ? (
|
||||
<MotionFade delay={0.12}>
|
||||
<FlashMessage type="error" message={searchParams.error} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
<MotionFade delay={0.16}>
|
||||
<ContactProtectionForm
|
||||
action={saveContactProtectionSettingsAction}
|
||||
|
||||
+1
-22
@@ -1,7 +1,6 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { FlashMessage } from "@/components/root/flash-message";
|
||||
import { RootDashboardShell } from "@/components/root/root-dashboard-shell";
|
||||
import { SMTPSettingsForm } from "@/components/root/smtp-settings-form";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -27,14 +26,7 @@ const copy = {
|
||||
backToSite: "Zur Website",
|
||||
};
|
||||
|
||||
type RootSMTPPageProps = {
|
||||
searchParams?: {
|
||||
success?: string;
|
||||
error?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export default async function RootSMTPPage({ searchParams }: RootSMTPPageProps) {
|
||||
export default async function RootSMTPPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
}
|
||||
@@ -57,7 +49,6 @@ export default async function RootSMTPPage({ searchParams }: RootSMTPPageProps)
|
||||
headerTitle={copy.title}
|
||||
headerDescription={copy.subtitle}
|
||||
saveFormId="smtp-settings-form"
|
||||
reloadDocumentOnSave
|
||||
headerActions={(
|
||||
<form action={sendTestEmailAction}>
|
||||
<Button type="submit" variant="outline">
|
||||
@@ -67,18 +58,6 @@ export default async function RootSMTPPage({ searchParams }: RootSMTPPageProps)
|
||||
)}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{searchParams?.success ? (
|
||||
<MotionFade delay={0.1}>
|
||||
<FlashMessage type="success" message={searchParams.success} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
{searchParams?.error ? (
|
||||
<MotionFade delay={0.12}>
|
||||
<FlashMessage type="error" message={searchParams.error} />
|
||||
</MotionFade>
|
||||
) : null}
|
||||
|
||||
<MotionFade delay={0.16}>
|
||||
<SMTPSettingsForm
|
||||
action={saveMailSettingsAction}
|
||||
|
||||
Reference in New Issue
Block a user