import { useState } from 'react'; import { toast } from 'react-toastify'; import { signInWithEmail, signUp } from '~/lib/stores/auth'; interface AuthProps { onClose: () => void; } export function Auth({ onClose }: AuthProps) { const [isSignUp, setIsSignUp] = useState(false); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [loading, setLoading] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); try { if (isSignUp) { await signUp(email, password); toast.success('Check your email for the confirmation link'); } else { await signInWithEmail(email, password); toast.success('Signed in successfully'); onClose(); } } catch (error) { toast.error(error instanceof Error ? error.message : 'Authentication failed'); } finally { setLoading(false); } }; return (