import { redirect } from "next/navigation";
import { getCtx } from "@/lib/auth";
import { AuthFrame } from "@/components/auth-forms";
import { SignupForm } from "@/components/signup-form";

export const dynamic = "force-dynamic";
export const metadata = { title: "Create your account" };

export default async function Signup({ searchParams }: { searchParams: Promise<{ plan?: string }> }) {
  if (await getCtx()) redirect("/dashboard");
  const sp = await searchParams;
  return <AuthFrame title="Create your account" subtitle="Set up your workspace in two minutes — free for 14 days" wide><SignupForm initialPlan={sp.plan} /></AuthFrame>;
}
