// ============================================================ // Mobile auth — Login + Sign Up (polished) // Loads after extras-v2.jsx // ============================================================ const LOGO_URL = "https://www.nambikkai.com/logo.png"; const APP_NAME_V2 = "Ground Voice"; function AuthField({ label, icon: Ic, children }) { return ( ); } function AuthInput({ icon: Ic, type = "text", value, onChange, placeholder, trailing }) { return (
{Ic && } {trailing}
); } function PwToggle({ show, onToggle }) { return ( ); } function Login({ onLogin }) { const [mode, setMode] = React.useState("login"); // Login fields const [user, setUser] = React.useState(""); const [pw, setPw] = React.useState(""); const [showPw, setShowPw] = React.useState(false); // Signup fields const [name, setName] = React.useState(""); const [email, setEmail] = React.useState(""); const [signPw, setSignPw] = React.useState(""); const [signPwC, setSignPwC] = React.useState(""); const [showSignPw, setShowSignPw] = React.useState(false); const [loc, setLoc] = React.useState(""); const [agreed, setAgreed] = React.useState(false); const validLogin = user.trim().length > 2 && pw.length >= 4; const validSignup = name.trim().length > 2 && email.trim().length > 3 && signPw.length >= 4 && signPw === signPwC && agreed; const pwMismatch = signPwC.length > 0 && signPw !== signPwC; return (
{/* ---- brand block ---- */}
Nambikkai { e.currentTarget.onerror = null; e.currentTarget.src = "assets/logo.png"; }} />
{APP_NAME_V2}
நம்பிக்கை · Report the story from where you stand.
{/* ---- form sheet ---- */}
{/* tab toggle */}
{[["login", "Log in"], ["signup", "Sign up"]].map(([k, l]) => ( ))}
{mode === "login" ? ( setUser(e.target.value)} placeholder="arjun.v" /> setPw(e.target.value)} placeholder="••••••••" trailing={ setShowPw((s) => !s)} />} />
Forgot password?
or
New reporter? setMode("signup")} style={{ color: "var(--blue)", fontWeight: 600, cursor: "pointer" }}> Sign up
) : ( setName(e.target.value)} placeholder="Arjun Vasudevan" /> setEmail(e.target.value)} placeholder="arjun@example.com" /> setSignPw(e.target.value)} placeholder="Min. 8 characters" trailing={ setShowSignPw((s) => !s)} />} />
setSignPwC(e.target.value)} placeholder="Re-enter password" style={{ ...nkInput, paddingLeft: 38, borderColor: pwMismatch ? "var(--red)" : undefined }} /> {pwMismatch && (
Passwords don't match
)}
setLoc(e.target.value)} placeholder="Coimbatore, TN" /> {/* terms checkbox */}
Already registered? setMode("login")} style={{ color: "var(--blue)", fontWeight: 600, cursor: "pointer" }}> Log in
)}
); } Object.assign(window, { Login, LOGO_URL, APP_NAME_V2 });