import { prisma } from "@/lib/db";
import { ReleaseForm } from "@/components/admin/ReleaseForm";

export const dynamic = "force-dynamic";

export default async function NewReleasePage() {
  const addons = await prisma.addon.findMany({
    select: { id: true, name: true },
    orderBy: { name: "asc" },
  });

  return (
    <div className="mx-auto max-w-2xl space-y-6">
      <h1 className="text-3xl font-bold">发布新版本</h1>
      {addons.length === 0 ? (
        <p className="text-muted-foreground">
          请先创建一个插件后再发布版本。
        </p>
      ) : (
        <ReleaseForm addons={addons} />
      )}
    </div>
  );
}
