import { useState } from 'react'; import { useNavigate, Link, useSearchParams } from 'react-router-dom'; import { useAuthStore } from '../../store/authStore'; import { Blocks, Eye, EyeOff, Mail, Lock } from 'lucide-react'; import GoogleButton from './GoogleButton'; export default function LoginForm() { const [searchParams] = useSearchParams(); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [showPassword, setShowPassword] = useState(false); const { login, loading, error, clearError } = useAuthStore(); const navigate = useNavigate(); const urlError = searchParams.get('error'); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); try { await login(email, password); navigate('/dashboard'); } catch {} }; return (
RealBlocks

Sign in to your account

{(error || urlError) && (
{error || (urlError === 'google-auth-failed' ? 'Google sign in failed. Please try again.' : urlError)}
)}
{ setEmail(e.target.value); clearError(); }} className="input pl-10" placeholder="you@example.com" required />
{ setPassword(e.target.value); clearError(); }} className="input pl-10 pr-10" placeholder="••••••••" required />
Forgot password?
or continue with

Don't have an account?{' '} Create one

); }