Spaces:
Running
Running
ทำต่อให้เสร็จ
Browse files- README.md +8 -5
- components/footer.js +56 -0
- components/navbar.js +171 -0
- index.html +218 -19
- script.js +241 -0
- style.css +222 -19
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title: Pulse Flow
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Pulse Flow 🥷
|
| 3 |
+
colorFrom: pink
|
| 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).
|
components/footer.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```javascript
|
| 2 |
+
class ThaiFooter extends HTMLElement {
|
| 3 |
+
constructor() {
|
| 4 |
+
super();
|
| 5 |
+
this.attachShadow({ mode: 'open' });
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
connectedCallback() {
|
| 9 |
+
this.render();
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
render() {
|
| 13 |
+
this.shadowRoot.innerHTML = `
|
| 14 |
+
<style>
|
| 15 |
+
:host {
|
| 16 |
+
display: block;
|
| 17 |
+
position: fixed;
|
| 18 |
+
bottom: 0;
|
| 19 |
+
left: 0;
|
| 20 |
+
right: 0;
|
| 21 |
+
z-index: 40;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
footer {
|
| 25 |
+
background: rgba(255, 255, 255, 0.9);
|
| 26 |
+
backdrop-filter: blur(10px);
|
| 27 |
+
-webkit-backdrop-filter: blur(10px);
|
| 28 |
+
border-top: 1px solid rgba(255, 255, 255, 0.18);
|
| 29 |
+
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
|
| 30 |
+
padding: 0.75rem 0;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.dark footer {
|
| 34 |
+
background: rgba(15, 23, 42, 0.9);
|
| 35 |
+
border-color: rgba(255, 255, 255, 0.08);
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.nav-items {
|
| 39 |
+
display: flex;
|
| 40 |
+
justify-content: space-around;
|
| 41 |
+
align-items: center;
|
| 42 |
+
max-width: 500px;
|
| 43 |
+
margin: 0 auto;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
a {
|
| 47 |
+
display: flex;
|
| 48 |
+
flex-direction: column;
|
| 49 |
+
align-items: center;
|
| 50 |
+
gap: 0.25rem;
|
| 51 |
+
padding: 0.5rem;
|
| 52 |
+
text-decoration: none;
|
| 53 |
+
color: #64748b;
|
| 54 |
+
transition: all 0.2s;
|
| 55 |
+
border-radius: 0.75rem;
|
| 56 |
+
min-width: 64px
|
components/navbar.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
|
| 7 |
+
connectedCallback() {
|
| 8 |
+
this.render();
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
render() {
|
| 12 |
+
this.shadowRoot.innerHTML = `
|
| 13 |
+
<style>
|
| 14 |
+
:host {
|
| 15 |
+
display: block;
|
| 16 |
+
position: fixed;
|
| 17 |
+
top: 0;
|
| 18 |
+
left: 0;
|
| 19 |
+
right: 0;
|
| 20 |
+
z-index: 40;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
nav {
|
| 24 |
+
background: rgba(255, 255, 255, 0.9);
|
| 25 |
+
backdrop-filter: blur(10px);
|
| 26 |
+
-webkit-backdrop-filter: blur(10px);
|
| 27 |
+
border-bottom: 1px solid rgba(255, 255, 255, 0.18);
|
| 28 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
| 29 |
+
padding: 1rem;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
.dark nav {
|
| 33 |
+
background: rgba(15, 23, 42, 0.9);
|
| 34 |
+
border-color: rgba(255, 255, 255, 0.08);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.container {
|
| 38 |
+
display: flex;
|
| 39 |
+
justify-content: space-between;
|
| 40 |
+
align-items: center;
|
| 41 |
+
max-width: 1200px;
|
| 42 |
+
margin: 0 auto;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.logo {
|
| 46 |
+
display: flex;
|
| 47 |
+
align-items: center;
|
| 48 |
+
gap: 0.5rem;
|
| 49 |
+
font-size: 1.25rem;
|
| 50 |
+
font-weight: 700;
|
| 51 |
+
color: #7c3aed;
|
| 52 |
+
text-decoration: none;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
.dark .logo {
|
| 56 |
+
color: #c4b5fd;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
.nav-links {
|
| 60 |
+
display: flex;
|
| 61 |
+
gap: 1rem;
|
| 62 |
+
align-items: center;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
button {
|
| 66 |
+
background: none;
|
| 67 |
+
border: none;
|
| 68 |
+
cursor: pointer;
|
| 69 |
+
padding: 0.5rem;
|
| 70 |
+
border-radius: 0.5rem;
|
| 71 |
+
transition: all 0.2s;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
button:hover {
|
| 75 |
+
background: rgba(124, 58, 237, 0.1);
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
.dark button:hover {
|
| 79 |
+
background: rgba(196, 181, 253, 0.1);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
.icon {
|
| 83 |
+
width: 1.5rem;
|
| 84 |
+
height: 1.5rem;
|
| 85 |
+
stroke: #7c3aed;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
.dark .icon {
|
| 89 |
+
stroke: #c4b5fd;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
.badge {
|
| 93 |
+
position: absolute;
|
| 94 |
+
top: -4px;
|
| 95 |
+
right: -4px;
|
| 96 |
+
background: #ef4444;
|
| 97 |
+
color: white;
|
| 98 |
+
font-size: 0.625rem;
|
| 99 |
+
padding: 0.125rem 0.375rem;
|
| 100 |
+
border-radius: 9999px;
|
| 101 |
+
font-weight: 600;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.relative {
|
| 105 |
+
position: relative;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
@media (max-width: 640px) {
|
| 109 |
+
nav {
|
| 110 |
+
padding: 0.75rem;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
.logo {
|
| 114 |
+
font-size: 1rem;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
.nav-links {
|
| 118 |
+
gap: 0.5rem;
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
</style>
|
| 122 |
+
|
| 123 |
+
<nav>
|
| 124 |
+
<div class="container">
|
| 125 |
+
<a href="/" class="logo">
|
| 126 |
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 127 |
+
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
|
| 128 |
+
<polyline points="9 22 9 12 15 12 15 22"></polyline>
|
| 129 |
+
</svg>
|
| 130 |
+
ชีพจร Pulse
|
| 131 |
+
</a>
|
| 132 |
+
|
| 133 |
+
<div class="nav-links">
|
| 134 |
+
<button id="theme-toggle" aria-label="Toggle theme">
|
| 135 |
+
<svg class="icon" id="theme-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 136 |
+
<circle cx="12" cy="12" r="5"></circle>
|
| 137 |
+
<line x1="12" y1="1" x2="12" y2="3"></line>
|
| 138 |
+
<line x1="12" y1="21" x2="12" y2="23"></line>
|
| 139 |
+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
|
| 140 |
+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
|
| 141 |
+
<line x1="1" y1="12" x2="3" y2="12"></line>
|
| 142 |
+
<line x1="21" y1="12" x2="23" y2="12"></line>
|
| 143 |
+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
|
| 144 |
+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
|
| 145 |
+
</svg>
|
| 146 |
+
</button>
|
| 147 |
+
|
| 148 |
+
<div class="relative">
|
| 149 |
+
<button aria-label="Notifications">
|
| 150 |
+
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 151 |
+
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path>
|
| 152 |
+
<path d="M13.73 21a2 2 0 0 1-3.46 0"></path>
|
| 153 |
+
</svg>
|
| 154 |
+
</button>
|
| 155 |
+
<span class="badge">3</span>
|
| 156 |
+
</div>
|
| 157 |
+
|
| 158 |
+
<button aria-label="Settings">
|
| 159 |
+
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 160 |
+
<circle cx="12" cy="12" r="3"></circle>
|
| 161 |
+
<path d="M12 1v6m0 6v6m4.22-10.22l1.42-1.42M6.36 17.64l1.42-1.42M1 12h6m6 0h6m-10.22 4.22l-1.42 1.42M17.64 6.36l-1.42 1.42"></path>
|
| 162 |
+
</svg>
|
| 163 |
+
</button>
|
| 164 |
+
</div>
|
| 165 |
+
</div>
|
| 166 |
+
</nav>
|
| 167 |
+
`;
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
customElements.define('thai-navbar', ThaiNavbar);
|
index.html
CHANGED
|
@@ -1,19 +1,218 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="th" class="scroll-smooth">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ชีพจร Pulse - แดชบอร์ดสุขภาพของคุณ</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🥷</text></svg>">
|
| 8 |
+
<link rel="stylesheet" href="style.css">
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 12 |
+
</head>
|
| 13 |
+
<body class="bg-gradient-to-br from-slate-50 via-purple-50 to-teal-50 dark:from-slate-900 dark:via-slate-800 dark:to-slate-900 min-h-screen">
|
| 14 |
+
|
| 15 |
+
<!-- Navigation -->
|
| 16 |
+
<thai-navbar></thai-navbar>
|
| 17 |
+
|
| 18 |
+
<main class="pt-4 pb-20">
|
| 19 |
+
<!-- Hero Section with 3-Ring Vitals -->
|
| 20 |
+
<section class="px-4 mb-6">
|
| 21 |
+
<div class="text-center mb-6">
|
| 22 |
+
<h1 class="text-2xl font-bold text-slate-800 dark:text-white mb-1">สวัสดีตอนเช้า, คุณแมวเหมียว 🌅</h1>
|
| 23 |
+
<p class="text-sm text-slate-600 dark:text-slate-400">วันอังคารที่ 15 ตุลาคม 2567</p>
|
| 24 |
+
</div>
|
| 25 |
+
|
| 26 |
+
<!-- 3-Ring Vitals -->
|
| 27 |
+
<div class="flex justify-center items-center space-x-4 mb-8">
|
| 28 |
+
<!-- Recovery Ring -->
|
| 29 |
+
<div class="relative w-24 h-24">
|
| 30 |
+
<div class="w-24 h-24 rounded-full border-8 border-slate-200 dark:border-slate-700 flex items-center justify-center">
|
| 31 |
+
<div class="text-center">
|
| 32 |
+
<div class="text-2xl font-bold text-emerald-500">72%</div>
|
| 33 |
+
<div class="text-xs text-slate-500 dark:text-slate-400">ฟื้นตัว</div>
|
| 34 |
+
</div>
|
| 35 |
+
</div>
|
| 36 |
+
<div class="absolute inset-0 rounded-full border-8 border-transparent border-t-emerald-500 animate-pulse" style="clip-path: polygon(50% 0%, 50% 50%, 100% 0%, 100% 100%, 0% 100%, 0% 0%);"></div>
|
| 37 |
+
</div>
|
| 38 |
+
|
| 39 |
+
<!-- Strain Ring -->
|
| 40 |
+
<div class="relative w-24 h-24">
|
| 41 |
+
<div class="w-24 h-24 rounded-full border-8 border-slate-200 dark:border-slate-700 flex items-center justify-center">
|
| 42 |
+
<div class="text-center">
|
| 43 |
+
<div class="text-2xl font-bold text-orange-500">14.2</div>
|
| 44 |
+
<div class="text-xs text-slate-500 dark:text-slate-400">ภาระ</div>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
<div class="absolute inset-0 rounded-full border-8 border-transparent border-t-orange-500" style="clip-path: polygon(50% 0%, 50% 50%, 100% 0%, 100% 100%, 0% 100%, 0% 0%);"></div>
|
| 48 |
+
</div>
|
| 49 |
+
|
| 50 |
+
<!-- Sleep Ring -->
|
| 51 |
+
<div class="relative w-24 h-24">
|
| 52 |
+
<div class="w-24 h-24 rounded-full border-8 border-slate-200 dark:border-slate-700 flex items-center justify-center">
|
| 53 |
+
<div class="text-center">
|
| 54 |
+
<div class="text-2xl font-bold text-purple-500">85%</div>
|
| 55 |
+
<div class="text-xs text-slate-500 dark:text-slate-400">การนอน</div>
|
| 56 |
+
</div>
|
| 57 |
+
</div>
|
| 58 |
+
<div class="absolute inset-0 rounded-full border-8 border-transparent border-t-purple-500" style="clip-path: polygon(50% 0%, 50% 50%, 100% 0%, 100% 100%, 0% 100%, 0% 0%);"></div>
|
| 59 |
+
</div>
|
| 60 |
+
</div>
|
| 61 |
+
|
| 62 |
+
<!-- AI Coach Summary Card -->
|
| 63 |
+
<div class="bg-gradient-to-r from-violet-600 to-purple-700 rounded-2xl p-4 text-white shadow-lg mb-6">
|
| 64 |
+
<div class="flex items-start space-x-3">
|
| 65 |
+
<div class="w-10 h-10 bg-white/20 rounded-full flex items-center justify-center flex-shrink-0">
|
| 66 |
+
<i data-feather="zap" class="w-5 h-5"></i>
|
| 67 |
+
</div>
|
| 68 |
+
<div class="flex-1">
|
| 69 |
+
<h3 class="font-semibold text-sm mb-1">ผู้ช่วยชีพจร AI</h3>
|
| 70 |
+
<p class="text-xs opacity-90 leading-relaxed">
|
| 71 |
+
��ันนี้คุณภาพอากาศปานกลาง (AQI 65) และ Recovery 72% แนะนำให้ออกกำลังกายในร่ม เช่น โยคะหรือเวทเทรนนิ่ง หลีกเลี่ยงการวิ่งกลางแจ้งช่วงเย็นนะครับ
|
| 72 |
+
</p>
|
| 73 |
+
<button class="text-xs bg-white/20 px-3 py-1 rounded-full mt-2 hover:bg-white/30 transition">ดูรายละเอียด</button>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
</section>
|
| 78 |
+
|
| 79 |
+
<!-- Contextual Vitals -->
|
| 80 |
+
<section class="px-4 mb-6">
|
| 81 |
+
<h2 class="text-lg font-semibold text-slate-800 dark:text-white mb-3">ข้อมูลบริบทรอบตัวคุณ</h2>
|
| 82 |
+
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3">
|
| 83 |
+
<contextual-vital
|
| 84 |
+
icon="wind"
|
| 85 |
+
title="คุณภาพอากาศ"
|
| 86 |
+
value="ปานกลาง (65)"
|
| 87 |
+
status="warning"
|
| 88 |
+
detail="PM2.5: 35 μg/m³">
|
| 89 |
+
</contextual-vital>
|
| 90 |
+
<contextual-vital
|
| 91 |
+
icon="sun"
|
| 92 |
+
title="ดัชนีความร้อน"
|
| 93 |
+
value="39°C (เสี่ยง)"
|
| 94 |
+
status="danger"
|
| 95 |
+
detail="ความชื้น: 75%">
|
| 96 |
+
</contextual-vital>
|
| 97 |
+
<contextual-vital
|
| 98 |
+
icon="navigation"
|
| 99 |
+
title="การจราจร"
|
| 100 |
+
value="ติดขัด"
|
| 101 |
+
status="warning"
|
| 102 |
+
detail="เส้นทางกลับบ้าน 45 นาที">
|
| 103 |
+
</contextual-vital>
|
| 104 |
+
</div>
|
| 105 |
+
</section>
|
| 106 |
+
|
| 107 |
+
<!-- Quick Actions -->
|
| 108 |
+
<section class="px-4 mb-6">
|
| 109 |
+
<h2 class="text-lg font-semibold text-slate-800 dark:text-white mb-3">บันทึกด่วน</h2>
|
| 110 |
+
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3">
|
| 111 |
+
<quick-action icon="coffee" text="บันทึกอาหาร" color="bg-orange-500"></quick-action>
|
| 112 |
+
<quick-action icon="activity" text="เริ่มออกกำลัง" color="bg-red-500"></quick-action>
|
| 113 |
+
<quick-action icon="heart" text="อารมณ์วันนี้" color="bg-pink-500"></quick-action>
|
| 114 |
+
<quick-action icon="clock" text="IF Timer" color="bg-teal-500"></quick-action>
|
| 115 |
+
</div>
|
| 116 |
+
</section>
|
| 117 |
+
|
| 118 |
+
<!-- Today's Activities -->
|
| 119 |
+
<section class="px-4 mb-6">
|
| 120 |
+
<h2 class="text-lg font-semibold text-slate-800 dark:text-white mb-3">กิจกรรมวันนี้</h2>
|
| 121 |
+
<div class="space-y-3">
|
| 122 |
+
<div class="bg-white dark:bg-slate-800 rounded-xl p-4 shadow-sm border border-slate-100 dark:border-slate-700">
|
| 123 |
+
<div class="flex items-center justify-between">
|
| 124 |
+
<div class="flex items-center space-x-3">
|
| 125 |
+
<div class="w-10 h-10 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center">
|
| 126 |
+
<i data-feather="activity" class="w-5 h-5 text-red-500"></i>
|
| 127 |
+
</div>
|
| 128 |
+
<div>
|
| 129 |
+
<h4 class="font-medium text-slate-800 dark:text-white">มวยไทย</h4>
|
| 130 |
+
<p class="text-xs text-slate-500 dark:text-slate-400">07:30 - 08:30 (1 ชั่วโมง)</p>
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
<div class="text-right">
|
| 134 |
+
<div class="text-sm font-semibold text-slate-800 dark:text-white">142 แคล</div>
|
| 135 |
+
<div class="text-xs text-slate-500 dark:text-slate-400">Strain 8.2</div>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
|
| 140 |
+
<div class="bg-white dark:bg-slate-800 rounded-xl p-4 shadow-sm border border-slate-100 dark:border-slate-700">
|
| 141 |
+
<div class="flex items-center justify-between">
|
| 142 |
+
<div class="flex items-center space-x-3">
|
| 143 |
+
<div class="w-10 h-10 bg-purple-100 dark:bg-purple-900/30 rounded-full flex items-center justify-center">
|
| 144 |
+
<i data-feather="moon" class="w-5 h-5 text-purple-500"></i>
|
| 145 |
+
</div>
|
| 146 |
+
<div>
|
| 147 |
+
<h4 class="font-medium text-slate-800 dark:text-white">การนอนหลับ</h4>
|
| 148 |
+
<p class="text-xs text-slate-500 dark:text-slate-400">23:15 - 06:45 (7.5 ชั่วโมง)</p>
|
| 149 |
+
</div>
|
| 150 |
+
</div>
|
| 151 |
+
<div class="text-right">
|
| 152 |
+
<div class="text-sm font-semibold text-slate-800 dark:text-white">85%</div>
|
| 153 |
+
<div class="text-xs text-slate-500 dark:text-slate-400">Deep: 1.5 ชม.</div>
|
| 154 |
+
</div>
|
| 155 |
+
</div>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
+
</section>
|
| 159 |
+
|
| 160 |
+
<!-- AI Insights -->
|
| 161 |
+
<section class="px-4 mb-6">
|
| 162 |
+
<h2 class="text-lg font-semibold text-slate-800 dark:text-white mb-3">AI Insights ประจำวัน</h2>
|
| 163 |
+
<div class="space-y-3">
|
| 164 |
+
<ai-insight
|
| 165 |
+
type="warning"
|
| 166 |
+
icon="wind"
|
| 167 |
+
title="ผลกระทบจาก PM2.5"
|
| 168 |
+
message="เราสังเกตว่าค่า HRV ของคุณลดลง 15% ในคืนหลังจากวันที่ PM2.5 สูงเกิน 100 นี่อาจหมายถึงร่างกายคุณเกิดการอักเสบ วันนี้ (ที่ฝุ่นยังสูง) ลองงดออกกำลังกายกลางแจ้ง และทานอาหารต้านอักเสบดูนะครับ"
|
| 169 |
+
action="ดูคำแนะนำอาหาร">
|
| 170 |
+
</ai-insight>
|
| 171 |
+
|
| 172 |
+
<ai-insight
|
| 173 |
+
type="info"
|
| 174 |
+
icon="clock"
|
| 175 |
+
title="IF + Sleep สัมพันธ์กัน"
|
| 176 |
+
message="เราพบว่าการทานอาหารมื้อดึก (23.00 น.) ของคุณเมื่อคืน ทำให้ 'Deep Sleep' ลดลง 40 นาที ลองเลื่อนมื้อเย็นเร็วขึ้น 2 ชั่วโมง จะช่วยให้นอนหลับสนิทขึ้นนะครับ"
|
| 177 |
+
action="ตั้งเป้าหมายใหม่">
|
| 178 |
+
</ai-insight>
|
| 179 |
+
</div>
|
| 180 |
+
</section>
|
| 181 |
+
</main>
|
| 182 |
+
|
| 183 |
+
<!-- Footer Navigation -->
|
| 184 |
+
<thai-footer></thai-footer>
|
| 185 |
+
|
| 186 |
+
<!-- Scripts -->
|
| 187 |
+
<script src="components/navbar.js"></script>
|
| 188 |
+
<script src="components/footer.js"></script>
|
| 189 |
+
<script src="components/contextual-vital.js"></script>
|
| 190 |
+
<script src="components/ai-insight.js"></script>
|
| 191 |
+
<script src="components/quick-action.js"></script>
|
| 192 |
+
<script src="script.js"></script>
|
| 193 |
+
<script>
|
| 194 |
+
// Initialize Feather Icons
|
| 195 |
+
feather.replace();
|
| 196 |
+
|
| 197 |
+
// Update time
|
| 198 |
+
function updateTime() {
|
| 199 |
+
const now = new Date();
|
| 200 |
+
const options = {
|
| 201 |
+
weekday: 'long',
|
| 202 |
+
year: 'numeric',
|
| 203 |
+
month: 'long',
|
| 204 |
+
day: 'numeric',
|
| 205 |
+
timeZone: 'Asia/Bangkok'
|
| 206 |
+
};
|
| 207 |
+
const thaiDate = now.toLocaleDateString('th-TH', options);
|
| 208 |
+
const timeElement = document.querySelector('p.text-sm.text-slate-600');
|
| 209 |
+
if (timeElement) {
|
| 210 |
+
timeElement.textContent = thaiDate;
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
updateTime();
|
| 214 |
+
setInterval(updateTime, 60000);
|
| 215 |
+
</script>
|
| 216 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 217 |
+
</body>
|
| 218 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class PulseApp {
|
| 3 |
+
constructor() {
|
| 4 |
+
this.userData = this.loadUserData();
|
| 5 |
+
this.init();
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
init() {
|
| 9 |
+
this.setupThemeToggle();
|
| 10 |
+
this.setupQuickActions();
|
| 11 |
+
this.startRealTimeUpdates();
|
| 12 |
+
this.setupVitalRings();
|
| 13 |
+
this.setupAICoach();
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
// Theme Management
|
| 17 |
+
setupThemeToggle() {
|
| 18 |
+
const themeToggle = document.querySelector('#theme-toggle');
|
| 19 |
+
if (themeToggle) {
|
| 20 |
+
themeToggle.addEventListener('click', () => {
|
| 21 |
+
const html = document.documentElement;
|
| 22 |
+
const isDark = html.classList.contains('dark');
|
| 23 |
+
html.classList.toggle('dark');
|
| 24 |
+
localStorage.setItem('theme', isDark ? 'light' : 'dark');
|
| 25 |
+
});
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
// Load saved theme
|
| 29 |
+
const savedTheme = localStorage.getItem('theme');
|
| 30 |
+
if (savedTheme === 'dark') {
|
| 31 |
+
document.documentElement.classList.add('dark');
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
// Quick Actions Handler
|
| 36 |
+
setupQuickActions() {
|
| 37 |
+
const quickActionButtons = document.querySelectorAll('quick-action');
|
| 38 |
+
quickActionButtons.forEach(button => {
|
| 39 |
+
button.addEventListener('click', (e) => {
|
| 40 |
+
const action = e.currentTarget.getAttribute('data-action');
|
| 41 |
+
this.handleQuickAction(action);
|
| 42 |
+
});
|
| 43 |
+
});
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
handleQuickAction(action) {
|
| 47 |
+
const actions = {
|
| 48 |
+
'food': () => this.showNotification('กำลังเปิดบันทึกอาหาร...', 'orange'),
|
| 49 |
+
'exercise': () => this.showNotification('กำลังเริ่มจับเวลาออกกำลังกาย...', 'red'),
|
| 50 |
+
'mood': () => this.showNotification('กำลังเปิดบันทึกอารมณ์...', 'pink'),
|
| 51 |
+
'fasting': () => this.startFastingTimer(),
|
| 52 |
+
};
|
| 53 |
+
|
| 54 |
+
if (actions[action]) {
|
| 55 |
+
actions[action]();
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
// Fasting Timer
|
| 60 |
+
startFastingTimer() {
|
| 61 |
+
const startTime = Date.now();
|
| 62 |
+
const timerInterval = setInterval(() => {
|
| 63 |
+
const elapsed = Date.now() - startTime;
|
| 64 |
+
const hours = Math.floor(elapsed / 3600000);
|
| 65 |
+
const minutes = Math.floor((elapsed % 3600000) / 60000);
|
| 66 |
+
|
| 67 |
+
const timerElement = document.querySelector('#fasting-timer');
|
| 68 |
+
if (timerElement) {
|
| 69 |
+
timerElement.textContent = `${hours}ชม. ${minutes}น.`;
|
| 70 |
+
}
|
| 71 |
+
}, 60000);
|
| 72 |
+
|
| 73 |
+
this.showNotification('จับเวลาการ IF เริ่มแล้ว!', 'teal');
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
// Real-time Data Updates
|
| 77 |
+
startRealTimeUpdates() {
|
| 78 |
+
// Simulate real-time vital changes
|
| 79 |
+
setInterval(() => {
|
| 80 |
+
this.updateVitalRings();
|
| 81 |
+
this.updateContextualData();
|
| 82 |
+
}, 30000); // Update every 30 seconds
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
updateVitalRings() {
|
| 86 |
+
const rings = [
|
| 87 |
+
{ selector: '.text-emerald-500', key: 'recovery', variance: 2 },
|
| 88 |
+
{ selector: '.text-orange-500', key: 'strain', variance: 0.5 },
|
| 89 |
+
{ selector: '.text-purple-500', key: 'sleep', variance: 3 }
|
| 90 |
+
];
|
| 91 |
+
|
| 92 |
+
rings.forEach(ring => {
|
| 93 |
+
const element = document.querySelector(ring.selector);
|
| 94 |
+
if (element) {
|
| 95 |
+
const currentValue = parseFloat(element.textContent);
|
| 96 |
+
const change = (Math.random() - 0.5) * ring.variance;
|
| 97 |
+
const newValue = Math.max(0, Math.min(100, currentValue + change));
|
| 98 |
+
element.textContent = ring.key === 'strain' ? newValue.toFixed(1) : Math.round(newValue) + '%';
|
| 99 |
+
}
|
| 100 |
+
});
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
updateContextualData() {
|
| 104 |
+
// Simulate AQI changes
|
| 105 |
+
const aqiElement = document.querySelector('contextual-vital[title="คุณภาพอากาศ"]');
|
| 106 |
+
if (aqiElement) {
|
| 107 |
+
const currentAQI = parseInt(aqiElement.getAttribute('value').match(/\d+/)[0]);
|
| 108 |
+
const newAQI = Math.max(30, Math.min(200, currentAQI + (Math.random() - 0.5) * 10));
|
| 109 |
+
const status = newAQI < 50 ? 'safe' : newAQI < 100 ? 'warning' : 'danger';
|
| 110 |
+
const statusText = status === 'safe' ? 'ดี' : status === 'warning' ? 'ปานกลาง' : 'ไม่ดี';
|
| 111 |
+
|
| 112 |
+
aqiElement.setAttribute('value', `${statusText} (${Math.round(newAQI)})`);
|
| 113 |
+
aqiElement.setAttribute('status', status);
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
// Vital Rings Animation
|
| 118 |
+
setupVitalRings() {
|
| 119 |
+
const rings = document.querySelectorAll('.relative.w-24.h-24');
|
| 120 |
+
rings.forEach((ring, index) => {
|
| 121 |
+
setTimeout(() => {
|
| 122 |
+
ring.classList.add('vital-pulse');
|
| 123 |
+
}, index * 200);
|
| 124 |
+
});
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
// AI Coach Interactions
|
| 128 |
+
setupAICoach() {
|
| 129 |
+
const aiButton = document.querySelector('.bg-gradient-to-r button');
|
| 130 |
+
if (aiButton) {
|
| 131 |
+
aiButton.addEventListener('click', () => {
|
| 132 |
+
this.showDetailedRecommendations();
|
| 133 |
+
});
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
showDetailedRecommendations() {
|
| 138 |
+
const modal = document.createElement('div');
|
| 139 |
+
modal.className = 'fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4';
|
| 140 |
+
modal.innerHTML = `
|
| 141 |
+
<div class="bg-white dark:bg-slate-800 rounded-2xl p-6 max-w-md w-full shadow-2xl">
|
| 142 |
+
<h3 class="text-lg font-semibold mb-4 text-slate-800 dark:text-white">คำแนะนำเพิ่มเติม</h3>
|
| 143 |
+
<div class="space-y-3 mb-4">
|
| 144 |
+
<div class="flex items-start space-x-3">
|
| 145 |
+
<i data-feather="shield" class="w-5 h-5 text-green-500 mt-1"></i>
|
| 146 |
+
<div>
|
| 147 |
+
<p class="text-sm font-medium text-slate-800 dark:text-white">ใส่หน้ากาก N95</p>
|
| 148 |
+
<p class="text-xs text-slate-500 dark:text-slate-400">เมื่อออกนอกบ้านในวันฝุ่นสูง</p>
|
| 149 |
+
</div>
|
| 150 |
+
</div>
|
| 151 |
+
<div class="flex items-start space-x-3">
|
| 152 |
+
<i data-feather="droplet" class="w-5 h-5 text-blue-500 mt-1"></i>
|
| 153 |
+
<div>
|
| 154 |
+
<p class="text-sm font-medium text-slate-800 dark:text-white">ดื่มน้ำมากขึ้น 20%</p>
|
| 155 |
+
<p class="text-xs text-slate-500 dark:text-slate-400">ช่วยขับสารพิษจากฝุ่น</p>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
+
<div class="flex items-start space-x-3">
|
| 159 |
+
<i data-feather="home" class="w-5 h-5 text-purple-500 mt-1"></i>
|
| 160 |
+
<div>
|
| 161 |
+
<p class="text-sm font-medium text-slate-800 dark:text-white">ใช้เครื่องฟอกอากาศ</p>
|
| 162 |
+
<p class="text-xs text-slate-500 dark:text-slate-400">อย่างน้อย 2 ชม. ก่อนนอน</p>
|
| 163 |
+
</div>
|
| 164 |
+
</div>
|
| 165 |
+
</div>
|
| 166 |
+
<button onclick="this.closest('.fixed').remove()" class="w-full bg-violet-600 text-white py-2 rounded-lg hover:bg-violet-700 transition">
|
| 167 |
+
ปิด
|
| 168 |
+
</button>
|
| 169 |
+
</div>
|
| 170 |
+
`;
|
| 171 |
+
document.body.appendChild(modal);
|
| 172 |
+
feather.replace();
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
// Notifications
|
| 176 |
+
showNotification(message, color = 'violet') {
|
| 177 |
+
const notification = document.createElement('div');
|
| 178 |
+
notification.className = `fixed top-20 right-4 z-50 transform translate-x-full transition-transform duration-300`;
|
| 179 |
+
notification.innerHTML = `
|
| 180 |
+
<div class="bg-${color}-500 text-white px-4 py-3 rounded-lg shadow-lg flex items-center space-x-2">
|
| 181 |
+
<i data-feather="check" class="w-4 h-4"></i>
|
| 182 |
+
<span class="text-sm">${message}</span>
|
| 183 |
+
</div>
|
| 184 |
+
`;
|
| 185 |
+
document.body.appendChild(notification);
|
| 186 |
+
|
| 187 |
+
setTimeout(() => {
|
| 188 |
+
notification.classList.remove('translate-x-full');
|
| 189 |
+
}, 100);
|
| 190 |
+
|
| 191 |
+
setTimeout(() => {
|
| 192 |
+
notification.classList.add('translate-x-full');
|
| 193 |
+
setTimeout(() => notification.remove(), 300);
|
| 194 |
+
}, 3000);
|
| 195 |
+
|
| 196 |
+
feather.replace();
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
// Data Persistence
|
| 200 |
+
loadUserData() {
|
| 201 |
+
const defaultData = {
|
| 202 |
+
recovery: 72,
|
| 203 |
+
strain: 14.2,
|
| 204 |
+
sleep: 85,
|
| 205 |
+
theme: 'light'
|
| 206 |
+
};
|
| 207 |
+
|
| 208 |
+
const saved = localStorage.getItem('pulseData');
|
| 209 |
+
return saved ? JSON.parse(saved) : defaultData;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
saveUserData() {
|
| 213 |
+
localStorage.setItem('pulseData', JSON.stringify(this.userData));
|
| 214 |
+
}
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
// Initialize App
|
| 218 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 219 |
+
new PulseApp();
|
| 220 |
+
});
|
| 221 |
+
|
| 222 |
+
// Global Utilities
|
| 223 |
+
window.showNotification = function(message, color) {
|
| 224 |
+
const notification = document.createElement('div');
|
| 225 |
+
notification.className = `fixed top-20 right-4 z-50 transform translate-x-full transition-transform duration-300`;
|
| 226 |
+
notification.innerHTML = `
|
| 227 |
+
<div class="bg-${color}-500 text-white px-4 py-3 rounded-lg shadow-lg flex items-center space-x-2">
|
| 228 |
+
<i data-feather="check" class="w-4 h-4"></i>
|
| 229 |
+
<span class="text-sm">${message}</span>
|
| 230 |
+
</div>
|
| 231 |
+
`;
|
| 232 |
+
document.body.appendChild(notification);
|
| 233 |
+
|
| 234 |
+
setTimeout(() => notification.classList.remove('translate-x-full'), 100);
|
| 235 |
+
setTimeout(() => {
|
| 236 |
+
notification.classList.add('translate-x-full');
|
| 237 |
+
setTimeout(() => notification.remove(), 300);
|
| 238 |
+
}, 3000);
|
| 239 |
+
|
| 240 |
+
feather.replace();
|
| 241 |
+
};
|
style.css
CHANGED
|
@@ -1,28 +1,231 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* ===== Thai-Inspired Custom CSS for Pulse App ===== */
|
| 2 |
+
|
| 3 |
+
/* Import Google Font - Noto Sans Thai */
|
| 4 |
+
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap');
|
| 5 |
+
|
| 6 |
+
/* Custom CSS Variables */
|
| 7 |
+
:root {
|
| 8 |
+
--thai-primary: #7c3aed; /* Violet-600 */
|
| 9 |
+
--thai-secondary: #f97316; /* Orange-500 */
|
| 10 |
+
--thai-accent: #14b8a6; /* Teal-500 */
|
| 11 |
+
--thai-gold: #fbbf24; /* Amber-400 */
|
| 12 |
+
--thai-danger: #ef4444; /* Red-500 */
|
| 13 |
+
--thai-warning: #f59e0b; /* Amber-500 */
|
| 14 |
+
--thai-success: #10b981; /* Emerald-500 */
|
| 15 |
+
|
| 16 |
+
/* Glassmorphism */
|
| 17 |
+
--glass-bg: rgba(255, 255, 255, 0.25);
|
| 18 |
+
--glass-border: rgba(255, 255, 255, 0.18);
|
| 19 |
+
--glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
/* Dark mode variables */
|
| 23 |
+
[data-theme="dark"] {
|
| 24 |
+
--glass-bg: rgba(30, 41, 59, 0.4);
|
| 25 |
+
--glass-border: rgba(255, 255, 255, 0.08);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/* Base Styles */
|
| 29 |
+
* {
|
| 30 |
+
font-family: 'Noto Sans Thai', 'Segoe UI', system-ui, sans-serif;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/* Smooth Scrolling */
|
| 34 |
+
html {
|
| 35 |
+
scroll-behavior: smooth;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/* Custom Scrollbar */
|
| 39 |
+
::-webkit-scrollbar {
|
| 40 |
+
width: 8px;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
::-webkit-scrollbar-track {
|
| 44 |
+
background: #f1f5f9;
|
| 45 |
+
border-radius: 4px;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
::-webkit-scrollbar-thumb {
|
| 49 |
+
background: var(--thai-primary);
|
| 50 |
+
border-radius: 4px;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.dark ::-webkit-scrollbar-track {
|
| 54 |
+
background: #1e293b;
|
| 55 |
}
|
| 56 |
|
| 57 |
+
.dark ::-webkit-scrollbar-thumb {
|
| 58 |
+
background: var(--thai-accent);
|
|
|
|
| 59 |
}
|
| 60 |
|
| 61 |
+
/* Glassmorphism Card Effect */
|
| 62 |
+
.glass-card {
|
| 63 |
+
background: var(--glass-bg);
|
| 64 |
+
backdrop-filter: blur(10px);
|
| 65 |
+
-webkit-backdrop-filter: blur(10px);
|
| 66 |
+
border: 1px solid var(--glass-border);
|
| 67 |
+
box-shadow: var(--glass-shadow);
|
| 68 |
}
|
| 69 |
|
| 70 |
+
/* Animated Gradient Background */
|
| 71 |
+
.animated-gradient {
|
| 72 |
+
background: linear-gradient(270deg, var(--thai-primary), var(--thai-secondary), var(--thai-accent));
|
| 73 |
+
background-size: 600% 600%;
|
| 74 |
+
animation: gradientShift 8s ease infinite;
|
|
|
|
| 75 |
}
|
| 76 |
|
| 77 |
+
@keyframes gradientShift {
|
| 78 |
+
0% { background-position: 0% 50%; }
|
| 79 |
+
50% { background-position: 100% 50%; }
|
| 80 |
+
100% { background-position: 0% 50%; }
|
| 81 |
}
|
| 82 |
+
|
| 83 |
+
/* Pulse Animation for Vital Rings */
|
| 84 |
+
@keyframes pulseRing {
|
| 85 |
+
0% { transform: scale(1); opacity: 1; }
|
| 86 |
+
50% { transform: scale(1.05); opacity: 0.7; }
|
| 87 |
+
100% { transform: scale(1); opacity: 1; }
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.vital-pulse {
|
| 91 |
+
animation: pulseRing 2s infinite;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
/* Floating Animation for Icons */
|
| 95 |
+
@keyframes float {
|
| 96 |
+
0% { transform: translateY(0px); }
|
| 97 |
+
50% { transform: translateY(-8px); }
|
| 98 |
+
100% { transform: translateY(0px); }
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
.float-icon {
|
| 102 |
+
animation: float 3s ease-in-out infinite;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
/* Thai-specific Text Styling */
|
| 106 |
+
.thai-headline {
|
| 107 |
+
line-height: 1.4;
|
| 108 |
+
letter-spacing: -0.01em;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
.thai-body {
|
| 112 |
+
line-height: 1.6;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/* Status Badge Colors */
|
| 116 |
+
.status-safe {
|
| 117 |
+
background: linear-gradient(135deg, #10b981, #059669);
|
| 118 |
+
color: white;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.status-warning {
|
| 122 |
+
background: linear-gradient(135deg, #f59e0b, #d97706);
|
| 123 |
+
color: white;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
.status-danger {
|
| 127 |
+
background: linear-gradient(135deg, #ef4444, #dc2626);
|
| 128 |
+
color: white;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
/* Button Hover Effects */
|
| 132 |
+
.btn-hover-lift {
|
| 133 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.btn-hover-lift:hover {
|
| 137 |
+
transform: translateY(-2px);
|
| 138 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
/* Insight Card Variants */
|
| 142 |
+
.insight-card-info {
|
| 143 |
+
border-left: 4px solid var(--thai-accent);
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
.insight-card-warning {
|
| 147 |
+
border-left: 4px solid var(--thai-warning);
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
.insight-card-danger {
|
| 151 |
+
border-left: 4px solid var(--thai-danger);
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
/* Progress Ring Animation */
|
| 155 |
+
.progress-ring {
|
| 156 |
+
transition: stroke-dashoffset 0.5s ease-in-out;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/* Loading Skeleton */
|
| 160 |
+
.skeleton {
|
| 161 |
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
| 162 |
+
background-size: 200% 100%;
|
| 163 |
+
animation: loading 1.5s infinite;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
.dark .skeleton {
|
| 167 |
+
background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
@keyframes loading {
|
| 171 |
+
0% { background-position: 200% 0; }
|
| 172 |
+
100% { background-position: -200% 0; }
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
/* Responsive Typography */
|
| 176 |
+
@media (max-width: 640px) {
|
| 177 |
+
.thai-headline {
|
| 178 |
+
font-size: 1.5rem;
|
| 179 |
+
line-height: 1.3;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
.vital-ring {
|
| 183 |
+
width: 5rem;
|
| 184 |
+
height: 5rem;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
.vital-ring .text-2xl {
|
| 188 |
+
font-size: 1.25rem;
|
| 189 |
+
}
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
/* Desktop Enhancements */
|
| 193 |
+
@media (min-width: 1024px) {
|
| 194 |
+
main {
|
| 195 |
+
max-width: 1200px;
|
| 196 |
+
margin: 0 auto;
|
| 197 |
+
padding-top: 1rem;
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
.dashboard-grid {
|
| 201 |
+
grid-template-columns: repeat(3, 1fr);
|
| 202 |
+
}
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
/* Focus Styles for Accessibility */
|
| 206 |
+
button:focus-visible,
|
| 207 |
+
a:focus-visible {
|
| 208 |
+
outline: 2px solid var(--thai-accent);
|
| 209 |
+
outline-offset: 2px;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
/* Reduced Motion */
|
| 213 |
+
@media (prefers-reduced-motion: reduce) {
|
| 214 |
+
* {
|
| 215 |
+
animation-duration: 0.01ms !important;
|
| 216 |
+
animation-iteration-count: 1 !important;
|
| 217 |
+
transition-duration: 0.01ms !important;
|
| 218 |
+
}
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
/* Print Styles */
|
| 222 |
+
@media print {
|
| 223 |
+
.no-print {
|
| 224 |
+
display: none !important;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
.glass-card {
|
| 228 |
+
background: white !important;
|
| 229 |
+
border: 1px solid #ddd !important;
|
| 230 |
+
}
|
| 231 |
+
}
|