import { redirect } from "next/navigation"; import type { ReactNode } from "react"; import { AdminNavLink } from "@/components/admin/admin-nav-link"; import { requireStaff } from "@/lib/admin/guard"; import { prisma } from "@/lib/prisma"; import { siteSettings } from "@/lib/services/site-settings"; import { LayoutDashboard, Newspaper, Tags, Compass, HelpCircle, Megaphone, SquarePen, Image, Users, Ban, Globe, Shield, ClipboardList, Group, Key, Store, ShoppingCart, Receipt, Ticket, CreditCard, Gem, Award, Trophy, Calendar, Radio, History, Terminal, Monitor, Bell, FileText, Filter, Wrench, Settings, DoorOpen, Mail, Palette, Cog, ChevronDown, LogOut, } from "lucide-react"; export const dynamic = "force-dynamic"; const NAV_GROUPS: { label: string; icon: ReactNode; items: { href: string; label: string; icon: ReactNode }[] }[] = [ { label: "Overview", icon: , items: [{ href: "/admin", label: "Dashboard", icon: }], }, { label: "Content", icon: , items: [ { href: "/admin/articles", label: "Articles", icon: }, { href: "/admin/tags", label: "Tags", icon: }, { href: "/admin/navigation", label: "Navigator", icon: }, { href: "/admin/help-questions", label: "Help center", icon: }, { href: "/admin/ads", label: "Advertisements", icon: }, { href: "/admin/writeable-boxes", label: "Writeable boxes", icon: }, { href: "/admin/photos", label: "Photos", icon: }, ], }, { label: "Users & access", icon: , items: [ { href: "/admin/users", label: "Users", icon: }, { href: "/admin/bans", label: "Bans", icon: }, { href: "/admin/ip", label: "IP management", icon: }, { href: "/admin/vpn", label: "VPN", icon: }, { href: "/admin/applications", label: "Applications", icon: }, { href: "/admin/teams", label: "Teams", icon: }, { href: "/admin/permissions", label: "Permissions", icon: }, ], }, { label: "Economy", icon: , items: [ { href: "/admin/catalog", label: "Catalog", icon: }, { href: "/admin/shop", label: "Shop", icon: }, { href: "/admin/transactions", label: "Transactions", icon: }, { href: "/admin/vouchers", label: "Vouchers", icon: }, { href: "/admin/subscriptions", label: "Subscriptions", icon: }, { href: "/admin/rare-values", label: "Rare values", icon: }, { href: "/admin/badges", label: "Badges", icon: }, { href: "/admin/achievements", label: "Achievements", icon: }, { href: "/admin/calendar", label: "Calendar", icon: }, ], }, { label: "Radio", icon: , items: [ { href: "/admin/radio", label: "Radio", icon: }, { href: "/admin/radio/history", label: "Radio history", icon: }, ], }, { label: "System", icon: , items: [ { href: "/admin/commandocentrum", label: "Commandocentrum", icon: }, { href: "/admin/emulator", label: "Emulator", icon: }, { href: "/admin/alerts", label: "Alerts", icon: }, { href: "/admin/logs", label: "Logs", icon: }, { href: "/admin/wordfilter", label: "Word filter", icon: }, { href: "/admin/maintenance", label: "Maintenance", icon: }, { href: "/admin/housekeeping", label: "Housekeeping", icon: }, { href: "/admin/rooms", label: "Rooms", icon: }, { href: "/admin/email-templates", label: "Email templates", icon: }, { href: "/admin/theme", label: "Theme", icon: }, { href: "/admin/media", label: "Media", icon: }, { href: "/admin/settings", label: "Settings", icon: }, ], }, ]; export default async function AdminLayout({ children }: { children: ReactNode }) { const staff = await requireStaff(); if (await siteSettings.getBool("force_staff_2fa", false)) { const u = await prisma.user .findUnique({ where: { id: staff.id }, select: { twoFactorConfirmedAt: true } }) .catch(() => null); if (!u?.twoFactorConfirmedAt) redirect("/settings/2fa?error=staffrequired"); } return (
{children}
); } function Sidebar({ staff }: { staff: { id: number; username: string; rank: number } }) { const initial = staff.username.charAt(0).toUpperCase(); return ( ); } function Topbar({ staff }: { staff: { id: number; username: string; rank: number } }) { return (

Housekeeping

Hotel management panel
{staff.username} rank {staff.rank}
); }