/* ============================================================ INDIC LEAGUE NEWS — Mock login screen No backend; "Continue" just sets a fake user in localStorage. ============================================================ */ function Login({ onLoggedIn, onBack }) { const [email, setEmail] = React.useState(''); const [password, setPassword] = React.useState(''); const [showPw, setShowPw] = React.useState(false); const [error, setError] = React.useState(null); const [loading, setLoading] = React.useState(false); const validEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email); const submit = (e) => { if (e) e.preventDefault(); if (!validEmail) { setError('Please enter a valid email'); window.IL_Sounds && window.IL_Sounds.error(); window.IL_Util && window.IL_Util.Haptics.error(); return; } if (password.length < 4) { setError('Password must be at least 4 characters'); window.IL_Sounds && window.IL_Sounds.error(); window.IL_Util && window.IL_Util.Haptics.error(); return; } setError(null); setLoading(true); window.IL_Sounds && window.IL_Sounds.tap(); setTimeout(() => { const name = email.split('@')[0].replace(/[._-]/g, ' '); const user = { name: name.split(' ').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' '), email, joined: new Date().toISOString(), }; window.IL_Util.Storage.set(window.IL_KEYS.authed, true); window.IL_Util.Storage.set(window.IL_KEYS.user, user); window.IL_Sounds && window.IL_Sounds.success(); window.IL_Util && window.IL_Util.Haptics.success(); onLoggedIn(user); }, 500); }; const continueAsGuest = () => { window.IL_Sounds && window.IL_Sounds.tap(); onLoggedIn(null); }; const socialLogin = (provider) => { setLoading(true); window.IL_Sounds && window.IL_Sounds.tap(); setTimeout(() => { const fakeUser = { name: provider === 'google' ? 'Deepanshu Tomar' : 'Indic Reader', email: provider === 'google' ? 'deepanshu@gmail.com' : 'user@icloud.com', joined: new Date().toISOString(), provider, }; window.IL_Util.Storage.set(window.IL_KEYS.authed, true); window.IL_Util.Storage.set(window.IL_KEYS.user, fakeUser); window.IL_Sounds && window.IL_Sounds.success(); window.IL_Util && window.IL_Util.Haptics.success(); onLoggedIn(fakeUser); }, 600); }; return (
iL
INDIC LEAGUE NEWS

Welcome back.

Pick up where you left off. We saved your perspective and your reading streak.

{ setEmail(e.target.value); setError(null); }} autoComplete="email" disabled={loading} />
{ setPassword(e.target.value); setError(null); }} autoComplete="current-password" disabled={loading} style={{ paddingRight: 50 }} />
{error && (
{error}
)}
{ e.preventDefault(); window.IL_Sounds && window.IL_Sounds.tap(); }} style={{ fontSize: 13, fontWeight: 500, color: 'var(--text-2)' }} > Forgot password?
OR
New to Indic League? { e.preventDefault(); onBack && onBack(); }}>Create account
); } Object.assign(window, { Login });