From a20fa9004d5327dd8500a99bac08de2966abf079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E6=B2=9B=E8=BB=92?= Date: Sat, 20 Sep 2025 03:41:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=87=8D=E6=A7=8B=E4=BE=8B=E5=8F=A5?= =?UTF-8?q?=E5=A1=AB=E7=A9=BA=E8=88=87=E4=BE=8B=E5=8F=A5=E9=87=8D=E7=B5=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= 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 | 250 ++++++++++++++++++++++-------------- 1 file changed, 155 insertions(+), 95 deletions(-) diff --git a/frontend/app/learn/page.tsx b/frontend/app/learn/page.tsx index 0352c16..f663898 100644 --- a/frontend/app/learn/page.tsx +++ b/frontend/app/learn/page.tsx @@ -391,16 +391,34 @@ export default function LearnPage() {
-

- {currentCard.word} -

-
- - {currentCard.pronunciation} + {/* Title and Instructions */} +
+

+ 翻卡記憶 +

+ + {currentCard.difficulty} - +
+

+ 點擊卡片翻面,根據你對單字的熟悉程度進行自我評估: +

+ + {/* Word Display */} +
+
+

+ {currentCard.word} +

+
+ + {currentCard.pronunciation} + + +
+
@@ -599,87 +617,124 @@ export default function LearnPage() { {currentCard.difficulty}
-

- 請根據定義和翻譯,輸入對應的英文單字: -

-
-
-

- 定義:{currentCard.definition} -

-

- 中文翻譯:{currentCard.translation} -

-
-

- 請輸入對應的英文單字: -

-
- -
- setFillAnswer(e.target.value)} - onKeyDown={(e) => { - if (e.key === 'Enter' && !showResult && fillAnswer.trim()) { - handleFillAnswer() - } - }} - placeholder="輸入英文單字..." - disabled={showResult} - className="w-full p-4 text-center text-xl border-2 border-gray-200 rounded-lg focus:border-blue-500 focus:outline-none disabled:bg-gray-100" - /> - -
- {!showResult && fillAnswer.trim() && ( - - )} - -
- - {showHint && ( -
-

- 提示:這個詞有 {currentCard.word.length} 個字母, - 開頭是 "{currentCard.word[0].toUpperCase()}" -

+ {/* Example Image */} + {currentCard.exampleImage && ( +
+
+ Example illustration setModalImage(currentCard.exampleImage)} + />
- )} +
+ )} +

+ 請點擊例句中的空白處輸入正確的單字: +

+ {/* Example Sentence with Blanks */} +
+
+
+ {currentCard.example.split(new RegExp(`(${currentCard.word})`, 'gi')).map((part, index) => { + const isTargetWord = part.toLowerCase() === currentCard.word.toLowerCase(); + return isTargetWord ? ( + + setFillAnswer(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter' && !showResult && fillAnswer.trim()) { + handleFillAnswer() + } + }} + placeholder="" + disabled={showResult} + className={`inline-block px-2 py-1 text-center bg-transparent focus:outline-none disabled:bg-gray-100 ${ + fillAnswer + ? 'border-b-2 border-blue-500' + : 'border-b-2 border-dashed border-gray-400 focus:border-blue-400 focus:border-solid' + }`} + style={{ width: `${Math.max(100, Math.max(currentCard.word.length * 12, fillAnswer.length * 12 + 20))}px` }} + /> + {!fillAnswer && ( + + ____ + + )} + + ) : ( + {part} + ); + })} +
+
+ {/* Action Buttons */} +
+ {!showResult && fillAnswer.trim() && ( + + )} + +
+ + {/* Hint Section */} + {showHint && ( +
+

詞彙定義:

+

{currentCard.definition}

+
+ )} + {showResult && ( -
-

{fillAnswer.toLowerCase().trim() === currentCard.word.toLowerCase() ? '正確!' : '錯誤!'}

+ {fillAnswer.toLowerCase().trim() !== currentCard.word.toLowerCase() && ( -

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

+
+

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

+
)} -
-

發音:{currentCard.pronunciation}

- + +
+
+

+ {currentCard.pronunciation} + +

+
+ +
+
)} @@ -732,23 +787,15 @@ export default function LearnPage() { 請聽發音並選擇正確的英文單字:

-
- -
-

- 中文翻譯:{currentCard.translation} -

-

- 定義:{currentCard.definition} -

-
-

- 請聽發音並選擇正確的英文單字: -

-
- + {/* Content Sections */} +
+ {/* Audio */} +
+

發音

+
+ {currentCard.pronunciation} + +
@@ -1009,12 +1056,26 @@ export default function LearnPage() { {currentCard.difficulty}
-

+ + + {/* Example Image */} + {currentCard.exampleImage && ( +

+
+ Example illustration setModalImage(currentCard.exampleImage)} + /> +
+
+ )} +

請將下方的單字重新排列成正確的句子:

- +
-

詞彙:{currentCard.word} @@ -1023,7 +1084,6 @@ export default function LearnPage() { 翻譯:{currentCard.exampleTranslation}

-
@@ -1174,8 +1234,8 @@ export default function LearnPage() { height: 100%; display: flex; flex-direction: column; - justify-content: center; - align-items: center; + justify-content: flex-start; + align-items: stretch; padding: 2rem; box-sizing: border-box; }