Spaces:
Running
Running
Download script.js from CSNET/fit-journey-tracker: direct link, hf CLI and curl.
- Browser
- Download file 42.4 kB
-
https://huggingface.co/spaces/CSNET/fit-journey-tracker/resolve/main/script.js
- Command line
-
hf download hf://spaces/CSNET/fit-journey-tracker/script.js
-
curl -L -o script.js https://huggingface.co/spaces/CSNET/fit-journey-tracker/resolve/main/script.js
42.4 kB
| // Tab switching functionality | |
| function switchTab(tabName) { | |
| // Hide all tab contents | |
| const tabContents = document.querySelectorAll('.tab-content'); | |
| tabContents.forEach(content => { | |
| content.classList.add('hidden'); | |
| }); | |
| // Show selected tab | |
| const selectedTab = document.getElementById(tabName); | |
| if (selectedTab) { | |
| selectedTab.classList.remove('hidden'); | |
| } | |
| // Update tab button colors | |
| const tabButtons = document.querySelectorAll('.tab-btn'); | |
| tabButtons.forEach(btn => { | |
| btn.classList.remove('text-green-600'); | |
| btn.classList.add('text-gray-600'); | |
| }); | |
| // Highlight active tab button | |
| const activeBtn = document.querySelector(`button[onclick="switchTab('${tabName}')"]`); | |
| if (activeBtn) { | |
| activeBtn.classList.remove('text-gray-600'); | |
| activeBtn.classList.add('text-green-600'); | |
| } | |
| // Re-initialize feather icons | |
| feather.replace(); | |
| // Initialize chart if graph tab is selected | |
| if (tabName === 'graph') { | |
| setTimeout(() => initChart(), 100); | |
| } | |
| } | |
| // Chart functionality | |
| let healthChart = null; | |
| function initChart() { | |
| const canvas = document.getElementById('healthChart'); | |
| if (!canvas) return; | |
| const ctx = canvas.getContext('2d'); | |
| // Sample data for 7 days | |
| const labels = ['จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.', 'อา.']; | |
| const fatData = [29.1, 28.9, 28.8, 28.7, 28.6, 28.5, 28.4]; | |
| const muscleData = [30.2, 30.4, 30.5, 30.8, 30.9, 31.0, 31.2]; | |
| const weightData = [67.0, 66.8, 66.7, 66.6, 66.5, 66.4, 66.4]; | |
| // Simple line chart drawing | |
| drawLineChart(ctx, canvas.width, canvas.height, labels, [ | |
| { data: fatData, color: '#3B82F6', label: 'ไขมัน %' }, | |
| { data: muscleData, color: '#10B981', label: 'กล้ามเนื้อ kg' }, | |
| { data: weightData, color: '#8B5CF6', label: 'น้ำหนัก kg' } | |
| ]); | |
| } | |
| function drawLineChart(ctx, width, height, labels, datasets) { | |
| // Clear canvas | |
| ctx.clearRect(0, 0, width, height); | |
| const padding = 40; | |
| const graphWidth = width - padding * 2; | |
| const graphHeight = height - padding * 2; | |
| const dataPoints = labels.length; | |
| // Draw axes | |
| ctx.strokeStyle = '#E5E7EB'; | |
| ctx.lineWidth = 1; | |
| ctx.beginPath(); | |
| ctx.moveTo(padding, padding); | |
| ctx.lineTo(padding, height - padding); | |
| ctx.lineTo(width - padding, height - padding); | |
| ctx.stroke(); | |
| // Draw grid lines | |
| ctx.strokeStyle = '#F3F4F6'; | |
| for (let i = 0; i <= 5; i++) { | |
| const y = padding + (graphHeight / 5) * i; | |
| ctx.beginPath(); | |
| ctx.moveTo(padding, y); | |
| ctx.lineTo(width - padding, y); | |
| ctx.stroke(); | |
| } | |
| // Draw labels | |
| ctx.fillStyle = '#6B7280'; | |
| ctx.font = '12px Prompt'; | |
| labels.forEach((label, i) => { | |
| const x = padding + (graphWidth / (dataPoints - 1)) * i; | |
| ctx.fillText(label, x - 10, height - padding + 20); | |
| }); | |
| // Draw data lines | |
| datasets.forEach(dataset => { | |
| ctx.strokeStyle = dataset.color; | |
| ctx.lineWidth = 2; | |
| ctx.beginPath(); | |
| dataset.data.forEach((value, i) => { | |
| const x = padding + (graphWidth / (dataPoints - 1)) * i; | |
| const normalizedValue = (value - Math.min(...dataset.data)) / (Math.max(...dataset.data) - Math.min(...dataset.data)); | |
| const y = height - padding - (normalizedValue * graphHeight * 0.8 + graphHeight * 0.1); | |
| if (i === 0) { | |
| ctx.moveTo(x, y); | |
| } else { | |
| ctx.lineTo(x, y); | |
| } | |
| }); | |
| ctx.stroke(); | |
| // Draw data points | |
| dataset.data.forEach((value, i) => { | |
| const x = padding + (graphWidth / (dataPoints - 1)) * i; | |
| const normalizedValue = (value - Math.min(...dataset.data)) / (Math.max(...dataset.data) - Math.min(...dataset.data)); | |
| const y = height - padding - (normalizedValue * graphHeight * 0.8 + graphHeight * 0.1); | |
| ctx.fillStyle = dataset.color; | |
| ctx.beginPath(); | |
| ctx.arc(x, y, 3, 0, Math.PI * 2); | |
| ctx.fill(); | |
| }); | |
| }); | |
| } | |
| // Update graph based on time range | |
| function updateGraph(days) { | |
| // Update button styles | |
| const buttons = document.querySelectorAll('[onclick^="updateGraph"]'); | |
| buttons.forEach(btn => { | |
| btn.classList.remove('bg-green-500', 'text-white'); | |
| btn.classList.add('bg-gray-200', 'text-gray-700'); | |
| }); | |
| event.target.classList.remove('bg-gray-200', 'text-gray-700'); | |
| event.target.classList.add('bg-green-500', 'text-white'); | |
| // Re-initialize chart with new data | |
| initChart(); | |
| } | |
| // Add to cart functionality | |
| function addToCart(productName, price) { | |
| // Create notification | |
| const notification = document.createElement('div'); | |
| notification.className = 'fixed top-20 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg z-50'; | |
| notification.textContent = `เพิ่ม ${productName} ลงตะกร้าแล้ว`; | |
| document.body.appendChild(notification); | |
| // Animate in | |
| notification.style.animation = 'slideIn 0.3s ease-out'; | |
| // Remove after 2 seconds | |
| setTimeout(() => { | |
| notification.style.animation = 'slideOut 0.3s ease-out'; | |
| setTimeout(() => { | |
| document.body.removeChild(notification); | |
| }, 300); | |
| }, 2000); | |
| } | |
| // Buy now functionality | |
| function buyNow(productName, price) { | |
| // Create confirmation modal | |
| const modal = document.createElement('div'); | |
| modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50'; | |
| modal.innerHTML = ` | |
| <div class="bg-white rounded-2xl p-6 m-4 max-w-sm w-full"> | |
| <h3 class="text-lg font-bold mb-4">ยืนยันการสั่งซื้อ</h3> | |
| <p class="text-gray-600 mb-4">คุณต้องการสั่งซื้อ ${productName} ในราคา ${price} ใช่หรือไม่?</p> | |
| <div class="flex space-x-2"> | |
| <button onclick="this.closest('.fixed').remove()" class="flex-1 bg-gray-200 text-gray-700 py-2 rounded-lg font-medium">ยกเลิก</button> | |
| <button onclick="confirmPurchase('${productName}')" class="flex-1 bg-green-500 text-white py-2 rounded-lg font-medium">ยืนยัน</button> | |
| </div> | |
| </div> | |
| `; | |
| document.body.appendChild(modal); | |
| } | |
| function confirmPurchase(productName) { | |
| // Remove modal | |
| document.querySelector('.fixed.inset-0').remove(); | |
| // Show success notification | |
| const notification = document.createElement('div'); | |
| notification.className = 'fixed top-20 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg z-50'; | |
| notification.textContent = `สั่งซื้อ ${productName} สำเร็จแล้ว`; | |
| document.body.appendChild(notification); | |
| setTimeout(() => { | |
| notification.remove(); | |
| }, 3000); | |
| } | |
| // Contact coach functionality | |
| function contactCoach() { | |
| const modal = document.createElement('div'); | |
| modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50'; | |
| modal.innerHTML = ` | |
| <div class="bg-white rounded-2xl p-6 m-4 max-w-sm w-full"> | |
| <h3 class="text-lg font-bold mb-4">ติดต่อโค้ชแนต</h3> | |
| <p class="text-gray-600 mb-4">คุณสามารถติดต่อโค้ชได้ผ่านช่องทางต่อไปนี้:</p> | |
| <div class="space-y-2 mb-4"> | |
| <div class="flex items-center space-x-2"> | |
| <i data-feather="message-circle" class="w-5 h-5 text-green-500"></i> | |
| <span class="text-sm">LINE: @wpcoach</span> | |
| </div> | |
| <div class="flex items-center space-x-2"> | |
| <i data-feather="phone" class="w-5 h-5 text-green-500"></i> | |
| <span class="text-sm">โทร: 099-123-4567</span> | |
| </div> | |
| <div class="flex items-center space-x-2"> | |
| <i data-feather="mail" class="w-5 h-5 text-green-500"></i> | |
| <span class="text-sm">Email: coach@wpwellnet.com</span> | |
| </div> | |
| </div> | |
| <button onclick="this.closest('.fixed').remove()" class="w-full bg-green-500 text-white py-2 rounded-lg font-medium">ตกลง</button> | |
| </div> | |
| `; | |
| document.body.appendChild(modal); | |
| feather.replace(); | |
| } | |
| // Animation styles | |
| const style = document.createElement('style'); | |
| style.textContent = ` | |
| @keyframes slideIn { | |
| from { | |
| transform: translateX(100%); | |
| opacity: 0; | |
| } | |
| to { | |
| transform: translateX(0); | |
| opacity: 1; | |
| } | |
| } | |
| @keyframes slideOut { | |
| from { | |
| transform: translateX(0); | |
| opacity: 1; | |
| } | |
| to { | |
| transform: translateX(100%); | |
| opacity: 0; | |
| } | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| // Initialize on page load | |
| document.addEventListener('DOMContentLoaded', function() { | |
| feather.replace(); | |
| // Add click handlers to product buttons | |
| const addButtons = document.querySelectorAll('button:not([onclick])'); | |
| addButtons.forEach(btn => { | |
| if (btn.textContent.includes('เพิ่มลงตะกร้า')) { | |
| const card = btn.closest('.bg-white'); | |
| const productName = card.querySelector('h3')?.textContent || 'สินค้า'; | |
| btn.onclick = () => addToCart(productName); | |
| } else if (btn.textContent.includes('ซื้อทันที')) { | |
| const card = btn.closest('.bg-white'); | |
| const productName = card.querySelector('h3')?.textContent || 'สินค้า'; | |
| const price = card.querySelector('.text-green-600')?.textContent || '฿0'; | |
| btn.onclick = () => buyNow(productName, price); | |
| } else if (btn.textContent.includes('ปรึกษา')) { | |
| btn.onclick = contactCoach; | |
| } else if (btn.textContent.includes('ซื้อซ้ำ')) { | |
| const product = btn.closest('.flex').querySelector('p.font-medium')?.textContent || 'สินค้า'; | |
| btn.onclick = () => buyNow(product, 'ราคาพิเศษ'); | |
| } | |
| }); | |
| // Mission toggle functionality | |
| const missionItems = document.querySelectorAll('.flex.items-center.justify-between.p-4'); | |
| missionItems.forEach(item => { | |
| if (item.textContent.includes('ไม่สำเร็จ')) { | |
| item.style.cursor = 'pointer'; | |
| item.onclick = function() { | |
| if (confirm('ต้องการทำภารกิจนี้ใหม่ใช่หรือไม่?')) { | |
| location.reload(); | |
| } | |
| }; | |
| } | |
| }); | |
| // Subscription reminder buttons | |
| const reminderButtons = document.querySelectorAll('.bg-blue-50 button'); | |
| reminderButtons.forEach(btn => { | |
| btn.onclick = function() { | |
| reminderButtons.forEach(b => { | |
| b.classList.remove('bg-green-500', 'text-white'); | |
| b.classList.add('bg-white'); | |
| }); | |
| this.classList.remove('bg-white'); | |
| this.classList.add('bg-green-500', 'text-white'); | |
| const notification = document.createElement('div'); | |
| notification.className = 'fixed top-20 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg z-50'; | |
| notification.textContent = `ตั้งเตือน ${this.textContent} แล้ว`; | |
| document.body.appendChild(notification); | |
| setTimeout(() => { | |
| notification.remove(); | |
| }, 2000); | |
| }; | |
| }); | |
| }); | |
| <!-- Header --> | |
| <header class="bg-white shadow-sm fixed top-0 w-full z-40"> | |
| <div class="container mx-auto px-4 py-3 flex items-center justify-between"> | |
| <div class="flex items-center space-x-2"> | |
| <div class="w-10 h-10 bg-green-300 rounded-full flex items-center justify-center"> | |
| <span class="text-white font-bold text-xl">W</span> | |
| </div> | |
| <span class="font-semibold text-lg">WP WELLNET</span> | |
| </div> | |
| <div class="flex items-center space-x-4"> | |
| <button class="relative"> | |
| <i data-feather="bell" class="w-6 h-6 text-gray-600"></i> | |
| <span class="absolute -top-1 -right-1 w-3 h-3 bg-red-500 rounded-full"></span> | |
| </button> | |
| <div class="w-10 h-10 bg-gradient-to-r from-green-300 to-green-400 rounded-full flex items-center justify-center"> | |
| <span class="text-white font-semibold">ก</span> | |
| </div> | |
| </div> | |
| </div> | |
| </header> | |
| <!-- Main Content --> | |
| <main class="pt-16 pb-20 min-h-screen"> | |
| <div class="container mx-auto px-4 py-4"> | |
| <!-- Tab Content --> | |
| <div id="tab-content"> | |
| <!-- Dashboard Tab --> | |
| <div id="dashboard" class="tab-content"> | |
| <div class="bg-gradient-to-r from-green-200 to-green-300 rounded-2xl p-6 mb-6 text-white"> | |
| <h2 class="text-2xl font-bold mb-2">ยินดีต้อนรับกลับมา</h2> | |
| <p class="text-lg">คุณมีเป้าหมาย: ลดไขมัน 3% ใน 60 วัน</p> | |
| </div> | |
| <!-- Today's Stats --> | |
| <div class="bg-white rounded-2xl p-4 mb-6 shadow-sm"> | |
| <h3 class="font-semibold text-lg mb-4">ข้อมูลวันนี้</h3> | |
| <div class="grid grid-cols-2 gap-4"> | |
| <div class="bg-gray-50 p-3 rounded-lg"> | |
| <div class="flex items-center justify-between"> | |
| <span class="text-gray-600 text-sm">ไขมัน</span> | |
| <i data-feather="trending-down" class="w-4 h-4 text-green-500"></i> | |
| </div> | |
| <p class="text-xl font-bold">28.5%</p> | |
| <p class="text-xs text-gray-500">เป้าหมาย: 25%</p> | |
| </div> | |
| <div class="bg-gray-50 p-3 rounded-lg"> | |
| <div class="flex items-center justify-between"> | |
| <span class="text-gray-600 text-sm">กล้ามเนื้อ</span> | |
| <i data-feather="check-circle" class="w-4 h-4 text-green-500"></i> | |
| </div> | |
| <p class="text-xl font-bold">31.2 กก.</p> | |
| <p class="text-xs text-green-500">ตามเป้าหมาย</p> | |
| </div> | |
| <div class="bg-gray-50 p-3 rounded-lg"> | |
| <span class="text-gray-600 text-sm">น้ำหนัก</span> | |
| <p class="text-xl font-bold">66.4 กก.</p> | |
| </div> | |
| <div class="bg-gray-50 p-3 rounded-lg"> | |
| <span class="text-gray-600 text-sm">BMR</span> | |
| <p class="text-xl font-bold">1,540 kcal</p> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Status Today --> | |
| <div class="bg-white rounded-2xl p-4 shadow-sm"> | |
| <h3 class="font-semibold text-lg mb-4">สถานะวันนี้</h3> | |
| <div class="space-y-3"> | |
| <div class="flex items-center justify-between p-3 bg-orange-50 rounded-lg"> | |
| <div class="flex items-center space-x-3"> | |
| <span class="text-2xl">🔋</span> | |
| <div> | |
| <p class="font-medium">เผาผลาญแล้ว</p> | |
| <p class="text-sm text-gray-500">เป้าหมาย 2,000 kcal</p> | |
| </div> | |
| </div> | |
| <span class="font-bold text-orange-600">1,830 kcal</span> | |
| </div> | |
| <div class="flex items-center justify-between p-3 bg-blue-50 rounded-lg"> | |
| <div class="flex items-center space-x-3"> | |
| <span class="text-2xl">🏃♀️</span> | |
| <div> | |
| <p class="font-medium">เดินแล้ว</p> | |
| <p class="text-sm text-gray-500">เป้าหมาย 8,000 ก้าว</p> | |
| </div> | |
| </div> | |
| <span class="font-bold text-blue-600">6,200 ก้าว</span> | |
| </div> | |
| <div class="p-3 bg-green-50 rounded-lg"> | |
| <p class="font-medium mb-2">Meal Plan วันนี้</p> | |
| <div class="flex space-x-4"> | |
| <span class="flex items-center space-x-1"> | |
| <i data-feather="check" class="w-4 h-4 text-green-500"></i> | |
| <span class="text-sm">เช้า</span> | |
| </span> | |
| <span class="flex items-center space-x-1"> | |
| <i data-feather="check" class="w-4 h-4 text-green-500"></i> | |
| <span class="text-sm">กลางวัน</span> | |
| </span> | |
| <span class="flex items-center space-x-1"> | |
| <i data-feather="x" class="w-4 h-4 text-red-500"></i> | |
| <span class="text-sm">เย็น</span> | |
| </span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Journey Tab --> | |
| <div id="journey" class="tab-content hidden"> | |
| <div class="bg-gradient-to-r from-purple-200 to-purple-300 rounded-2xl p-6 mb-6 text-white"> | |
| <h2 class="text-2xl font-bold mb-2">Fit Journey 60 วัน</h2> | |
| <p class="text-lg">วันที่ 18 จาก 60</p> | |
| </div> | |
| <!-- Progress Bar --> | |
| <div class="bg-white rounded-2xl p-4 mb-6 shadow-sm"> | |
| <div class="mb-4"> | |
| <div class="flex justify-between mb-2"> | |
| <span class="text-sm font-medium">ความคืบหน้า</span> | |
| <span class="text-sm font-medium">18/60 วัน</span> | |
| </div> | |
| <div class="w-full bg-gray-200 rounded-full h-3"> | |
| <div class="bg-gradient-to-r from-green-400 to-green-500 h-3 rounded-full" style="width: 30%"></div> | |
| </div> | |
| </div> | |
| <div class="text-center"> | |
| <p class="text-sm text-gray-600">ทำภารกิจสะสม: 44 / 60 วัน</p> | |
| <p class="font-semibold mt-2">เป้าหมาย: ลดไขมัน 3% ภายใน 60 วัน</p> | |
| </div> | |
| </div> | |
| <!-- Today's Missions --> | |
| <div class="bg-white rounded-2xl p-4 shadow-sm"> | |
| <h3 class="font-semibold text-lg mb-4">ภารกิจวันนี้</h3> | |
| <div class="space-y-3"> | |
| <div class="flex items-center justify-between p-4 bg-green-50 rounded-lg border border-green-200"> | |
| <div class="flex items-center space-x-3"> | |
| <div class="w-10 h-10 bg-green-500 rounded-full flex items-center justify-center"> | |
| <i data-feather="check" class="w-5 h-5 text-white"></i> | |
| </div> | |
| <div> | |
| <p class="font-medium">กินโปรตีนเช้า 25g</p> | |
| <p class="text-sm text-gray-500">เวลา 07:00-09:00</p> | |
| </div> | |
| </div> | |
| <span class="text-green-600 font-semibold">✅ สำเร็จ</span> | |
| </div> | |
| <div class="flex items-center justify-between p-4 bg-green-50 rounded-lg border border-green-200"> | |
| <div class="flex items-center space-x-3"> | |
| <div class="w-10 h-10 bg-green-500 rounded-full flex items-center justify-center"> | |
| <i data-feather="check" class="w-5 h-5 text-white"></i> | |
| </div> | |
| <div> | |
| <p class="font-medium">เดินเร็ว 30 นาที</p> | |
| <p class="text-sm text-gray-500">เวลา 17:00-19:00</p> | |
| </div> | |
| </div> | |
| <span class="text-green-600 font-semibold">✅ สำเร็จ</span> | |
| </div> | |
| <div class="flex items-center justify-between p-4 bg-red-50 rounded-lg border border-red-200"> | |
| <div class="flex items-center space-x-3"> | |
| <div class="w-10 h-10 bg-red-500 rounded-full flex items-center justify-center"> | |
| <i data-feather="x" class="w-5 h-5 text-white"></i> | |
| </div> | |
| <div> | |
| <p class="font-medium">งดน้ำหวานทั้งวัน</p> | |
| <p class="text-sm text-gray-500">ตลอดทั้งวัน</p> | |
| </div> | |
| </div> | |
| <span class="text-red-600 font-semibold">❌ ไม่สำเร็จ</span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Graph Tab --> | |
| <div id="graph" class="tab-content hidden"> | |
| <div class="bg-white rounded-2xl p-4 shadow-sm mb-4"> | |
| <h3 class="font-semibold text-lg mb-4">กราฟสุขภาพ</h3> | |
| <!-- Time Range Selector --> | |
| <div class="flex space-x-2 mb-4"> | |
| <button onclick="updateGraph(7)" class="px-4 py-2 bg-green-500 text-white rounded-lg text-sm font-medium">7 วัน</button> | |
| <button onclick="updateGraph(30)" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg text-sm font-medium">30 วัน</button> | |
| <button onclick="updateGraph(60)" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg text-sm font-medium">60 วัน</button> | |
| </div> | |
| <!-- Graph Container --> | |
| <div class="bg-gray-50 p-4 rounded-lg"> | |
| <canvas id="healthChart" width="400" height="200"></canvas> | |
| </div> | |
| <!-- Stats Summary --> | |
| <div class="grid grid-cols-3 gap-2 mt-4"> | |
| <div class="text-center p-2 bg-blue-50 rounded-lg"> | |
| <p class="text-xs text-gray-600">ไขมัน</p> | |
| <p class="text-lg font-bold text-blue-600">28.4%</p> | |
| <p class="text-xs text-green-500">-0.7%</p> | |
| </div> | |
| <div class="text-center p-2 bg-green-50 rounded-lg"> | |
| <p class="text-xs text-gray-600">กล้ามเนื้อ</p> | |
| <p class="text-lg font-bold text-green-600">31.2kg</p> | |
| <p class="text-xs text-green-500">+1.0kg</p> | |
| </div> | |
| <div class="text-center p-2 bg-purple-50 rounded-lg"> | |
| <p class="text-xs text-gray-600">น้ำหนัก</p> | |
| <p class="text-lg font-bold text-purple-600">66.4kg</p> | |
| <p class="text-xs text-green-500">-0.6kg</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Products Tab --> | |
| <div id="products" class="tab-content hidden"> | |
| <div class="bg-gradient-to-r from-blue-200 to-blue-300 rounded-2xl p-6 mb-6 text-white"> | |
| <h2 class="text-xl font-bold mb-2">แนะนำผลิตภัณฑ์</h2> | |
| <p class="text-sm">จากข้อมูลของคุณ เราขอแนะนำแพ็กนี้:</p> | |
| </div> | |
| <!-- Product Cards --> | |
| <div class="space-y-4"> | |
| <!-- FIT BURN Pack --> | |
| <div class="bg-white rounded-2xl p-4 shadow-sm"> | |
| <div class="flex items-center justify-between mb-3"> | |
| <h3 class="font-bold text-lg">📦 แพ็ก FIT BURN</h3> | |
| <span class="bg-orange-100 text-orange-600 px-2 py-1 rounded-full text-sm font-semibold">ยอดนิยม</span> | |
| </div> | |
| <div class="space-y-2 mb-4"> | |
| <div class="flex items-center space-x-2"> | |
| <i data-feather="check" class="w-4 h-4 text-green-500"></i> | |
| <span class="text-sm">Whey-Fit 900g</span> | |
| </div> | |
| <div class="flex items-center space-x-2"> | |
| <i data-feather="check" class="w-4 h-4 text-green-500"></i> | |
| <span class="text-sm">Magnesium Complex</span> | |
| </div> | |
| <div class="flex items-center space-x-2"> | |
| <i data-feather="check" class="w-4 h-4 text-green-500"></i> | |
| <span class="text-sm">ADEK Vitamins</span> | |
| </div> | |
| </div> | |
| <div class="flex items-center justify-between mb-4"> | |
| <div> | |
| <span class="text-gray-500 line-through text-sm">฿2,290</span> | |
| <p class="text-2xl font-bold text-green-600">฿1,690</p> | |
| <p class="text-xs text-gray-500">ประหยัด 26%</p> | |
| </div> | |
| <img src="http://static.photos/fitness/100x100/123" alt="Product" class="w-20 h-20 rounded-lg object-cover"> | |
| </div> | |
| <div class="flex space-x-2"> | |
| <button class="flex-1 bg-green-500 text-white py-2 rounded-lg font-medium">เพิ่มลงตะกร้า</button> | |
| <button class="flex-1 bg-blue-500 text-white py-2 rounded-lg font-medium">ซื้อทันที</button> | |
| </div> | |
| </div> | |
| <!-- Build Lean Pack --> | |
| <div class="bg-white rounded-2xl p-4 shadow-sm"> | |
| <div class="flex items-center justify-between mb-3"> | |
| <h3 class="font-bold text-lg">📦 แพ็ก Build Lean</h3> | |
| <span class="bg-purple-100 text-purple-600 px-2 py-1 rounded-full text-sm font-semibold">เพิ่มกล้าม</span> | |
| </div> | |
| <div class="space-y-2 mb-4"> | |
| <div class="flex items-center space-x-2"> | |
| <i data-feather="check" class="w-4 h-4 text-green-500"></i> | |
| <span class="text-sm">Creatine + CLA</span> | |
| </div> | |
| <div class="flex items-center space-x-2"> | |
| <i data-feather="check" class="w-4 h-4 text-green-500"></i> | |
| <span class="text-sm">Meal Planner</span> | |
| </div> | |
| </div> | |
| <div class="flex items-center justify-between mb-4"> | |
| <div> | |
| <span class="text-gray-500 line-through text-sm">฿2,490</span> | |
| <p class="text-2xl font-bold text-green-600">฿1,890</p> | |
| <p class="text-xs text-gray-500">ประหยัด 24%</p> | |
| </div> | |
| <img src="http://static.photos/fitness/100x100/456" alt="Product" class="w-20 h-20 rounded-lg object-cover"> | |
| </div> | |
| <div class="flex space-x-2"> | |
| <button class="flex-1 bg-green-500 text-white py-2 rounded-lg font-medium">เพิ่มลงตะกร้า</button> | |
| <button class="flex-1 bg-blue-500 text-white py-2 rounded-lg font-medium">ซื้อทันที</button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Subscription Section --> | |
| <div class="bg-white rounded-2xl p-4 shadow-sm mt-4"> | |
| <h3 class="font-semibold text-lg mb-4">ซื้อซ้ำ / Subscription</h3> | |
| <div class="space-y-3"> | |
| <div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg"> | |
| <div> | |
| <p class="font-medium">Whey-Fit</p> | |
| <p class="text-xs text-gray-500">สั่งล่าสุด: 12 ก.ย.</p> | |
| </div> | |
| <button class="bg-green-500 text-white px-4 py-1 rounded-lg text-sm">ซื้อซ้ำ</button> | |
| </div> | |
| <div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg"> | |
| <div> | |
| <p class="font-medium">MAG-5</p> | |
| <p class="text-xs text-gray-500">สั่งล่าสุด: 5 ก.ย.</p> | |
| </div> | |
| <button class="bg-green-500 text-white px-4 py-1 rounded-lg text-sm">ซื้อซ้ำ</button> | |
| </div> | |
| </div> | |
| <div class="mt-4 p-3 bg-blue-50 rounded-lg"> | |
| <p class="text-sm font-medium mb-2">ตั้งเตือนซื้ออัตโนมัติ</p> | |
| <div class="flex space-x-2"> | |
| <button class="px-3 py-1 bg-white rounded text-sm">30 วัน</button> | |
| <button class="px-3 py-1 bg-green-500 text-white rounded text-sm">45 วัน</button> | |
| <button class="px-3 py-1 bg-white rounded text-sm">60 วัน</button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Profile Tab --> | |
| <div id="profile" class="tab-content hidden"> | |
| <!-- User Info --> | |
| <div class="bg-gradient-to-r from-green-200 to-green-300 rounded-2xl p-6 mb-6"> | |
| <div class="flex items-center space-x-4"> | |
| <div class="w-20 h-20 bg-white rounded-full flex items-center justify-center"> | |
| <span class="text-3xl font-bold text-green-500">ก</span> | |
| </div> | |
| <div class="text-white"> | |
| <h2 class="text-xl font-bold">กฤติกา ศรีใจดี</h2> | |
| <p class="text-sm opacity-90">อายุ 33 ปี</p> | |
| <div class="flex items-center space-x-2 mt-2"> | |
| <span class="bg-white/20 px-2 py-1 rounded-full text-xs">1,150 คะแนน</span> | |
| <span class="bg-white/20 px-2 py-1 rounded-full text-xs">Gold Member</span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Goals --> | |
| <div class="bg-white rounded-2xl p-4 shadow-sm mb-4"> | |
| <h3 class="font-semibold text-lg mb-4">เป้าหมายของฉัน</h3> | |
| <div class="space-y-3"> | |
| <div class="flex justify-between items-center p-3 bg-gray-50 rounded-lg"> | |
| <span class="text-gray-600">น้ำหนักเป้าหมาย</span> | |
| <span class="font-bold">62 กก.</span> | |
| </div> | |
| <div class="flex justify-between items-center p-3 bg-gray-50 rounded-lg"> | |
| <span class="text-gray-600">ไขมันเป้าหมาย</span> | |
| <span class="font-bold"><25%</span> | |
| </div> | |
| <div class="flex justify-between items-center p-3 bg-gray-50 rounded-lg"> | |
| <span class="text-gray-600">กล้ามเนื้อเป้าหมาย</span> | |
| <span class="font-bold">33 กก.</span> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Achievements --> | |
| <div class="bg-white rounded-2xl p-4 shadow-sm mb-4"> | |
| <h3 class="font-semibold text-lg mb-4">ความสำเร็จและรางวัล</h3> | |
| <div class="space-y-3"> | |
| <div class="flex items-center space-x-3 p-3 bg-yellow-50 rounded-lg"> | |
| <span class="text-2xl">🏆</span> | |
| <div> | |
| <p class="font-medium">ภารกิจ 7 วันติด</p> | |
| <p class="text-xs text-gray-500">สำเร็จเมื่อ 10 ก.ย.</p> | |
| </div> | |
| </div> | |
| <div class="flex items-center space-x-3 p-3 bg-blue-50 rounded-lg"> | |
| <span class="text-2xl">🥈</span> | |
| <div> | |
| <p class="font-medium">ลดน้ำหนัก 1 กก.แรก</p> | |
| <p class="text-xs text-gray-500">สำเร็จเมื่อ 5 ก.ย.</p> | |
| </div> | |
| </div> | |
| <div class="flex items-center space-x-3 p-3 bg-purple-50 rounded-lg"> | |
| <span class="text-2xl">🎯</span> | |
| <div> | |
| <p class="font-medium">อันดับ 6 กล้ามเพิ่มเร็วที่สุด</p> | |
| <p class="text-xs text-gray-500">ประจำเดือนกันยายน</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Order History --> | |
| <div class="bg-white rounded-2xl p-4 shadow-sm mb-4"> | |
| <h3 class="font-semibold text-lg mb-4">ประวัติการสั่งซื้อ</h3> | |
| <div class="space-y-2"> | |
| <div class="flex justify-between items-center p-2 border-b"> | |
| <div> | |
| <p class="font-medium text-sm">Whey-Fit 900g</p> | |
| <p class="text-xs text-gray-500">12 ก.ย. 2567</p> | |
| </div> | |
| <span class="text-green-600 font-semibold">฿690</span> | |
| </div> | |
| <div class="flex justify-between items-center p-2 border-b"> | |
| <div> | |
| <p class="font-medium text-sm">MAG-5</p> | |
| <p class="text-xs text-gray-500">5 ก.ย. 2567</p> | |
| </div> | |
| <span class="text-green-600 font-semibold">฿450</span> | |
| </div> | |
| <div class="flex justify-between items-center p-2"> | |
| <div> | |
| <p class="font-medium text-sm">CLA 1000mg</p> | |
| <p class="text-xs text-gray-500">20 ส.ค. 2567</p> | |
| </div> | |
| <span class="text-green-600 font-semibold">฿890</span> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Coach Contact --> | |
| <div class="bg-white rounded-2xl p-4 shadow-sm"> | |
| <h3 class="font-semibold text-lg mb-4">ติดต่อโค้ช</h3> | |
| <div class="flex items-center space-x-3 p-4 bg-green-50 rounded-lg"> | |
| <div class="w-12 h-12 bg-green-500 rounded-full flex items-center justify-center"> | |
| <i data-feather="user" class="w-6 h-6 text-white"></i> | |
| </div> | |
| <div class="flex-1"> | |
| <p class="font-medium">โค้ชแนต</p> | |
| <p class="text-xs text-gray-500">WP Certified FitCoach</p> | |
| </div> | |
| <button class="bg-green-500 text-white px-4 py-2 rounded-lg text-sm font-medium">ปรึกษา</button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- Bottom Navigation --> | |
| <nav class="fixed bottom-0 w-full bg-white border-t z-40"> | |
| <div class="container mx-auto px-4"> | |
| <div class="flex justify-around items-center py-2"> | |
| <button onclick="switchTab('dashboard')" class="tab-btn flex flex-col items-center p-2 text-green-600"> | |
| <i data-feather="home" class="w-6 h-6"></i> | |
| <span class="text-xs mt-1">หน้าแรก</span> | |
| </button> | |
| <button onclick="switchTab('journey')" class="tab-btn flex flex-col items-center p-2 text-gray-600"> | |
| <i data-feather="calendar" class="w-6 h-6"></i> | |
| <span class="text-xs mt-1">แผน 60 วัน</span> | |
| </button> | |
| <button onclick="switchTab('graph')" class="tab-btn flex flex-col items-center p-2 text-gray-600"> | |
| <i data-feather="bar-chart-2" class="w-6 h-6"></i> | |
| <span class="text-xs mt-1">กราฟสุขภาพ</span> | |
| </button> | |
| <button onclick="switchTab('products')" class="tab-btn flex flex-col items-center p-2 text-gray-600"> | |
| <i data-feather="shopping-cart" class="w-6 h-6"></i> | |
| <span class="text-xs mt-1">สินค้า</span> | |
| </button> | |
| <button onclick="switchTab('profile')" class="tab-btn flex flex-col items-center p-2 text-gray-600"> | |
| <i data-feather="user" class="w-6 h-6"></i> | |
| <span class="text-xs mt-1">โปรไฟล์</span> | |
| </button> | |
| </div> | |
| </div> | |
| </nav> | |
| <script src="script.js"></script> | |
| <script>feather.replace();</script> | |
| </body> | |
| </html> |