'use client' import { useState } from 'react' import { ClickableTextV2 } from '@/components/ClickableTextV2' export default function DemoV2Page() { const [mode, setMode] = useState<'manual' | 'screenshot'>('manual') const [textInput, setTextInput] = useState('') const [isAnalyzing, setIsAnalyzing] = useState(false) const [showAnalysisView, setShowAnalysisView] = useState(false) const [sentenceAnalysis, setSentenceAnalysis] = useState(null) const [sentenceMeaning, setSentenceMeaning] = useState('') const [usageCount, setUsageCount] = useState(0) const [isPremium] = useState(false) // 模擬分析後的句子資料(新版本) const mockSentenceAnalysis = { meaning: "他在我們的會議中提出了這件事,但沒有人同意。這句話表達了在會議中有人提出某個議題或想法,但得不到其他與會者的認同。", highValueWords: ["brought", "up", "meeting", "agreed"], // 高價值詞彙 phrasesDetected: [ { phrase: "bring up", words: ["brought", "up"], colorCode: "#F59E0B" } ], words: { "he": { word: "he", translation: "他", definition: "Used to refer to a male person or animal", partOfSpeech: "pronoun", pronunciation: "/hiː/", synonyms: ["him", "that man"], antonyms: [], isPhrase: false, isHighValue: false, // 低價值詞彙 learningPriority: "low", difficultyLevel: "A1", costIncurred: 1 }, "brought": { word: "brought", translation: "帶來、提出", definition: "Past tense of bring; to take or carry something to a place", partOfSpeech: "verb", pronunciation: "/brɔːt/", synonyms: ["carried", "took", "delivered"], antonyms: ["removed", "took away"], isPhrase: true, isHighValue: true, // 高價值片語 learningPriority: "high", phraseInfo: { phrase: "bring up", meaning: "提出(話題)、養育", warning: "在這個句子中,\"brought up\" 是一個片語,意思是\"提出話題\",而不是單純的\"帶來\"", colorCode: "#F59E0B" }, difficultyLevel: "B1", costIncurred: 0 // 高價值免費 }, "this": { word: "this", translation: "這個", definition: "Used to indicate something near or just mentioned", partOfSpeech: "pronoun", pronunciation: "/ðɪs/", synonyms: ["that", "it"], antonyms: [], isPhrase: false, isHighValue: false, // 低價值詞彙 learningPriority: "low", difficultyLevel: "A1", costIncurred: 1 }, "thing": { word: "thing", translation: "事情、東西", definition: "An object, fact, or situation", partOfSpeech: "noun", pronunciation: "/θɪŋ/", synonyms: ["object", "matter", "item"], antonyms: [], isPhrase: false, isHighValue: false, // 低價值詞彙 learningPriority: "low", difficultyLevel: "A1", costIncurred: 1 }, "up": { word: "up", translation: "向上", definition: "Toward a higher place or position", partOfSpeech: "adverb", pronunciation: "/ʌp/", synonyms: ["upward", "above"], antonyms: ["down", "below"], isPhrase: true, isHighValue: true, // 高價值片語部分 learningPriority: "high", phraseInfo: { phrase: "bring up", meaning: "提出(話題)、養育", warning: "\"up\" 在這裡是片語 \"bring up\" 的一部分,不是單獨的\"向上\"的意思", colorCode: "#F59E0B" }, difficultyLevel: "B1", costIncurred: 0 // 高價值免費 }, "during": { word: "during", translation: "在...期間", definition: "Throughout the course or duration of", partOfSpeech: "preposition", pronunciation: "/ˈdjʊərɪŋ/", synonyms: ["throughout", "while"], antonyms: [], isPhrase: false, isHighValue: false, // 低價值詞彙 learningPriority: "low", difficultyLevel: "A2", costIncurred: 1 }, "our": { word: "our", translation: "我們的", definition: "Belonging to us", partOfSpeech: "pronoun", pronunciation: "/aʊər/", synonyms: ["ours"], antonyms: [], isPhrase: false, isHighValue: false, // 低價值詞彙 learningPriority: "low", difficultyLevel: "A1", costIncurred: 1 }, "meeting": { word: "meeting", translation: "會議", definition: "An organized gathering of people for discussion", partOfSpeech: "noun", pronunciation: "/ˈmiːtɪŋ/", synonyms: ["conference", "assembly", "gathering"], antonyms: [], isPhrase: false, isHighValue: true, // 高價值單字(B2級) learningPriority: "high", difficultyLevel: "B2", costIncurred: 0 // 高價值免費 }, "and": { word: "and", translation: "和、而且", definition: "Used to connect words or clauses", partOfSpeech: "conjunction", pronunciation: "/ænd/", synonyms: ["plus", "also"], antonyms: [], isPhrase: false, isHighValue: false, // 低價值詞彙 learningPriority: "low", difficultyLevel: "A1", costIncurred: 1 }, "no": { word: "no", translation: "沒有", definition: "Not any; not one", partOfSpeech: "determiner", pronunciation: "/nəʊ/", synonyms: ["none", "zero"], antonyms: ["some", "any"], isPhrase: false, isHighValue: false, // 低價值詞彙 learningPriority: "low", difficultyLevel: "A1", costIncurred: 1 }, "one": { word: "one", translation: "一個人、任何人", definition: "A single person or thing", partOfSpeech: "pronoun", pronunciation: "/wʌn/", synonyms: ["someone", "anybody"], antonyms: ["none", "nobody"], isPhrase: false, isHighValue: false, // 低價值詞彙 learningPriority: "low", difficultyLevel: "A1", costIncurred: 1 }, "agreed": { word: "agreed", translation: "同意", definition: "Past tense of agree; to have the same opinion", partOfSpeech: "verb", pronunciation: "/əˈɡriːd/", synonyms: ["consented", "accepted", "approved"], antonyms: ["disagreed", "refused"], isPhrase: false, isHighValue: true, // 高價值單字(B1級) learningPriority: "medium", difficultyLevel: "B1", costIncurred: 0 // 高價值免費 } } } // 處理句子分析 const handleAnalyzeSentence = async () => { if (!textInput.trim()) return // 檢查使用次數限制 if (!isPremium && usageCount >= 5) { alert('❌ 免費用戶 3 小時內只能分析 5 次句子,請稍後再試或升級到付費版本') return } setIsAnalyzing(true) try { // 模擬 API 調用 await new Promise(resolve => setTimeout(resolve, 2000)) setSentenceAnalysis(mockSentenceAnalysis.words) setSentenceMeaning(mockSentenceAnalysis.meaning) setShowAnalysisView(true) setUsageCount(prev => prev + 1) // 句子分析扣除1次 } catch (error) { console.error('Error analyzing sentence:', error) alert('分析句子時發生錯誤,請稍後再試') } finally { setIsAnalyzing(false) } } const getHighValueCount = () => { if (!sentenceAnalysis) return 0 return Object.values(sentenceAnalysis).filter((word: any) => word.isHighValue).length } const getLowValueCount = () => { if (!sentenceAnalysis) return 0 return Object.values(sentenceAnalysis).filter((word: any) => !word.isHighValue).length } return (
{/* Navigation */}
{!showAnalysisView ? (

AI 智能生成詞卡 - 高價值標記系統

{/* 功能說明 */}

🎯 高價值標記系統特色

高價值片語 - 免費無限點擊
高價值單字 - 免費無限點擊
普通單字 - 點擊扣除 1 次額度
星號標記 - 高學習價值指標
{/* Input Mode Selection */}

原始例句類型

{/* Content Input */}

輸入英文文本