'use client' import { useState } from 'react' import { createClient } from '@/lib/supabase/client' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' export default function LoginPage() { const [email, setEmail] = useState('') const [submitted, setSubmitted] = useState(false) const [error, setError] = useState(null) const [loading, setLoading] = useState(false) async function handleSubmit(e: React.FormEvent) { e.preventDefault() setLoading(true) setError(null) const supabase = createClient() const { error } = await supabase.auth.signInWithOtp({ email, options: { emailRedirectTo: `${window.location.origin}/auth/confirm`, shouldCreateUser: false, // invite-only: only existing users can log in }, }) if (error) { setError(error.message) } else { setSubmitted(true) } setLoading(false) } if (submitted) { return (

Check your email

We sent a magic link to {email}. Tap the link to sign in.

) } return (

MulliganMates

Sign in to track your round

setEmail(e.target.value)} required autoComplete="email" autoFocus />
{error &&

{error}

}
) }