CSNET commited on
Commit
feb7fff
·
verified ·
1 Parent(s): 1da01a0

ออกแบบเว็บไซต์ HTML5 หน้าเดียว (Single Page Web App) แบบ mobile-first ภาษาไทยทั้งหมด สำหรับแพลตฟอร์ม WP WELLNET ที่เน้นฟื้นฟูสุขภาพและชะลอวัย (Longevity Platform) โดยใช้ข้อมูลจาก Smart Band (แนว Whoop) และ MyScale (วัดองค์ประกอบร่างกาย)

Browse files

ต้องการดีไซน์ UI ที่ทันสมัย สะอาดตา ใช้สีแนวสุขภาพ (เขียว-ขาว-เทา), ฟอนต์ Prompt สำหรับภาษาไทย และใช้งานง่ายบนมือถือ

หน้าเว็บต้องประกอบด้วย 10 ส่วนหลักดังนี้:

---

📌 1. หัวเว็บ (Header ติดด้านบน):
- โลโก้ WP WELLNET
- ไอคอนแจ้งเตือน
- ปุ่มโปรไฟล์ผู้ใช้

---

📊 2. หน้าหลัก Dashboard:
- แสดง “อายุชีวภาพ” (Biological Age) เทียบกับอายุจริง
- กราฟวงกลม “สถานะย้อนวัย %” (Progress Toward Goal)
- การ์ดสรุปข้อมูลล่าสุด:
- Sleep Score
- HRV
- ความเครียด
- Fat %, Muscle Mass
- BMR
- Visceral Fat

---

🧠 3. วิเคราะห์สุขภาพด้วย AI:
- ปุ่ม “วิเคราะห์ใหม่จากข้อมูลล่าสุด”
- ข้อมูลล่าสุดจาก Smart Band / MyScale
- ข้อแนะนำอัตโนมัติ เช่น “ควรนอนก่อน 23:00 น.”, “ขาดแมกนีเซียม”

---

📅 4. แผนย้อนวัย 90 วัน (Longevity Plan):
- ปฏิทิน 90 วัน
- แต่ละวันมี “ภารกิจ”: เช่น กิน ADEK, วิ่ง 20 นาที, เว้นน้ำตาล
- แถบความสำเร็จและปุ่มเช็กว่า “ทำแล้ววันนี้”

---

📈 5. กราฟติดตามสุขภาพ:
- แสดงการเปลี่ยนแปลงแบบ Line Chart
- HRV
- Sleep Duration
- น้ำหนัก
- Fat %, Muscle Mass
- ปรับช่วงเวลาได้: 7 วัน / 30 วัน / 90 วัน

---

🛍️ 6. แนะนำสินค้าอัจฉริยะ:
- AI แนะนำแพ็กอาหารเสริมที่เหมาะสม เช่น
- “BioAge Pack 1” (ADEK + NMN + MAG5)
- “Deep Sleep Support”
- ปุ่ม “ดูรายละเอียด” และ “สั่งซื้อทันที”

---

🔁 7. ระบบซื้อซ้ำ:
- แสดงสินค้าที่ซื้อประจำ
- ปุ่ม “ซื้อซ้ำภายใน 1 คลิก”
- ตั้งรอบเตือนซื้อซ้ำอัตโนมัติ

---

🏆 8. ระบบเกมสุขภาพ (Gamification):
- Leaderboard ผู้ใช้อายุชีวภาพลดลงมากสุด
- ป้ายรางวัล (Badge): “Sleep Master”, “HRV Hero”, “Bio-Warrior”
- แต้มสะสม → แลกรางวัล/ส่วนลด

---

🧑‍⚕️ 9. ปรึกษา BioCoach:
- ปุ่ม “ติดต่อโค้ชสุขภาพ”
- เปิดแชทหรือวิดีโอคอล
- แสดงข้อมูลโค้ชประจำตัว (ชื่อ, ระดับ, ประวัติ)

---

👤 10. โปรไฟล์ผู้ใช้:
- แสดงข้อมูลส่วนตัว: ชื่อ, อายุ, เป้าหมายสุขภาพ
- ประวัติการสั่งซื้อ
- แพ็กเกจที่ใช้อยู่
- สถิติการใช้งานรายวัน/สัปดาห์

---

