From f494331bdba5313b3629707092635c70c62a52c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E6=B2=9B=E8=BB=92?= Date: Sat, 27 Sep 2025 19:18:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BB=BA=E7=AB=8BReview=20Tests?= =?UTF-8?q?=E7=B5=84=E4=BB=B6=E5=B1=95=E7=A4=BA=E9=A0=81=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增/review-tests測試頁面專門展示review-tests組件 - 導航欄添加🧪測試項目方便快速進入 - 實現Tab切換界面,每個測驗組件獨立展示 - 包含操作日誌系統追蹤組件互動行為 - 修正SentenceSpeakingTest組件props類型錯誤 - 提供完整模擬資料用於組件測試 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- frontend/app/review-tests/page.tsx | 220 +++++++++++++++++++++++++++++ frontend/components/Navigation.tsx | 1 + 2 files changed, 221 insertions(+) create mode 100644 frontend/app/review-tests/page.tsx diff --git a/frontend/app/review-tests/page.tsx b/frontend/app/review-tests/page.tsx new file mode 100644 index 0000000..90e36df --- /dev/null +++ b/frontend/app/review-tests/page.tsx @@ -0,0 +1,220 @@ +'use client' + +import { useState } from 'react' +import { Navigation } from '@/components/Navigation' +import { + FlipMemoryTest, + VocabChoiceTest, + SentenceFillTest, + SentenceReorderTest, + VocabListeningTest, + SentenceListeningTest, + SentenceSpeakingTest +} from '@/components/review/review-tests' + +export default function ReviewTestsPage() { + const [logs, setLogs] = useState([]) + const [activeTab, setActiveTab] = useState('FlipMemoryTest') + + // 測驗組件清單 + const testComponents = [ + { id: 'FlipMemoryTest', name: '翻卡記憶測試', color: 'bg-blue-50' }, + { id: 'VocabChoiceTest', name: '詞彙選擇測試', color: 'bg-green-50' }, + { id: 'SentenceFillTest', name: '句子填空測試', color: 'bg-yellow-50' }, + { id: 'SentenceReorderTest', name: '句子重排測試', color: 'bg-purple-50' }, + { id: 'VocabListeningTest', name: '詞彙聽力測試', color: 'bg-red-50' }, + { id: 'SentenceListeningTest', name: '句子聽力測試', color: 'bg-indigo-50' }, + { id: 'SentenceSpeakingTest', name: '句子口說測試', color: 'bg-pink-50' } + ] + + // 添加日誌函數 + const addLog = (message: string) => { + const timestamp = new Date().toLocaleTimeString() + setLogs(prev => [`[${activeTab}] [${timestamp}] ${message}`, ...prev.slice(0, 9)]) + } + + // 模擬資料 + const mockCardData = { + word: "elaborate", + definition: "To explain something in more detail; to develop or present a theory, policy, or system in further detail", + example: "Could you elaborate on your proposal for the new marketing strategy?", + exampleTranslation: "你能詳細說明一下你對新行銷策略的提案嗎?", + pronunciation: "/ɪˈlæbərət/", + synonyms: ["explain", "detail", "expand", "clarify"], + difficultyLevel: "B2", + exampleImage: "https://via.placeholder.com/400x200?text=Marketing+Strategy" + } + + // 選項題選項 + const vocabChoiceOptions = ["elaborate", "celebrate", "collaborate", "deliberate"] + + // 回調函數 + const handleConfidenceSubmit = (level: number) => { + addLog(`FlipMemoryTest: 信心等級 ${level}`) + } + + const handleAnswer = (answer: string) => { + addLog(`答案提交: ${answer}`) + } + + const handleReportError = () => { + addLog('回報錯誤') + } + + const handleImageClick = (image: string) => { + addLog(`圖片點擊: ${image}`) + } + + return ( +
+ + +
+ {/* 頁面標題 */} +
+

Review Tests 組件展示

+
+ + {/* Tab 導航 */} +
+
+
+ {testComponents.map((component) => ( + + ))} +
+
+
+ + + {/* 當前測驗組件展示 */} +
+
c.id === activeTab)?.color}`}> +

{activeTab}

+

{testComponents.find(c => c.id === activeTab)?.name}

+
+
+ {/* 條件渲染當前選中的測驗組件 */} + {activeTab === 'FlipMemoryTest' && ( + + )} + + {activeTab === 'VocabChoiceTest' && ( + + )} + + {activeTab === 'SentenceFillTest' && ( + + )} + + {activeTab === 'SentenceReorderTest' && ( + + )} + + {activeTab === 'VocabListeningTest' && ( + + )} + + {activeTab === 'SentenceListeningTest' && ( + + )} + + {activeTab === 'SentenceSpeakingTest' && ( + + )} +
+
+ + {/* 操作日誌區域 */} +
+

操作日誌

+
+ {logs.length === 0 ? ( +

無操作記錄

+ ) : ( + logs.map((log, index) => ( +
+ {log} +
+ )) + )} +
+
+
+
+ ) +} \ No newline at end of file diff --git a/frontend/components/Navigation.tsx b/frontend/components/Navigation.tsx index 101fa03..76596b7 100644 --- a/frontend/components/Navigation.tsx +++ b/frontend/components/Navigation.tsx @@ -19,6 +19,7 @@ export function Navigation({ showExitLearning = false, onExitLearning }: Navigat { href: '/dashboard', label: '儀表板' }, { href: '/flashcards', label: '詞卡' }, { href: '/review', label: '複習' }, + { href: '/review-tests', label: '🧪 測試' }, { href: '/generate', label: 'AI 生成' }, { href: '/settings', label: '⚙️ 設定' } ]