import { useState } from 'react' import { Loader2, MailCheck } from 'lucide-react' import { authApi } from '@/api/auth' import { useAuthStore } from '@/store/authStore' import { toast } from '@/lib/toast' import { cn } from '@/lib/utils' interface EmailVerificationWallProps { className?: string } /** * Hard wall shown after the email-verification grace period expires. * * Minimal v1 — Task 37 will refine copy, layout, and add the * `/verify-email?token=...` route handling. Until then this gives * Day 7+ unverified users a way to re-send the verification email * or sign out. */ export function EmailVerificationWall({ className }: EmailVerificationWallProps) { const user = useAuthStore((s) => s.user) const logout = useAuthStore((s) => s.logout) const [isSending, setIsSending] = useState(false) const handleResend = async () => { setIsSending(true) try { await authApi.sendVerificationEmail() toast.success('Verification email sent') } catch { toast.error('Failed to send verification email') } finally { setIsSending(false) } } const handleLogout = async () => { try { await logout() } catch { // logout swallows API errors internally } } return (
{user?.email ? `We sent a verification link to ${user.email}. Click it to unlock your account.` : 'Check your inbox for the verification link we sent when you signed up.'}