import { notFound } from "next/navigation";
import { prisma } from "@/lib/db";
import { AddonForm } from "@/components/admin/AddonForm";

export const dynamic = "force-dynamic";

export default async function EditAddonPage({
  params,
}: {
  params: Promise<{ id: string }>;
}) {
  const { id } = await params;
  const addon = await prisma.addon.findUnique({ where: { id } });

  if (!addon) notFound();

  return (
    <div className="mx-auto max-w-2xl space-y-6">
      <h1 className="text-3xl font-bold">编辑插件</h1>
      <AddonForm initialData={addon} />
    </div>
  );
}
