import { useState } from 'react' import { Link, useNavigate } from 'react-router-dom' import { useAuth } from '@/context/AuthContext' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Mail, Lock, ArrowRight, AlertCircle } from 'lucide-react' export function Login() { const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState('') const [loading, setLoading] = useState(false) const { login } = useAuth() const navigate = useNavigate() const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setError('') setLoading(true) try { await login(email, password) navigate('/dashboard') } catch (err: unknown) { setError(err instanceof Error ? err.message : 'Login failed. Please check your credentials.') } finally { setLoading(false) } } return (
{/* Left side - Form */}
{/* Logo */} MailFlow Logo MailFlow

Welcome back

Sign in to access your dashboard.

{/* Error message */} {error && (

{error}

)} {/* Form */}
setEmail(e.target.value)} className="pl-10 bg-slate-800 border-slate-700 text-white placeholder:text-slate-400 focus:border-primary-500" required />
Forgot?
setPassword(e.target.value)} className="pl-10 bg-slate-800 border-slate-700 text-white placeholder:text-slate-400 focus:border-primary-500" required />

Don't have an account?{' '} Sign up free

{/* Right side - Decorative */}

Your inbox under control

Thousands of users already trust MailFlow for more productive email communication.

) }