File size: 17,573 Bytes
f93e15c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
```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