import { useState } from 'react' import { useTranslation } from '@shared/i18n/react' import { Notice } from '@shared/ui/Notice' import { resendVerification } from './api' import { useSession } from './session/useSession' /** * The "confirm your email" strip: shown under the top bar for every * signed-in visitor with an unconfirmed address, because device linking * (and later addon publishing) stays locked until the email is verified. */ export function VerifyEmailBanner() { const { t } = useTranslation('auth') const { status, me } = useSession() const [state, setState] = useState<'idle' | 'busy' | 'sent' | 'failed'>('idle') if (status !== 'authenticated' || !me || me.email_verified) return null async function resend() { setState('busy') try { await resendVerification() setState('sent') } catch { setState('failed') } } return (
{t('banner.resent')}
: null} {state === 'failed' ?{t('banner.failed')}
: null}