import React, { useState, useEffect, useMemo } from 'react';
import {
Coffee, MapPin, Droplets, Leaf, Thermometer,
BookOpen, ChevronRight, X, Award, CheckCircle,
Search, Globe, Beaker, Sun, Wind, Filter,
Timer, Zap, AlertCircle, Palette, Settings,
Flame, Activity, MousePointer2, ExternalLink, Languages
} from 'lucide-react';
// --- 多語言設定 ---
const LANGUAGES = [
{ code: 'zh-TW', label: '繁體中文' },
{ code: 'zh-CN', label: '简体中文' },
{ code: 'en', label: 'English' },
{ code: 'ja', label: '日本語' },
{ code: 'ko', label: '한국어' }
];
// --- UI 翻譯字典 ---
const UI_TEXT = {
'zh-TW': {
title: '里響咖啡知識百科',
subtitle: 'Reshock Coffee Encyclopedia',
heroTitle: '從種子到杯中靈魂',
heroDesc: '我們致力於推廣阿里山咖啡,更希望讓每一個熱愛咖啡的靈魂,都能在這裡找到從種子到杯中的完整解答。',
startBtn: '開始探索知識',
officialBtn: '前往里響官網',
readMore: '閱讀完整介紹',
coreKnowledge: '核心知識',
processFlow: '處理流程',
impact: '負面影響',
features: ['全球與台灣產地', '互動式風味輪', '完整瑕疵豆圖鑑', '專業烘焙曲線'],
tabs: {
origins: '產地百科', varieties: '品種圖鑑', processing: '處理法',
brewing: '沖煮指南', sensory: '風味感官', roasting: '烘焙全解',
grinding: '研磨刻度', defects: '瑕疵豆大全', quiz: '大師考核'
},
severity: '嚴重度',
highlight: '里響推薦'
},
'zh-CN': {
title: '里响咖啡知识百科',
subtitle: 'Reshock Coffee Encyclopedia',
heroTitle: '从种子到杯中灵魂',
heroDesc: '我们致力于推广阿里山咖啡,更希望让每一个热爱咖啡的灵魂,都能在这里找到从种子到杯中的完整解答。',
startBtn: '开始探索知识',
officialBtn: '前往里响官网',
readMore: '阅读完整介绍',
coreKnowledge: '核心知识',
processFlow: '处理流程',
impact: '负面影响',
features: ['全球与台湾产地', '交互式风味轮', '完整瑕疵豆图鉴', '专业烘焙曲线'],
tabs: {
origins: '产地百科', varieties: '品种图鉴', processing: '处理法',
brewing: '冲煮指南', sensory: '风味感官', roasting: '烘焙全解',
grinding: '研磨刻度', defects: '瑕疵豆大全', quiz: '大师考核'
},
severity: '严重度',
highlight: '里响推荐'
},
'en': {
title: 'Reshock Coffee Encyclopedia',
subtitle: 'Knowledge Base',
heroTitle: 'From Seed to Cup',
heroDesc: 'Dedicated to promoting Alishan coffee, we hope every coffee soul can find complete answers from seed to cup here.',
startBtn: 'Start Exploring',
officialBtn: 'Official Website',
readMore: 'Read More',
coreKnowledge: 'Core Knowledge',
processFlow: 'Process Flow',
impact: 'Negative Impact',
features: ['Global & Taiwan Origins', 'Flavor Wheel', 'Defect Guide', 'Roasting Curves'],
tabs: {
origins: 'Origins', varieties: 'Varieties', processing: 'Processing',
brewing: 'Brewing', sensory: 'Sensory', roasting: 'Roasting',
grinding: 'Grinding', defects: 'Defects', quiz: 'Quiz'
},
severity: 'Severity',
highlight: 'Recommended'
},
'ja': {
title: 'Reshock コーヒー百科事典',
subtitle: '知識ベース',
heroTitle: '種子からカップまで',
heroDesc: '阿里山コーヒーの普及に努め、すべてのコーヒー愛好家がここで答えを見つけられることを願っています。',
startBtn: '探索を開始',
officialBtn: '公式サイト',
readMore: '詳細を読む',
coreKnowledge: '基礎知識',
processFlow: 'プロセスフロー',
impact: '悪影響',
features: ['世界の産地', 'フレーバーホイール', '欠点豆ガイド', '焙煎曲線'],
tabs: {
origins: '産地', varieties: '品種', processing: '精製方法',
brewing: '抽出', sensory: '官能評価', roasting: '焙煎',
grinding: '挽き目', defects: '欠点豆', quiz: 'クイズ'
},
severity: '深刻度',
highlight: '推奨'
},
'ko': {
title: '리샹 커피 백과사전',
subtitle: '지식 기반',
heroTitle: '씨앗에서 컵까지',
heroDesc: '아리산 커피를 알리는 데 전념하며, 모든 커피 애호가가 여기서 해답을 찾을 수 있기를 바랍니다.',
startBtn: '탐색 시작',
officialBtn: '공식 웹사이트',
readMore: '더 읽기',
coreKnowledge: '핵심 지식',
processFlow: '처리 과정',
impact: '부정적 영향',
features: ['세계 산지', '플레이버 휠', '결점두 가이드', '로스팅 곡선'],
tabs: {
origins: '산지', varieties: '품종', processing: '가공법',
brewing: '브루잉', sensory: '관능 평가', roasting: '로스팅',
grinding: '분쇄도', defects: '결점두', quiz: '퀴즈'
},
severity: '심각도',
highlight: '추천'
}
};
// --- 資料生成函數 (根據語言回傳資料) ---
const getCoffeeData = (lang) => {
// 簡單的翻譯輔助 (實際專案會使用完整的翻譯檔)
const isZh = lang.includes('zh');
const isEn = lang === 'en';
return {
origins: [
{
id: 'taiwan-alishan',
title: isZh ? '台灣阿里山 (Taiwan Alishan)' : 'Taiwan Alishan',
subtitle: isZh ? '雲海滋養的島嶼寶藏' : 'Treasure of the Sea of Clouds',
region: isZh ? '亞洲' : 'Asia',
isHighlight: true,
description: isZh
? '阿里山擁有得天獨厚的雲霧帶與高海拔微氣候,日夜溫差大,讓咖啡豆能在慢速生長中累積驚人的甜度與茶感。「里響咖啡」嚴選阿里山頂級莊園,帶您品味這份來自日出與雲海的禮物。'
: 'Alishan possesses a unique cloud belt and high-altitude microclimate. The significant temperature difference between day and night allows coffee beans to accumulate amazing sweetness and tea-like notes during slow growth. Reshock Coffee selects top estates in Alishan to bring you this gift from the sunrise and clouds.',
details: [
{ label: isZh ? '知名產區' : 'Region', value: isZh ? '阿里山樂野、達邦、特富野' : 'Leye, Dabang, Tefuye' },
{ label: isZh ? '品牌推薦' : 'Brand', value: '里響咖啡 Reshock Coffee' },
{ label: isZh ? '海拔' : 'Altitude', value: '1,000 - 1,400m' },
{ label: isZh ? '風味' : 'Flavor', value: isZh ? '烏龍茶韻、黑糖、龍眼' : 'Oolong Tea, Brown Sugar, Longan' }
],
image: 'https://images.unsplash.com/photo-1518832553480-cd0e625ed3e6?auto=format&fit=crop&w=800&q=80', // 阿里山意象 (茶園/山脈)
icon:
},
{
id: 'ethiopia',
title: isZh ? '衣索比亞 (Ethiopia)' : 'Ethiopia',
subtitle: isZh ? '咖啡基因庫與花香之王' : 'Birthplace of Coffee',
region: isZh ? '非洲' : 'Africa',
description: isZh
? '阿拉比卡發源地,擁有成千上萬種原生種(Heirloom)。產區極致細分,風味以細緻花香與水果酸質著稱。'
: 'The birthplace of Arabica, home to thousands of Heirloom varieties. Known for delicate floral notes and fruity acidity.',
details: [
{ label: isZh ? '產區' : 'Region', value: 'Yirgacheffe, Sidamo, Guji' },
{ label: isZh ? '風味' : 'Flavor', value: isZh ? '茉莉花、檸檬、水蜜桃' : 'Jasmine, Lemon, Peach' }
],
image: 'https://images.unsplash.com/photo-1621843669478-6d925d853511?auto=format&fit=crop&w=800&q=80', // 衣索比亞儀式/豆子
icon:
},
{
id: 'kenya',
title: isZh ? '肯亞 (Kenya)' : 'Kenya',
subtitle: isZh ? '強勁酸質與磷酸感' : 'Bright Acidity',
region: isZh ? '非洲' : 'Africa',
description: isZh
? '特有的紅色火山土壤孕育出極具爆發力的酸質與莓果香。'
: 'Unique red volcanic soil cultivates powerful acidity and berry aromas.',
details: [
{ label: isZh ? '產區' : 'Region', value: 'Nyeri, Kirinyaga' },
{ label: isZh ? '風味' : 'Flavor', value: isZh ? '黑醋栗、烏梅、葡萄柚' : 'Blackcurrant, Plum, Grapefruit' }
],
image: 'https://images.unsplash.com/photo-1526404522228-3e65d297c0c2?auto=format&fit=crop&w=800&q=80', // 肯亞豆/自然
icon:
},
{
id: 'panama',
title: isZh ? '巴拿馬 (Panama)' : 'Panama',
subtitle: isZh ? '競標天價與藝妓傳奇' : 'Legend of Geisha',
region: isZh ? '中美洲' : 'Central America',
description: isZh
? '擁有獨特的微型氣候,孕育出世界上最昂貴的藝妓(Geisha)咖啡。'
: 'Possesses unique microclimates, cultivating the world\'s most expensive Geisha coffee.',
details: [
{ label: isZh ? '產區' : 'Region', value: 'Boquete, Volcan' },
{ label: isZh ? '風味' : 'Flavor', value: isZh ? '極致花香、柑橘、精緻' : 'Floral, Citrus, Delicate' }
],
image: 'https://images.unsplash.com/photo-1459755486867-b55449bb39ff?auto=format&fit=crop&w=800&q=80', // 咖啡莊園
icon:
}
],
processing: [
{
id: 'washed',
title: isZh ? '水洗法 (Washed)' : 'Washed Process',
subtitle: isZh ? '乾淨明亮的試金石' : 'Clean & Bright',
description: isZh
? '利用水洗去除果肉與果膠。發酵過程較短且受控,能呈現最純淨的酸質與原產地風味。'
: 'Removes pulp and mucilage via washing. Controlled fermentation highlights pure acidity and terroir.',
flow: isZh ? ['去果皮', '水槽發酵', '清洗', '乾燥', '養豆'] : ['De-pulp', 'Ferment', 'Wash', 'Dry', 'Rest'],
image: 'https://images.unsplash.com/photo-1611057726661-77765e570055?auto=format&fit=crop&w=800&q=80', // 水洗處理站
icon:
},
{
id: 'natural',
title: isZh ? '日曬法 (Natural)' : 'Natural Process',
subtitle: isZh ? '陽光濃縮的甜美' : 'Sun-Dried Sweetness',
description: isZh
? '整顆漿果直接曝曬,果肉糖分滲入種子。風險在於乾燥不均易產生發酵過度,但成功時甜度驚人。'
: 'Whole cherries are dried in the sun. Sugars permeate the bean. High sweetness and fruity notes.',
flow: isZh ? ['浮選', '整顆曝曬', '翻動', '去殼'] : ['Float', 'Sun Dry', 'Turn', 'Hull'],
image: 'https://images.unsplash.com/photo-1599455304872-8c692ee342b0?auto=format&fit=crop&w=800&q=80', // 日曬床
icon:
},
{
id: 'honey',
title: isZh ? '蜜處理 (Honey)' : 'Honey Process',
subtitle: isZh ? '精準控制的平衡' : 'Sweet Balance',
description: isZh
? '去除果皮但保留果膠層進行乾燥。依保留量分為白蜜、黃蜜、紅蜜、黑蜜。'
: 'De-pulped but mucilage remains. Classified as White, Yellow, Red, or Black Honey.',
flow: isZh ? ['去皮', '保留果膠', '曝曬', '監控', '脫殼'] : ['De-pulp', 'Save Mucilage', 'Dry', 'Monitor', 'Hull'],
image: 'https://plus.unsplash.com/premium_photo-1675718772835-4395a30590b6?auto=format&fit=crop&w=800&q=80', // 咖啡果膠感
icon:
},
{
id: 'anaerobic',
title: isZh ? '厭氧發酵 (Anaerobic)' : 'Anaerobic',
subtitle: isZh ? '現代風味實驗' : 'Modern Experiment',
description: isZh
? '在無氧環境下發酵,控制溫度與pH值,創造出肉桂、優格等特殊強烈香氣。'
: 'Fermentation in oxygen-free tanks. Creates intense notes like cinnamon and yogurt.',
flow: isZh ? ['密封桶', '注入CO2', '低溫發酵', '乾燥'] : ['Sealed Tank', 'CO2', 'Ferment', 'Dry'],
image: 'https://images.unsplash.com/photo-1514432324607-a09d9b4aefdd?auto=format&fit=crop&w=800&q=80', // 實驗室/桶裝感
icon:
}
],
varieties: [
{
id: 'arabica',
title: '阿拉比卡 (Arabica)',
subtitle: isZh ? '精品咖啡主流' : 'Mainstream Specialty',
description: isZh ? '風味精緻多變,佔全球產量多數。' : 'Delicate flavors, majority of global production.',
image: 'https://images.unsplash.com/photo-1524350876685-274059332603?auto=format&fit=crop&w=800&q=80',
icon:
},
{
id: 'geisha',
title: '藝妓/瑰夏 (Geisha)',
subtitle: isZh ? '當代王者' : 'The Queen of Coffee',
description: isZh ? '擁有辨識度極高的茉莉花香與柑橘調。' : 'Distinctive jasmine and citrus notes.',
image: 'https://images.unsplash.com/photo-1511920170033-f8396924c348?auto=format&fit=crop&w=800&q=80',
icon:
},
{
id: 'sl28',
title: 'SL28 / SL34',
subtitle: isZh ? '肯亞之光' : 'Star of Kenya',
description: isZh ? '擁有極致的黑醋栗酸質與扎實口感。' : 'Intense blackcurrant acidity and body.',
image: 'https://images.unsplash.com/photo-1587049352846-4a222e784d38?auto=format&fit=crop&w=800&q=80',
icon:
}
],
brewing: [
{
id: 'v60',
title: 'V60',
subtitle: isZh ? '手沖標準' : 'Pour Over Standard',
description: isZh ? '60度錐形設計,流速快,層次分明。' : '60-degree cone, fast flow, clear layers.',
guide: { ratio: '1:15', temp: '90-93°C', grind: 'Medium-Fine', time: '2:30' },
image: 'https://images.unsplash.com/photo-1519081836204-c8b907593a76?auto=format&fit=crop&w=800&q=80',
icon:
},
{
id: 'espresso',
title: 'Espresso',
subtitle: isZh ? '義式濃縮' : 'High Pressure',
description: isZh ? '9 bar 高壓萃取,濃郁油脂(Crema)。' : '9 bar extraction, rich Crema.',
guide: { ratio: '1:2', temp: '92°C', grind: 'Extra-Fine', time: '30s' },
image: 'https://images.unsplash.com/photo-1514066558159-fc8c737ef259?auto=format&fit=crop&w=800&q=80',
icon:
}
],
defects: [
{
id: 'black',
title: isZh ? '全黑豆 (Full Black)' : 'Full Black',
subtitle: isZh ? '嚴重真菌感染' : 'Fungus Damage',
description: isZh ? '外觀完全變黑。通常由嚴重真菌感染或過度發酵引起。' : 'Completely black beans caused by severe fungus or over-fermentation.',
impact: isZh ? '發霉味、藥水味、苯酚味。' : 'Moldy, phenolic, medicinal taste.',
severity: 'High',
image: 'https://images.unsplash.com/photo-1559525839-b184a4d698c7?auto=format&fit=crop&w=800&q=80', // 示意圖
icon:
},
{
id: 'sour',
title: isZh ? '發酵豆 (Sour)' : 'Sour Bean',
subtitle: isZh ? '發酵過度' : 'Over Fermented',
description: isZh ? '顏色由黃轉褐。採收後處理不當導致。' : 'Yellow to brown color. Improper processing.',
impact: isZh ? '腐敗酸味、醋酸味。' : 'Rotten sour, vinegar taste.',
severity: 'High',
image: 'https://images.unsplash.com/photo-1616489888285-8509d5d1e17e?auto=format&fit=crop&w=800&q=80',
icon:
},
{
id: 'insect',
title: isZh ? '蟲蛀豆 (Insect)' : 'Insect Damage',
subtitle: isZh ? '咖啡果小蠹' : 'Berry Borer',
description: isZh ? '豆體表面有小圓孔。' : 'Small holes on the bean surface.',
impact: isZh ? '風味平淡、髒味。' : 'Flat flavor, dirty taste.',
severity: 'Medium',
image: 'https://images.unsplash.com/photo-1517682205457-097214f08d79?auto=format&fit=crop&w=800&q=80', // 示意用
icon:
},
{
id: 'broken',
title: isZh ? '破碎豆 (Broken)' : 'Broken Bean',
subtitle: isZh ? '機械損傷' : 'Mechanical Damage',
description: isZh ? '豆子破裂、缺角。' : 'Chipped or broken beans.',
impact: isZh ? '烘焙易燒焦,產生焦苦味。' : 'Easy to burn, bitter taste.',
severity: 'Low',
image: 'https://images.unsplash.com/photo-1552346988-192350239da4?auto=format&fit=crop&w=800&q=80',
icon:
},
],
roasting_levels: [
{ id: 'light', title: isZh ? '淺焙' : 'Light', temp: isZh ? '一爆結束' : 'First Crack', flavor: isZh ? '花果酸香' : 'Floral & Fruity', color: 'bg-[#C69C6D]' },
{ id: 'medium', title: isZh ? '中焙' : 'Medium', temp: isZh ? '二爆前' : 'Before 2nd Crack', flavor: isZh ? '堅果焦糖' : 'Nutty & Caramel', color: 'bg-[#8B5E3C]' },
{ id: 'dark', title: isZh ? '深焙' : 'Dark', temp: isZh ? '二爆後' : 'After 2nd Crack', flavor: isZh ? '醇厚苦甜' : 'Dark & Bitter', color: 'bg-[#3E2723]' }
],
sensory: [
{
id: 'floral',
title: isZh ? '花香調 (Floral)' : 'Floral',
color: '#F472B6',
desc: isZh ? '優雅輕盈的氣息,常見於水洗衣索比亞或藝妓品種。' : 'Elegant and light. Common in washed Ethiopia or Geisha.',
notes: isZh ? ['茉莉花', '玫瑰', '洋甘菊', '咖啡花'] : ['Jasmine', 'Rose', 'Chamomile', 'Blossom']
},
{
id: 'fruity',
title: isZh ? '水果調 (Fruity)' : 'Fruity',
color: '#F87171',
desc: isZh ? '酸質的主要來源,包含柑橘、莓果與熱帶水果。' : 'Source of acidity. Citrus, berry, and tropical fruits.',
notes: isZh ? ['柑橘', '莓果', '水蜜桃', '鳳梨'] : ['Citrus', 'Berry', 'Peach', 'Pineapple']
},
{
id: 'nutty',
title: isZh ? '堅果可可 (Nutty)' : 'Nutty',
color: '#A8A29E',
desc: isZh ? '中深焙常見的風味,帶來厚實與溫暖的感受。' : 'Common in medium-dark roasts. Warm and full body.',
notes: isZh ? ['杏仁', '榛果', '花生', '巧克力'] : ['Almond', 'Hazelnut', 'Peanut', 'Chocolate']
}
],
grinding: [
{ id: 'coarse', title: isZh ? '粗研磨' : 'Coarse', desc: isZh ? '像海鹽' : 'Like Sea Salt', usage: isZh ? '法壓壺, 冷萃' : 'French Press', size: 'w-5 h-5' },
{ id: 'medium', title: isZh ? '中研磨' : 'Medium', desc: isZh ? '像二砂' : 'Like Sand', usage: isZh ? '手沖, 美式' : 'Pour Over', size: 'w-4 h-4' },
{ id: 'fine', title: isZh ? '細研磨' : 'Fine', desc: isZh ? '像精鹽' : 'Like Fine Salt', usage: isZh ? '摩卡壺' : 'Moka Pot', size: 'w-3 h-3' },
{ id: 'extra-fine', title: isZh ? '極細研磨' : 'Extra Fine', desc: isZh ? '像麵粉' : 'Like Flour', usage: isZh ? '義式濃縮' : 'Espresso', size: 'w-2 h-2' }
],
};
};
// --- 組件區 ---
const Navigation = ({ activeTab, setActiveTab, lang, setLang }) => {
const t = UI_TEXT[lang] || UI_TEXT['zh-TW'];
const navItems = [
{ id: 'origins', label: t.tabs.origins, icon: },
{ id: 'varieties', label: t.tabs.varieties, icon: },
{ id: 'processing', label: t.tabs.processing, icon: },
{ id: 'brewing', label: t.tabs.brewing, icon: },
{ id: 'sensory', label: t.tabs.sensory, icon: },
{ id: 'roasting', label: t.tabs.roasting, icon: },
{ id: 'grinding', label: t.tabs.grinding, icon: },
{ id: 'defects', label: t.tabs.defects, icon: },
{ id: 'quiz', label: t.tabs.quiz, icon: },
];
return (
{/* Top Row: Logo & Language */}
setActiveTab('home')}>
{t.title}
{t.subtitle}
{/* Language Switcher */}
{/* Bottom Row: Nav Items (Scrollable) */}
{navItems.map((item) => (
))}
);
};
const Hero = ({ onStart, lang }) => {
const t = UI_TEXT[lang] || UI_TEXT['zh-TW'];
return (
{t.heroTitle}
里響咖啡
{t.title}
{t.heroDesc}
{t.officialBtn}
{t.features.map((feat, idx) => (
))}
);
};
const CardGrid = ({ data, category, onSelect, subtitle, lang }) => {
const t = UI_TEXT[lang] || UI_TEXT['zh-TW'];
return (
{category}
{subtitle &&
{subtitle}
}
{data.map((item) => (
onSelect(item)}
className={`bg-white rounded-2xl overflow-hidden shadow-sm hover:shadow-2xl hover:shadow-amber-500/10 transition-all cursor-pointer group border flex flex-col relative ${item.isHighlight ? 'border-amber-400 ring-2 ring-amber-100' : 'border-stone-100'}`}
>
{item.isHighlight && (
{t.highlight}
)}
{/* 卡片圖片區域 (Cover Image) */}
{/* 圖片層 */}
{item.image ? (

) : (
)}
{/* 漸層遮罩,讓文字更清楚或增加質感 */}
{/* Icon Overlay */}
{item.icon}
{item.severity && (
{t.severity}: {item.severity}
)}
{item.title}
{item.subtitle &&
{item.subtitle}
}
{item.description}
))}
);
};
const DetailModal = ({ item, onClose, type, lang }) => {
if (!item) return null;
const t = UI_TEXT[lang] || UI_TEXT['zh-TW'];
return (
{/* 左側:大圖視覺區 */}
{item.image ? (

) : (
)}
{/* 右側:內容詳解區 */}
{t.coreKnowledge}
{/* 圖文整合的詳細數據 */}
{item.details && (
{item.details.map((detail, idx) => (
{detail.label}
{detail.value}
))}
)}
{/* 處理法流程 */}
{item.flow && (
{t.processFlow}
{item.flow.map((step, i) => (
{step}
{i < item.flow.length - 1 &&
}
))}
)}
{/* 瑕疵影響 */}
{item.impact && (
)}
{/* 沖煮參數 */}
{item.guide && (
)}
);
};
const FlavorWheel = ({ data, lang }) => {
const [activeSlice, setActiveSlice] = useState(null);
const radius = 150;
const center = 160;
const t = UI_TEXT[lang] || UI_TEXT['zh-TW'];
const createSlice = (index, total) => {
const angle = 360 / total;
const startAngle = (index * angle - 90) * (Math.PI / 180);
const endAngle = ((index + 1) * angle - 90) * (Math.PI / 180);
const x1 = center + radius * Math.cos(startAngle);
const y1 = center + radius * Math.sin(startAngle);
const x2 = center + radius * Math.cos(endAngle);
const y2 = center + radius * Math.sin(endAngle);
return `M${center},${center} L${x1},${y1} A${radius},${radius} 0 0,1 ${x2},${y2} Z`;
};
return (
{activeSlice ? (
{activeSlice.title}
{activeSlice.desc}
Notes
{activeSlice.notes.map((note, idx) => (
{note}
))}
) : (
)}
);
};
const RoastingView = ({ data, lang }) => {
const t = UI_TEXT[lang] || UI_TEXT['zh-TW'];
return (
{t.tabs.roasting}
Roasting is the journey of heat. 烘焙是將生豆轉化為熟豆的「熱能旅程」。
{data.map((level) => (
{level.title}
{level.temp}
{level.flavor}
))}
);
};
// --- 主程式 ---
export default function App() {
const [activeTab, setActiveTab] = useState('home');
const [selectedItem, setSelectedItem] = useState(null);
const [lang, setLang] = useState('zh-TW'); // 預設繁體中文
// 根據目前選擇的語言產生資料
const currentData = useMemo(() => getCoffeeData(lang), [lang]);
const t = UI_TEXT[lang] || UI_TEXT['zh-TW'];
useEffect(() => {
window.scrollTo(0, 0);
}, [activeTab]);
const renderContent = () => {
switch (activeTab) {
case 'home':
return setActiveTab(tab)} lang={lang} />;
case 'origins':
return ;
case 'processing':
return ;
case 'varieties':
return ;
case 'brewing':
return ;
case 'sensory':
return (
);
case 'roasting':
return ;
case 'grinding':
return ;
case 'defects':
return ;
case 'quiz':
return (
{t.tabs.quiz}
Feature coming soon.
);
default:
return setActiveTab(tab)} lang={lang} />;
}
};
return (
{renderContent()}
{selectedItem && (
setSelectedItem(null)}
type={activeTab}
lang={lang}
/>
)}
);
}