Spaces:
Running
Running
Download nutrition.html from CSNET/pulse-whoop: direct link, hf CLI and curl.
- Browser
- Download file 16.7 kB
-
https://huggingface.co/spaces/CSNET/pulse-whoop/resolve/main/nutrition.html
- Command line
-
hf download hf://spaces/CSNET/pulse-whoop/nutrition.html
-
curl -L -o nutrition.html https://huggingface.co/spaces/CSNET/pulse-whoop/resolve/main/nutrition.html
16.7 kB
| ```html | |
| <html lang="th" class="dark"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
| <title>โภชนาการ - ชีพจร</title> | |
| <link rel="icon" type="image/x-icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🌿</text></svg>"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | |
| <link rel="stylesheet" href="style.css"> | |
| </head> | |
| <body class="bg-gray-900 text-white font-sans pb-20"> | |
| <!-- Main Container --> | |
| <div class="min-h-screen bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900"> | |
| <!-- Header --> | |
| <header class="px-4 pt-12 pb-6"> | |
| <div class="flex items-center justify-between"> | |
| <div> | |
| <h1 class="text-2xl font-bold bg-gradient-to-r from-purple-400 to-pink-500 bg-clip-text text-transparent"> | |
| โภชนาการ | |
| </h1> | |
| <p class="text-gray-400 text-sm mt-1">ติดตามการรับประทานอาหารของคุณ 🍎</p> | |
| </div> | |
| <button onclick="window.location.href='index.html'" class="w-10 h-10 rounded-full bg-gray-800 flex items-center justify-center"> | |
| <i data-feather="arrow-left" class="w-5 h-5"></i> | |
| </button> | |
| </div> | |
| </header> | |
| <!-- Daily Nutrition Overview --> | |
| <section class="px-4 mb-6"> | |
| <div class="glass-card rounded-2xl p-5 border border-gray-700/50"> | |
| <h3 class="text-lg font-semibold mb-4 flex items-center gap-2"> | |
| <i data-feather="pie-chart" class="w-5 h-5 text-purple-400"></i> | |
| ภาพรวมวันนี้ | |
| </h3> | |
| <div class="grid grid-cols-3 gap-4 mb-4"> | |
| <div class="text-center"> | |
| <p class="text-2xl font-bold text-orange-400">1,847</p> | |
| <p class="text-xs text-gray-400">แคลอรี</p> | |
| </div> | |
| <div class="text-center"> | |
| <p class="text-2xl font-bold text-blue-400">92g</p> | |
| <p class="text-xs text-gray-400">โปรตีน</p> | |
| </div> | |
| <div class="text-center"> | |
| <p class="text-2xl font-bold text-green-400">35g</p> | |
| <p class="text-xs text-gray-400">ใยอาหาร</p> | |
| </div> | |
| </div> | |
| <div class="bg-gray-800/50 rounded-xl p-3"> | |
| <div class="flex justify-between text-sm mb-2"> | |
| <span>เป้าหมาย: 2,200 แคลอรี</span> | |
| <span>73%</span> | |
| </div> | |
| <div class="bg-gray-700 rounded-full h-3"> | |
| <div class="bg-gradient-to-r from-purple-500 to-pink-600 h-3 rounded-full" style="width: 73%"></div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Macro Distribution --> | |
| <section class="px-4 mb-6"> | |
| <div class="glass-card rounded-2xl p-5 border border-gray-700/50"> | |
| <h3 class="text-lg font-semibold mb-4 flex items-center gap-2"> | |
| <i data-feather="percent" class="w-5 h-5 text-yellow-400"></i> | |
| สัดส่วนสารอาหาร | |
| </h3> | |
| <canvas id="macroChart" height="200"></canvas> | |
| </div> | |
| </section> | |
| <!-- Meal Timeline --> | |
| <section class="px-4 mb-6"> | |
| <div class="glass-card rounded-2xl p-5 border border-gray-700/50"> | |
| <h3 class="text-lg font-semibold mb-4 flex items-center gap-2"> | |
| <i data-feather="clock" class="w-5 h-5 text-green-400"></i> | |
| มื้ออาหารวันนี้ | |
| </h3> | |
| <div class="space-y-4" id="mealTimeline"> | |
| <div class="flex gap-3"> | |
| <div class="flex-shrink-0 w-16 h-16 bg-gradient-to-r from-yellow-400 to-orange-500 rounded-xl flex items-center justify-center text-xl"> | |
| 🌅 | |
| </div> | |
| <div class="flex-1"> | |
| <div class="flex justify-between items-start mb-1"> | |
| <h4 class="font-medium">มื้อเช้า</h4> | |
| <span class="text-sm text-gray-400">07:30</span> | |
| </div> | |
| <p class="text-sm text-gray-300 mb-1">ข้าวต้มหมู + ไข่ลวก</p> | |
| <p class="text-xs text-orange-400">580 แคลอรี</p> | |
| </div> | |
| </div> | |
| <div class="flex gap-3"> | |
| <div class="flex-shrink-0 w-16 h-16 bg-gradient-to-r from-red-500 to-pink-600 rounded-xl flex items-center justify-center text-xl"> | |
| ☀️ | |
| </div> | |
| <div class="flex-1"> | |
| <div class="flex justify-between items-start mb-1"> | |
| <h4 class="font-medium">มื้อเที่ยง</h4> | |
| <span class="text-sm text-gray-400">12:15</span> | |
| </div> | |
| <p class="text-sm text-gray-300 mb-1">ส้มตำไทย + ไก่ย่าง</p> | |
| <p class="text-xs text-orange-400">450 แคลอรี</p> | |
| </div> | |
| </div> | |
| <div class="flex gap-3"> | |
| <div class="flex-shrink-0 w-16 h-16 bg-gradient-to-r from-blue-500 to-indigo-600 rounded-xl flex items-center justify-center text-xl"> | |
| 🌙 | |
| </div> | |
| <div class="flex-1"> | |
| <div class="flex justify-between items-start mb-1"> | |
| <h4 class="font-medium">มื้อเย็น</h4> | |
| <span class="text-sm text-gray-400">18:30</span> | |
| </div> | |
| <p class="text-sm text-gray-300 mb-1">ยังไม่บันทึก</p> | |
| <button class="text-xs text-blue-400 hover:underline">+ เพิ่มมื้อเย็น</button> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Enhanced Meal Logger --> | |
| <meal-logger-enhanced></meal-logger-enhanced> | |
| <!-- Water Intake --> | |
| <section class="px-4 mb-6"> | |
| <div class="glass-card rounded-2xl p-5 border border-gray-700/50"> | |
| <h3 class="text-lg font-semibold mb-4 flex items-center gap-2"> | |
| <i data-feather="droplet" class="w-5 h-5 text-cyan-400"></i> | |
| การดื่มน้ำ | |
| </h3> | |
| <div class="flex items-center justify-between mb-4"> | |
| <div class="text-center"> | |
| <p class="text-2xl font-bold text-cyan-400">1.8L</p> | |
| <p class="text-xs text-gray-400">ดื่มไปแล้ว</p> | |
| </div> | |
| <div class="text-center"> | |
| <p class="text-2xl font-bold text-gray-400">2.5L</p> | |
| <p class="text-xs text-gray-400">เป้าหมาย</p> | |
| </div> | |
| </div> | |
| <div class="grid grid-cols-4 gap-2 mb-4"> | |
| <div class="aspect-square bg-cyan-500 rounded-lg flex items-center justify-center"> | |
| <i data-feather="check" class="w-4 h-4 text-white"></i> | |
| </div> | |
| <div class="aspect-square bg-cyan-500 rounded-lg flex items-center justify-center"> | |
| <i data-feather="check" class="w-4 h-4 text-white"></i> | |
| </div> | |
| <div class="aspect-square bg-cyan-500 rounded-lg flex items-center justify-center"> | |
| <i data-feather="check" class="w-4 h-4 text-white"></i> | |
| </div> | |
| <div class="aspect-square bg-gray-700 rounded-lg flex items-center justify-center"> | |
| <span class="text-xs text-gray-400">4</span> | |
| </div> | |
| </div> | |
| <button class="w-full bg-gradient-to-r from-cyan-500 to-blue-600 py-2 rounded-lg text-sm font-medium" onclick="logWater()"> | |
| <i data-feather="plus" class="w-4 h-4 inline mr-1"></i> | |
| เพิ่มแก้วน้ำ (250ml) | |
| </button> | |
| </div> | |
| </section> | |
| <!-- Nutrition Insights --> | |
| <section class="px-4 mb-6"> | |
| <div class="glass-card rounded-2xl p-5 border border-gray-700/50"> | |
| <h3 class="text-lg font-semibold mb-4 flex items-center gap-2"> | |
| <i data-feather="info" class="w-5 h-5 text-yellow-400"></i> | |
| คำแนะนำโภชนาการ | |
| </h3> | |
| <div class="space-y-3"> | |
| <div class="p-3 bg-green-500/10 border border-green-500/30 rounded-xl"> | |
| <div class="flex items-center gap-3"> | |
| <div class="w-8 h-8 bg-green-500 rounded-lg flex items-center justify-center"> | |
| <i data-feather="check-circle" class="w-4 h-4 text-white"></i> | |
| </div> | |
| <div class="flex-1"> | |
| <p class="text-sm font-medium">โปรตีนเพียงพอ</p> | |
| <p class="text-xs text-gray-400">คุณได้รับโปรตีนครบตามเป้าหมายแล้ว</p> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="p-3 bg-orange-500/10 border border-orange-500/30 rounded-xl"> | |
| <div class="flex items-center gap-3"> | |
| <div class="w-8 h-8 bg-orange-500 rounded-lg flex items-center justify-center"> | |
| <i data-feather="alert-circle" class="w-4 h-4 text-white"></i> | |
| </div> | |
| <div class="flex-1"> | |
| <p class="text-sm font-medium">ใยอาหารต่ำ</p> | |
| <p class="text-xs text-gray-400">ควรทานผักเพิ่มขึ้นอีก 15g</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| </div> | |
| <!-- Bottom Navigation --> | |
| <main-navbar></main-navbar> | |
| <!-- Scripts --> | |
| <script src="components/navbar.js"></script> | |
| <script src="components/meal-logger-enhanced.js"></script> | |
| <script src="script.js"></script> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Set active page in navbar | |
| const navbar = document.querySelector('main-navbar'); | |
| if (navbar) { | |
| navbar.setActivePage('nutrition'); | |
| } | |
| // Macro distribution chart | |
| const ctx = document.getElementById('macroChart'); | |
| if (ctx) { | |
| new Chart(ctx, { | |
| type: 'doughnut', | |
| data: { | |
| labels: ['คาร์โบไฮเดรต', 'โปรตีน', 'ไขมัน', 'ใยอาหาร'], | |
| datasets: [{ | |
| data: [45, 25, 25, 5], | |
| backgroundColor: [ | |
| '#f59e0b', | |
| '#3b82f6', | |
| '#10b981', | |
| '#8b5cf6' | |
| ], | |
| borderWidth: 0 | |
| }] | |
| }, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| plugins: { | |
| legend: { | |
| position: 'bottom', | |
| labels: { | |
| padding: 15, | |
| font: { size: 12, family: 'Prompt' }, | |
| color: '#e5e7eb' | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| } | |
| // Load meals from localStorage | |
| loadMealsFromStorage(); | |
| }); | |
| function logWater() { | |
| const waterGrid = document.querySelector('.grid.grid-cols-4'); | |
| const emptyGlass = waterGrid.querySelector('.bg-gray-700'); | |
| if (emptyGlass) { | |
| emptyGlass.className = 'aspect-square bg-cyan-500 rounded-lg flex items-center justify-center'; | |
| emptyGlass.innerHTML = '<i data-feather="check" class="w-4 h-4 text-white"></i>'; | |
| feather.replace(); | |
| showNotification('บันทึกการดื่มน้ำ 250ml สำเร็จ!', 'success'); | |
| // Update total | |
| const currentText = document.querySelector('.text-2xl.font-bold.text-cyan-400').textContent; | |
| const current = parseFloat(currentText); | |
| document.querySelector('.text-2xl.font-bold.text-cyan-400').textContent = (current + 0.25).toFixed(1) + 'L'; | |
| } else { | |
| showNotification('คุณดื่มน้ำครบเป้าหมายแล้ววันนี้! 🎉', 'success'); | |
| } | |
| } | |
| function loadMealsFromStorage() { | |
| const meals = JSON.parse(localStorage.getItem('todayMeals') || '[]'); | |
| const timeline = document.getElementById('mealTimeline'); | |
| // Update timeline with saved meals | |
| if (meals.length > 0) { | |
| // Clear existing meals except the "dinner" placeholder | |
| const existingMeals = timeline.querySelectorAll('.flex.gap-3:not(:last-child)'); | |
| existingMeals.forEach(meal => meal.remove()); | |
| // Add saved meals | |
| meals.forEach((meal, index) => { | |
| const mealElement = document.createElement('div'); | |
| mealElement.className = 'flex gap-3'; | |
| mealElement.innerHTML = ` | |
| <div class="flex-shrink-0 w-16 h-16 bg-gradient-to-r from-orange-500 to-red-600 rounded-xl flex items-center justify-center text-xl"> | |
| ${meal.mealType === 'เช้า' ? '🌅' : meal.mealType === 'เที่ยง' ? '☀️' : '🌙'} | |
| </div> | |
| <div class="flex-1"> | |
| <div class="flex justify-between items-start mb-1"> | |
| <h4 class="font-medium">มื้อ${meal.mealType}</h4> | |
| <span class="text-sm text-gray-400">${new Date(meal.timestamp).toLocaleTimeString('th-TH', { hour: '2-digit', minute: '2-digit' })}</span> | |
| </div> | |
| <p class="text-sm text-gray-300 mb-1">${meal.name}</p> | |
| <p class="text-xs text-orange-400">${meal.calories} แคลอรี</p> | |
| </div> | |
| `; | |
| timeline.insertBefore(mealElement, timeline.firstChild); | |
| }); | |
| } | |
| } | |
| </script> | |
| <script>feather.replace();</script> | |
| </body> | |
| </html> | |
| >>>>>>> REPLACE |