🎨 Style Guide:
- สีหลัก: เขียวพาสเทล (#A5D6A7), ขาว (#FFFFFF), เทาอ่อน
- ฟอนต์: Prompt
- ปุ่มและการ์ดโค้งมน, มีเงาเบาๆ
- เน้น mobile responsive (HTML5), แตะง่าย, ใช้งานมือเดียวได้

---

🎯 เป้าหมาย:
สร้างเว็บไซต์สุขภาพที่รวมข้อมูลจาก Smart Band (แนว Whoop) และ MyScale เพื่อช่วยให้ผู้ใช้เข้าใจสุขภาพตนเอง ฟื้นฟูร่างกาย และชะลอวัย ด้วยระบบที่วัดผลได้จริง + AI + ระบบตัวแทน BioCoach พร้อมระบบสั่งซื้อผลิตภัณฑ์อัตโนมัติ

ภาษาในเว็บไซต์ทั้งหมดเป็นภาษาไทย

Files changed (4) hide show
  1. README.md +8 -5
  2. index.html +580 -19
  3. script.js +267 -0
  4. style.css +58 -19
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Wp Wellnet
3
- emoji: 🐢
4
- colorFrom: pink
5
- colorTo: yellow
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: WP WELLNET ย้อนวัย 🌿
3
+ colorFrom: purple
4
+ colorTo: gray
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
index.html CHANGED
@@ -1,19 +1,580 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="th">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
6
+ <title>WP WELLNET - แพลตฟอร์มฟื้นฟูสุขภาพและชะลอวัย</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://unpkg.com/feather-icons"></script>
10
+ <script>
11
+ tailwind.config = {
12
+ theme: {
13
+ extend: {
14
+ colors: {
15
+ primary: '#A5D6A7',
16
+ 'primary-dark': '#81C784',
17
+ 'primary-light': '#C8E6C9',
18
+ secondary: '#F5F5F5',
19
+ accent: '#4CAF50',
20
+ textDark: '#263238',
21
+ textLight: '#78909C'
22
+ },
23
+ fontFamily: {
24
+ 'prompt': ['Prompt', 'sans-serif']
25
+ }
26
+ }
27
+ }
28
+ }
29
+ </script>
30
+ <link href="https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap" rel="stylesheet">
31
+ <style>
32
+ * {
33
+ font-family: 'Prompt', sans-serif;
34
+ }
35
+ .scroll-smooth {
36
+ scroll-behavior: smooth;
37
+ }
38
+ .gradient-health {
39
+ background: linear-gradient(135deg, #A5D6A7 0%, #81C784 100%);
40
+ }
41
+ .glass-effect {
42
+ background: rgba(255, 255, 255, 0.9);
43
+ backdrop-filter: blur(10px);
44
+ }
45
+ @keyframes pulse-green {
46
+ 0%, 100% { box-shadow: 0 0 0 0 rgba(165, 214, 167, 0.4); }
47
+ 50% { box-shadow: 0 0 0 10px rgba(165, 214, 167, 0); }
48
+ }
49
+ .pulse-animation {
50
+ animation: pulse-green 2s infinite;
51
+ }
52
+ .hide-scrollbar {
53
+ -ms-overflow-style: none;
54
+ scrollbar-width: none;
55
+ }
56
+ .hide-scrollbar::-webkit-scrollbar {
57
+ display: none;
58
+ }
59
+ </style>
60
+ </head>
61
+ <body class="bg-gray-50 text-gray-800 scroll-smooth">
62
+ <!-- Header -->
63
+ <header class="fixed top-0 left-0 right-0 z-50 glass-effect border-b border-gray-200">
64
+ <div class="container mx-auto px-4 py-3">
65
+ <div class="flex items-center justify-between">
66
+ <div class="flex items-center space-x-3">
67
+ <div class="w-10 h-10 gradient-health rounded-full flex items-center justify-center">
68
+ <span class="text-white font-bold text-lg">WP</span>
69
+ </div>
70
+ <span class="font-semibold text-gray-800">WELLNET</span>
71
+ </div>
72
+ <div class="flex items-center space-x-4">
73
+ <button class="relative p-2" onclick="toggleNotifications()">
74
+ <i data-feather="bell" class="w-5 h-5"></i>
75
+ <span class="absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full"></span>
76
+ </button>
77
+ <button onclick="scrollToSection('profile')" class="w-10 h-10 bg-gray-200 rounded-full overflow-hidden">
78
+ <img src="https://static.photos/people/100x100/42" alt="Profile" class="w-full h-full object-cover">
79
+ </button>
80
+ </div>
81
+ </div>
82
+ </div>
83
+ </header>
84
+
85
+ <!-- Main Content -->
86
+ <main class="pt-16 pb-20">
87
+ <!-- Dashboard Section -->
88
+ <section id="dashboard" class="container mx-auto px-4 py-6">
89
+ <h1 class="text-2xl font-bold mb-6">สวัสดี, สุชาติ 👋</h1>
90
+
91
+ <!-- Biological Age Card -->
92
+ <div class="bg-white rounded-2xl p-6 shadow-sm mb-4">
93
+ <div class="flex justify-between items-center mb-4">
94
+ <h2 class="text-lg font-semibold">อายุชีวภาพของคุณ</h2>
95
+ <span class="text-sm text-gray-500">อัพเดท 2 ชั่วโมงที่แล้ว</span>
96
+ </div>
97
+ <div class="flex items-center justify-around">
98
+ <div class="text-center">
99
+ <div class="text-4xl font-bold text-gray-400">45</div>
100
+ <div class="text-sm text-gray-500 mt-1">อายุจริง</div>
101
+ </div>
102
+ <div class="text-3xl text-primary">→</div>
103
+ <div class="text-center">
104
+ <div class="text-4xl font-bold text-primary">38</div>
105
+ <div class="text-sm text-primary mt-1">อายุชีวภาพ</div>
106
+ </div>
107
+ </div>
108
+ <div class="mt-4 p-3 bg-green-50 rounded-lg">
109
+ <p class="text-sm text-green-800">🎉 ดีกว่าอายุจริง 7 ปี! รักษาสถานะนี้ต่อไป</p>
110
+ </div>
111
+ </div>
112
+
113
+ <!-- Progress Circle -->
114
+ <div class="bg-white rounded-2xl p-6 shadow-sm mb-4">
115
+ <h2 class="text-lg font-semibold mb-4">สถานะย้อนวัย</h2>
116
+ <div class="flex justify-center">
117
+ <div class="relative w-40 h-40">
118
+ <svg class="transform -rotate-90 w-40 h-40">
119
+ <circle cx="80" cy="80" r="70" stroke="#E5E7EB" stroke-width="12" fill="none"/>
120
+ <circle cx="80" cy="80" r="70" stroke="#A5D6A7" stroke-width="12" fill="none"
121
+ stroke-dasharray="440" stroke-dashoffset="88" stroke-linecap="round"/>
122
+ </svg>
123
+ <div class="absolute inset-0 flex items-center justify-center">
124
+ <div class="text-center">
125
+ <div class="text-3xl font-bold">80%</div>
126
+ <div class="text-xs text-gray-500">ถึงเป้าหมาย</div>
127
+ </div>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ </div>
132
+
133
+ <!-- Summary Cards -->
134
+ <div class="grid grid-cols-2 gap-3 mb-6">
135
+ <div class="bg-white rounded-xl p-4 shadow-sm">
136
+ <div class="flex items-center justify-between mb-2">
137
+ <i data-feather="moon" class="w-5 h-5 text-purple-500"></i>
138
+ <span class="text-xs text-gray-500">คืนนี้</span>
139
+ </div>
140
+ <div class="text-2xl font-bold">85</div>
141
+ <div class="text-xs text-gray-500">Sleep Score</div>
142
+ </div>
143
+ <div class="bg-white rounded-xl p-4 shadow-sm">
144
+ <div class="flex items-center justify-between mb-2">
145
+ <i data-feather="activity" class="w-5 h-5 text-red-500"></i>
146
+ <span class="text-xs text-gray-500">วันนี้</span>
147
+ </div>
148
+ <div class="text-2xl font-bold">52</div>
149
+ <div class="text-xs text-gray-500">HRV (ms)</div>
150
+ </div>
151
+ <div class="bg-white rounded-xl p-4 shadow-sm">
152
+ <div class="flex items-center justify-between mb-2">
153
+ <i data-feather="zap" class="w-5 h-5 text-yellow-500"></i>
154
+ <span class="text-xs text-gray-500">ปัจจุบัน</span>
155
+ </div>
156
+ <div class="text-2xl font-bold">35</div>
157
+ <div class="text-xs text-gray-500">ความเครียด</div>
158
+ </div>
159
+ <div class="bg-white rounded-xl p-4 shadow-sm">
160
+ <div class="flex items-center justify-between mb-2">
161
+ <i data-feather="layers" class="w-5 h-5 text-orange-500"></i>
162
+ <span class="text-xs text-gray-500">สัปดาห์นี้</span>
163
+ </div>
164
+ <div class="text-2xl font-bold">18.5%</div>
165
+ <div class="text-xs text-gray-500">ไขมัน (%)</div>
166
+ </div>
167
+ <div class="bg-white rounded-xl p-4 shadow-sm">
168
+ <div class="flex items-center justify-between mb-2">
169
+ <i data-feather="thermometer" class="w-5 h-5 text-blue-500"></i>
170
+ <span class="text-xs text-gray-500">วันนี้</span>
171
+ </div>
172
+ <div class="text-2xl font-bold">1,650</div>
173
+ <div class="text-xs text-gray-500">BMR (kcal)</div>
174
+ </div>
175
+ <div class="bg-white rounded-xl p-4 shadow-sm">
176
+ <div class="flex items-center justify-between mb-2">
177
+ <i data-feather="alert-circle" class="w-5 h-5 text-red-500"></i>
178
+ <span class="text-xs text-gray-500">เดือนนี้</span>
179
+ </div>
180
+ <div class="text-2xl font-bold">8</div>
181
+ <div class="text-xs text-gray-500">ไขมันในอวัยวะ</div>
182
+ </div>
183
+ </div>
184
+ </section>
185
+
186
+ <!-- AI Analysis Section -->
187
+ <section id="ai-analysis" class="container mx-auto px-4 py-6">
188
+ <div class="bg-gradient-to-r from-primary to-primary-dark rounded-2xl p-6 text-white">
189
+ <h2 class="text-xl font-bold mb-4">🤖 วิเคราะห์สุขภาพด้วย AI</h2>
190
+ <p class="text-sm mb-4 opacity-90">ข้อมูลล่าสุดจาก Smart Band และ MyScale</p>
191
+ <button onclick="runAIAnalysis()" class="bg-white text-primary px-6 py-3 rounded-xl font-semibold hover:bg-gray-100 transition-colors">
192
+ วิเคราะห์ใหม่
193
+ </button>
194
+ <div id="ai-results" class="mt-4 space-y-2">
195
+ <div class="bg-white bg-opacity-20 rounded-lg p-3">
196
+ <p class="text-sm">💤 ควรนอนหลับก่อน 23:00 น. เพื่อปรับปรุงคุณภาพการนอน</p>
197
+ </div>
198
+ <div class="bg-white bg-opacity-20 rounded-lg p-3">
199
+ <p class="text-sm">💊 ตรวจพบการขาดแมกนีเซียม แนะนำรับประทานเสริม MAG5</p>
200
+ </div>
201
+ <div class="bg-white bg-opacity-20 rounded-lg p-3">
202
+ <p class="text-sm">🏃 ควรออกกำลังกายแบบ Cardio 20 นาที เพื่อเพิ่ม HRV</p>
203
+ </div>
204
+ </div>
205
+ </div>
206
+ </section>
207
+
208
+ <!-- 90 Day Plan Section -->
209
+ <section id="plan" class="container mx-auto px-4 py-6">
210
+ <h2 class="text-xl font-bold mb-4">📅 แผนย้อนวัย 90 วัน</h2>
211
+ <div class="bg-white rounded-2xl p-4 shadow-sm">
212
+ <div class="flex space-x-2 mb-4 overflow-x-auto hide-scrollbar">
213
+ <button class="px-4 py-2 bg-primary text-white rounded-lg text-sm whitespace-nowrap">สัปดาห์ 1</button>
214
+ <button class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg text-sm whitespace-nowrap">สัปดาห์ 2</button>
215
+ <button class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg text-sm whitespace-nowrap">สัปดาห์ 3</button>
216
+ <button class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg text-sm whitespace-nowrap">สัปดาห์ 4</button>
217
+ </div>
218
+ <div class="space-y-3">
219
+ <div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
220
+ <div class="flex items-center space-x-3">
221
+ <input type="checkbox" class="w-5 h-5 text-primary rounded" checked>
222
+ <div>
223
+ <p class="font-medium text-sm">ทานวิตามิน ADEK</p>
224
+ <p class="text-xs text-gray-500">เช้า หลังอาหาร</p>
225
+ </div>
226
+ </div>
227
+ <span class="text-xs bg-green-100 text-green-600 px-2 py-1 rounded">ทำแล้ว</span>
228
+ </div>
229
+ <div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
230
+ <div class="flex items-center space-x-3">
231
+ <input type="checkbox" class="w-5 h-5 text-primary rounded">
232
+ <div>
233
+ <p class="font-medium text-sm">วิ่งจ๊อกกิ้ง 20 นาที</p>
234
+ <p class="text-xs text-gray-500">ความเร็ว 6-8 km/h</p>
235
+ </div>
236
+ </div>
237
+ <span class="text-xs bg-gray-100 text-gray-600 px-2 py-1 rounded">รอดำเนินการ</span>
238
+ </div>
239
+ <div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
240
+ <div class="flex items-center space-x-3">
241
+ <input type="checkbox" class="w-5 h-5 text-primary rounded">
242
+ <div>
243
+ <p class="font-medium text-sm">งดของหวาน</p>
244
+ <p class="text-xs text-gray-500">ทั้งวัน</p>
245
+ </div>
246
+ </div>
247
+ <span class="text-xs bg-gray-100 text-gray-600 px-2 py-1 rounded">รอดำเนินการ</span>
248
+ </div>
249
+ </div>
250
+ <div class="mt-4">
251
+ <div class="flex justify-between text-sm mb-1">
252
+ <span>ความสำเร็จวันนี้</span>
253
+ <span class="font-semibold">33%</span>
254
+ </div>
255
+ <div class="w-full bg-gray-200 rounded-full h-2">
256
+ <div class="bg-primary h-2 rounded-full" style="width: 33%"></div>
257
+ </div>
258
+ </div>
259
+ </div>
260
+ </section>
261
+
262
+ <!-- Health Graphs Section -->
263
+ <section id="graphs" class="container mx-auto px-4 py-6">
264
+ <h2 class="text-xl font-bold mb-4">📈 กราฟติดตามสุขภาพ</h2>
265
+ <div class="flex space-x-2 mb-4 overflow-x-auto hide-scrollbar">
266
+ <button onclick="changeTimeRange('7')" class="time-btn px-4 py-2 bg-primary text-white rounded-lg text-sm whitespace-nowrap">7 วัน</button>
267
+ <button onclick="changeTimeRange('30')" class="time-btn px-4 py-2 bg-gray-100 text-gray-600 rounded-lg text-sm whitespace-nowrap">30 วัน</button>
268
+ <button onclick="changeTimeRange('90')" class="time-btn px-4 py-2 bg-gray-100 text-gray-600 rounded-lg text-sm whitespace-nowrap">90 วัน</button>
269
+ </div>
270
+ <div class="space-y-4">
271
+ <div class="bg-white rounded-xl p-4 shadow-sm">
272
+ <h3 class="font-semibold mb-3">HRV (ms)</h3>
273
+ <canvas id="hrvChart" class="w-full h-32"></canvas>
274
+ </div>
275
+ <div class="bg-white rounded-xl p-4 shadow-sm">
276
+ <h3 class="font-semibold mb-3">ระยะเวลาการนอน (ชั่วโมง)</h3>
277
+ <canvas id="sleepChart" class="w-full h-32"></canvas>
278
+ </div>
279
+ <div class="bg-white rounded-xl p-4 shadow-sm">
280
+ <h3 class="font-semibold mb-3">น้ำหนัก (กก.)</h3>
281
+ <canvas id="weightChart" class="w-full h-32"></canvas>
282
+ </div>
283
+ </div>
284
+ </section>
285
+
286
+ <!-- Product Recommendations Section -->
287
+ <section id="products" class="container mx-auto px-4 py-6">
288
+ <h2 class="text-xl font-bold mb-4">🛍️ แนะนำสินค้าอัจฉริยะ</h2>
289
+ <div class="space-y-4">
290
+ <div class="bg-white rounded-xl p-4 shadow-sm">
291
+ <div class="flex items-start space-x-3">
292
+ <img src="https://static.photos/health/80x80/1" alt="Product" class="w-20 h-20 rounded-lg object-cover">
293
+ <div class="flex-1">
294
+ <h3 class="font-semibold">BioAge Pack 1</h3>
295
+ <p class="text-sm text-gray-500 mt-1">ADEK + NMN + MAG5</p>
296
+ <p class="text-xs text-green-600 mt-1">✨ เหมาะกับคุณ 100%</p>
297
+ <div class="flex items-center justify-between mt-3">
298
+ <span class="text-lg font-bold text-primary">฿2,990</span>
299
+ <div class="space-x-2">
300
+ <button class="px-3 py-1 bg-gray-100 text-gray-600 rounded-lg text-sm">ดูรายละเอียด</button>
301
+ <button class="px-3 py-1 bg-primary text-white rounded-lg text-sm">สั่งซื้อทันที</button>
302
+ </div>
303
+ </div>
304
+ </div>
305
+ </div>
306
+ </div>
307
+ <div class="bg-white rounded-xl p-4 shadow-sm">
308
+ <div class="flex items-start space-x-3">
309
+ <img src="https://static.photos/health/80x80/2" alt="Product" class="w-20 h-20 rounded-lg object-cover">
310
+ <div class="flex-1">
311
+ <h3 class="font-semibold">Deep Sleep Support</h3>
312
+ <p class="text-sm text-gray-500 mt-1">เสริมคุณภาพการนอนหลับ</p>
313
+ <p class="text-xs text-blue-600 mt-1">💤 HRV ของคุณต่ำ</p>
314
+ <div class="flex items-center justify-between mt-3">
315
+ <span class="text-lg font-bold text-primary">฿1,490</span>
316
+ <div class="space-x-2">
317
+ <button class="px-3 py-1 bg-gray-100 text-gray-600 rounded-lg text-sm">ดูรายละเอียด</button>
318
+ <button class="px-3 py-1 bg-primary text-white rounded-lg text-sm">สั่งซื้อทันที</button>
319
+ </div>
320
+ </div>
321
+ </div>
322
+ </div>
323
+ </div>
324
+ </div>
325
+ </section>
326
+
327
+ <!-- Repeat Purchase Section -->
328
+ <section id="repeat" class="container mx-auto px-4 py-6">
329
+ <h2 class="text-xl font-bold mb-4">🔁 สินค้าที่สั่งประจำ</h2>
330
+ <div class="bg-gradient-to-r from-blue-50 to-green-50 rounded-xl p-4">
331
+ <div class="flex items-center justify-between mb-4">
332
+ <h3 class="font-semibold">NMN 250mg</h3>
333
+ <span class="text-xs bg-orange-100 text-orange-600 px-2 py-1 rounded">จะหมดใน 5 วัน</span>
334
+ </div>
335
+ <div class="flex items-center justify-between">
336
+ <div>
337
+ <p class="text-sm text-gray-600">สั่งซื้อทุก 30 วัน</p>
338
+ <p class="text-xs text-gray-500 mt-1">ครั้งล่าสุด: 15 พ.ย. 2023</p>
339
+ </div>
340
+ <button onclick="quickReorder()" class="bg-primary text-white px-4 py-2 rounded-lg text-sm font-medium pulse-animation">
341
+ สั่งซ้ำ 1 คลิก
342
+ </button>
343
+ </div>
344
+ </div>
345
+ </section>
346
+
347
+ <!-- Gamification Section -->
348
+ <section id="gamification" class="container mx-auto px-4 py-6">
349
+ <h2 class="text-xl font-bold mb-4">🏆 เกมสุขภาพ</h2>
350
+ <div class="bg-white rounded-xl p-4 shadow-sm mb-4">
351
+ <h3 class="font-semibold mb-3">Leaderboard สัปดาห์นี้</h3>
352
+ <div class="space-y-2">
353
+ <div class="flex items-center justify-between p-2">
354
+ <div class="flex items-center space-x-3">
355
+ <span class="text-lg">🥇</span>
356
+ <img src="https://static.photos/people/40x40/1" class="w-10 h-10 rounded-full">
357
+ <div>
358
+ <p class="font-medium text-sm">มานี</p>
359
+ <p class="text-xs text-gray-500">ลด 9 ปี</p>
360
+ </div>
361
+ </div>
362
+ <span class="text-sm font-semibold text-primary">2,450 คะแนน</span>
363
+ </div>
364
+ <div class="flex items-center justify-between p-2">
365
+ <div class="flex items-center space-x-3">
366
+ <span class="text-lg">🥈</span>
367
+ <img src="https://static.photos/people/40x40/2" class="w-10 h-10 rounded-full">
368
+ <div>
369
+ <p class="font-medium text-sm">สมชาย</p>
370
+ <p class="text-xs text-gray-500">ลด 7 ปี</p>
371
+ </div>
372
+ </div>
373
+ <span class="text-sm font-semibold text-primary">2,120 คะแนน</span>
374
+ </div>
375
+ <div class="flex items-center justify-between p-2 bg-primary bg-opacity-10 rounded-lg">
376
+ <div class="flex items-center space-x-3">
377
+ <span class="text-lg">5</span>
378
+ <img src="https://static.photos/people/40x40/42" class="w-10 h-10 rounded-full">
379
+ <div>
380
+ <p class="font-medium text-sm">คุณ</p>
381
+ <p class="text-xs text-gray-500">ลด 7 ปี</p>
382
+ </div>
383
+ </div>
384
+ <span class="text-sm font-semibold text-primary">1,850 คะแนน</span>
385
+ </div>
386
+ </div>
387
+ </div>
388
+ <div class="bg-white rounded-xl p-4 shadow-sm">
389
+ <h3 class="font-semibold mb-3">เหรียญรางวัลของคุณ</h3>
390
+ <div class="grid grid-cols-4 gap-3">
391
+ <div class="text-center">
392
+ <div class="w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-1">
393
+ <span class="text-2xl">🌙</span>
394
+ </div>
395
+ <p class="text-xs">Sleep Master</p>
396
+ </div>
397
+ <div class="text-center">
398
+ <div class="w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-1">
399
+ <span class="text-2xl">❤️</span>
400
+ </div>
401
+ <p class="text-xs">HRV Hero</p>
402
+ </div>
403
+ <div class="text-center">
404
+ <div class="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-1">
405
+ <span class="text-2xl">💪</span>
406
+ </div>
407
+ <p class="text-xs">Bio-Warrior</p>
408
+ </div>
409
+ <div class="text-center opacity-50">
410
+ <div class="w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-1">
411
+ <span class="text-2xl">🏃</span>
412
+ </div>
413
+ <p class="text-xs">Runner</p>
414
+ </div>
415
+ </div>
416
+ </div>
417
+ </section>
418
+
419
+ <!-- BioCoach Section -->
420
+ <section id="coach" class="container mx-auto px-4 py-6">
421
+ <h2 class="text-xl font-bold mb-4">🧑‍⚕️ ปรึกษา BioCoach</h2>
422
+ <div class="bg-gradient-to-r from-purple-500 to-pink-500 rounded-xl p-4 text-white">
423
+ <div class="flex items-center space-x-4 mb-4">
424
+ <img src="https://static.photos/people/80x80/3" class="w-20 h-20 rounded-full border-3 border-white">
425
+ <div>
426
+ <h3 class="font-semibold text-lg">ดร.วรรณี จันทร์เพ็ญ</h3>
427
+ <p class="text-sm opacity-90">BioCoach ผู้เชี่ยวชาญระดับ Platinum</p>
428
+ <div class="flex items-center mt-1">
429
+ <span class="text-yellow-300">★★★★★</span>
430
+ <span class="text-xs ml-2 opacity-90">(4.9/5.0)</span>
431
+ </div>
432
+ </div>
433
+ </div>
434
+ <p class="text-sm mb-4 opacity-90">ประสบการณ์ 15 ปีด้านการฟื้นฟูสุขภาพและชะลอวัย</p>
435
+ <div class="grid grid-cols-2 gap-3">
436
+ <button onclick="startChat()" class="bg-white text-purple-600 px-4 py-3 rounded-lg font-semibold text-center">
437
+ 💬 เริ่มแชท
438
+ </button>
439
+ <button onclick="startVideoCall()" class="bg-purple-600 text-white px-4 py-3 rounded-lg font-semibold text-center">
440
+ 📹 วิดีโอคอล
441
+ </button>
442
+ </div>
443
+ </div>
444
+ </section>
445
+
446
+ <!-- Profile Section -->
447
+ <section id="profile" class="container mx-auto px-4 py-6">
448
+ <h2 class="text-xl font-bold mb-4">👤 โปรไฟล์ของฉัน</h2>
449
+ <div class="bg-white rounded-xl p-4 shadow-sm mb-4">
450
+ <div class="flex items-center space-x-4 mb-4">
451
+ <img src="https://static.photos/people/100x100/42" class="w-20 h-20 rounded-full">
452
+ <div>
453
+ <h3 class="font-semibold text-lg">สุชาติ ใจดี</h3>
454
+ <p class="text-sm text-gray-500">สมาชิกตั้งแต่ ม.ค. 2023</p>
455
+ <span class="inline-block mt-1 px-2 py-1 bg-primary text-white text-xs rounded-full">Premium Member</span>
456
+ </div>
457
+ </div>
458
+ <div class="grid grid-cols-2 gap-4">
459
+ <div>
460
+ <p class="text-xs text-gray-500">อายุ</p>
461
+ <p class="font-semibold">45 ปี</p>
462
+ </div>
463
+ <div>
464
+ <p class="text-xs text-gray-500">เป้าหมาย</p>
465
+ <p class="font-semibold">ลดอายุชีวภาพ 10 ปี</p>
466
+ </div>
467
+ <div>
468
+ <p class="text-xs text-gray-500">ส่วนสูง</p>
469
+ <p class="font-semibold">175 ซม.</p>
470
+ </div>
471
+ <div>
472
+ <p class="text-xs text-gray-500">น้ำหนัก</p>
473
+ <p class="font-semibold">75 กก.</p>
474
+ </div>
475
+ </div>
476
+ </div>
477
+
478
+ <div class="bg-white rounded-xl p-4 shadow-sm mb-4">
479
+ <h3 class="font-semibold mb-3">ประวัติการสั่งซื้อ</h3>
480
+ <div class="space-y-2">
481
+ <div class="flex items-center justify-between py-2 border-b">
482
+ <div>
483
+ <p class="text-sm font-medium">BioAge Pack 1</p>
484
+ <p class="text-xs text-gray-500">25 พ.ย. 2023</p>
485
+ </div>
486
+ <span class="text-sm font-semibold">฿2,990</span>
487
+ </div>
488
+ <div class="flex items-center justify-between py-2 border-b">
489
+ <div>
490
+ <p class="text-sm font-medium">NMN 250mg</p>
491
+ <p class="text-xs text-gray-500">15 พ.ย. 2023</p>
492
+ </div>
493
+ <span class="text-sm font-semibold">฿3,490</span>
494
+ </div>
495
+ </div>
496
+ </div>
497
+
498
+ <div class="bg-white rounded-xl p-4 shadow-sm">
499
+ <h3 class="font-semibold mb-3">สถิติการใช้งาน</h3>
500
+ <div class="grid grid-cols-2 gap-4">
501
+ <div class="text-center p-3 bg-gray-50 rounded-lg">
502
+ <p class="text-2xl font-bold text-primary">28</p>
503
+ <p class="text-xs text-gray-500">วันติดต่อ</p>
504
+ </div>
505
+ <div class="text-center p-3 bg-gray-50 rounded-lg">
506
+ <p class="text-2xl font-bold text-primary">85%</p>
507
+ <p class="text-xs text-gray-500">ทำภารกิจสำเร็จ</p>
508
+ </div>
509
+ <div class="text-center p-3 bg-gray-50 rounded-lg">
510
+ <p class="text-2xl font-bold text-primary">12</p>
511
+ <p class="text-xs text-gray-500">ครั้งปรึกษาโค้ช</p>
512
+ </div>
513
+ <div class="text-center p-3 bg-gray-50 rounded-lg">
514
+ <p class="text-2xl font-bold text-primary">1,850</p>
515
+ <p class="text-xs text-gray-500">คะแนนสะสม</p>
516
+ </div>
517
+ </div>
518
+ </div>
519
+ </section>
520
+ </main>
521
+
522
+ <!-- Bottom Navigation -->
523
+ <nav class="fixed bottom-0 left-0 right-0 bg-white border-t border-gray-200 z-40">
524
+ <div class="container mx-auto px-4">
525
+ <div class="flex justify-around py-2">
526
+ <button onclick="scrollToSection('dashboard')" class="flex flex-col items-center p-2 text-primary">
527
+ <i data-feather="home" class="w-5 h-5"></i>
528
+ <span class="text-xs mt-1">หน้าหลัก</span>
529
+ </button>
530
+ <button onclick="scrollToSection('plan')" class="flex flex-col items-center p-2 text-gray-500">
531
+ <i data-feather="calendar" class="w-5 h-5"></i>
532
+ <span class="text-xs mt-1">แผน</span>
533
+ </button>
534
+ <button onclick="scrollToSection('graphs')" class="flex flex-col items-center p-2 text-gray-500">
535
+ <i data-feather="bar-chart-2" class="w-5 h-5"></i>
536
+ <span class="text-xs mt-1">กราฟ</span>
537
+ </button>
538
+ <button onclick="scrollToSection('coach')" class="flex flex-col items-center p-2 text-gray-500">
539
+ <i data-feather="users" class="w-5 h-5"></i>
540
+ <span class="text-xs mt-1">โค้ช</span>
541
+ </button>
542
+ <button onclick="scrollToSection('profile')" class="flex flex-col items-center p-2 text-gray-500">
543
+ <i data-feather="user" class="w-5 h-5"></i>
544
+ <span class="text-xs mt-1">โปรไฟล์</span>
545
+ </button>
546
+ </div>
547
+ </div>
548
+ </nav>
549
+
550
+ <!-- Chat Modal -->
551
+ <div id="chatModal" class="fixed inset-0 bg-black bg-opacity-50 z-50 hidden">
552
+ <div class="absolute bottom-0 left-0 right-0 bg-white rounded-t-3xl p-4 max-h-[80vh] overflow-y-auto">
553
+ <div class="flex justify-between items-center mb-4">
554
+ <h3 class="font-semibold text-lg">แชทกับ BioCoach</h3>
555
+ <button onclick="closeChat()" class="p-2">
556
+ <i data-feather="x" class="w-5 h-5"></i>
557
+ </button>
558
+ </div>
559
+ <div class="space-y-3 mb-4">
560
+ <div class="bg-gray-100 rounded-lg p-3 max-w-[80%]">
561
+ <p class="text-sm">สวัสดีครับคุณสุชาติ! มีอะไรให้ช่วยไหม?</p>
562
+ </div>
563
+ <div class="bg-primary text-white rounded-lg p-3 max-w-[80%] ml-auto">
564
+ <p class="text-sm">อยากปรับปรุงคุณภาพการนอนครับ</p>
565
+ </div>
566
+ </div>
567
+ <div class="flex space-x-2">
568
+ <input type="text" placeholder="พิมพ์ข้อความ..." class="flex-1 px-4 py-2 border rounded-lg">
569
+ <button class="bg-primary text-white px-4 py-2 rounded-lg">
570
+ <i data-feather="send" class="w-5 h-5"></i>
571
+ </button>
572
+ </div>
573
+ </div>
574
+ </div>
575
+
576
+ <script src="script.js"></script>
577
+ <script>feather.replace();</script>
578
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
579
+ </body>
580
+ </html>
script.js ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Initialize app
2
+ document.addEventListener('DOMContentLoaded', function() {
3
+ initializeCharts();
4
+ setupEventListeners();
5
+ updateRealTimeData();
6
+ });
7
+
8
+ // Navigation
9
+ function scrollToSection(sectionId) {
10
+ const section = document.getElementById(sectionId);
11
+ if (section) {
12
+ section.scrollIntoView({ behavior: 'smooth', block: 'start' });
13
+ updateActiveNav(sectionId);
14
+ }
15
+ }
16
+
17
+ function updateActiveNav(sectionId) {
18
+ const navButtons = document.querySelectorAll('nav button');
19
+ navButtons.forEach(btn => {
20
+ btn.classList.remove('text-primary');
21
+ btn.classList.add('text-gray-500');
22
+ });
23
+
24
+ const activeBtn = document.querySelector(`nav button[onclick*="${sectionId}"]`);
25
+ if (activeBtn) {
26
+ activeBtn.classList.remove('text-gray-500');
27
+ activeBtn.classList.add('text-primary');
28
+ }
29
+ }
30
+
31
+ // AI Analysis
32
+ function runAIAnalysis() {
33
+ const resultsDiv = document.getElementById('ai-results');
34
+ resultsDiv.innerHTML = '<div class="text-center py-4"><div class="inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-white"></div></div>';
35
+
36
+ setTimeout(() => {
37
+ const insights = [
38
+ { icon: '🧘', text: 'ควรทำสมาธิ 10 นาที ก่อนนอนเพื่อลดความเครียด' },
39
+ { icon: '💧', text: 'ต้องการดื่มน้ำเพิ่ม 500 มล. ในช่วงบ่าย' },
40
+ { icon: '🥗', text: 'แนะนำเพิ่มผักใบเขียวในมื้อเย็นวันนี้' },
41
+ { icon: '☀️', text: 'ต้องการรับแสงแดด 15 นาทีเพื่อวิตามิน D' }
42
+ ];
43
+
44
+ resultsDiv.innerHTML = insights.map(insight => `
45
+ <div class="bg-white bg-opacity-20 rounded-lg p-3 slide-up">
46
+ <p class="text-sm">${insight.icon} ${insight.text}</p>
47
+ </div>
48
+ `).join('');
49
+ }, 1500);
50
+ }
51
+
52
+ // Initialize Charts
53
+ function initializeCharts() {
54
+ drawLineChart('hrvChart', [45, 48, 52, 50, 55, 52, 54], '#EF4444');
55
+ drawLineChart('sleepChart', [6.5, 7.2, 6.8, 7.5, 8.0, 7.8, 7.2], '#8B5CF6');
56
+ drawLineChart('weightChart', [76, 75.5, 75.8, 75.2, 75, 74.8, 75], '#3B82F6');
57
+ }
58
+
59
+ function drawLineChart(canvasId, data, color) {
60
+ const canvas = document.getElementById(canvasId);
61
+ if (!canvas) return;
62
+
63
+ const ctx = canvas.getContext('2d');
64
+ const width = canvas.width = canvas.offsetWidth;
65
+ const height = canvas.height = 128;
66
+
67
+ const padding = 10;
68
+ const graphWidth = width - padding * 2;
69
+ const graphHeight = height - padding * 2;
70
+
71
+ const maxValue = Math.max(...data);
72
+ const minValue = Math.min(...data);
73
+ const range = maxValue - minValue;
74
+
75
+ // Clear canvas
76
+ ctx.clearRect(0, 0, width, height);
77
+
78
+ // Draw grid lines
79
+ ctx.strokeStyle = '#E5E7EB';
80
+ ctx.lineWidth = 1;
81
+ for (let i = 0; i <= 4; i++) {
82
+ const y = padding + (graphHeight / 4) * i;
83
+ ctx.beginPath();
84
+ ctx.moveTo(padding, y);
85
+ ctx.lineTo(width - padding, y);
86
+ ctx.stroke();
87
+ }
88
+
89
+ // Draw line chart
90
+ ctx.strokeStyle = color;
91
+ ctx.lineWidth = 2;
92
+ ctx.beginPath();
93
+
94
+ data.forEach((value, index) => {
95
+ const x = padding + (graphWidth / (data.length - 1)) * index;
96
+ const y = padding + graphHeight - ((value - minValue) / range) * graphHeight;
97
+
98
+ if (index === 0) {
99
+ ctx.moveTo(x, y);
100
+ } else {
101
+ ctx.lineTo(x, y);
102
+ }
103
+ });
104
+
105
+ ctx.stroke();
106
+
107
+ // Draw points
108
+ ctx.fillStyle = color;
109
+ data.forEach((value, index) => {
110
+ const x = padding + (graphWidth / (data.length - 1)) * index;
111
+ const y = padding + graphHeight - ((value - minValue) / range) * graphHeight;
112
+
113
+ ctx.beginPath();
114
+ ctx.arc(x, y, 3, 0, Math.PI * 2);
115
+ ctx.fill();
116
+ });
117
+ }
118
+
119
+ function changeTimeRange(days) {
120
+ const buttons = document.querySelectorAll('.time-btn');
121
+ buttons.forEach(btn => {
122
+ btn.classList.remove('bg-primary', 'text-white');
123
+ btn.classList.add('bg-gray-100', 'text-gray-600');
124
+ });
125
+
126
+ event.target.classList.remove('bg-gray-100', 'text-gray-600');
127
+ event.target.classList.add('bg-primary', 'text-white');
128
+
129
+ // Simulate loading new data
130
+ const hrvData = days === '7' ? [45, 48, 52, 50, 55, 52, 54] :
131
+ days === '30' ? [42, 45, 48, 46, 50, 52, 51, 53, 52, 54, 55, 53] :
132
+ [40, 42, 44, 43, 45, 47, 46, 48, 49, 48, 50, 52, 51, 53, 54, 55, 54, 53, 52, 54];
133
+
134
+ drawLineChart('hrvChart', hrvData, '#EF4444');
135
+ }
136
+
137
+ // Chat functions
138
+ function startChat() {
139
+ document.getElementById('chatModal').classList.remove('hidden');
140
+ document.body.style.overflow = 'hidden';
141
+ }
142
+
143
+ function closeChat() {
144
+ document.getElementById('chatModal').classList.add('hidden');
145
+ document.body.style.overflow = 'auto';
146
+ }
147
+
148
+ function startVideoCall() {
149
+ // Simulate video call
150
+ alert('กำลังเชื่อมต่อกับ BioCoach... ฟีเจอร์วิดีโอคอลจะเปิดใช้งานเร็วๆ นี้');
151
+ }
152
+
153
+ // Quick reorder
154
+ function quickReorder() {
155
+ // Show loading state
156
+ event.target.innerHTML = '<div class="inline-block animate-spin rounded-full h-5 w-5 border-b-2 border-white"></div>';
157
+ event.target.disabled = true;
158
+
159
+ setTimeout(() => {
160
+ event.target.innerHTML = '✓ สั่งซื้อสำเร็จ!';
161
+ event.target.classList.remove('bg-primary');
162
+ event.target.classList.add('bg-green-500');
163
+
164
+ setTimeout(() => {
165
+ event.target.innerHTML = 'สั่งซ้ำ 1 คลิก';
166
+ event.target.disabled = false;
167
+ event.target.classList.remove('bg-green-500');
168
+ event.target.classList.add('bg-primary');
169
+ }, 2000);
170
+ }, 1500);
171
+ }
172
+
173
+ // Notifications
174
+ function toggleNotifications() {
175
+ alert('คุณมีการแจ้งเตือนใหม่: อย่าลืมทานวิตามิน ADEK ในช่วงเช้านะครับ!');
176
+ }
177
+
178
+ // Setup event listeners
179
+ function setupEventListeners() {
180
+ // Handle checkbox changes
181
+ document.querySelectorAll('input[type="checkbox"]').forEach(checkbox => {
182
+ checkbox.addEventListener('change', function() {
183
+ updateProgress();
184
+ });
185
+ });
186
+ }
187
+
188
+ // Update progress
189
+ function updateProgress() {
190
+ const checkboxes = document.querySelectorAll('#plan input[type="checkbox"]');
191
+ const checked = document.querySelectorAll('#plan input[type="checkbox"]:checked');
192
+ const percentage = Math.round((checked.length / checkboxes.length) * 100);
193
+
194
+ const progressBar = document.querySelector('#plan .bg-primary.h-2');
195
+ const percentageText = document.querySelector('#plan .font-semibold');
196
+
197
+ if (progressBar) {
198
+ progressBar.style.width = `${percentage}%`;
199
+ }
200
+ if (percentageText) {
201
+ percentageText.textContent = `${percentage}%`;
202
+ }
203
+ }
204
+
205
+ // Update real-time data
206
+ function updateRealTimeData() {
207
+ setInterval(() => {
208
+ // Simulate real-time updates
209
+ const stressElement = document.querySelector('.text-yellow-500').parentElement.parentElement.querySelector('.text-2xl');
210
+ if (stressElement && Math.random() > 0.7) {
211
+ const newStress = Math.floor(Math.random() * 20) + 30;
212
+ stressElement.textContent = newStress;
213
+ }
214
+ }, 10000);
215
+ }
216
+
217
+ // Handle pull-to-refresh
218
+ let startY = 0;
219
+ let isPulling = false;
220
+
221
+ document.addEventListener('touchstart', function(e) {
222
+ if (window.scrollY === 0) {
223
+ startY = e.touches[0].pageY;
224
+ isPulling = true;
225
+ }
226
+ });
227
+
228
+ document.addEventListener('touchmove', function(e) {
229
+ if (!isPulling) return;
230
+
231
+ const currentY = e.touches[0].pageY;
232
+ const pullDistance = currentY - startY;
233
+
234
+ if (pullDistance > 0 && pullDistance < 100) {
235
+ e.preventDefault();
236
+ document.body.style.transform = `translateY(${pullDistance * 0.5}px)`;
237
+ }
238
+ });
239
+
240
+ document.addEventListener('touchend', function(e) {
241
+ if (!isPulling) return;
242
+
243
+ isPulling = false;
244
+ document.body.style.transform = '';
245
+
246
+ const currentY = e.changedTouches[0].pageY;
247
+ const pullDistance = currentY - startY;
248
+
249
+ if (pullDistance > 80) {
250
+ location.reload();
251
+ }
252
+ });
253
+
254
+ // Lazy load images
255
+ const imageObserver = new IntersectionObserver((entries, observer) => {
256
+ entries.forEach(entry => {
257
+ if (entry.isIntersecting) {
258
+ const img = entry.target;
259
+ img.src = img.dataset.src;
260
+ observer.unobserve(img);
261
+ }
262
+ });
263
+ });
264
+
265
+ document.querySelectorAll('img[data-src]').forEach(img => {
266
+ imageObserver.observe(img);
267
+ });
style.css CHANGED
@@ -1,28 +1,67 @@
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
+ /* Custom animations and styles */
2
+ @keyframes slideUp {
3
+ from {
4
+ transform: translateY(100%);
5
+ opacity: 0;
6
+ }
7
+ to {
8
+ transform: translateY(0);
9
+ opacity: 1;
10
+ }
11
  }
12
 
13
+ @keyframes fadeIn {
14
+ from {
15
+ opacity: 0;
16
+ }
17
+ to {
18
+ opacity: 1;
19
+ }
20
  }
21
 
22
+ .slide-up {
23
+ animation: slideUp 0.3s ease-out;
 
 
 
24
  }
25
 
26
+ .fade-in {
27
+ animation: fadeIn 0.5s ease-out;
 
 
 
 
28
  }
29
 
30
+ /* Chart styles */
31
+ .chart-container {
32
+ position: relative;
33
+ height: 200px;
34
  }
35
+
36
+ /* Custom scrollbar */
37
+ ::-webkit-scrollbar {
38
+ width: 6px;
39
+ }
40
+
41
+ ::-webkit-scrollbar-track {
42
+ background: #f1f1f1;
43
+ }
44
+
45
+ ::-webkit-scrollbar-thumb {
46
+ background: #A5D6A7;
47
+ border-radius: 3px;
48
+ }
49
+
50
+ ::-webkit-scrollbar-thumb:hover {
51
+ background: #81C784;
52
+ }
53
+
54
+ /* Touch friendly buttons */
55
+ .touch-target {
56
+ min-height: 44px;
57
+ min-width: 44px;
58
+ }
59
+
60
+ /* Safe area insets for mobile */
61
+ .safe-area-top {
62
+ padding-top: env(safe-area-inset-top);
63
+ }
64
+
65
+ .safe-area-bottom {
66
+ padding-bottom: env(safe-area-inset-bottom);
67
+ }