// app/register/page.tsx "use client"; import { FormEvent, useState } from "react"; import { useRouter, useSearchParams } from "next/navigation"; import Link from "next/link"; import { useAuth } from "@/context/AuthContext"; import { Button, Field, Input } from "@/components/ui/form"; export default function RegisterPage() { const router = useRouter(); const searchParams = useSearchParams(); const { register, loading } = useAuth(); const [email, setEmail] = useState(""); const [displayName, setDisplayName] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(null); const next = searchParams.get("next") || "/builder"; async function handleSubmit(e: FormEvent) { e.preventDefault(); setError(null); try { await register({ email, password, displayName }); router.push(next); } catch (err: any) { setError(err.message ?? "Failed to create account"); } } return (

Join the Battl Builder Beta

Create an account so we can save your builds, watch price drops, and roll out new features to you first.

{error && (
{error}
)} setDisplayName(e.target.value)} /> setEmail(e.target.value)} /> setPassword(e.target.value)} />

Already have an account?{" "} Log in .

); }