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