import { useEffect, useState, type FormEvent } from 'react'; import { useTranslation } from 'react-i18next'; import './CuratorLoginModal.css'; interface Props { open: boolean; onClose: () => void; onLogin: (username: string, password: string) => Promise; } export default function CuratorLoginModal({ open, onClose, onLogin }: Props) { const { t } = useTranslation('debug'); const { t: tc } = useTranslation('common'); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(null); const [submitting, setSubmitting] = useState(false); useEffect(() => { if (!open) { setUsername(''); setPassword(''); setError(null); setSubmitting(false); } }, [open]); if (!open) return null; const handleSubmit = async (e: FormEvent) => { e.preventDefault(); setError(null); setSubmitting(true); try { await onLogin(username.trim(), password); onClose(); } catch (err) { setError(err instanceof Error ? err.message : t('loginFailed')); } finally { setSubmitting(false); } }; return (
e.stopPropagation()} >

{t('loginTitle')}

Debug tools and catalog edits require a curator account.

{error &&

{error}

}
); }