"use client"; import { useState } from "react"; import { cmsApi } from "@/lib/api"; import { useAuth } from "@/context/AuthContext"; import { useRouter } from "next/navigation"; import Link from "next/link"; import { UserPlus, Mail, Lock, User } from "lucide-react"; export default function RegisterPage() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [fullName, setFullName] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); const { login } = useAuth(); const router = useRouter(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(""); try { const res = await cmsApi.register({ email, password, full_name: fullName }); login(res.user, res.token); router.push("/"); } catch (err) { const message = err instanceof Error ? err.message : "Registration failed. Please try again."; setError(message); } finally { setLoading(false); } }; return (

Instructor Studio

Create your professional teaching workspace

{error && (
{error}
)}
setFullName(e.target.value)} placeholder="Instructor Name" className="w-full bg-white/5 border border-white/10 rounded-xl py-4 pl-12 pr-4 text-sm text-white focus:outline-none focus:border-blue-500 transition-all placeholder:text-gray-700" />
setEmail(e.target.value)} placeholder="instructor@openccb.com" className="w-full bg-white/5 border border-white/10 rounded-xl py-4 pl-12 pr-4 text-sm text-white focus:outline-none focus:border-blue-500 transition-all placeholder:text-gray-700" />
setPassword(e.target.value)} placeholder="••••••••" className="w-full bg-white/5 border border-white/10 rounded-xl py-4 pl-12 pr-4 text-sm text-white focus:outline-none focus:border-blue-500 transition-all placeholder:text-gray-700" />

Already registered? Login to Studio

); }