CSNET commited on
Commit
9d40d50
·
verified ·
1 Parent(s): d12ca4b

Project Name: ชีพจร (Pulse) - The Context-Aware Thai Health & Recovery Coach

Browse files

Core Objective: เว็บ HTML5 สำหรับติดตามสุขภาพ การฟื้นตัว และสมรรถภาพร่างกาย ที่ออกแบบมาเพื่อคนไทยโดยเฉพาะ โดยมีเป้าหมายเพื่อเป็นผู้นำตลาดแทนที่ WHOOP ในประเทศไทย

Key Differentiators (จุดขายหลัก):

Hyper-localization: Database อาหารไทย, กิจกรรม (มวยไทย, สมาธิ), และภาษาที่เข้าใจง่าย

Contextual Awareness (ระบบตระหนักรู้บริบท): เชื่อมโยงข้อมูลสุขภาพ (HRV, Sleep) เข้ากับข้อมูลสิ่งแวดล้อมจริง (AQI, สภาพอากาศ, การจราจร) เพื่อให้คำแนะนำที่แม่นยำกว่า

Actionable AI Coach: AI ที่ให้คำแนะนำเชิงปฏิบัติ (ไม่ใช่แค่แสดงข้อมูล) โดยอิงจากบริบทชีวิตของคนไทย

Holistic Tracking: ครอบคลุม ร่างกาย (Strain), การนอน (Sleep), การฟื้นตัว (Recovery), โภชนาการ (Nutrition), และ จิตใจ (Mental Wellness)

Module 1: User Onboarding & Profile (อัปเกรด)
Function 1.1: Authentication: สมัครผ่าน Email, Google, Facebook, Apple ID

Function 1.2: Profile Setup:

ข้อมูลพื้นฐาน (เพศ, วันเกิด, ส่วนสูง, น้ำหนัก)

เป้าหมายหลัก (Goal Setting): ลดน้ำหนัก, สร้างกล้าม, นอนดีขึ้น, ลดเครียด

(ใหม่) ข้อมูลไลฟ์สไตล์:

ที่อยู่ "บ้าน" และ "ที่ทำงาน" (สำหรับวิเคราะห์การจราจร)

รูปแบบการกิน (Dietary Style): ทั่วไป, ทำ IF (Intermittent Fasting), มังสวิรัติ, กินเจ (ช่วงเทศกาล)

Function 1.3: Hardware Pairing: เชื่อมต่อ Bluetooth กับ Hardware ที่รองรับ (Smartwatch, Ring, Strap)

Function 1.4: Permission Request:

Health Data: HealthKit (iOS) / Health Connect (Android)

(สำคัญ) Location (Always): สำหรับดึงข้อมูล AQI และ สภาพอากาศ

Camera: สำหรับ AI Food Log

Notifications: สำหรับการแจ้งเตือนอัจฉริยะ

Module 2: Dashboard (หน้าหลัก "วันนี้") (อัปเกรด)
Function 2.1: Main Vitals (วงกลม 3 วงหลัก):

Recovery (การฟื้นตัว): % (คำนวณจาก HRV, RHR, Sleep)

Strain (ภาระร่างกาย): คะแนน (0-21)

Sleep (การนอนหลับ): % Performance (เทียบกับ Sleep Need)

Function 2.2: (ใหม่) Contextual Vitals (ข้อมูลบริบทแวดล้อม):

การ์ดแสดงผลเล็กๆ แสดงข้อมูล Real-time ตามตำแหน่งที่อยู่

AQI/PM2.5: "คุณภาพอากาศ: ปานกลาง (65)" (ดึง API)

Weather: "ดัชนีความร้อน: 39°C (เสี่ยง)" (ดึง API)

Traffic: "เส้นทางกลับบ้าน: ติดขัด" (ดึง API)

Function 2.3: AI Coach Summary: การ์ดสรุปสั้นๆ จาก AI Coach ที่ นำข้อมูลจาก 2.2 มาใช้ (เช่น "วันนี้ฝุ่นเยอะ Recovery 60% แนะนำออกกำลังในร่ม")

