'use client' import { createClient } from '@/lib/supabase/client' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import Link from 'next/link' import { useRouter } from 'next/navigation' import { useState } from 'react' import { Mail, Lock, Loader2, ArrowLeft, User } from 'lucide-react' export default function SignUpPage() { const [name, setName] = useState('') const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState(null) const [isLoading, setIsLoading] = useState(false) const [isGoogleLoading, setIsGoogleLoading] = useState(false) const router = useRouter() const handleSignUp = async (e: React.FormEvent) => { e.preventDefault() const supabase = createClient() setIsLoading(true) setError(null) try { const { error } = await supabase.auth.signUp({ email, password, options: { emailRedirectTo: `${window.location.origin}/auth/callback`, data: { full_name: name, }, }, }) if (error) throw error router.push('/auth/sign-up-success') } catch (error: unknown) { setError(error instanceof Error ? error.message : 'An error occurred') } finally { setIsLoading(false) } } const handleGoogleSignUp = async () => { const supabase = createClient() setIsGoogleLoading(true) setError(null) try { const { error } = await supabase.auth.signInWithOAuth({ provider: 'google', options: { redirectTo: `${window.location.origin}/auth/callback`, }, }) if (error) throw error } catch (error: unknown) { setError(error instanceof Error ? error.message : 'An error occurred') setIsGoogleLoading(false) } } return (
{/* Background elements */}
{/* Back to home */} Back to home {/* Card */}
{/* Header */}
Cloudrite

Create an account

Get started with Cloudrite today

{/* Google OAuth Button */} {/* Divider */}
Or continue with email
{/* Email/Password Form */}
setName(e.target.value)} className="pl-10 h-12" />
setEmail(e.target.value)} className="pl-10 h-12" />
setPassword(e.target.value)} className="pl-10 h-12" />

Must be at least 6 characters

{error && (

{error}

)}
{/* Footer */}

Already have an account?{' '} Sign in

) }