pulse-whoop / activity.html
CSNET's picture
ช่วยแก้ code ต่อ และทำเว็บให้สมบรูณ์ที
f93e15c verified
Raw History Blame Contribute Delete
17.6 kB
```html
<!DOCTYPE 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-orange-400 to-red-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>
<!-- Today's Activity -->
<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="activity" class="w-5 h-5 text-orange-400"></i>
กิจกรรมวันนี้
</h3>
<div class="grid grid-cols-2 gap-4 mb-4">
<div class="text-center">
<p class="text-3xl font-bold text-orange-400">1,247</p>
<p class="text-xs text-gray-400">แคลอรีเผาผลาญ</p>
</div>
<div class="text-center">
<p class="text-3xl font-bold text-blue-400">8,247</p>
<p class="text-xs text-gray-400">จำนวนก้าว</p>
</div>
</div>
<div class="bg-gray-800/50 rounded-xl p-3">
<div class="flex items-center justify-between mb-2">
<span class="text-sm text-gray-400">เป้าหมายรายวัน</span>
<span class="text-sm font-medium">82%</span>
</div>
<div class="bg-gray-700 rounded-full h-3">
<div class="bg-gradient-to-r from-orange-400 to-red-500 h-3 rounded-full" style="width: 82%"></div>
</div>
</div>
</div>
</section>
<!-- Workout Logger -->
<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="play-circle" class="w-5 h-5 text-green-400"></i>
เริ่มออกกำลังกาย
</h3>
<div class="grid grid-cols-2 gap-3">
<button class="workout-type-btn p-4 bg-gradient-to-r from-red-500 to-pink-600 rounded-xl text-center" data-workout="boxing">
<div class="text-2xl mb-1">🥊</div>
<div class="text-sm font-medium">มวยไทย</div>
<div class="text-xs text-gray-200">45 นาที</div>
</button>
<button class="workout-type-btn p-4 bg-gradient-to-r from-blue-500 to-indigo-600 rounded-xl text-center" data-workout="yoga">
<div class="text-2xl mb-1">🧘</div>
<div class="text-sm font-medium">โยคะ</div>
<div class="text-xs text-gray-200">30 นาที</div>
</button>
<button class="workout-type-btn p-4 bg-gradient-to-r from-green-500 to-emerald-600 rounded-xl text-center" data-workout="running">
<div class="text-2xl mb-1">🏃</div>
<div class="text-sm font-medium">วิ่ง</div>
<div class="text-xs text-gray-200">30 นาที</div>
</button>
<button class="workout-type-btn p-4 bg-gradient-to-r from-purple-500 to-pink-600 rounded-xl text-center" data-workout="strength">
<div class="text-2xl mb-1">💪</div>
<div class="text-sm font-medium">เวทเทรนนิ่ง</div>
<div class="text-xs text-gray-200">40 นาที</div>
</button>
</div>
</div>
</section>
<!-- Recent Workouts -->
<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="calendar" class="w-5 h-5 text-green-400"></i>
ประวัติการออกกำลังกาย
</h3>
<div class="space-y-3" id="workoutHistory">
<div class="p-3 bg-gray-800/30 rounded-xl border border-gray-700/30">
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-red-500 rounded-lg flex items-center justify-center">
<span class="text-lg">🥊</span>
</div>
<div>
<p class="font-medium text-sm">มวยไทย</p>
<p class="text-xs text-gray-400">เมื่อวาน • 45 นาที</p>
</div>
</div>
<div class="text-right">
<p class="text-sm font-medium text-orange-400">-520 แคล</p>
<p class="text-xs text-gray-400">Heart Rate: 145 bpm</p>
</div>
</div>
</div>
<div class="p-3 bg-gray-800/30 rounded-xl border border-gray-700/30">
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-blue-500 rounded-lg flex items-center justify-center">
<span class="text-lg">🧘</span>
</div>
<div>
<p class="font-medium text-sm">โยคะคลายเครียด</p>
<p class="text-xs text-gray-400">2 วันก่อน • 30 นาที</p>
</div>
</div>
<div class="text-right">
<p class="text-sm font-medium text-blue-400">-180 แคล</p>
<p class="text-xs text-gray-400">Heart Rate: 85 bpm</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Heart Rate Zones -->
<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="heart" class="w-5 h-5 text-red-400"></i>
Heart Rate Zones วันนี้
</h3>
<div class="space-y-2">
<div class="flex items-center gap-3">
<div class="w-4 h-4 bg-gray-500 rounded"></div>
<div class="flex-1">
<div class="flex justify-between text-xs mb-1">
<span>พักผ่อน (50-60%)</span>
<span>2.5 ชม.</span>
</div>
<div class="bg-gray-700 rounded-full h-2">
<div class="bg-gray-500 h-2 rounded-full" style="width: 35%"></div>
</div>
</div>
</div>
<div class="flex items-center gap-3">
<div class="w-4 h-4 bg-blue-500 rounded"></div>
<div class="flex-1">
<div class="flex justify-between text-xs mb-1">
<span>เบา (60-70%)</span>
<span>3.2 ชม.</span>
</div>
<div class="bg-gray-700 rounded-full h-2">
<div class="bg-blue-500 h-2 rounded-full" style="width: 45%"></div>
</div>
</div>
</div>
<div class="flex items-center gap-3">
<div class="w-4 h-4 bg-green-500 rounded"></div>
<div class="flex-1">
<div class="flex justify-between text-xs mb-1">
<span>กลาง (70-85%)</span>
<span>1.8 ชม.</span>
</div>
<div class="bg-gray-700 rounded-full h-2">
<div class="bg-green-500 h-2 rounded-full" style="width: 25%"></div>
</div>
</div>
</div>
<div class="flex items-center gap-3">
<div class="w-4 h-4 bg-red-500 rounded"></div>
<div class="flex-1">
<div class="flex justify-between text-xs mb-1">
<span>หนัก (85-95%)</span>
<span>45 นาที</span>
</div>
<div class="bg-gray-700 rounded-full h-2">
<div class="bg-red-500 h-2 rounded-full" style="width: 15%"></div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- Bottom Navigation -->
<main-navbar></main-navbar>
<!-- Workout Modal -->
<div id="workoutModal" class="fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4 hidden">
<div class="glass-card rounded-2xl p-6 max-w-sm w-full border border-gray-700/50">
<div class="text-center">
<div class="text-4xl mb-3" id="workoutEmoji">🥊</div>
<h3 class="text-xl font-bold mb-2" id="workoutName">มวยไทย</h3>
<p class="text-gray-400 mb-6" id="workoutDuration">45 นาที</p>
<div class="space-y-4">
<button onclick="startWorkout()" class="w-full bg-gradient-to-r from-green-500 to-emerald-600 py-3 rounded-xl font-medium transition-all hover:scale-[1.02]">
เริ่มออกกำลังกาย
</button>
<button onclick="closeWorkoutModal()" class="w-full bg-gray-700 hover:bg-gray-600 py-3 rounded-xl font-medium transition-colors">
ยกเลิก
</button>
</div>
</div>
</div>
</div>
<!-- Scripts -->
<script src="components/navbar.js"></script>
<script src="script.js"></script>
<script>
let selectedWorkout = null;
document.addEventListener('DOMContentLoaded', function() {
// Set active page in navbar
const navbar = document.querySelector('main-navbar');
if (navbar) {
navbar.setActivePage('activity');
}
// Workout type buttons
document.querySelectorAll('.workout-type-btn').forEach(btn => {
btn.addEventListener('click', function() {
const type = this.dataset.workout;
openWorkoutModal(type);
});
});
});
function openWorkoutModal(type) {
const workouts = {
boxing: { name: 'มวยไทย', duration: '45 นาที', emoji: '🥊' },
yoga: { name: 'โยคะ', duration: '30 นาที', emoji: '🧘' },
running: { name: 'วิ่ง', duration: '30 นาที', emoji: '🏃' },
strength: { name: 'เวทเทรนนิ่ง', duration: '40 นาที', emoji: '💪' }
};
selectedWorkout = workouts[type];
document.getElementById('workoutEmoji').textContent = selectedWorkout.emoji;
document.getElementById('workoutName').textContent = selectedWorkout.name;
document.getElementById('workoutDuration').textContent = selectedWorkout.duration;
document.getElementById('workoutModal').classList.remove('hidden');
}
function closeWorkoutModal() {
document.getElementById('workoutModal').classList.add('hidden');
}
function startWorkout() {
if (!selectedWorkout) return;
showNotification(`เริ่ม ${selectedWorkout.name} ${selectedWorkout.duration} สำเร็จ!`, 'success');
closeWorkoutModal();
// Simulate workout session
simulateWorkoutSession(selectedWorkout);
}
function simulateWorkoutSession(workout) {
const modal = document.createElement('div');
modal.className = 'fixed inset-0 bg-black/80 z-50 flex items-center justify-center p-4';
modal.innerHTML = `
<div class="glass-card rounded-2xl p-6 max-w-md w-full border border-gray-700/50 text-center">
<div class="text-6xl mb-4">${workout.emoji}</div>
<h3 class="text-2xl font-bold mb-2">${workout.name}</h3>
<div class="text-4xl font-mono text-green-400 my-6" id="workoutTimer">00:00</div>
<div class="text-sm text-gray-400 mb-4">Heart Rate: <span id="hrValue">85</span> bpm</div>
<button onclick="endWorkout(this)" class="w-full bg-red-500 hover:bg-red-600 py-3 rounded-xl font-medium transition-colors">
หยุดออกกำลังกาย
</button>
</div>
`;
document.body.appendChild(modal);
// Start timer
let seconds = 0;
const timer = setInterval(() => {
seconds++;
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
modal.querySelector('#workoutTimer').textContent =
`${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
// Simulate HR
const hr = 85 + Math.floor(Math.random() * 60);
modal.querySelector('#hrValue').textContent = hr;
}, 1000);
modal.addEventListener('remove', () => clearInterval(timer));
}
function endWorkout(btn) {
const modal = btn.closest('.fixed');
showNotification('ออกกำลังกายเสร็จสิ้น! เยี่ยมมากค่ะ', 'success');
modal.remove();
// Update stats
updateActivityStats();
}
function updateActivityStats() {
// Simulate updating stats
const caloriesElement = document.querySelector('.text-3xl.font-bold.text-orange-400');
if (caloriesElement) {
const currentCalories = parseInt(caloriesElement.textContent);
caloriesElement.textContent = currentCalories + 250;
}
}
</script>
<script>feather.replace();</script>
</body>
</html>
>>>>>>> REPLACE