/* global React */ (function () { const T = window.SC_T; function QuestionCard({ question, index, total, loading, onAnswer }) { const [text, setText] = React.useState(''); React.useEffect(() => setText(''), [question]); const submit = () => { if (!loading) onAnswer(text.trim()); }; const handleKey = (e) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); submit(); } }; const isLast = index + 1 >= total; return (