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}"

@@ -411,17 +416,17 @@ export default function LearnPage() { {/* Navigation */} -
+
@@ -444,28 +449,13 @@ export default function LearnPage() {
-
-
- - {currentCard.difficulty} - -
-

- {currentCard.word} -

-

- {currentCard.partOfSpeech} {currentCard.pronunciation} -

-
- -
+
-

- {currentCard.definition} -

+

定義

+

{currentCard.definition}

-

- 這個詞的中文翻譯是? +

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

@@ -475,9 +465,9 @@ export default function LearnPage() { key={idx} onClick={() => !showResult && handleQuizAnswer(option)} disabled={showResult} - className={`w-full p-4 text-left rounded-lg border-2 transition-all ${ + className={`w-full p-4 text-center rounded-lg border-2 transition-all ${ showResult - ? option === currentCard.translation + ? option === currentCard.word ? 'border-green-500 bg-green-50 text-green-700' : option === selectedAnswer ? 'border-red-500 bg-red-50 text-red-700' @@ -492,41 +482,47 @@ export default function LearnPage() { {showResult && (

- {selectedAnswer === currentCard.translation ? '正確!' : '錯誤!'} + {selectedAnswer === currentCard.word ? '正確!' : '錯誤!'}

- {selectedAnswer !== currentCard.translation && ( + {selectedAnswer !== currentCard.word && (

- 正確答案是:{currentCard.translation} + 正確答案是:{currentCard.word}

)} +
+

+ 翻譯:{currentCard.translation} +

+ +
)} +
- {/* Navigation */} -
- - -
+ {/* Navigation */} +
+ +
) : mode === 'fill' ? ( @@ -634,23 +630,23 @@ export default function LearnPage() {
)} + - {/* Navigation */} -
- - -
+ {/* Navigation */} +
+ +
) : mode === 'listening' ? ( @@ -744,23 +740,23 @@ export default function LearnPage() { )} )} + - {/* Navigation */} -
- - -
+ {/* Navigation */} +
+ +
) : mode === 'speaking' ? ( @@ -839,23 +835,23 @@ export default function LearnPage() { )} + - {/* Navigation */} -
- - -
+ {/* Navigation */} +
+ +
) : null}