"use client"; import { useState } from "react"; import { createClient, magicLinkRedirectTo } from "@/lib/supabase/browser.js"; export default function LoginForm() { const [email, setEmail] = useState(""); const [status, setStatus] = useState("idle"); const [error, setError] = useState(""); async function sendMagicLink(event) { event.preventDefault(); setStatus("pending"); setError(""); const { error: signInError } = await createClient().auth.signInWithOtp({ email, options: { emailRedirectTo: magicLinkRedirectTo(window.location.origin) }, }); if (signInError) { setError("We could not send a magic link. Please try again."); setStatus("idle"); return; } setStatus("sent"); } return (

Welcome

Confidence Engine

Enter your email and we will send you a secure link to continue.

setEmail(event.target.value)} className="w-full rounded-lg border border-gray-300 px-4 py-3 text-sm focus:border-teal-600 focus:outline-none focus:ring-2 focus:ring-teal-400" />
{status === "sent" &&

Check your email for your magic link.

} {error &&

{error}

}

Sign in to continue

Enter your email and we{'\''}ll send you a secure sign-in link.

Your investigations are private to your account and saved so you can return to them later.

); }