import { useState } from 'react' import AudioPlayer from '@/components/AudioPlayer' interface VocabChoiceTestProps { word: string definition: string example: string exampleTranslation: string pronunciation?: string difficultyLevel: string options: string[] onAnswer: (answer: string) => void onReportError: () => void disabled?: boolean } export const VocabChoiceTest: React.FC = ({ word, definition, example, exampleTranslation, pronunciation, difficultyLevel, options, onAnswer, onReportError, disabled = false }) => { const [selectedAnswer, setSelectedAnswer] = useState(null) const [showResult, setShowResult] = useState(false) const handleAnswerSelect = (answer: string) => { if (disabled || showResult) return setSelectedAnswer(answer) setShowResult(true) onAnswer(answer) } const isCorrect = selectedAnswer === word return (
{/* 錯誤回報按鈕 */}
{/* 標題區 */}

詞彙選擇

{difficultyLevel}
{/* 指示文字 */}

請選擇符合上述定義的英文詞彙:

{/* 定義顯示區 */}

定義

{definition}

{/* 選項區域 - 響應式網格布局 */}
{options.map((option, idx) => ( ))}
{/* 結果反饋區 */} {showResult && (

{isCorrect ? '正確!' : '錯誤!'}

{!isCorrect && (

正確答案是:{word}

)}
{pronunciation && {pronunciation}}
)}
) }