2026-06-01 13:42:30 +03:30
|
|
|
import { redirect } from "next/navigation";
|
2026-06-02 09:35:14 +03:30
|
|
|
import { getTranslations } from "next-intl/server";
|
2026-06-01 13:42:30 +03:30
|
|
|
|
|
|
|
|
import { getCurrentUser } from "@/lib/auth/session";
|
|
|
|
|
|
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
|
|
|
|
|
|
export default async function AdminLayout({
|
|
|
|
|
children,
|
|
|
|
|
}: {
|
|
|
|
|
children: React.ReactNode;
|
|
|
|
|
}) {
|
|
|
|
|
const user = await getCurrentUser();
|
|
|
|
|
if (!user || !user.is_admin) {
|
|
|
|
|
redirect("/dashboard");
|
|
|
|
|
}
|
2026-06-02 09:35:14 +03:30
|
|
|
const t = await getTranslations("auto.appAdminLayout");
|
|
|
|
|
const links: { href: string; label: string }[] = [
|
|
|
|
|
{ href: "/admin/categories", label: t("categories") },
|
2026-06-02 14:26:44 +03:30
|
|
|
{ href: "/admin/templates", label: t("templates") },
|
2026-06-02 09:35:14 +03:30
|
|
|
{ href: "/admin/tags", label: t("tags") },
|
|
|
|
|
{ href: "/admin/fonts", label: t("fonts") },
|
|
|
|
|
{ href: "/admin/blogs", label: t("blogs") },
|
|
|
|
|
{ href: "/admin/slides", label: t("slides") },
|
2026-06-02 14:55:52 +03:30
|
|
|
{ href: "/admin/files", label: t("media") },
|
2026-06-02 09:35:14 +03:30
|
|
|
{ href: "/admin/ai", label: t("aiContent") },
|
2026-06-02 17:32:54 +03:30
|
|
|
{ href: "/admin/messaging", label: t("messaging") },
|
2026-06-02 18:17:19 +03:30
|
|
|
{ href: "/admin/marketing", label: t("marketing") },
|
2026-06-02 09:35:14 +03:30
|
|
|
{ href: "/admin/users", label: t("users") },
|
|
|
|
|
{ href: "/admin/plans", label: t("plans") },
|
2026-06-02 15:20:07 +03:30
|
|
|
{ href: "/admin/discounts", label: t("discounts") },
|
|
|
|
|
{ href: "/admin/settings", label: t("siteSettings") },
|
2026-06-02 09:35:14 +03:30
|
|
|
{ href: "/admin/nodes", label: t("nodes") },
|
|
|
|
|
{ href: "/admin/renders", label: t("renderQueue") },
|
|
|
|
|
];
|
2026-06-01 13:42:30 +03:30
|
|
|
return (
|
|
|
|
|
<div className="min-h-screen bg-[#0c0e1a] text-gray-200">
|
|
|
|
|
<nav className="border-b border-[#1e2235] bg-[#0f1120] px-6 py-3">
|
2026-06-02 09:35:14 +03:30
|
|
|
<div className="mx-auto flex max-w-7xl flex-wrap items-center gap-x-5 gap-y-2">
|
|
|
|
|
<span className="text-sm font-semibold text-white">{t("brand")}</span>
|
|
|
|
|
{links.map((l) => (
|
|
|
|
|
<a
|
|
|
|
|
key={l.href}
|
|
|
|
|
href={l.href}
|
|
|
|
|
className="text-sm text-gray-400 transition-colors hover:text-white"
|
|
|
|
|
>
|
|
|
|
|
{l.label}
|
|
|
|
|
</a>
|
|
|
|
|
))}
|
2026-06-01 13:42:30 +03:30
|
|
|
<a
|
|
|
|
|
href="/dashboard"
|
2026-06-02 09:35:14 +03:30
|
|
|
className="ml-auto text-xs text-gray-500 transition-colors hover:text-gray-300"
|
2026-06-01 13:42:30 +03:30
|
|
|
>
|
2026-06-02 09:35:14 +03:30
|
|
|
{t("backToDashboard")}
|
2026-06-01 13:42:30 +03:30
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|
|
|
|
|
<main className="mx-auto max-w-7xl px-6 py-8">{children}</main>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|