CSNET commited on
Commit
e58c862
·
verified ·
1 Parent(s): 546fc96

ทำต่อให้จบ

Browse files
Files changed (3) hide show
  1. index.html +102 -3
  2. script.js +185 -0
  3. style.css +77 -18
index.html CHANGED
@@ -266,7 +266,106 @@
266
  <div class="flex-1 mx-3 bg-slate-200 rounded-full h-2">
267
  <div class="bg-purple-600 h-2 rounded-full" style="width: 20%"></div>
268
  </div>
269
- <span class="text-sm font-semibold">1h 28m
270
- <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  </body>
272
- </html>
 
266
  <div class="flex-1 mx-3 bg-slate-200 rounded-full h-2">
267
  <div class="bg-purple-600 h-2 rounded-full" style="width: 20%"></div>
268
  </div>
269
+ <span class="text-sm font-semibold">1h 28m</span>
270
+ </div>
271
+ <div class="flex items-center justify-between">
272
+ <span class="text-sm text-slate-600">Light</span>
273
+ <div class="flex-1 mx-3 bg-slate-200 rounded-full h-2">
274
+ <div class="bg-green-600 h-2 rounded-full" style="width: 55%"></div>
275
+ </div>
276
+ <span class="text-sm font-semibold">4h 5m</span>
277
+ </div>
278
+ </div>
279
+ </div>
280
+ </div>
281
+ </div>
282
+ </section>
283
+
284
+ <!-- Activity Section -->
285
+ <section id="activity" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
286
+ <h2 class="text-2xl font-bold text-slate-900 mb-6">กิจกรรมและการออกกำลังกาย</h2>
287
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
288
+ <div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-6">
289
+ <h3 class="text-lg font-semibold mb-4">ก้าววันนี้</h3>
290
+ <div class="text-center">
291
+ <div class="text-4xl font-bold text-thai-600 mb-2">8,432</div>
292
+ <p class="text-slate-600 mb-4">จากเป้า 10,000 ก้าว</p>
293
+ <div class="w-full bg-slate-200 rounded-full h-3">
294
+ <div class="bg-thai-600 h-3 rounded-full" style="width: 84%"></div>
295
+ </div>
296
+ </div>
297
+ </div>
298
+ <div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-6">
299
+ <h3 class="text-lg font-semibold mb-4">แคลอรี่ที่เผาผลาญ</h3>
300
+ <div class="text-center">
301
+ <div class="text-4xl font-bold text-orange-600 mb-2">1,245</div>
302
+ <p class="text-slate-600">แคลอรี่</p>
303
+ </div>
304
+ </div>
305
+ </div>
306
+ </section>
307
+
308
+ <!-- Nutrition Section -->
309
+ <section id="nutrition" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
310
+ <h2 class="text-2xl font-bold text-slate-900 mb-6">โภชนาการ</h2>
311
+ <div class="bg-white rounded-2xl shadow-sm border border-slate-200 p-6">
312
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
313
+ <div class="text-center">
314
+ <div class="text-2xl font-bold text-green-600 mb-1">1,850</div>
315
+ <p class="text-sm text-slate-600">แคลอรี่ที่รับประทาน</p>
316
+ </div>
317
+ <div class="text-center">
318
+ <div class="text-2xl font-bold text-blue-600 mb-1">75g</div>
319
+ <p class="text-sm text-slate-600">โปรตีน</p>
320
+ </div>
321
+ <div class="text-center">
322
+ <div class="text-2xl font-bold text-orange-600 mb-1">45g</div>
323
+ <p class="text-sm text-slate-600">ไขมัน</p>
324
+ </div>
325
+ </div>
326
+ <div class="mt-6">
327
+ <h4 class="font-semibold text-slate-900 mb-3">มื้อล่าสุด</h4>
328
+ <div class="space-y-3">
329
+ <div class="flex items-center justify-between p-3 bg-slate-50 rounded-lg">
330
+ <div>
331
+ <p class="font-medium text-slate-900">กะเพราไข่ดาว</p>
332
+ <p class="text-sm text-slate-600">มื้อเที่ยง • 650 แคลอรี่</p>
333
+ </div>
334
+ <img src="http://static.photos/food/120x120/1" alt="กะเพราไข่ดาว" class="w-16 h-16 rounded-lg object-cover">
335
+ </div>
336
+ </div>
337
+ </div>
338
+ </div>
339
+ </section>
340
+ </main>
341
+
342
+ <!-- Bottom Navigation -->
343
+ <nav class="fixed bottom-0 w-full bg-white border-t border-slate-200">
344
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
345
+ <div class="flex justify-around items-center h-16">
346
+ <a href="#dashboard" class="flex flex-col items-center py-2 text-thai-600">
347
+ <i data-feather="home" class="w-6 h-6 mb-1"></i>
348
+ <span class="text-xs">หน้าแรก</span>
349
+ </a>
350
+ <a href="#sleep" class="flex flex-col items-center py-2 text-slate-600">
351
+ <i data-feather="moon" class="w-6 h-6 mb-1"></i>
352
+ <span class="text-xs">การนอน</span>
353
+ </a>
354
+ <a href="#activity" class="flex flex-col items-center py-2 text-slate-600">
355
+ <i data-feather="activity" class="w-6 h-6 mb-1"></i>
356
+ <span class="text-xs">กิจกรรม</span>
357
+ </a>
358
+ <a href="#nutrition" class="flex flex-col items-center py-2 text-slate-600">
359
+ <i data-feather="coffee" class="w-6 h-6 mb-1"></i>
360
+ <span class="text-xs">โภชนาการ</span>
361
+ </a>
362
+ </div>
363
+ </div>
364
+ </nav>
365
+
366
+ <script src="script.js"></script>
367
+ <script>
368
+ feather.replace();
369
+ </script>
370
  </body>
