diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 43a54d6..ca85d6b 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -11,7 +11,8 @@ "Bash(xargs:*)", "Bash(npm init:*)", "Bash(npm run dev:*)", - "Bash(npm uninstall:*)" + "Bash(npm uninstall:*)", + "Bash(git push:*)" ], "deny": [], "ask": [] diff --git a/app/generate/page.tsx b/app/generate/page.tsx index f565836..55d28c5 100644 --- a/app/generate/page.tsx +++ b/app/generate/page.tsx @@ -4,57 +4,83 @@ import { useState } from 'react' import Link from 'next/link' export default function GeneratePage() { - const [mode, setMode] = useState<'text' | 'theme'>('text') + const [mode, setMode] = useState<'manual' | 'screenshot'>('manual') const [textInput, setTextInput] = useState('') - const [selectedTheme, setSelectedTheme] = useState('') - const [difficulty, setDifficulty] = useState('intermediate') + 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 themes = [ - { id: 'daily', name: '日常對話', icon: '🗣️' }, - { id: 'business', name: '商務英語', icon: '💼' }, - { id: 'tv', name: '美劇經典', icon: '📺' }, - { id: 'movie', name: '電影台詞', icon: '🎬' }, - { id: 'academic', name: '學術英語', icon: '🎓' }, - { id: 'travel', name: '旅遊英語', icon: '✈️' }, - ] + 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: 'negotiate', + word: 'brought', partOfSpeech: 'verb', - pronunciation: '/nɪˈɡoʊʃieɪt/', - translation: '協商、談判', - definition: 'To discuss something with someone in order to reach an agreement', - example: 'We need to negotiate a better deal with our suppliers.', - exampleTranslation: '我們需要與供應商協商更好的交易。', - difficulty: 'intermediate' + 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: 'perspective', + word: 'instincts', partOfSpeech: 'noun', - pronunciation: '/pərˈspektɪv/', - translation: '觀點、看法', - definition: 'A particular way of considering something', - example: 'From my perspective, this is the best solution.', - exampleTranslation: '從我的角度來看,這是最好的解決方案。', - difficulty: 'intermediate' + 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: 'accomplish', - partOfSpeech: 'verb', - pronunciation: '/əˈkɒmplɪʃ/', - translation: '完成、達成', - definition: 'To finish something successfully or to achieve something', - example: 'She accomplished her goal of running a marathon.', - exampleTranslation: '她完成了跑馬拉松的目標。', - difficulty: 'intermediate' + 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' } ] @@ -73,6 +99,13 @@ export default function GeneratePage() { alert('詞卡已保存到您的卡組!') } + const toggleImageForCard = (cardId: number) => { + setShowImageForCard(prev => ({ + ...prev, + [cardId]: !prev[cardId] + })) + } + return (
{/* Navigation */} @@ -97,42 +130,81 @@ export default function GeneratePage() {

AI 智能生成詞卡

- {/* Mode Selection */} + {/* Input Mode Selection */}
-

選擇生成模式

+

原始例句類型

+
+
+ + {/* Extraction Type Selection */} +
+

萃取方式

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

輸入文本內容

+

輸入英文文本