Function 2.4: Quick-Log Buttons: บันทึกอาหาร, เริ่มออกกำลังกาย, บันทึกอารมณ์, (ใหม่) เริ่ม/หยุด Fasting (สำหรับคนทำ IF)

Module 3: Sleep Tracking (การนอนหลับ)
Function 3.1: Automatic Detection: ตรวจจับการนอนหลับและตื่นนอนอัตโนมัติ

Function 3.2: Sleep Stages: กราฟ (Awake, Light, Deep, REM)

Function 3.3: Sleep Metrics: Efficiency, Latency, Disturbances, Respiratory Rate

Function 3.4: Smart Alarm: ปลุกในช่วง Light Sleep

Module 4: Strain & Activity (การออกกำลังกาย) (อัปเกรด)
Function 4.1: Activity Detection: ตรวจจับกิจกรรมอัตโนมัติ (เดิน, วิ่ง)

Function 4.2: Manual Activity Logging (Thai-Centric):

หน้าจอเลือกประเภทกิจกรรม เพิ่ม List กีฬา/กิจกรรมไทย:

"มวยไทย"

"แบดมินตัน"

"เวทเทรนนิ่ง"

(ใหม่) "นั่งสมาธิ" (Samadhi)

(ใหม่) "สวดมนต์" (Chanting)

(ใหม่) "เดินจงกรม" (Walking Meditation)

(ใหม่) "เข้าวัด/ทำบุญ" (Mental Recovery)

Function 4.3: Daily Strain Score: คะแนนภาระรวมของวัน

Function 4.4: Strain Coach: AI แนะนำระดับ Strain ที่เหมาะสม (อิงตาม Recovery และ ข้อมูลบริบท เช่น "วันนี้ร้อนจัด Strain Coach แนะนำให้ลดเป้าลง 20%")

Module 5: Recovery & Readiness (การฟื้นตัว)
Function 5.1: Daily Recovery Score: แสดงผล % (คำนวณตอนตื่นนอน)

Function 5.2: Key Recovery Metrics: HRV, RHR, Skin Temperature (ถ้ามี)

Function 5.3: Recovery Insights: อธิบายว่าทำไมวันนี้ Recovery ถึงสูง/ต่ำ

Module 6: Nutrition Log (โภชนาการ) (อัปเกรด)
Function 6.1: Thai Food Database: Database อาหารไทย/ตามสั่ง/ชานมไข่มุก (ต้องสร้างเอง)

Function 6.2: AI Food Photo Logging: ถ่ายรูปอาหารไทย (เช่น กะเพราไข่ดาว) AI วิเคราะห์และบันทึก

Function 6.3: Barcode Scanner: สแกนสินค้าใน 7-Eleven, Lotus's

Function 6.4: Nutrition Summary: สรุปแคลอรี, Macros (Carb/Fat/Protein)

Function 6.5: (ใหม่) Intermittent Fasting (IF) Tracker:

ตั้งค่ารูปแบบ (16/8, 18/6)

แสดง Timer นับเวลา Fasting/Eating

แจ้งเตือนเมื่อเริ่มและจบ

Function 6.6: (ใหม่) Dietary Mode Filter:

หากผู้ใช้ตั้งค่า "กินเจ" แอปจะ Pop-up ถามช่วงเทศกาล และ AI Coach จะเปลี่ยนคำแนะนำโภชนาการ (เช่น "อย่าลืมหาโปรตีนจากถั่ว/เต้าหู้ทดแทนเนื้อสัตว์นะครับ")

Module 7: Mental Wellness & Office Syndrome (อัปเกรด)
Function 7.1: Mood Log: บันทึกอารมณ์ (Emoji)

Function 7.2: (ใหม่) Digital Stress Log:

เมื่อผู้ใช้ Log อารมณ์ "เครียด" ให้มี Quick-Tap เลือกสาเหตุ: [งาน, ครอบครัว, การจราจร, ข่าว/โซเชียล, PM2.5] (เพื่อป้อนข้อมูลให้ AI)