371
+ </html>
script.js ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Initialize app
2
+ document.addEventListener('DOMContentLoaded', function() {
3
+ initializeNavigation();
4
+ initializeProgressBars();
5
+ initializeScrollEffects();
6
+ initializeLinks();
7
+ });
8
+
9
+ // Navigation functionality
10
+ function initializeNavigation() {
11
+ const navLinks = document.querySelectorAll('.nav-link');
12
+ const sections = document.querySelectorAll('section[id]');
13
+
14
+ // Handle navigation active states
15
+ function updateActiveNav() {
16
+ let current = = '';
17
+
18
+ sections.forEach(section => {
19
+ const sectionTop = section.offsetTop;
20
+ const sectionHeight = section.clientHeight;
21
+ if (window.scrollY >= sectionTop - 100) {
22
+ current = section.getAttribute('id');
23
+ }
24
+ });
25
+
26
+ navLinks.forEach(link => {
27
+ link.classList.remove('active');
28
+ if (link.getAttribute('href') === `#${current}`) {
29
+ link.classList.add('active');
30
+ }
31
+ });
32
+ }
33
+
34
+ window.addEventListener('scroll', updateActiveNav);
35
+
36
+ // Smooth scroll for navigation links
37
+ navLinks.forEach(link => {
38
+ link.addEventListener('click', function(e) {
39
+ e.preventDefault();
40
+ const targetId = this.getAttribute('href').substring(1);
41
+ const targetSection = document.getElementById(targetId);
42
+
43
+ if (targetSection) {
44
+ targetSection.scrollIntoView({
45
+ behavior: 'smooth',
46
+ block: 'start'
47
+ });
48
+ }
49
+ });
50
+ });
51
+ }
52
+
53
+ // Progress bar animations
54
+ function initializeProgressBars() {
55
+ const progressBars = document.querySelectorAll('.bg-slate-200 > div');
56
+
57
+ const observer = new IntersectionObserver((entries) => {
58
+ entries.forEach(entry => {
59
+ if (entry.isIntersecting) {
60
+ const bar = entry.target;
61
+ const width = bar.style.width;
62
+ bar.style.width = '0%';
63
+ setTimeout(() => {
64
+ bar.style.transition = 'width 1s ease-out';
65
+ bar.style.width = width;
66
+ }, 100);
67
+ }
68
+ });
69
+ });
70
+
71
+ progressBars.forEach(bar => {
72
+ observer.observe(bar);
73
+ });
74
+ }
75
+
76
+ // Scroll effects
77
+ function initializeScrollEffects() {
78
+ const observerOptions = {
79
+ threshold: 0.1,
80
+ rootMargin: '0px 0px -50px 0px'
81
+ };
82
+
83
+ const observer = new IntersectionObserver((entries) => {
84
+ entries.forEach(entry => {
85
+ if (entry.isIntersecting) {
86
+ entry.target.classList.add('fade-in');
87
+ }
88
+ });
89
+ }, observerOptions);
90
+
91
+ const elements = document.querySelectorAll('.bg-white');
92
+ elements.forEach(el => observer.observe(el));
93
+ }
94
+
95
+ // Interactive elements
96
+ function initializeLinks() {
97
+ // Quick action buttons
98
+ const quickActions = document.querySelectorAll('.bg-white.rounded-xl.p-4');
99
+ quickActions.forEach(button => {
100
+ button.addEventListener('click', function() {
101
+ const action = this.querySelector('span').textContent;
102
+ handleQuickAction(action);
103
+ });
104
+ });
105
+
106
+ // AI coach button
107
+ const aiButton = document.querySelector('.bg-thai-600');
108
+ if (aiButton) {
109
+ aiButton.addEventListener('click', function() {
110
+ showDetailedRecommendations();
111
+ });
112
+ }
113
+ }
114
+
115
+ // Handle quick actions
116
+ function handleQuickAction(action) {
117
+ switch(action) {
118
+ case 'ถ่ายอาหาร':
119
+ openFoodCamera();
120
+ break;
121
+ case 'เริ่มออกกำลัง':
122
+ startWorkout();
123
+ break;
124
+ case 'เริ่ม IF':
125
+ startIntermittentFasting();
126
+ break;
127
+ case 'บันทึกอารมณ์':
128
+ openMoodTracker();
129
+ break;
130
+ }
131
+ }
132
+
133
+ // API simulation functions
134
+ function openFoodCamera() {
135
+ // Simulate opening camera for food logging
136
+ alert('เปิดกล้องเพื่อถ่ายอาหาร...');
137
+ }
138
+
139
+ function startWorkout() {
140
+ // Simulate starting workout tracking
141
+ alert('เริ่มติดตามการออกกำลังกาย...');
142
+ }
143
+
144
+ function startIntermittentFasting() {
145
+ // Simulate starting IF timer
146
+ alert('เริ่มจับเวลาการอดอาหาร...');
147
+ }
148
+
149
+ function openMoodTracker() {
150
+ // Simulate opening mood tracker
151
+ alert('เปิดตัวติดตามอารมณ์...');
152
+ }
153
+
154
+ function showDetailedRecommendations() {
155
+ // Simulate showing detailed AI recommendations
156
+ alert('กำลังโหลดคำแนะนำเพิ่มเติม...');
157
+ }
158
+
159
+ // Real-time updates simulation
160
+ function simulateRealTimeUpdates() {
161
+ const recoveryScore = document.querySelector('.text-green-600');
162
+ const strainScore = document.querySelector('.text-orange-600');
163
+
164
+ setInterval(() => {
165
+ // Simulate slight variations in scores
166
+ if (recoveryScore && strainScore) {
167
+ const newRecovery = Math.floor(Math.random() * 5) + 75;
168
+ const newStrain = (Math.random() * 2 + 11).toFixed(1);
169
+
170
+ recoveryScore.textContent = newRecovery + '%';
171
+ strainScore.textContent = newStrain;
172
+ }
173
+ }, 30000); // Update every 30 seconds
174
+ }
175
+
176
+ // Initialize real-time updates
177
+ simulateRealTimeUpdates();
178
+
179
+ // Handle page visibility changes
180
+ document.addEventListener('visibilitychange', function() {
181
+ if (document.visibilityState === 'visible') {
182
+ // Refresh data when user returns to page
183
+ location.reload();
184
+ }
185
+ });
style.css CHANGED
@@ -1,28 +1,87 @@
 
 
 
 
 
 
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
 
 
 
 
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
 
