Spaces:
Running
Running
ชื่อโปรเจกต์: Oura Ring Dashboard Mockup (Web Version)เป้าหมาย: สร้างไฟล์ HTML5 เดี่ยว (.html) ที่ประกอบด้วย HTML, CSS, และ JavaScript ทั้งหมด เพื่อจำลองหน้า Dashboard หลักของ Oura Ring บนเว็บ (คล้ายกับ "Oura on the Web") โดยเน้นการแสดงผล คะแนนหลัก 3 คะแนน และ แนวโน้มข้อมูลรายวัน/รายสัปดาห์ อย่างชัดเจนและสวยงาม📝 รายละเอียด Prompt1. โครงสร้างไฟล์ (File Structure)ต้องเป็น ไฟล์ HTML5 เดี่ยว (index.html หรือชื่ออื่นตามสะดวก)HTML, CSS, และ JavaScript ทั้งหมดต้องอยู่ในไฟล์เดียวCSS ต้องอยู่ในแท็ก <style> ภายใน <head> (ใช้ CSS Variables และ Flexbox/Grid เพื่อความทันสมัย).JavaScript ต้องอยู่ในแท็ก <script> ภายใน <body> หรือ <head> (เน้นการสร้าง Chart แบบง่ายๆ).ห้ามใช้ Library/Framework ภายนอก (เช่น React, Vue, jQuery, หรือ Chart.js/D3.js) ต้องใช้ Vanilla JS เท่านั้น.2. ข้อมูลจำลอง (Mock Data)สร้างโครงสร้างข้อมูล JavaScript เพื่อจำลองข้อมูลสุขภาพรายวัน/รายสัปดาห์ (อย่างน้อย 7 วัน) โดยเน้นไปที่ Metrics หลักของ Oura:FieldDescriptionTypeDaily ExampleWeekly Array Example (7 days)dateวันที่ของข้อมูลString"2025-11-15"["11/9", "11/10", ...]readinessScoreคะแนนความพร้อม (0-100)Number85[75, 88, 65, 90, 85, 70, 92]sleepScoreคะแนนการนอน (0-100)Number90[80, 91, 72, 85, 90, 75, 95]activityScoreคะแนนกิจกรรม (0-100)Number78[85, 75, 90, 80, 78, 92, 60]rhrอัตราการเต้นของหัวใจขณะพัก (Resting HR)Number52[55, 50, 58, 51, 52, 57, 49]hrvความแปรปรวนของอัตราการเต้นของหัวใจ (HRV)Number80[65, 85, 50, 90, 80, 60, 95]tempDeltaอุณหภูมิร่างกายที่เปลี่ยนแปลงจาก BaselineNumber$-0.1$[0.2, -0.1, 0.5, 0.0, -0.2, 0.1, -0.3]sleepDurationระยะเวลาการนอนทั้งหมด (นาที)Number450 (7.5 ชม.)[400, 480, 390, 450, 470, 420, 500]3. องค์ประกอบของ Dashboard (Dashboard Components)Dashboard ต้องแบ่งออกเป็น 3 ส่วนหลัก (หรือแท็บ: Today, Vitals, Trends) โดยเน้นการแสดงผลที่หน้า Today และ Trends:A. Today's View (มุมมองประจำวัน)Header Card: แสดงวันที่ปัจจุบันและ 3 คะแนนหลัก พร้อมสีตามช่วงคะแนน (Optimal: เขียว >85, Good: เหลือง 70-84, Pay Attention: แดง <70).Readiness ScoreSleep ScoreActivity ScoreInsight Card: ข้อความสรุปสั้นๆ (เช่น "Your RHR was lower than usual, indicating strong recovery." หรือ "Lower Readiness today. Focus on light activity.")B. Sleep Breakdown Card (รายละเอียดการนอนหลับ)แสดงผล Sleep Score (ตัวเลขและกราฟวงกลม/วงแหวน)Sub-Metrics: แสดงค่าตัวเลขสำหรับ:Total Sleep Duration (sleepDuration)Time in Bed (สมมติ: Total Sleep + 30 นาที)Efficiency (สมมติ: sleepScore / 100)Graph Mockup: จำลองกราฟแท่งแสดง Sleep Stages (Deep, REM, Light) แบบง่ายๆ (ไม่ต้องใช้ข้อมูลจริง).C. Readiness & Vitals Trends (แนวโน้มและสัญญาณชีพ)Trend Chart 1: Readiness & RHR: กราฟเส้นคู่สำหรับ 7 วันล่าสุด เพื่อเปรียบเทียบ readinessScore และ rhr (แสดงความสัมพันธ์แบบผกผัน: RHR ต่ำ = Readiness สูง).ใช้ JavaScript สร้างเส้นกราฟ/จุด ด้วยการจัดการ DOM/SVG/Canvas อย่างง่ายTrend Chart 2: HRV & Temperature: กราฟเส้นคู่สำหรับ 7 วันล่าสุด เพื่อเปรียบเทียบ hrv และ tempDelta (แสดงความสัมพันธ์: HRV สูง/Temp Delta ใกล้ 0 = Recovery ดี).4. คุณสมบัติการโต้ตอบ (Interactive Features)Date Picker Mockup: มีปุ่ม/ฟังก์ชัน Previous Day และ Next Day (จำลองการเปลี่ยนข้อมูลในหน้า Today's View โดยการสลับ Index ใน Mock Data Array).Toggle/Switch Mockup: ปุ่มจำลอง (เช่น "Show 7-Day / Show 30-Day") ใต้กราฟ Trends ที่ปรับเปลี่ยน Label/Scale ของกราฟให้ดูเหมือนเปลี่ยนมุมมอง.5. ข้อจำกัดด้านการออกแบบ (Design Constraints)เน้นความสะอาด (Clean Design): ใช้โทนสีเข้ม (Dark Mode) คล้าย Oura App หรือโทนสีอ่อนที่สบายตา.ใช้ Emoji: ใช้ Emoji (เช่น 🌙, 🔋, ✨) เพื่อช่วยนำทางข้อมูลแทนไอคอนที่ซับซ้อน.Responsive Mockup: การจัดวางควรดูดีทั้งบนหน้าจอ Desktop และเมื่อจำลองบน Mobile View (ใช้ Media Queries หรือ Flexbox/Grid).🚀 สิ่งที่ต้องการจากการตอบกลับโค้ด HTML5 ที่ทำงานได้เต็มรูปแบบ (Full working HTML5 file) พร้อมข้อมูลจำลองและฟังก์ชัน JavaScript ข้างต้น เพื่อเป็น Mockup Dashboard ของ Oura Ring ที่มีความคล้ายคลึงและสื่อถึงข้อมูลหลักของอุปกรณ์ได้อย่างครบถ้วน
152c583 verified Download components/header.js from CSNET/oura-health-hub: direct link, hf CLI and curl.
- Browser
- Download file 4.46 kB
-
https://huggingface.co/spaces/CSNET/oura-health-hub/resolve/main/components/header.js
- Command line
-
hf download hf://spaces/CSNET/oura-health-hub/components/header.js
-
curl -L -o header.js https://huggingface.co/spaces/CSNET/oura-health-hub/resolve/main/components/header.js
4.46 kB
| class HeaderComponent extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| header { | |
| background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); | |
| border-bottom: 1px solid rgba(255, 255, 255, 0.1); | |
| backdrop-filter: blur(10px); | |
| } | |
| .header-content { | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| padding: 1.5rem 2rem; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| .logo { | |
| display: flex; | |
| align-items: center; | |
| gap: 0.75rem; | |
| font-size: 1.5rem; | |
| font-weight: 700; | |
| color: white; | |
| text-decoration: none; | |
| } | |
| .logo-icon { | |
| width: 40px; | |
| height: 40px; | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| border-radius: 50%; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-size: 1.5rem; | |
| } | |
| .nav-menu { | |
| display: flex; | |
| gap: 2rem; | |
| list-style: none; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| .nav-link { | |
| color: #94a3b8; | |
| text-decoration: none; | |
| font-weight: 500; | |
| transition: color 0.3s ease; | |
| padding: 0.5rem 1rem; | |
| border-radius: 8px; | |
| } | |
| .nav-link:hover, .nav-link.active { | |
| color: white; | |
| background: rgba(255, 255, 255, 0.1); | |
| } | |
| .user-menu { | |
| display: flex; | |
| align-items: center; | |
| gap: 1rem; | |
| } | |
| .user-avatar { | |
| width: 36px; | |
| height: 36px; | |
| border-radius: 50%; | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| color: white; | |
| font-weight: 600; | |
| } | |
| @media (max-width: 768px) { | |
| .header-content { | |
| padding: 1rem; | |
| } | |
| .nav-menu { | |
| display: none; | |
| } | |
| .logo span { | |
| display: none; | |
| } | |
| } | |
| </style> | |
| <header> | |
| <div class="header-content"> | |
| <a href="#" class="logo"> | |
| <div class="logo-icon">⭕</div> | |
| <span>Oura Health Hub</span> | |
| </a> | |
| <nav> | |
| <ul class="nav-menu"> | |
| <li><a href="#" class="nav-link active">Dashboard</a></li> | |
| <li><a href="#" class="nav-link">Trends</a></li> | |
| <li><a href="#" class="nav-link">Insights</a></li> | |
| <li><a href="#" class="nav-link">Settings</a></li> | |
| </ul> | |
| </nav> | |
| <div class="user-menu"> | |
| <button style="background: none; border: none; cursor: pointer;"> | |
| <i data-feather="bell" style="width: 20px; height: 20px; color: #94a3b8;"></i> | |
| </button> | |
| <div class="user-avatar">JD</div> | |
| </div> | |
| </div> | |
| </header> | |
| `; | |
| } | |
| } | |
| customElements.define('header-component', HeaderComponent); |