import Link from "next/link";
import { AdminSidebar } from "@/components/admin/AdminSidebar";
import { Button } from "@/components/ui/button";
import { getCurrentUser } from "@/modules/auth";

export const metadata = { title: "Not found · Admin" };

export default async function AdminNotFound() {
  const session = await getCurrentUser();
  return (
    <div className="flex min-h-screen bg-surface-muted/40">
      <AdminSidebar
        user={
          session
            ? { name: session.name, email: session.email }
            : { name: "Admin", email: "" }
        }
      />
      <main className="flex-1 min-w-0 px-4 py-6 sm:px-6 lg:px-8 lg:py-8">
        <div className="mx-auto max-w-xl text-center">
          <p className="text-sm font-medium text-muted">404</p>
          <h1 className="mt-2 text-3xl font-semibold tracking-tight text-foreground">
            Not found in admin
          </h1>
          <p className="mt-3 text-muted">
            That admin page doesn&apos;t exist or has been moved. Head back to the
            dashboard.
          </p>
          <div className="mt-6">
            <Link href="/admin">
              <Button size="sm">Go to admin dashboard</Button>
            </Link>
          </div>
        </div>
      </main>
    </div>
  );
}
