'use client' import { useState } from 'react' import { ClickableText } from '@/components/ClickableText' export default function GenerateDemoPage() { const [mode, setMode] = useState<'manual' | 'screenshot'>('manual') const [textInput, setTextInput] = useState('') const [extractionType, setExtractionType] = useState<'vocabulary' | 'smart'>('vocabulary') const [cardCount, setCardCount] = useState(10) 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: "他在我們的會議中提出了這件事,但沒有人同意。這句話表達了在會議中有人提出某個議題或想法,但得不到其他與會者的認同。", words: { "he": { word: "he", translation: "他", definition: "Used to refer to a male person or animal", partOfSpeech: "pronoun", pronunciation: "/hiː/", synonyms: ["him", "that man"], isPhrase: false }, "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"], isPhrase: true, phraseInfo: { phrase: "bring up", meaning: "提出(話題)、養育", warning: "在這個句子中,\"brought up\" 是一個片語,意思是\"提出話題\",而不是單純的\"帶來\"" } }, "this": { word: "this", translation: "這個", definition: "Used to indicate something near or just mentioned", partOfSpeech: "pronoun", pronunciation: "/ðɪs/", synonyms: ["that", "it"], isPhrase: false }, "thing": { word: "thing", translation: "事情、東西", definition: "An object, fact, or situation", partOfSpeech: "noun", pronunciation: "/θɪŋ/", synonyms: ["object", "matter", "item"], isPhrase: false }, "up": { word: "up", translation: "向上", definition: "Toward a higher place or position", partOfSpeech: "adverb", pronunciation: "/ʌp/", synonyms: ["upward", "above"], isPhrase: true, phraseInfo: { phrase: "bring up", meaning: "提出(話題)、養育", warning: "\"up\" 在這裡是片語 \"bring up\" 的一部分,不是單獨的\"向上\"的意思" } }, "during": { word: "during", translation: "在...期間", definition: "Throughout the course or duration of", partOfSpeech: "preposition", pronunciation: "/ˈdjʊərɪŋ/", synonyms: ["throughout", "while"], isPhrase: false }, "our": { word: "our", translation: "我們的", definition: "Belonging to us", partOfSpeech: "pronoun", pronunciation: "/aʊər/", synonyms: ["ours"], isPhrase: false }, "meeting": { word: "meeting", translation: "會議", definition: "An organized gathering of people for discussion", partOfSpeech: "noun", pronunciation: "/ˈmiːtɪŋ/", synonyms: ["conference", "assembly", "gathering"], isPhrase: false }, "and": { word: "and", translation: "和、而且", definition: "Used to connect words or clauses", partOfSpeech: "conjunction", pronunciation: "/ænd/", synonyms: ["plus", "also"], isPhrase: false }, "no": { word: "no", translation: "沒有", definition: "Not any; not one", partOfSpeech: "determiner", pronunciation: "/nəʊ/", synonyms: ["none", "zero"], isPhrase: false }, "one": { word: "one", translation: "一個人、任何人", definition: "A single person or thing", partOfSpeech: "pronoun", pronunciation: "/wʌn/", synonyms: ["someone", "anybody"], isPhrase: false }, "agreed": { word: "agreed", translation: "同意", definition: "Past tense of agree; to have the same opinion", partOfSpeech: "verb", pronunciation: "/əˈɡriːd/", synonyms: ["consented", "accepted", "approved"], isPhrase: false } } } // 處理句子分析 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) } catch (error) { console.error('Error analyzing sentence:', error) alert('分析句子時發生錯誤,請稍後再試') } finally { setIsAnalyzing(false) } } return (
{/* Navigation */}
{!showAnalysisView ? (

AI 智能生成詞卡 - 演示版

{/* Input Mode Selection */}

原始例句類型

{/* Content Input */}

輸入英文文本