'use client' import { useState, useEffect } from 'react' interface LanguageLevel { value: string; label: string; description: string; examples: string[]; } export default function SettingsPage() { const [userLevel, setUserLevel] = useState('A2'); const [isLoading, setIsLoading] = useState(false); const levels: LanguageLevel[] = [ { value: 'A1', label: 'A1 - 初學者', description: '能理解基本詞彙和簡單句子', examples: ['hello', 'good', 'house', 'eat', 'happy'] }, { value: 'A2', label: 'A2 - 基礎', description: '能處理日常對話和常見主題', examples: ['important', 'difficult', 'interesting', 'beautiful', 'understand'] }, { value: 'B1', label: 'B1 - 中級', description: '能理解清楚標準語言的要點', examples: ['analyze', 'opportunity', 'environment', 'responsibility', 'development'] }, { value: 'B2', label: 'B2 - 中高級', description: '能理解複雜文本的主要內容', examples: ['sophisticated', 'implications', 'comprehensive', 'substantial', 'methodology'] }, { value: 'C1', label: 'C1 - 高級', description: '能流利表達,理解含蓄意思', examples: ['meticulous', 'predominantly', 'intricate', 'corroborate', 'paradigm'] }, { value: 'C2', label: 'C2 - 精通', description: '接近母語水平', examples: ['ubiquitous', 'ephemeral', 'perspicacious', 'multifarious', 'idiosyncratic'] } ]; // 載入用戶已設定的程度 useEffect(() => { const savedLevel = localStorage.getItem('userEnglishLevel'); if (savedLevel) { setUserLevel(savedLevel); } }, []); const saveUserLevel = async () => { setIsLoading(true); try { // 保存到本地存儲 localStorage.setItem('userEnglishLevel', userLevel); // TODO: 如果用戶已登入,也保存到伺服器 // const token = localStorage.getItem('authToken'); // if (token) { // await fetch('/api/user/update-level', { // method: 'POST', // headers: { // 'Content-Type': 'application/json', // 'Authorization': `Bearer ${token}` // }, // body: JSON.stringify({ englishLevel: userLevel }) // }); // } alert('✅ 程度設定已保存!系統將為您提供個人化的詞彙標記。'); } catch (error) { console.error('Error saving user level:', error); alert('❌ 保存失敗,請稍後再試'); } finally { setIsLoading(false); } }; const getHighValueRange = (level: string) => { const ranges = { 'A1': 'A2-B1', 'A2': 'B1-B2', 'B1': 'B2-C1', 'B2': 'C1-C2', 'C1': 'C2', 'C2': 'C2' }; return ranges[level as keyof typeof ranges] || 'B1-B2'; }; return (

🎯 英語程度設定

設定您的英語程度,系統將為您提供個人化的詞彙學習建議。 設定後,我們會重點標記比您目前程度高1-2級的詞彙。

{levels.map(level => ( ))}
{/* 個人化效果預覽 */}

💡 您的個人化學習效果預覽

高價值詞彙範圍

系統將重點標記 {getHighValueRange(userLevel)} 等級的詞彙

學習建議

專注於比您目前程度({userLevel})高1-2級的詞彙,既有挑戰性又不會太困難

💡 提示: 您隨時可以回到這裡調整程度設定

); }