diff --git a/frontend/components/review/ReviewContainer.tsx b/frontend/components/review/ReviewContainer.tsx deleted file mode 100644 index 4ce7cb6..0000000 --- a/frontend/components/review/ReviewContainer.tsx +++ /dev/null @@ -1,284 +0,0 @@ -import { useRef } from 'react' - -// 複習模式類型 -type ReviewMode = 'flip-memory' | 'vocab-choice' | 'vocab-listening' | 'sentence-listening' | 'sentence-fill' | 'sentence-reorder' | 'sentence-speaking' - -// 擴展的Flashcard接口 -interface ExtendedFlashcard { - id: string - word: string - definition: string - example: string - difficultyLevel?: string - [key: string]: any -} - -interface ReviewContainerProps { - // 當前詞卡和模式 - currentCard: ExtendedFlashcard | null - mode: ReviewMode - - // 答題狀態 - selectedAnswer: string | null - showResult: boolean - fillAnswer: string - showHint: boolean - isFlipped: boolean - - // 題型特定狀態 - quizOptions: string[] - shuffledWords: string[] - arrangedWords: string[] - reorderResult: boolean | null - - // 導航狀態 - currentCardIndex: number - totalCards: number - - // 事件處理器 - onAnswer: (answer: string) => void - onFillSubmit: () => void - onFillAnswerChange: (answer: string) => void - onToggleHint: () => void - onFlip: () => void - onConfidenceLevel: (level: number) => void - onWordClick: (word: string) => void - onRemoveFromArranged: (word: string) => void - onCheckReorderAnswer: () => void - onResetReorder: () => void - onReportError: () => void - onNavigate: (direction: 'previous' | 'next') => void - setModalImage: (image: string | null) => void -} - -export const ReviewContainer: React.FC = ({ - currentCard, - mode, - selectedAnswer, - showResult, - fillAnswer, - showHint, - isFlipped, - quizOptions, - shuffledWords, - arrangedWords, - reorderResult, - currentCardIndex, - totalCards, - onAnswer, - onFillSubmit, - onFillAnswerChange, - onToggleHint, - onFlip, - onConfidenceLevel, - onWordClick, - onRemoveFromArranged, - onCheckReorderAnswer, - onResetReorder, - onReportError, - onNavigate, - setModalImage -}) => { - // Refs for card height calculation - const cardContainerRef = useRef(null) - const cardFrontRef = useRef(null) - const cardBackRef = useRef(null) - - if (!currentCard) { - return ( -
-
載入詞卡中...
-
- ) - } - - // 渲染不同的測驗類型 - const renderTestComponent = () => { - switch (mode) { - case 'flip-memory': - return ( -
-

翻卡記憶測驗

-
詞卡: {currentCard.word}
- -
- {!isFlipped ? ( -
-
{currentCard.word}
-
- ) : ( -
-
{currentCard.definition}
-
{currentCard.example}
-
- )} -
- - - - {isFlipped && ( -
- -
- )} -
- ) - - case 'vocab-choice': - return ( -
-

詞彙選擇測驗

-
選擇正確的單字意思
-
{currentCard.definition}
- -
- {quizOptions.map((option, index) => ( - - ))} -
- - {showResult && ( -
- -
- )} -
- ) - - case 'sentence-fill': - return ( -
-

例句填空測驗

-
填入正確的單字
- -
-
- {currentCard.example?.replace(currentCard.word, '___')} -
-
- -
- onFillAnswerChange(e.target.value)} - className="border-2 border-gray-300 px-4 py-2 rounded-lg w-48 focus:border-blue-500" - placeholder="輸入答案" - /> -
- - - - {showResult && ( -
- -
- )} -
- ) - - case 'sentence-reorder': - return ( -
-

例句重組測驗

-
重新排列單字組成正確句子
- -
-

可用詞語:

-
- {shuffledWords.map((word, index) => ( - - ))} -
-
- -
-

你的句子:

-
- {arrangedWords.map((word, index) => ( - - ))} -
-
- -
- - -
- - {reorderResult !== null && ( -
-
- {reorderResult ? '✅ 正確!' : '❌ 不正確,請再試試'} -
- {reorderResult && ( - - )} -
- )} -
- ) - - default: - return ( -
-
- 測驗類型 "{mode}" 尚未實現 -
- -
- ) - } - } - - return ( -
- {renderTestComponent()} -
- ) -} \ No newline at end of file