// ============ TaskQuest — Login / Sign-up page ============ const { useState: useStateL } = React; function LoginPage({ theme, toggleTheme, onLogin }) { const live = window.TQ_BACKEND.CONFIGURED; const [mode, setMode] = useStateL("signin"); // 'signin' | 'signup' const [name, setName] = useStateL(""); const [email, setEmail] = useStateL(""); const [identifier, setIdentifier] = useStateL(""); const [password, setPassword] = useStateL(""); const [roleType, setRoleType] = useStateL("consultant"); const [show, setShow] = useStateL(false); const [error, setError] = useStateL(""); const [info, setInfo] = useStateL(""); const [busy, setBusy] = useStateL(false); async function submit(e) { if (e) e.preventDefault(); setError(""); setInfo(""); setBusy(true); try { if (mode === "signin") { const { error } = await window.TQ_BACKEND.signIn(identifier.trim(), password); if (error) { setError(error.message || "Could not sign in."); } else { onLogin(); } } else { if (!name.trim()) { setError("Please enter your full name."); setBusy(false); return; } const { error, needsConfirm } = await window.TQ_BACKEND.signUp({ email: email.trim(), password, fullName: name.trim(), roleType, }); if (error) { setError(error.message || "Could not create the account."); } else if (needsConfirm) { setInfo("Account created — check your email to confirm, then sign in."); setMode("signin"); } else { onLogin(); } } } catch (err) { setError(err.message || "Something went wrong."); } setBusy(false); } return (
{/* Brand panel */}
TaskQuest
Accountability and momentum for delivery teams.
A Kanban-first workspace where progress earns points, managers approve in a click, and recognition lands on the leaderboard instantly.
{/* Form panel */}
TaskQuest
{mode === "signin" ? "Sign in" : "Create your account"}
{mode === "signin" ? "Welcome back — sign in to your workspace." : "Join your team's workspace."}
{error &&
{error}
} {info &&
{info}
} {mode === "signup" && (
{ setName(e.target.value); setError(""); }} />
)} {mode === "signin" ? (
{ setIdentifier(e.target.value); setError(""); }} />
) : (
{ setEmail(e.target.value); setError(""); }} />
)}
{ setPassword(e.target.value); setError(""); }} />
{mode === "signup" && (
)}
{mode === "signin" ? ( <>New here? ) : ( <>Already have an account? )}
{!live && (
Preview mode (no Supabase keys). Sign in with any details to explore as an admin, or Create an account to preview a role. Nothing is saved.
)}
); } window.LoginPage = LoginPage;