"use client"; import { motion } from "framer-motion"; import { Mail } from "lucide-react"; import { useState } from "react"; import { ScreenHeader, ScreenShell } from "@/components/online/ScreenHeader"; import { useSessionStore } from "@/lib/session-store"; import { useUIStore } from "@/lib/ui-store"; import { useI18n } from "@/lib/i18n"; export function AuthScreen() { const { t } = useI18n(); const go = useUIStore((s) => s.go); const done = () => go("online"); return (

{t("auth.subtitle")}

{/* Active method: phone OTP */} {/* Coming soon (until email SMTP / Google are configured) */}

{t("auth.otherSoon")}

} label={t("auth.email")} soon={t("common.soon")} /> } label={t("auth.google")} soon={t("common.soon")} />
); } function SoonButton({ icon, label, soon, }: { icon: React.ReactNode; label: string; soon: string; }) { return ( ); } function PhoneForm({ onDone }: { onDone: () => void }) { const { t } = useI18n(); const requestOtp = useSessionStore((s) => s.requestOtp); const verifyOtp = useSessionStore((s) => s.verifyOtp); const [phone, setPhone] = useState(""); const [code, setCode] = useState(""); const [devCode, setDevCode] = useState(null); const [error, setError] = useState(""); const send = async () => { if (phone.trim().length < 4) return; const res = await requestOtp(phone.trim()); setDevCode(res.devCode ?? null); setError(""); }; const verify = async () => { try { await verifyOtp(phone.trim(), code.trim()); onDone(); } catch { setError(t("auth.invalidCode")); } }; return (
setPhone(e.target.value)} placeholder={t("auth.phonePlaceholder")} className="w-full rounded-xl bg-navy-900/70 gold-border px-4 py-3 text-cream text-center tracking-wider outline-none focus:ring-2 focus:ring-gold-500/40" />
{devCode == null ? ( ) : (
{t("auth.devCode", { code: devCode })}
setCode(e.target.value)} placeholder={t("auth.codePlaceholder")} maxLength={4} className="w-full rounded-xl bg-navy-900/70 gold-border px-4 py-3 text-cream text-center text-xl tracking-[0.5em] outline-none focus:ring-2 focus:ring-gold-500/40" />
{error &&

{error}

}
)}
); } function GoogleIcon() { return ( ); }