From 5bd823ee9190989f148897083357d9f32fea9ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E6=B2=9B=E8=BB=92?= Date: Fri, 19 Sep 2025 23:23:02 +0800 Subject: [PATCH] =?UTF-8?q?ux:=20=E9=87=8D=E6=A7=8B=E5=AD=B8=E7=BF=92?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E8=A8=AD=E8=A8=88=E8=88=87=E5=B0=8E=E8=88=AA?= =?UTF-8?q?=E9=AB=94=E9=A9=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 改進選擇題模式:顯示定義讓用戶選擇對應英文詞彙 - 優化選項生成邏輯:動態從卡片組生成選項並隨機排序 - 新增翻卡背面例句播放功能,提升學習效果 - 統一所有學習模式導航按鈕位置和樣式 - 實現全版導航按鈕設計,改善觸控體驗 - 修正結果顯示邏輯和音頻回饋功能 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- frontend/app/learn/page.tsx | 202 ++++++++++++++++++------------------ 1 file changed, 99 insertions(+), 103 deletions(-) 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}