Function 7.3: Guided Meditation (คลังเสียงภาษาไทย):

"เสียงนำนั่งสมาธิ" (อานาปานสติ)

"เสียงนำแผ่เมตตา"

(ใหม่) "ไฟล์เสียงสวดมนต์" (Audio Tracks เช่น ชินบัญชร)

Function 7.4: Sedentary Alert (Office Syndrome): แจ้งเตือนเมื่อนั่งนาน + Pop-up ท่ากายบริหารยืดเหยียดที่โต๊ะทำงาน

Module 8: AI Coach ("ผู้ช่วยชีพจร") (อัปเกรด - นี่คือหัวใจสำคัญ)
Function 8.1: Daily/Weekly Report: สรุปรายงานสุขภาพรายวันและรายสัปดาห์

Function 8.2: Actionable Insights (The Core Logic):

ระบบต้องวิเคราะห์ความสัมพันธ์ (Correlate) ข้อมูลสุขภาพ กับ ข้อมูลบริบท (Contextual Data)

ตัวอย่าง Insight 1 (AQI): "เราสังเกตว่าค่า HRV ของคุณลดลง 15% ในคืนหลังจากวันที่ PM2.5 สูงเกิน 100 นี่อาจหมายถึงร่างกายคุณเกิดการอักเสบ วันนี้ (ที่ฝุ่นยังสูง) ลองงดออกกำลังกายกลางแจ้ง และทานอาหารต้านอักเสบดูนะครับ"

ตัวอย่าง Insight 2 (Traffic): "เมื่อวานนี้ HR ของคุณสูงค้าง (Zone 2) นาน 1 ชั่วโมง ในช่วง 18.00-19.00 น. ซึ่งตรงกับข้อมูล 'รถติดหนัก' บนเส้นทางกลับบ้านของคุณ นี่คือ 'ความเครียดแ

Files changed (4) hide show
  1. index.html +68 -0
  2. onboarding.html +68 -0
  3. script.js +5 -1
  4. style.css +27 -1
index.html CHANGED
@@ -362,10 +362,78 @@
362
  </div>
363
  </div>
364
  </nav>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
 
366
  <script src="script.js"></script>
367
  <script>
368
  feather.replace();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369
  </script>
370
  </body>
371
  </html>
 
362
  </div>
363
  </div>
364
  </nav>
365
+ <!-- Address Management Modal -->
366
+ <div id="address-modal" class="fixed inset-0 bg-black bg-opacity-50 hidden z-50 flex items-center justify-center">
367
+ <div class="bg-white rounded-2xl p-6 max-w-md w-full mx-4">
368
+ <h3 class="text-lg font-semibold mb-4">จัดการที่อยู่</h3>
369
+ <div class="space-y-4">
370
+ <div>
371
+ <label class="block text-sm font-medium text-slate-700 mb-1">ที่อยู่บ้าน</label>
372
+ <input type="text" id="home-address" class="w-full px-3 py-2 border border-slate-300 rounded-lg" placeholder="ใส่ที่อยู่บ้าน">
373
+ </div>
374
+ <div>
375
+ <label class="block text-sm font-medium text-slate-700 mb-1">ที่อยู่ที่ทำงาน</label>
376
+ <input type="text" id="work-address" class="w-full px-3 py-2 border border-slate-300 rounded-lg" placeholder="ใส่ที่อยู่ที่ทำงาน">
377
+ </div>
378
+ <div class="flex gap-3">
379
+ <button onclick="saveAddress()" class="flex-1 bg-thai-600 text-white py-2 rounded-lg hover:bg-thai-700">บันันทึก</button>
380
+ <button onclick="closeAddressModal()" class="flex-1 bg-slate-200 text-slate-700 py-2 rounded-lg hover:bg-slate-300">ยกเลิก</button>
381
+ </div>
382
+ </div>
383
+ </div>
384
+ </div>
385
+
386
+ <!-- Food Camera Modal -->
387
+ <div id="food-modal" class="fixed inset-0 bg-black bg-opacity-50 hidden z-50 flex items-center justify-center">
388
+ <div class="bg-white rounded-2xl p-6 max-w-sm w-full mx-4">
389
+ <h3 class="text-lg font-semibold mb-4">ถ่ายอาาหาร</h3>
390
+ <input type="file" id="food-photo" accept="image/*" class="w-full mb-4">
391
+ <div class="flex gap-3">
392
+ <button onclick="analyzeFood()" class="flex-1 bg-thai-600 text-white py-2 rounded-lg hover:bg-thai-700">วิเเคราาะห์</button>
393
+ <button onclick="closeFoodModal()" class="flex-1 bg-slate-200 text-slate-700 py-2 rounded-lg hover:bg-slate-300">ยกเลิก</button>
394
+ </div>
395
+ </div>
396
+ </div>
397
 
