@@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input"
88import { Label } from "@/components/ui/label"
99import Link from "next/link"
1010import { motion , AnimatePresence } from "framer-motion"
11- import { signInWithEmail } from "@/lib/features/auth"
11+ import { signUp } from "@/lib/features/auth"
1212import { getTranslations , getUserLanguage } from "@/lib/config"
1313import { LanguageSwitcher } from "@/components/language-switcher"
1414import {
@@ -17,14 +17,20 @@ import {
1717 ArrowRightIcon ,
1818 BoltIcon ,
1919 CheckCircleIcon ,
20- ShieldCheckIcon
20+ ShieldCheckIcon ,
21+ LockClosedIcon ,
22+ EyeIcon ,
23+ EyeSlashIcon
2124} from "@heroicons/react/24/outline"
2225
2326export default function SignUpPage ( ) {
2427 const router = useRouter ( )
2528 const [ email , setEmail ] = useState ( "" )
29+ const [ password , setPassword ] = useState ( "" )
30+ const [ confirmPassword , setConfirmPassword ] = useState ( "" )
2631 const [ error , setError ] = useState ( "" )
27- const [ message , setMessage ] = useState ( "" )
32+ const [ showPassword , setShowPassword ] = useState ( false )
33+ const [ showConfirmPassword , setShowConfirmPassword ] = useState ( false )
2834 const [ t , setT ] = useState ( getTranslations ( "en" ) )
2935
3036 useEffect ( ( ) => {
@@ -34,17 +40,27 @@ export default function SignUpPage() {
3440 const handleSignUp = async ( e : React . FormEvent ) => {
3541 e . preventDefault ( )
3642 setError ( "" )
37- setMessage ( "" )
3843
39- if ( ! email ) {
40- setError ( "Email is required" )
44+ if ( ! email || ! password ) {
45+ setError ( "Email and password are required" )
4146 return
4247 }
4348
44- const result = await signInWithEmail ( email )
49+ if ( password !== confirmPassword ) {
50+ setError ( "Passwords do not match" )
51+ return
52+ }
53+
54+ if ( password . length < 6 ) {
55+ setError ( "Password must be at least 6 characters" )
56+ return
57+ }
58+
59+ // Name is optional in our new flow, passing undefined
60+ const result = await signUp ( email , password )
4561
4662 if ( result . success ) {
47- setMessage ( "Check your email for the magic link to complete sign up! ")
63+ router . push ( "/dashboard ")
4864 } else {
4965 setError ( result . error || "Sign up failed" )
5066 }
@@ -165,19 +181,6 @@ export default function SignUpPage() {
165181 </ div >
166182 </ motion . div >
167183 ) }
168- { message && (
169- < motion . div
170- initial = { { opacity : 0 , height : 0 } }
171- animate = { { opacity : 1 , height : "auto" } }
172- exit = { { opacity : 0 , height : 0 } }
173- className = "rounded-2xl border border-green-500/50 bg-green-500/5 p-4 text-sm text-green-400 overflow-hidden"
174- >
175- < div className = "flex items-center gap-3" >
176- < div className = "w-1.5 h-6 bg-green-500 rounded-full" > </ div >
177- < p className = "font-medium" > { message } </ p >
178- </ div >
179- </ motion . div >
180- ) }
181184 </ AnimatePresence >
182185
183186 < div className = "space-y-5" >
@@ -200,6 +203,60 @@ export default function SignUpPage() {
200203 />
201204 </ div >
202205 </ div >
206+
207+ < div className = "space-y-2" >
208+ < Label htmlFor = "password" className = "text-xs font-bold uppercase tracking-widest text-slate-500 ml-1" >
209+ { t . auth . password }
210+ </ Label >
211+ < div className = "relative group" >
212+ < div className = "absolute left-4 top-1/2 -translate-y-1/2 flex items-center justify-center" >
213+ < LockClosedIcon className = "h-5 w-5 text-slate-500 group-focus-within:text-primary transition-colors" />
214+ </ div >
215+ < Input
216+ id = "password"
217+ type = { showPassword ? "text" : "password" }
218+ placeholder = "••••••••"
219+ value = { password }
220+ onChange = { ( e ) => setPassword ( e . target . value ) }
221+ className = "pl-12 pr-12 h-14 bg-white/[0.03] border-white/5 hover:border-white/10 focus:border-primary/50 transition-all rounded-2xl text-lg placeholder:text-slate-600 focus:ring-0 focus:bg-white/[0.05]"
222+ required
223+ />
224+ < button
225+ type = "button"
226+ onClick = { ( ) => setShowPassword ( ! showPassword ) }
227+ className = "absolute right-4 top-1/2 -translate-y-1/2 text-slate-500 hover:text-white transition-colors"
228+ >
229+ { showPassword ? < EyeSlashIcon className = "h-5 w-5" /> : < EyeIcon className = "h-5 w-5" /> }
230+ </ button >
231+ </ div >
232+ </ div >
233+
234+ < div className = "space-y-2" >
235+ < Label htmlFor = "confirmPassword" className = "text-xs font-bold uppercase tracking-widest text-slate-500 ml-1" >
236+ Confirm Password
237+ </ Label >
238+ < div className = "relative group" >
239+ < div className = "absolute left-4 top-1/2 -translate-y-1/2 flex items-center justify-center" >
240+ < LockClosedIcon className = "h-5 w-5 text-slate-500 group-focus-within:text-primary transition-colors" />
241+ </ div >
242+ < Input
243+ id = "confirmPassword"
244+ type = { showConfirmPassword ? "text" : "password" }
245+ placeholder = "••••••••"
246+ value = { confirmPassword }
247+ onChange = { ( e ) => setConfirmPassword ( e . target . value ) }
248+ className = "pl-12 pr-12 h-14 bg-white/[0.03] border-white/5 hover:border-white/10 focus:border-primary/50 transition-all rounded-2xl text-lg placeholder:text-slate-600 focus:ring-0 focus:bg-white/[0.05]"
249+ required
250+ />
251+ < button
252+ type = "button"
253+ onClick = { ( ) => setShowConfirmPassword ( ! showConfirmPassword ) }
254+ className = "absolute right-4 top-1/2 -translate-y-1/2 text-slate-500 hover:text-white transition-colors"
255+ >
256+ { showConfirmPassword ? < EyeSlashIcon className = "h-5 w-5" /> : < EyeIcon className = "h-5 w-5" /> }
257+ </ button >
258+ </ div >
259+ </ div >
203260 </ div >
204261
205262 < div className = "text-sm text-slate-500 font-medium px-1" >
@@ -213,7 +270,7 @@ export default function SignUpPage() {
213270 type = "submit"
214271 className = "w-full h-14 text-lg font-black uppercase tracking-widest bg-primary hover:bg-primary/90 text-slate-950 shadow-[0_0_20px_rgba(var(--primary-rgb),0.3)] hover:shadow-[0_0_30px_rgba(var(--primary-rgb),0.5)] transition-all group rounded-2xl"
215272 >
216- Send Magic Link
273+ Sign Up
217274 < ArrowRightIcon className = "ml-3 h-5 w-5 group-hover:translate-x-1.5 transition-transform" />
218275 </ Button >
219276 </ form >
0 commit comments