import React, { useState } from 'react'; import { Mail, Check, Loader2 } from 'lucide-react'; import { useAuth } from '../contexts/AuthContext'; import Modal from './ui/Modal'; // Sign-in modal: magic link (email) + Google OAuth. export default function LoginModal({ onClose }) { const { requestMagicLink, loginWithGoogle, googleAuthEnabled } = useAuth(); const [email, setEmail] = useState(''); const [sent, setSent] = useState(false); const [busy, setBusy] = useState(false); const [error, setError] = useState(''); const submit = async (e) => { e.preventDefault(); if (!email.trim()) return; setBusy(true); setError(''); try { await requestMagicLink(email.trim()); setSent(true); } catch (err) { setError(err.message || 'Something went wrong.'); } finally { setBusy(false); } }; return (

Access your plan and generate shorts with no API keys.

{sent ? (
sent

Check your inbox

We sent a sign-in link to {email}. It expires in 15 minutes.

) : ( <>
setEmail(e.target.value)} placeholder="you@email.com" className="input-field pl-10" autoFocus />
{error &&

{error}

}
{googleAuthEnabled && ( <>
or
)} {/* The account is created by this button, so the terms have to be reachable from it: a magic-link signup never passes the footer. */}

By signing in you agree to our{' '} Terms of Service {' '}and{' '} Privacy Policy.

)} ); }