398
  <script src="script.js"></script>
399
  <script>
400
  feather.replace();
401
+
402
+ // Modal functions
403
+ function openAddressModal() {
404
+ document.getElementById('address-modal').classList.remove('hidden');
405
+ }
406
+
407
+ function closeAddressModal() {
408
+ document.getElementById('address-modal').classList.add('hidden');
409
+ }
410
+
411
+ function openFoodModal() {
412
+ document.getElementById('food-modal').classList.remove('hidden');
413
+ }
414
+
415
+ function closeFoodModal() {
416
+ document.getElementById('food-modal').classList.add('hidden');
417
+ }
418
+
419
+ function saveAddress() {
420
+ const home = document.getElementById('home-address').value;
421
+ const work = document.getElementById('work-address').value;
422
+ localStorage.setItem('homeAddress', home);
423
+ localStorage.setItem('workAddress', work);
424
+ closeAddressModal();
425
+ }
426
+
427
+ function analyzeFood() {
428
+ alert('กำลังวิเเคราาะห์อาาหาร... พบว่าเป็น "กะเเพราไข่ดาว" 650 แคลอรี่');
429
+ closeFoodModal();
430
+ }
431
+
432
+ // Load saved addresses
433
+ const homeAddress = localStorage.getItem('homeAddress') || '';
434
+ const workAddress = localStorage.getItem('workAddress') || '';
435
+ document.getElementById('home-address').value = homeAddress;
436
+ document.getElementById('work-address').value = workAddress;
437
  </script>
438
  </body>
439
  </html>
