import { useState } from 'react' import { useTranslation } from 'react-i18next' import { AlertCircle } from 'lucide-react' import { Button } from '@/components/ui/button' import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@/components/ui/card' import { Input } from '@/components/ui/input' import { Alert, AlertDescription } from '@/components/ui/alert' import { Spinner } from '@/components/ui/spinner' import { palette } from '@/lib/palette' import type { AuthContext } from '@/hooks/useAuth' interface Props { auth: AuthContext onToggle: () => void } export function RegisterPage({ auth: { register }, onToggle }: Props) { const { t } = useTranslation() const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [displayName, setDisplayName] = useState('') const [error, setError] = useState('') const [loading, setLoading] = useState(false) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setError('') setLoading(true) try { await register(email, password, displayName) } catch (err) { setError(err instanceof Error ? err.message : 'Registration failed') } finally { setLoading(false) } } return (