'use client' import { useState } from 'react' import { Navigation } from '@/components/Navigation' import { ProtectedRoute } from '@/components/ProtectedRoute' export default function VocabDesignsPage() { return ( ) } function VocabDesignsContent() { const [selectedDesign, setSelectedDesign] = useState('modern') const [showPopup, setShowPopup] = useState(false) // 假詞彙數據 const mockWord = { word: 'elaborate', pronunciation: '/ɪˈlæbərət/', partOfSpeech: 'verb', translation: '詳細說明', definition: 'To explain something in more detail; to develop or present a theory, policy, or system in further detail', synonyms: ['explain', 'detail', 'expand', 'clarify'], difficultyLevel: 'B2', isHighValue: true, example: 'Could you elaborate on your proposal?', exampleTranslation: '你能詳細說明一下你的提案嗎?' } const designs = [ { id: 'modern', name: '現代玻璃', description: '毛玻璃效果,現代感設計' }, { id: 'classic', name: '經典卡片', description: '傳統卡片風格,清晰分區' }, { id: 'minimal', name: '極簡風格', description: '簡潔乾淨,突出重點' }, { id: 'magazine', name: '雜誌排版', description: '類似雜誌的排版風格' }, { id: 'mobile', name: '移動應用', description: 'iOS/Android應用風格' }, { id: 'learning', name: '學習卡片', description: '與學習功能一致的風格' }, { id: 'flashcard', name: '詞卡風格', description: '參考詞卡詳細頁面的設計' } ] return (
{/* 頁面標題 */}

詞彙明細版型展示

6種不同風格的詞彙彈窗設計

{/* 測試詞彙 */}
測試詞彙:
{/* 版型選擇器 */}
{designs.map((design) => ( ))}
{/* 版型預覽 */}
{/* 左側:版型說明 */}

{designs.find(d => d.id === selectedDesign)?.name}

{designs.find(d => d.id === selectedDesign)?.description}

設計特色

    {getDesignFeatures(selectedDesign).map((feature, idx) => (
  • {feature}
  • ))}

適用場景

{getDesignScenario(selectedDesign)}

{/* 右側:版型預覽 */}

點擊下方按鈕預覽版型效果

{/* 模擬背景文字 */}
This is a sample sentence where you can click on any word to see the elaborate definition and detailed explanation.
{/* 詞彙彈窗 - 根據選擇的設計風格渲染 */} {showPopup && ( <> {/* 背景遮罩 */}
setShowPopup(false)} /> {/* 彈窗內容 */}
{renderVocabPopup(selectedDesign, mockWord, () => setShowPopup(false))}
)}
) } // 渲染不同風格的詞彙彈窗 function renderVocabPopup(design: string, word: any, onClose: () => void) { const handleSave = () => { alert(`✅ 已將「${word.word}」保存到詞卡!`) onClose() } switch (design) { case 'modern': return case 'classic': return case 'minimal': return case 'magazine': return case 'mobile': return case 'learning': return case 'flashcard': return default: return } } // 1. 現代玻璃風格 function ModernGlassDesign({ word, onClose, onSave }: any) { return (

{word.word}

{word.isHighValue && }
{word.pronunciation} {word.difficultyLevel}
翻譯
{word.translation}
定義
{word.definition}
同義詞
{word.synonyms.map((synonym: string, idx: number) => ( {synonym} ))}
) } // 2. 經典卡片風格 function ClassicCardDesign({ word, onClose, onSave }: any) { return (

{word.word}

{word.pronunciation}

{word.partOfSpeech} {word.difficultyLevel} {word.isHighValue && ( ⭐ 高價值 )}

中文翻譯

{word.translation}

英文定義

{word.definition}

同義詞

{word.synonyms.map((synonym: string, idx: number) => ( {synonym} ))}
) } // 3. 極簡風格 function MinimalDesign({ word, onClose, onSave }: any) { return (

{word.word}

{word.pronunciation}

{word.translation} ({word.partOfSpeech})

{word.definition}

{word.synonyms.slice(0, 3).map((synonym: string, idx: number) => ( {synonym} ))}
) } // 4. 雜誌排版風格 function MagazineDesign({ word, onClose, onSave }: any) { return (

{word.word}

{word.pronunciation} {word.partOfSpeech} {word.difficultyLevel}

Translation

{word.translation}

Definition

{word.definition}

Synonyms

