import { type FormEvent, useState } from 'react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { H3, Muted } from '@/components/ui/typography'; import { useAuthStore } from '@/stores/auth-store'; interface CodeStepProps { email: string; onBack: () => void; } export function CodeStep({ email, onBack }: CodeStepProps) { const [code, setCode] = useState(''); const isSigningIn = useAuthStore((s) => s.isSigningIn); const error = useAuthStore((s) => s.error); const signIn = useAuthStore((s) => s.signIn); const clearError = useAuthStore((s) => s.clearError); const handleSubmit = async (e: FormEvent) => { e.preventDefault(); try { await signIn(email, code); } catch { // Error is set in the store } }; return (

Check your email

We sent a code to {email} .
{ setCode(e.target.value); if (error) clearError(); }} required autoFocus />
{error &&

{error}

}
); }