import React, { useState } from 'react'; import { useAuth } from '../context/AuthContext'; import { useNavigate } from 'react-router-dom'; // Icons const CloseIcon = ({ className }) => ( ); const GoogleIcon = ({ className }) => ( ); const AtSignIcon = ({ className }) => ( ); const LockIcon = ({ className }) => ( ); const LoginModal = ({ onClose, onSignup }) => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const { login, googleLogin } = useAuth(); const navigate = useNavigate(); const handleSubmit = async (e) => { e.preventDefault(); setError(''); setLoading(true); try { await login({ email, password }); onClose(); navigate('/dashboard'); } catch (err) { setError(err.response?.data?.message || 'Invalid email or password'); } finally { setLoading(false); } }; const handleGoogleLogin = () => { googleLogin(); }; return (
Welcome back to PopcornPing.
Don't have an account?{' '}