{word.synonyms.join(', ')}

) } // 5. 移動應用風格 function MobileAppDesign({ word, onClose, onSave }: any) { return (
{word.word[0].toUpperCase()}
詞彙詳情

{word.word}

{word.pronunciation}

{word.partOfSpeech} {word.difficultyLevel}
🌏
{word.translation}
中文翻譯
📝
{word.definition}
英文定義
🔗
{word.synonyms.slice(0, 3).map((synonym: string, idx: number) => ( {synonym} ))}
同義詞
) } // 6. 學習卡片風格 function LearningCardDesign({ word, onClose, onSave }: any) { return (
{word.word[0].toUpperCase()}

{word.word}

{word.partOfSpeech}

{word.pronunciation}

翻譯

{word.translation}

定義

{word.definition}

同義詞

{word.synonyms.map((synonym: string, idx: number) => ( {synonym} ))}
) } // 7. 詞卡風格 - 參考詞卡詳細頁面 function FlashcardDetailDesign({ word, onClose, onSave }: any) { // 獲取CEFR等級顏色 const getCEFRColor = (level: string) => { switch (level) { case 'A1': return 'bg-green-100 text-green-700 border-green-200' case 'A2': return 'bg-blue-100 text-blue-700 border-blue-200' case 'B1': return 'bg-yellow-100 text-yellow-700 border-yellow-200' case 'B2': return 'bg-orange-100 text-orange-700 border-orange-200' case 'C1': return 'bg-red-100 text-red-700 border-red-200' case 'C2': return 'bg-purple-100 text-purple-700 border-purple-200' default: return 'bg-gray-100 text-gray-700 border-gray-200' } } return (
{/* 標題區 - 漸層背景 */}
{/* 關閉按鈕 - 獨立一行 */}
{/* 詞彙標題 */}

{word.word}

{/* 詞性、發音、播放按鈕、CEFR */}
{word.partOfSpeech} {word.pronunciation}
{/* CEFR標籤 - 在播放按鈕那一行的最右邊 */} {word.difficultyLevel}
{/* 內容區 - 彩色區塊設計 */}
{/* 翻譯區塊 - 綠色 */}

中文翻譯

{word.translation}

{/* 定義區塊 - 灰色 */}

英文定義

{word.definition}

{/* 同義詞區塊 - 紫色 */}

同義詞

{word.synonyms.slice(0, 4).map((synonym: string, idx: number) => ( {synonym} ))}
{/* 保存按鈕 - 底部平均延展 */}
) } // 輔助函數 function getDesignFeatures(design: string): string[] { const features = { modern: [ '毛玻璃背景效果', '大尺寸陰影和圓角', '漸層按鈕設計', '微互動動畫', '現代配色方案' ], classic: [ '藍色漸層標題欄', '清晰的區塊分隔', '傳統卡片佈局', '顏色編碼標籤', '穩重的設計風格' ], minimal: [ '極簡配色方案', '去除多餘裝飾', '重點信息突出', '輕量化設計', '快速瀏覽體驗' ], magazine: [ '雜誌式字體', '專業排版設計', '大標題小說明', '黑白主色調', '閱讀導向佈局' ], mobile: [ 'iOS/Android風格', '圓角和圖標設計', '列表式信息展示', '觸控友好設計', '移動端優化' ], learning: [ '學習功能一致性', '彩色區塊設計', '教育導向佈局', '清晰的信息分類', '學習體驗優化' ], flashcard: [ '詞卡詳細頁面風格', '右上角CEFR標籤', '漸層標題背景', '彩色內容區塊', '響應式設計優化' ] } return features[design as keyof typeof features] || [] } function getDesignScenario(design: string): string { const scenarios = { modern: '適合追求現代感和科技感的用戶,特別是年輕用戶群體。設計前衛,視覺效果佳。', classic: '適合喜歡傳統界面的用戶,信息展示清晰,功能分區明確,適合學術或商務場景。', minimal: '適合追求效率的用戶,減少視覺干擾,快速獲取核心信息,適合頻繁使用的場景。', magazine: '適合喜歡閱讀體驗的用戶,類似字典或雜誌的專業排版,適合深度學習。', mobile: '適合手機用戶,觸控友好,符合移動端應用的使用習慣,適合隨時隨地學習。', learning: '與現有學習功能保持一致,用戶體驗連貫,適合在學習流程中使用。', flashcard: '完全參考詞卡詳細頁面設計,提供最一致的用戶體驗,適合需要詳細信息展示的場景。' } return scenarios[design as keyof typeof scenarios] || '' }