onboarding.html ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```html
2
+ <!DOCTYPE html>
3
+ <html lang="th" class="scroll-smooth">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>เริ่มต้นใช้งาน - ชีพจร</title>
8
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
9
+ <link rel="stylesheet" href="style.css">
10
+ <script src="https://cdn.tailwindcss.com"></script>
11
+ <script src="https://unpkg.com/feather-icons"></script>
12
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
13
+ <link rel="preconnect" href="https://fonts.googleapis.com">
14
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
15
+ <link href="https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap" rel="stylesheet">
16
+ <script>
17
+ tailwind.config = {
18
+ theme: {
19
+ extend: {
20
+ fontFamily: {
21
+ 'thai': ['Sarabun', 'sans-serif'],
22
+ },
23
+ colors: {
24
+ 'thai': {
25
+ 50: '#fef7ee',
26
+ 100: '#feefd7',
27
+ 200: '#fcdbae',
28
+ 300: '#f9c27c',
29
+ 400: '#f59e44',
30
+ 500: '#f17f0b',
31
+ 600: '#e36b07',
32
+ 700: '#bc5308',
33
+ 800: '#95420e',
34
+ 900: '#78370f',
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+ </script>
41
+ </head>
42
+ <body class="bg-slate-50 font-thai" style="font-family: 'Sarabun', sans-serif;">
43
+ <main class="min-h-screen flex items-center justify-center p-4">
44
+ <div class="max-w-md w-full">
45
+ <!-- Progress Bar -->
46
+ <div class="mb-8">
47
+ <div class="flex justify-between mb-2">
48
+ <span class="text-sm font-medium text-slate-700">ขั้นนตอนการสมัคร</span>
49
+ <span class="text-sm font-medium text-slate-700" id="progress-text">ขั้นนตอนนที่ 1 ของ 4</span>
50
+ </div>
51
+ <div class="w-full bg-slate-200 rounded-full h-2">
52
+ <div class="bg-thai-600 h-2 rounded-full transition-all duration-300" id="progress-bar" style="width: 25%"></div>
53
+ </div>
54
+ </div>
55
+
56
+ <!-- Step 1: Basic Info -->
57
+ <div class="step-card bg-white rounded-2xl shadow-lg p-6 mb-4" id="step1">
58
+ <h2 class="text-2xl font-bold text-slate-900 mb-4">ข้อมูลพื้นนฐาน</h2>
59
+ <div class="space-y-4">
60
+ <div>
61
+ <label class="block text-sm font-medium text-slate-700 mb-1">ชื่อเล่น</label>
62
+ <input type="text" id="nickname" class="w-full px-3 py-2 border border-slate-300 rounded-lg" placeholder="เเช่น เอ, บอส">
63
+ </div>
64
+ <div>
65
+ <label class="block text-sm font-medium text-slate-700 mb-1">เเพศ</label>
66
+ <select id="gender" class="w-full px-3 py-2 border border-slate-300 rounded-lg">
67
+ <option value="">เลือกเเพศ</option>
68
+ <option value="male
script.js CHANGED
@@ -1,11 +1,15 @@
 
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');
 
1
+
2
  // Initialize app
3
  document.addEventListener('DOMContentLoaded', function() {
4
  initializeNavigation();
5
  initializeProgressBars();
6
  initializeScrollEffects();
7
  initializeLinks();
8
+ initializeContextualData();
9
+ initializeFoodAI();
10
+ initializeIFTracker();
11
+ initializeMentalWellness();
12
  });
 
13
  // Navigation functionality
14
  function initializeNavigation() {
15
  const navLinks = document.querySelectorAll('.nav-link');
style.css CHANGED
@@ -46,7 +46,6 @@ button:hover {
46
  transform: translateY(-1px);
47
  transition: all 0.2s ease;
48
  }
49
-
50
  /* Custom animations */
51
  @keyframes fadeIn {
52
  from {
@@ -63,6 +62,33 @@ button:hover {
63
  animation: fadeIn 0.5s ease-out;
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  /* Responsive text sizes */
67
  @media (max-width: 640px) {
68
  .text-4xl {
 
46
  transform: translateY(-1px);
47
  transition: all 0.2s ease;
48
  }
 
49
  /* Custom animations */
50
  @keyframes fadeIn {
51
  from {
 
62
  animation: fadeIn 0.5s ease-out;
63
  }
64
 
65
+ /* Address modal styles */
66
+ #address-modal input:focus {
67
+ outline: none;
68
+ border-color: #f17f0b;
69
+ box-shadow: 0 0 0 3px rgba(241, 127, 11, 0.1);
70
+ }
71
+
72
+ /* Loading spinner */
73
+ .loading-spinner {
74
+ border: 4px solid #f3f4f6;
75
+ border-top: 4px solid #f17f0b;
76
+ border-radius: 50%;
77
+ width: 40px;
78
+ height: 40px;
79
+ animation: spin 1s linear infinite;
80
+ }
81
+
82
+ @keyframes spin {
83
+ 0% { transform: rotate(0deg); }
84
+ 100% { transform: rotate(360deg); }
85
+ }
86
+
87
+ /* Food analysis results */
88
+ .food-result {
89
+ background: linear-gradient(135deg, #fef7ee, #feefd7);
90
+ border-left: 4px solid #f17f0b;
91
+ }
92
  /* Responsive text sizes */
93
  @media (max-width: 640px) {
94
  .text-4xl {