'use client' import { useState } from 'react' import Link from 'next/link' import { ProtectedRoute } from '@/components/ProtectedRoute' import { Navigation } from '@/components/Navigation' function GenerateContent() { const [mode, setMode] = useState<'manual' | 'screenshot'>('manual') const [textInput, setTextInput] = useState('') const [extractionType, setExtractionType] = useState<'vocabulary' | 'smart'>('vocabulary') const [cardCount, setCardCount] = useState(10) const [isGenerating, setIsGenerating] = useState(false) const [generatedCards, setGeneratedCards] = useState([]) const [showPreview, setShowPreview] = useState(false) const [isPremium] = useState(false) // Mock premium status const [showImageForCard, setShowImageForCard] = useState<{ [key: number]: boolean }>({}) // Track which cards show images const [modalImage, setModalImage] = useState(null) // Track modal image const mockGeneratedCards = [ { id: 1, word: 'brought', partOfSpeech: 'verb', pronunciation: { us: '/brɔːt/', uk: '/brɔːt/' }, translation: '提出、帶來', definition: 'Past tense of bring; to mention or introduce a topic in conversation', synonyms: ['mentioned', 'raised', 'introduced'], antonyms: ['concealed', 'withheld'], originalExample: 'He brought this thing up during our meeting and no one agreed.', originalExampleTranslation: '他在我們的會議中提出了這件事,但沒有人同意。', generatedExample: { sentence: 'She brought up an interesting point about the budget.', translation: '她提出了一個關於預算的有趣觀點。', imageUrl: '/images/examples/bring_up.png', audioUrl: '#' }, difficulty: 'B1' }, { id: 2, word: 'instincts', partOfSpeech: 'noun', pronunciation: { us: '/ˈɪnstɪŋkts/', uk: '/ˈɪnstɪŋkts/' }, translation: '本能、直覺', definition: 'Natural abilities that help living things survive without learning', synonyms: ['intuition', 'impulse', 'tendency'], antonyms: ['logic', 'reasoning'], originalExample: 'Animals use their instincts to find food and stay safe.', originalExampleTranslation: '動物利用本能來尋找食物並保持安全。', generatedExample: { sentence: 'Trust your instincts when making important decisions.', translation: '在做重要決定時要相信你的直覺。', imageUrl: '/images/examples/instinct.png', audioUrl: '#' }, difficulty: 'B2' }, { id: 3, word: 'warrants', partOfSpeech: 'noun', pronunciation: { us: '/ˈwɔːrənts/', uk: '/ˈwɒrənts/' }, translation: '搜查令、授權令', definition: 'Official documents that give police permission to do something', synonyms: ['authorization', 'permit', 'license'], antonyms: ['prohibition', 'ban'], originalExample: 'The police obtained warrants to search the building.', originalExampleTranslation: '警方取得了搜查令來搜查這棟建築物。', generatedExample: { sentence: 'The judge issued arrest warrants for three suspects.', translation: '法官對三名嫌疑人發出了逮捕令。', imageUrl: '/images/examples/warrant.png', audioUrl: '#' }, difficulty: 'C1' } ] const handleGenerate = () => { setIsGenerating(true) // Simulate AI generation setTimeout(() => { setGeneratedCards(mockGeneratedCards) setShowPreview(true) setIsGenerating(false) }, 2000) } const handleSaveCards = () => { // Mock save action alert('詞卡已保存到您的卡組!') } const toggleImageForCard = (cardId: number) => { setShowImageForCard(prev => ({ ...prev, [cardId]: !prev[cardId] })) } return (
{/* Navigation */}
{!showPreview ? (

AI 智能生成詞卡

{/* Input Mode Selection */}

原始例句類型

{/* Extraction Type Selection */}

萃取方式

{/* Content Input */}
{mode === 'manual' ? (

輸入英文文本