28
  }
 
1
+
2
+ /* Global Styles */
3
+ * {
4
+ margin: 0;
5
+ padding: 0;
6
+ box-sizing: border-box;
7
+ }
8
+
9
  body {
10
+ font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
11
+ background-color: #f8fafc;
12
+ color: #1e293b;
13
+ }
14
+
15
+ /* Smooth scrolling for navigation links */
16
+ html {
17
+ scroll-behavior: smooth;
18
+ }
19
+
20
+ /* Custom scrollbar styles */
21
+ ::-webkit-scrollbar {
22
+ width: 6px;
23
+ }
24
+
25
+ ::-webkit-scrollbar-track {
26
+ background: #f1f5f9;
27
+ }
28
+
29
+ ::-webkit-scrollbar-thumb {
30
+ background: #cbd5e1;
31
+ border-radius: 3px;
32
+ }
33
+
34
+ ::-webkit-scrollbar-thumb:hover {
35
+ background: #94a3b8;
36
+ }
37
+
38
+ /* Navigation link active state */
39
+ .nav-link.active {
40
+ color: #f17f0b;
41
+ font-weight: 600;
42
+ }
43
+
44
+ /* Hover effects for interactive elements */
45
+ button:hover {
46
+ transform: translateY(-1px);
47
+ transition: all 0.2s ease;
48
+ }
49
+
50
+ /* Custom animations */
51
+ @keyframes fadeIn {
52
+ from {
53
+ opacity: 0;
54
+ transform: translateY(10px);
55
+ }
56
+ to {
57
+ opacity: 1;
58
+ transform: translateY(0);
59
+ }
60
  }
61
 
62
+ .fade-in {
63
+ animation: fadeIn 0.5s ease-out;
 
64
  }
65
 
66
+ /* Responsive text sizes */
67
+ @media (max-width: 640px) {
68
+ .text-4xl {
69
+ font-size: 2.25rem;
70
+ }
71
+
72
+ .text-5xl {
73
+ font-size: 2.5rem;
74
+ }
75
  }
76
 
77
+ /* Loading states */
78
+ .loading {
79
+ opacity: 0.6;
80
+ pointer-events: none;
 
 
81
  }
82
 
83
+ /* Card hover effects */
84
+ .bg-white:hover {
85
+ box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
86
+ transition: box-shadow 0.3s ease;
87
  }