import { useState } from 'react'; import { Link, useNavigate } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; import { UserPlus, Mail, Lock, AlertCircle } from 'lucide-react'; export function Register() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [confirmPassword, setConfirmPassword] = useState(''); const [error, setError] = useState(''); const [isLoading, setIsLoading] = useState(false); const { register } = useAuth(); const navigate = useNavigate(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); if (password !== confirmPassword) { setError('Passwords do not match'); return; } if (password.length < 8) { setError('Password must be at least 8 characters'); return; } setIsLoading(true); try { await register(email, password); navigate('/analysis', { replace: true }); } catch (err) { setError(err instanceof Error ? err.message : 'Registration failed'); } finally { setIsLoading(false); } }; return (
Semiconductor Patent Analytics Dashboard
The first registered user will automatically become an admin.