fix(admin): persist data directory and pass env vars
This commit is contained in:
parent
99e8201745
commit
1d7e7c41c9
39 changed files with 1297 additions and 32 deletions
48
components/admin/AdminShell.tsx
Normal file
48
components/admin/AdminShell.tsx
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
"use client";
|
||||
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
const navItems = [
|
||||
["Dashboard", "/admin"],
|
||||
["Kontaktanfragen", "/admin/kontaktanfragen"],
|
||||
["Reparaturanfragen", "/admin/reparaturanfragen"],
|
||||
["Website-Inhalte", "/admin/website"],
|
||||
["Medien", "/admin/medien"],
|
||||
["Einstellungen", "/admin/einstellungen"],
|
||||
["SMTP", "/admin/smtp"],
|
||||
["SEO", "/admin/seo"],
|
||||
["System", "/admin/system"],
|
||||
] as const;
|
||||
|
||||
export default function AdminShell({ children }: { children: ReactNode }) {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
|
||||
async function logout() {
|
||||
await fetch("/api/admin/logout", { method: "POST" });
|
||||
router.push("/admin/login");
|
||||
router.refresh();
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="admin-shell">
|
||||
<aside className="admin-sidebar">
|
||||
<Link className="admin-logo" href="/admin">
|
||||
<Image src="/funktechnik_schubert_logo.jpg" alt="Funktechnik Schubert" width={1672} height={941} />
|
||||
</Link>
|
||||
<nav className="admin-nav" aria-label="Administration">
|
||||
{navItems.map(([label, href]) => (
|
||||
<Link key={href} href={href} aria-current={pathname === href ? "page" : undefined}>
|
||||
{label}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
<button className="admin-logout" type="button" onClick={logout}>Abmelden</button>
|
||||
</aside>
|
||||
<div className="admin-main">{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue