diff --git a/frontend/app/learn/page.tsx b/frontend/app/learn/page.tsx index b110d03..4e01772 100644 --- a/frontend/app/learn/page.tsx +++ b/frontend/app/learn/page.tsx @@ -112,14 +112,14 @@ export default function LearnPage() { setMounted(true) const currentWord = cards[currentCardIndex].word; - // Fixed options based on current card index - const optionSets = [ - [currentWord, 'determine', 'achieve', 'consider'], // for index 0 - [currentWord, 'brought', 'achieve', 'negotiate'], // for index 1 - [currentWord, 'brought', 'instincts', 'determine'] // for index 2 - ]; + // Generate quiz options with current word and other words from the deck + const otherWords = cards + .filter((_, idx) => idx !== currentCardIndex) + .map(card => card.word) + .slice(0, 3); // Take 3 other words - const options = optionSets[currentCardIndex] || [currentWord, 'determine', 'achieve', 'consider']; + // Add the current word and shuffle + const options = [currentWord, ...otherWords].sort(() => Math.random() - 0.5); setQuizOptions(options); // Reset quiz state when card changes @@ -163,7 +163,7 @@ export default function LearnPage() { setSelectedAnswer(answer) setShowResult(true) - const isCorrect = answer === currentCard.translation + const isCorrect = answer === currentCard.word setScore(prev => ({ correct: isCorrect ? prev.correct + 1 : prev.correct, total: prev.total + 1 @@ -386,7 +386,12 @@ export default function LearnPage() { {/* Example */}
"{currentCard.example}"
+"{currentCard.example}"
+"{currentCard.exampleTranslation}"
- {currentCard.partOfSpeech} {currentCard.pronunciation} -
-- {currentCard.definition} -
+{currentCard.definition}
- 這個詞的中文翻譯是? +
+ 請選擇符合上述定義的英文詞彙:
- {selectedAnswer === currentCard.translation ? '正確!' : '錯誤!'} + {selectedAnswer === currentCard.word ? '正確!' : '錯誤!'}
- {selectedAnswer !== currentCard.translation && ( + {selectedAnswer !== currentCard.word && (- 正確答案是:{currentCard.translation} + 正確答案是:{currentCard.word}
)} ++ 翻譯:{currentCard.translation} +
+