Spaces:
Sleeping
Sleeping
Update web/profile.html
Browse files- web/profile.html +335 -571
web/profile.html
CHANGED
|
@@ -5,620 +5,384 @@
|
|
| 5 |
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
| 6 |
<title>Profile - CTRL + ALT + HEAL</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
-
<
|
| 9 |
-
:root {
|
| 10 |
-
--tropical-indigo: rgb(120, 187, 242);
|
| 11 |
-
--wisteria: rgb(197, 217, 251);
|
| 12 |
-
--latte-cream: #ffffff;
|
| 13 |
-
}
|
| 14 |
-
body {
|
| 15 |
-
font-family: "Rubik", sans-serif;
|
| 16 |
-
background-color: var(--latte-cream);
|
| 17 |
-
color: #333;
|
| 18 |
-
}
|
| 19 |
-
.btn-primary {
|
| 20 |
-
background-color: var(--tropical-indigo);
|
| 21 |
-
color: white;
|
| 22 |
-
transition: 0.3s;
|
| 23 |
-
}
|
| 24 |
-
.btn-primary:hover {
|
| 25 |
-
background-color: var(--wisteria);
|
| 26 |
-
color: #333;
|
| 27 |
-
}
|
| 28 |
-
.avatar {
|
| 29 |
-
width: 128px;
|
| 30 |
-
height: 128px;
|
| 31 |
-
border-radius: 50%;
|
| 32 |
-
object-fit: cover;
|
| 33 |
-
cursor: pointer;
|
| 34 |
-
background-color: #e5e7eb;
|
| 35 |
-
}
|
| 36 |
-
</style>
|
| 37 |
</head>
|
| 38 |
-
<body class="text-gray-800 min-h-screen
|
| 39 |
<!-- Navbar -->
|
| 40 |
-
<nav
|
| 41 |
-
class="
|
| 42 |
-
|
| 43 |
-
<div
|
| 44 |
-
class="max-w-6xl mx-auto px-6 py-4 flex justify-between items-center"
|
| 45 |
-
>
|
| 46 |
-
<a
|
| 47 |
-
href="index.html"
|
| 48 |
-
class="text-2xl font-bold hover:text-[var(--tropical-indigo)] transition"
|
| 49 |
>CTRL + ALT + HEAL</a
|
| 50 |
>
|
| 51 |
-
<ul class="
|
| 52 |
-
<li><a href="index.html">Home</a></li>
|
| 53 |
-
<li
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
<li
|
|
|
|
|
|
|
|
|
|
| 57 |
</ul>
|
| 58 |
-
<button id="hamburger" class="md:hidden text-2xl">☰</button>
|
| 59 |
</div>
|
| 60 |
</nav>
|
| 61 |
|
| 62 |
-
<
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
<
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
</div>
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
<div class="flex
|
| 83 |
-
<!--
|
| 84 |
-
<div
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
| 96 |
<input
|
| 97 |
-
type="
|
| 98 |
-
id="
|
| 99 |
-
|
| 100 |
-
class="hidden"
|
| 101 |
/>
|
| 102 |
-
<button
|
| 103 |
-
id="editProfileBtn"
|
| 104 |
-
class="btn-primary px-4 py-2 rounded"
|
| 105 |
-
>
|
| 106 |
-
Edit Profile
|
| 107 |
-
</button>
|
| 108 |
-
</div>
|
| 109 |
-
<div class="flex-1 flex flex-col justify-start space-y-2">
|
| 110 |
-
<h1 class="text-3xl font-semibold text-gray-800">
|
| 111 |
-
Your Profile
|
| 112 |
-
</h1>
|
| 113 |
-
<p class="text-gray-700">
|
| 114 |
-
Name: <span id="userName" class="font-medium"></span>
|
| 115 |
-
</p>
|
| 116 |
-
<p class="text-gray-700">
|
| 117 |
-
DOB: <span id="userDOB" class="font-medium"></span>
|
| 118 |
-
</p>
|
| 119 |
-
<p class="text-gray-700">
|
| 120 |
-
Big Things We Should Fix:
|
| 121 |
-
<span id="userFix" class="font-medium"></span>
|
| 122 |
-
</p>
|
| 123 |
-
<p class="text-gray-700">
|
| 124 |
-
Health Goals: <span id="userGoals" class="font-medium"></span>
|
| 125 |
-
</p>
|
| 126 |
-
<p class="text-gray-700">
|
| 127 |
-
Bio:
|
| 128 |
-
<span id="userBio" class="font-medium">No bio yet 📝</span>
|
| 129 |
-
</p>
|
| 130 |
</div>
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
class="hidden bg-white shadow rounded-lg p-6 flex-1 flex flex-col justify-between"
|
| 138 |
-
>
|
| 139 |
-
<div class="flex flex-col sm:flex-row items-start space-x-6">
|
| 140 |
-
<div class="flex flex-col items-center mb-4 sm:mb-0">
|
| 141 |
-
<img
|
| 142 |
-
id="editProfilePic"
|
| 143 |
-
class="avatar"
|
| 144 |
-
src=""
|
| 145 |
-
alt="Profile Picture"
|
| 146 |
-
/>
|
| 147 |
<input
|
| 148 |
-
type="
|
| 149 |
-
id="
|
| 150 |
-
|
| 151 |
-
class="hidden"
|
| 152 |
/>
|
| 153 |
</div>
|
| 154 |
-
<div class="flex-1">
|
| 155 |
-
<h1 class="text-3xl font-semibold text-gray-800 mb-4">
|
| 156 |
-
Edit Profile
|
| 157 |
-
</h1>
|
| 158 |
-
<div class="space-y-4">
|
| 159 |
-
<div>
|
| 160 |
-
<label
|
| 161 |
-
for="inputName"
|
| 162 |
-
class="block text-sm font-medium text-gray-600"
|
| 163 |
-
>Name</label
|
| 164 |
-
>
|
| 165 |
-
<input
|
| 166 |
-
type="text"
|
| 167 |
-
id="inputName"
|
| 168 |
-
class="w-full border border-gray-300 rounded px-3 py-2 focus:ring-2 focus:ring-[var(--tropical-indigo)] focus:outline-none"
|
| 169 |
-
/>
|
| 170 |
-
</div>
|
| 171 |
-
<div>
|
| 172 |
-
<label
|
| 173 |
-
for="inputDOB"
|
| 174 |
-
class="block text-sm font-medium text-gray-600"
|
| 175 |
-
>Date of Birth</label
|
| 176 |
-
>
|
| 177 |
-
<input
|
| 178 |
-
type="date"
|
| 179 |
-
id="inputDOB"
|
| 180 |
-
class="w-full border border-gray-300 rounded px-3 py-2 focus:ring-2 focus:ring-[var(--tropical-indigo)] focus:outline-none"
|
| 181 |
-
/>
|
| 182 |
-
</div>
|
| 183 |
-
<div>
|
| 184 |
-
<label
|
| 185 |
-
for="inputFix"
|
| 186 |
-
class="block text-sm font-medium text-gray-600"
|
| 187 |
-
>Big Things We Should Fix</label
|
| 188 |
-
>
|
| 189 |
-
<textarea
|
| 190 |
-
id="inputFix"
|
| 191 |
-
rows="2"
|
| 192 |
-
class="w-full border border-gray-300 rounded px-3 py-2 focus:ring-2 focus:ring-[var(--tropical-indigo)] focus:outline-none"
|
| 193 |
-
></textarea>
|
| 194 |
-
</div>
|
| 195 |
-
<div>
|
| 196 |
-
<label
|
| 197 |
-
for="inputGoals"
|
| 198 |
-
class="block text-sm font-medium text-gray-600"
|
| 199 |
-
>Health Goals</label
|
| 200 |
-
>
|
| 201 |
-
<textarea
|
| 202 |
-
id="inputGoals"
|
| 203 |
-
rows="2"
|
| 204 |
-
class="w-full border border-gray-300 rounded px-3 py-2 focus:ring-2 focus:ring-[var(--tropical-indigo)] focus:outline-none"
|
| 205 |
-
></textarea>
|
| 206 |
-
</div>
|
| 207 |
-
</div>
|
| 208 |
-
<div class="flex space-x-2 mt-4">
|
| 209 |
-
<button
|
| 210 |
-
id="saveProfileBtn"
|
| 211 |
-
class="btn-primary px-4 py-2 rounded"
|
| 212 |
-
>
|
| 213 |
-
Save
|
| 214 |
-
</button>
|
| 215 |
-
<button
|
| 216 |
-
id="cancelProfileBtn"
|
| 217 |
-
class="bg-gray-300 text-gray-700 px-4 py-2 rounded hover:bg-gray-400 transition"
|
| 218 |
-
>
|
| 219 |
-
Cancel
|
| 220 |
-
</button>
|
| 221 |
-
</div>
|
| 222 |
</div>
|
| 223 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
</div>
|
| 225 |
</div>
|
| 226 |
-
|
| 227 |
-
<!-- RIGHT: Mini Stats -->
|
| 228 |
-
<div class="w-full lg:w-1/3 flex flex-col justify-between gap-4">
|
| 229 |
-
<!-- Reports Uploaded -->
|
| 230 |
-
<div class="bg-white shadow rounded-lg p-4 flex-1 flex items-center gap-2">
|
| 231 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-[var(--tropical-indigo)]" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
| 232 |
-
<path stroke-linecap="round" stroke-linejoin="round" d="M3 7h5l2 3h11v11H3V7z" />
|
| 233 |
-
</svg>
|
| 234 |
-
<div class="flex-1">
|
| 235 |
-
<p class="text-sm text-gray-500">Reports Uploaded</p>
|
| 236 |
-
<p class="font-semibold text-lg" id="reportsCount">0</p>
|
| 237 |
-
</div>
|
| 238 |
-
</div>
|
| 239 |
-
|
| 240 |
-
<!-- Tests In Range -->
|
| 241 |
-
<div class="bg-white shadow rounded-lg p-4 flex-1 flex items-center gap-2">
|
| 242 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-green-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
| 243 |
-
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
|
| 244 |
-
</svg>
|
| 245 |
-
<div class="flex-1">
|
| 246 |
-
<p class="text-sm text-gray-500">Tests In Range In Latest Report</p>
|
| 247 |
-
<p class="font-semibold text-lg" id="testsInRange">0</p>
|
| 248 |
-
</div>
|
| 249 |
-
</div>
|
| 250 |
-
|
| 251 |
-
<!-- Tests Out of Range -->
|
| 252 |
-
<div class="bg-white shadow rounded-lg p-4 flex-1 flex items-center gap-2">
|
| 253 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-red-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
| 254 |
-
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
| 255 |
-
</svg>
|
| 256 |
-
<div class="flex-1">
|
| 257 |
-
<p class="text-sm text-gray-500">Tests Out of Range In Latest Report</p>
|
| 258 |
-
<p class="font-semibold text-lg" id="testsOutOfRange">0</p>
|
| 259 |
-
</div>
|
| 260 |
-
</div>
|
| 261 |
-
</div>
|
| 262 |
-
|
| 263 |
-
|
| 264 |
</div>
|
| 265 |
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
|
| 270 |
-
<!--
|
| 271 |
-
<div class="
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
class="text-blue-600 hover:underline hidden"
|
| 282 |
-
>sample_report.pdf</a
|
| 283 |
>
|
| 284 |
-
|
| 285 |
-
<
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
Past Reports
|
| 300 |
-
</h3>
|
| 301 |
-
<div id="pastReportsSection" class="flex flex-col gap-4 ">
|
| 302 |
-
<!-- Report 3 -->
|
| 303 |
-
<div class="flex flex-col bg-[var(--wisteria)] p-4 rounded-lg shadow hover:shadow-md transition">
|
| 304 |
-
<div class="flex justify-between items-center cursor-pointer report-header" onclick="toggleDetails(this)">
|
| 305 |
-
<div class="flex items-center gap-3">
|
| 306 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-[var(--tropical-indigo)]" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
| 307 |
-
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" />
|
| 308 |
-
</svg>
|
| 309 |
-
<p class="font-medium text-gray-800">Annual_Physical_Mar2025.pdf</p>
|
| 310 |
-
</div>
|
| 311 |
-
<div class="flex gap-2 flex-shrink-0">
|
| 312 |
-
<span class="px-2 py-1 rounded-full bg-green-200 text-green-800 text-xs font-semibold">In Range: 2</span>
|
| 313 |
-
<span class="px-2 py-1 rounded-full bg-red-200 text-red-800 text-xs font-semibold">Out of Range: 0</span>
|
| 314 |
-
</div>
|
| 315 |
-
</div>
|
| 316 |
-
<div class="report-details mt-2 hidden w-full bg-white rounded p-3 border border-gray-300 text-gray-700">
|
| 317 |
-
<ul class="space-y-4 text-sm">
|
| 318 |
-
<li>
|
| 319 |
-
<div class="flex justify-between mb-1">
|
| 320 |
-
<span>Hemoglobin: 14.2 g/dL</span>
|
| 321 |
-
<span class="text-xs text-gray-500">(12-16)</span>
|
| 322 |
-
</div>
|
| 323 |
-
<div class="relative w-full h-4 bg-gray-200 rounded">
|
| 324 |
-
<div class="absolute h-4 rounded bg-green-400" style="width: 70.5%;"></div>
|
| 325 |
-
<span class="absolute -top-5 text-xs font-semibold text-gray-800" style="left: 70.5%;">14.2</span>
|
| 326 |
-
<div class="absolute top-full left-0 w-full flex justify-between mt-1 text-xs text-gray-500">
|
| 327 |
-
<span>12</span>
|
| 328 |
-
<span>16</span>
|
| 329 |
-
</div>
|
| 330 |
-
</div>
|
| 331 |
-
</li>
|
| 332 |
-
<li>
|
| 333 |
-
<div class="flex justify-between mb-1">
|
| 334 |
-
<span>Cholesterol: 180 mg/dL</span>
|
| 335 |
-
<span class="text-xs text-gray-500">(125-200)</span>
|
| 336 |
-
</div>
|
| 337 |
-
<div class="relative w-full h-6 bg-gray-200 rounded overflow-hidden">
|
| 338 |
-
<div class="absolute h-6 rounded bg-green-400" style="width: 90%;"></div>
|
| 339 |
-
<span class="absolute top-1/2 transform -translate-y-1/2 text-xs font-semibold text-gray-800" style="left: 90%;">180</span>
|
| 340 |
-
<div class="absolute top-full left-0 w-full flex justify-between mt-1 text-xs text-gray-500">
|
| 341 |
-
<span>125</span>
|
| 342 |
-
<span>200</span>
|
| 343 |
-
</div>
|
| 344 |
-
</div>
|
| 345 |
-
</li>
|
| 346 |
-
</ul>
|
| 347 |
-
</div>
|
| 348 |
-
</div>
|
| 349 |
-
<!-- Report 2 -->
|
| 350 |
-
<div class="flex flex-col bg-[var(--wisteria)] p-4 rounded-lg shadow hover:shadow-md transition">
|
| 351 |
-
<div class="flex justify-between items-center cursor-pointer report-header" onclick="toggleDetails(this)">
|
| 352 |
-
<div class="flex items-center gap-3">
|
| 353 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-[var(--tropical-indigo)]" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
| 354 |
-
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" />
|
| 355 |
-
</svg>
|
| 356 |
-
<p class="font-medium text-gray-800">Checkup_Feb2025.pdf</p>
|
| 357 |
-
</div>
|
| 358 |
-
<div class="flex gap-2 flex-shrink-0">
|
| 359 |
-
<span class="px-2 py-1 rounded-full bg-green-200 text-green-800 text-xs font-semibold">In Range: 1</span>
|
| 360 |
-
<span class="px-2 py-1 rounded-full bg-red-200 text-red-800 text-xs font-semibold">Out of Range: 1</span>
|
| 361 |
-
</div>
|
| 362 |
-
</div>
|
| 363 |
-
<div class="report-details mt-2 hidden w-full bg-white rounded p-3 border border-gray-300 text-gray-700">
|
| 364 |
-
<ul class="space-y-4 text-sm">
|
| 365 |
-
<li>
|
| 366 |
-
<div class="flex justify-between mb-1">
|
| 367 |
-
<span>Glucose: 105 mg/dL</span>
|
| 368 |
-
<span class="text-xs text-gray-500">(70-99)</span>
|
| 369 |
-
</div>
|
| 370 |
-
<div class="relative w-full h-4 bg-gray-200 rounded">
|
| 371 |
-
<div class="absolute h-4 rounded bg-red-400" style="width: calc(105/99*100%);"></div>
|
| 372 |
-
<span class="absolute -top-5 text-xs font-semibold text-gray-800" style="left: 100%;">105</span>
|
| 373 |
-
<div class="absolute top-full left-0 w-full flex justify-between mt-1 text-xs text-gray-500">
|
| 374 |
-
<span>70</span>
|
| 375 |
-
<span>99</span>
|
| 376 |
-
</div>
|
| 377 |
-
</div>
|
| 378 |
-
</li>
|
| 379 |
-
<li>
|
| 380 |
-
<div class="flex justify-between mb-1">
|
| 381 |
-
<span>Vitamin D: 40 ng/mL</span>
|
| 382 |
-
<span class="text-xs text-gray-500">(30-100)</span>
|
| 383 |
-
</div>
|
| 384 |
-
<div class="relative w-full h-4 bg-gray-200 rounded">
|
| 385 |
-
<div class="absolute h-4 rounded bg-green-400" style="width: 12.5%;"></div>
|
| 386 |
-
<span class="absolute -top-5 text-xs font-semibold text-gray-800" style="left: 12.5%;">40</span>
|
| 387 |
-
<div class="absolute top-full left-0 w-full flex justify-between mt-1 text-xs text-gray-500">
|
| 388 |
-
<span>30</span>
|
| 389 |
-
<span>100</span>
|
| 390 |
-
</div>
|
| 391 |
-
</div>
|
| 392 |
-
</li>
|
| 393 |
-
</ul>
|
| 394 |
-
</div>
|
| 395 |
-
</div>
|
| 396 |
-
<!-- Report 1 -->
|
| 397 |
-
<div class="flex flex-col bg-[var(--wisteria)] p-4 rounded-lg shadow hover:shadow-md transition">
|
| 398 |
-
<div class="flex justify-between items-center cursor-pointer report-header" onclick="toggleDetails(this)">
|
| 399 |
-
<div class="flex items-center gap-3">
|
| 400 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-[var(--tropical-indigo)]" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
| 401 |
-
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" />
|
| 402 |
-
</svg>
|
| 403 |
-
<p class="font-medium text-gray-800">Bloodwork_Jan2025.pdf</p>
|
| 404 |
-
</div>
|
| 405 |
-
<div class="flex gap-2 flex-shrink-0">
|
| 406 |
-
<span class="px-2 py-1 rounded-full bg-green-200 text-green-800 text-xs font-semibold">In Range: 1</span>
|
| 407 |
-
<span class="px-2 py-1 rounded-full bg-red-200 text-red-800 text-xs font-semibold">Out of Range: 1</span>
|
| 408 |
-
</div>
|
| 409 |
-
</div>
|
| 410 |
-
<div class="report-details mt-2 hidden w-full bg-white rounded p-3 border border-gray-300 text-gray-700">
|
| 411 |
-
<ul class="space-y-4 text-sm">
|
| 412 |
-
<li>
|
| 413 |
-
<div class="flex justify-between mb-1">
|
| 414 |
-
<span>Hemoglobin: 13.5 g/dL</span>
|
| 415 |
-
<span class="text-xs text-gray-500">(12-16)</span>
|
| 416 |
</div>
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
<
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
|
|
|
| 430 |
</div>
|
| 431 |
-
|
| 432 |
-
<div class="absolute h-6 rounded" style="width: calc(min(210/200*100%, 100%)); background-color: #f87171;"></div>
|
| 433 |
-
<span class="absolute top-1/2 transform -translate-y-1/2 text-xs font-semibold text-gray-800" style="left: calc(min(210/200*100%, 95%));">210</span>
|
| 434 |
-
<div class="absolute top-full left-0 w-full flex justify-between mt-1 text-xs text-gray-500">
|
| 435 |
-
<span>125</span>
|
| 436 |
-
<span>200</span>
|
| 437 |
-
</div>
|
| 438 |
-
</div>
|
| 439 |
-
</li>
|
| 440 |
-
</ul>
|
| 441 |
-
</div>
|
| 442 |
-
</div>
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
</div>
|
| 449 |
-
</div>
|
| 450 |
-
|
| 451 |
-
<script>
|
| 452 |
-
function toggleDetails(element) {
|
| 453 |
-
const details = element.parentElement.querySelector('.report-details');
|
| 454 |
-
if (details) details.classList.toggle('hidden');
|
| 455 |
-
}
|
| 456 |
-
</script>
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
</main>
|
| 461 |
-
|
| 462 |
-
|
| 463 |
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
<p>© 2025 CTRL + ALT + HEAL. All rights reserved.</p>
|
| 469 |
-
<div class="flex space-x-4 mt-3 md:mt-0">
|
| 470 |
-
<a href="#" class="hover:text-[var(--tropical-indigo)] transition"
|
| 471 |
-
>Privacy Policy</a
|
| 472 |
-
>
|
| 473 |
-
<a href="#" class="hover:text-[var(--tropical-indigo)] transition"
|
| 474 |
-
>Terms of Service</a
|
| 475 |
-
>
|
| 476 |
</div>
|
| 477 |
</div>
|
| 478 |
-
</
|
| 479 |
-
|
| 480 |
-
<script>
|
| 481 |
-
// Profile Section
|
| 482 |
-
const profileView = document.getElementById("profileViewSection");
|
| 483 |
-
const profileEdit = document.getElementById("profileEditSection");
|
| 484 |
-
const editBtn = document.getElementById("editProfileBtn");
|
| 485 |
-
const saveBtn = document.getElementById("saveProfileBtn");
|
| 486 |
-
const cancelBtn = document.getElementById("cancelProfileBtn");
|
| 487 |
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 492 |
|
| 493 |
-
const
|
| 494 |
-
const
|
| 495 |
-
const
|
| 496 |
-
const editFileInput = document.getElementById("editFileInput");
|
| 497 |
|
| 498 |
-
|
| 499 |
-
inputName.value = localStorage.getItem("userName") || "";
|
| 500 |
-
inputDOB.value = localStorage.getItem("userDOB") || "";
|
| 501 |
-
inputFix.value = localStorage.getItem("userFix") || "";
|
| 502 |
-
inputGoals.value = localStorage.getItem("userGoals") || "";
|
| 503 |
-
profileView.classList.add("hidden");
|
| 504 |
-
profileEdit.classList.remove("hidden");
|
| 505 |
-
});
|
| 506 |
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 510 |
});
|
| 511 |
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 526 |
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 530 |
|
| 531 |
-
profilePic.addEventListener("click", () => fileInput.click());
|
| 532 |
-
editProfilePic.addEventListener("click", () => editFileInput.click());
|
| 533 |
|
| 534 |
-
function
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
|
|
|
| 541 |
}
|
| 542 |
|
| 543 |
-
fileInput.addEventListener("change", (e) => {
|
| 544 |
-
if (e.target.files[0]) handleFileUpload(e.target.files[0], profilePic);
|
| 545 |
-
});
|
| 546 |
-
editFileInput.addEventListener("change", (e) => {
|
| 547 |
-
if (e.target.files[0])
|
| 548 |
-
handleFileUpload(e.target.files[0], editProfilePic);
|
| 549 |
-
});
|
| 550 |
-
|
| 551 |
-
// Load saved profile
|
| 552 |
document.addEventListener("DOMContentLoaded", () => {
|
| 553 |
-
document.getElementById("userName").textContent =
|
| 554 |
-
localStorage.getItem("userName") || "Name";
|
| 555 |
-
document.getElementById("userDOB").textContent =
|
| 556 |
-
localStorage.getItem("userDOB") || "DOB";
|
| 557 |
-
document.getElementById("userFix").textContent =
|
| 558 |
-
localStorage.getItem("userFix") || "None set";
|
| 559 |
-
document.getElementById("userGoals").textContent =
|
| 560 |
-
localStorage.getItem("userGoals") || "None set";
|
| 561 |
|
| 562 |
-
const
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 566 |
}
|
| 567 |
-
});
|
| 568 |
-
const pastReportsSection = document.getElementById("pastReportsSection");
|
| 569 |
-
const togglePastReportsBtn = document.getElementById("togglePastReportsBtn");
|
| 570 |
-
|
| 571 |
-
togglePastReportsBtn.addEventListener("click", () => {
|
| 572 |
-
pastReportsSection.classList.toggle("hidden");
|
| 573 |
-
});
|
| 574 |
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
}
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 618 |
});
|
| 619 |
-
|
| 620 |
-
updateMiniStats();
|
| 621 |
-
|
| 622 |
</script>
|
| 623 |
</body>
|
| 624 |
-
</html>
|
|
|
|
| 5 |
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
| 6 |
<title>Profile - CTRL + ALT + HEAL</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
</head>
|
| 10 |
+
<body class="bg-[#F7F8F9] text-gray-800 min-h-screen">
|
| 11 |
<!-- Navbar -->
|
| 12 |
+
<nav class="bg-white border border-gray-200 px-6 py-4 mb-6">
|
| 13 |
+
<div class="container mx-auto flex justify-between items-center">
|
| 14 |
+
<a href="index.html" class="text-2xl font-bold text-[#6B9080]"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
>CTRL + ALT + HEAL</a
|
| 16 |
>
|
| 17 |
+
<ul class="flex space-x-6 text-sm font-medium text-gray-700">
|
| 18 |
+
<li><a href="index.html" class="hover:text-[#6B9080]">Home</a></li>
|
| 19 |
+
<li>
|
| 20 |
+
<a href="analyzer.html" class="hover:text-[#6B9080]">Analyzer</a>
|
| 21 |
+
</li>
|
| 22 |
+
<li>
|
| 23 |
+
<a href="profile.html" class="hover:text-[#6B9080]">Profile</a>
|
| 24 |
+
</li>
|
| 25 |
+
<li><button onclick="logout()" class="text-red-500">Logout</button></li>
|
| 26 |
</ul>
|
|
|
|
| 27 |
</div>
|
| 28 |
</nav>
|
| 29 |
|
| 30 |
+
<div class="container mx-auto px-6">
|
| 31 |
+
<!-- VIEW MODE -->
|
| 32 |
+
<div id="profileViewSection">
|
| 33 |
+
<div class="flex items-start space-x-6 mb-10">
|
| 34 |
+
<!-- Avatar & Edit Button -->
|
| 35 |
+
<div class="flex flex-col items-center">
|
| 36 |
+
<div class="w-32 h-32 bg-gray-300 rounded-full"></div>
|
| 37 |
+
<button
|
| 38 |
+
id="editProfileBtn"
|
| 39 |
+
class="mt-2 bg-[#6B9080] text-white px-4 py-2 rounded hover:bg-[#5b7e6a] transition"
|
| 40 |
+
>
|
| 41 |
+
Edit Profile
|
| 42 |
+
</button>
|
| 43 |
+
<a href="analyzer.html"
|
| 44 |
+
><button
|
| 45 |
+
class="mt-2 bg-[#6B9080] text-white px-4 py-2 rounded hover:bg-[#5b7e6a] transition"
|
| 46 |
+
>
|
| 47 |
+
Go To Analyzer
|
| 48 |
+
</button>
|
| 49 |
+
</a>
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
<!-- User Info -->
|
| 55 |
+
<div>
|
| 56 |
+
<h1 class="text-3xl font-semibold text-gray-800 mb-4">
|
| 57 |
+
Your Profile
|
| 58 |
+
</h1>
|
| 59 |
+
<p class="text-gray-700 mb-2">
|
| 60 |
+
Name: <span id="userName" class="font-medium">Loading...</span>
|
| 61 |
+
</p>
|
| 62 |
+
<p class="text-gray-700 mb-2">
|
| 63 |
+
DOB: <span id="userDOB" class="font-medium">Loding...</span>
|
| 64 |
+
</p>
|
| 65 |
+
<!-- <p class="text-gray-700 mb-2">
|
| 66 |
+
Big Things We Should Fix:
|
| 67 |
+
<span id="userFix" class="font-medium"></span>
|
| 68 |
+
</p>
|
| 69 |
+
<p class="text-gray-700 mb-6">
|
| 70 |
+
Health Goals: <span id="userGoals" class="font-medium"></span>
|
| 71 |
+
</p> -->
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
</div>
|
| 75 |
+
|
| 76 |
+
<!-- EDIT MODE -->
|
| 77 |
+
<div id="profileEditSection" class="hidden mb-10">
|
| 78 |
+
<div class="flex flex-col sm:flex-row items-start space-x-6">
|
| 79 |
+
<!-- Avatar Placeholder -->
|
| 80 |
+
<div class="flex flex-col items-center mb-4 sm:mb-0">
|
| 81 |
+
<div class="w-32 h-32 bg-gray-300 rounded-full"></div>
|
| 82 |
+
</div>
|
| 83 |
+
<!-- Edit Form -->
|
| 84 |
+
<div class="flex-1">
|
| 85 |
+
<h1 class="text-3xl font-semibold text-gray-800 mb-4">
|
| 86 |
+
Edit Profile
|
| 87 |
+
</h1>
|
| 88 |
+
<div class="space-y-4">
|
| 89 |
+
<div>
|
| 90 |
+
<label
|
| 91 |
+
for="inputName"
|
| 92 |
+
class="block text-sm font-medium text-gray-600"
|
| 93 |
+
>Name</label
|
| 94 |
+
>
|
| 95 |
<input
|
| 96 |
+
type="text"
|
| 97 |
+
id="inputName"
|
| 98 |
+
class="w-full border border-gray-300 rounded px-3 py-2 focus:ring-2 focus:ring-[#6B9080] focus:outline-none"
|
|
|
|
| 99 |
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
</div>
|
| 101 |
+
<div>
|
| 102 |
+
<label
|
| 103 |
+
for="inputDOB"
|
| 104 |
+
class="block text-sm font-medium text-gray-600"
|
| 105 |
+
>Date of Birth</label
|
| 106 |
+
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
<input
|
| 108 |
+
type="date"
|
| 109 |
+
id="inputDOB"
|
| 110 |
+
class="w-full border border-gray-300 rounded px-3 py-2 focus:ring-2 focus:ring-[#6B9080] focus:outline-none"
|
|
|
|
| 111 |
/>
|
| 112 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
</div>
|
| 114 |
</div>
|
| 115 |
+
<div class="flex space-x-2 mt-4">
|
| 116 |
+
<button
|
| 117 |
+
id="saveProfileBtn"
|
| 118 |
+
class="bg-[#6B9080] text-white px-4 py-2 rounded hover:bg-[#5b7e6a] transition"
|
| 119 |
+
>
|
| 120 |
+
Save
|
| 121 |
+
</button>
|
| 122 |
+
<button
|
| 123 |
+
id="cancelProfileBtn"
|
| 124 |
+
class="bg-gray-300 text-gray-700 px-4 py-2 rounded hover:bg-gray-400 transition"
|
| 125 |
+
>
|
| 126 |
+
Cancel
|
| 127 |
+
</button>
|
| 128 |
+
</div>
|
| 129 |
</div>
|
| 130 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
</div>
|
| 132 |
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
+
<!-- Chart Section -->
|
| 135 |
+
<div class="mt-10" id="chartSection">
|
| 136 |
+
<!-- Card Wrapper -->
|
| 137 |
+
<div class="bg-white border border-gray-200 rounded-lg p-6 mb-6">
|
| 138 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">
|
| 139 |
+
Health Progress
|
| 140 |
+
</h2>
|
| 141 |
+
|
| 142 |
+
<!-- Controls Row -->
|
| 143 |
+
<div
|
| 144 |
+
class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6"
|
|
|
|
|
|
|
| 145 |
>
|
| 146 |
+
<!-- Date & Score Inputs -->
|
| 147 |
+
<div class="flex flex-1 gap-2">
|
| 148 |
+
<input
|
| 149 |
+
type="date"
|
| 150 |
+
id="entryDate"
|
| 151 |
+
class="flex-1 border border-gray-300 rounded px-3 py-2 focus:ring-2 focus:ring-[#6B9080] focus:outline-none"
|
| 152 |
+
/>
|
| 153 |
+
<input
|
| 154 |
+
type="number"
|
| 155 |
+
id="entryScore"
|
| 156 |
+
min="0"
|
| 157 |
+
max="100"
|
| 158 |
+
placeholder="Score"
|
| 159 |
+
class="w-24 border border-gray-300 rounded px-3 py-2 focus:ring-2 focus:ring-[#6B9080] focus:outline-none"
|
| 160 |
+
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
</div>
|
| 162 |
+
<!-- Buttons -->
|
| 163 |
+
<div class="flex gap-2">
|
| 164 |
+
<button
|
| 165 |
+
id="addEntryBtn"
|
| 166 |
+
class="bg-[#6B9080] text-white px-4 py-2 rounded hover:bg-[#5b7e6a] transition"
|
| 167 |
+
>
|
| 168 |
+
Add Entry
|
| 169 |
+
</button>
|
| 170 |
+
<button
|
| 171 |
+
id="resetChartBtn"
|
| 172 |
+
class="bg-red-500 text-white px-4 py-2 rounded hover:bg-red-600 transition"
|
| 173 |
+
>
|
| 174 |
+
Reset Chart
|
| 175 |
+
</button>
|
| 176 |
</div>
|
| 177 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
|
| 179 |
+
<!-- Chart Canvas -->
|
| 180 |
+
<div class="overflow-x-auto">
|
| 181 |
+
<canvas id="progressChart" class="w-full h-64"></canvas>
|
| 182 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
</div>
|
| 184 |
</div>
|
| 185 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
+
<script type="module">
|
| 188 |
+
import { initializeApp } from 'https://www.gstatic.com/firebasejs/9.22.0/firebase-app.js';
|
| 189 |
+
import { getAuth, onAuthStateChanged, signOut } from 'https://www.gstatic.com/firebasejs/9.22.0/firebase-auth.js';
|
| 190 |
+
import { getFirestore, doc, getDoc, updateDoc } from 'https://www.gstatic.com/firebasejs/9.22.0/firebase-firestore.js';
|
| 191 |
+
|
| 192 |
+
const firebaseConfig = {
|
| 193 |
+
apiKey: "AIzaSyAPhM_Ee7cLzyKHs5zyFy8g5ZOk9-pubRI",
|
| 194 |
+
authDomain: "login-tutorial-7a9e1.firebaseapp.com",
|
| 195 |
+
projectId: "login-tutorial-7a9e1",
|
| 196 |
+
storageBucket: "login-tutorial-7a9e1.firebasestorage.app",
|
| 197 |
+
messagingSenderId: "491093197824",
|
| 198 |
+
appId: "1:491093197824:web:9f866..."
|
| 199 |
+
};
|
| 200 |
|
| 201 |
+
const app = initializeApp(firebaseConfig);
|
| 202 |
+
const auth = getAuth(app);
|
| 203 |
+
const db = getFirestore(app);
|
|
|
|
| 204 |
|
| 205 |
+
let currentUser = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
|
| 207 |
+
// Check authentication state
|
| 208 |
+
onAuthStateChanged(auth, async (user) => {
|
| 209 |
+
if (user) {
|
| 210 |
+
currentUser = user;
|
| 211 |
+
await loadUserProfile();
|
| 212 |
+
} else {
|
| 213 |
+
window.location.href = 'login.html';
|
| 214 |
+
}
|
| 215 |
});
|
| 216 |
|
| 217 |
+
|
| 218 |
+
async function loadUserProfile() {
|
| 219 |
+
try {
|
| 220 |
+
const userDoc = await getDoc(doc(db, 'users', currentUser.uid));
|
| 221 |
+
if (userDoc.exists()) {
|
| 222 |
+
const userData = userDoc.data();
|
| 223 |
+
document.getElementById("userName").textContent = userData.name || "Name not set";
|
| 224 |
+
document.getElementById("userDOB").textContent = userData.dob || "DOB not set";
|
| 225 |
+
localStorage.setItem("userName", userData.name || "");
|
| 226 |
+
localStorage.setItem("userDOB", userData.dob || "");
|
| 227 |
+
}
|
| 228 |
+
} catch (error) {
|
| 229 |
+
console.error("Error loading user profile:", error);
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
window.saveProfile = async (name, dob) => {
|
| 234 |
+
try {
|
| 235 |
+
await updateDoc(doc(db, 'users', currentUser.uid), {
|
| 236 |
+
name: name,
|
| 237 |
+
dob: dob
|
| 238 |
+
});
|
| 239 |
+
localStorage.setItem("userName", name);
|
| 240 |
+
localStorage.setItem("userDOB", dob);
|
| 241 |
+
return true;
|
| 242 |
+
} catch (error) {
|
| 243 |
+
console.error("Error updating profile:", error);
|
| 244 |
+
return false;
|
| 245 |
+
}
|
| 246 |
+
};
|
| 247 |
|
| 248 |
+
|
| 249 |
+
window.logout = async () => {
|
| 250 |
+
try {
|
| 251 |
+
await signOut(auth);
|
| 252 |
+
localStorage.clear();
|
| 253 |
+
window.location.href = 'login.html';
|
| 254 |
+
} catch (error) {
|
| 255 |
+
console.error("Error signing out:", error);
|
| 256 |
+
}
|
| 257 |
+
};
|
| 258 |
|
|
|
|
|
|
|
| 259 |
|
| 260 |
+
function loadProgressData() {
|
| 261 |
+
return JSON.parse(localStorage.getItem("progressData") || "[]");
|
| 262 |
+
}
|
| 263 |
+
function saveProgressData(data) {
|
| 264 |
+
localStorage.setItem("progressData", JSON.stringify(data));
|
| 265 |
+
}
|
| 266 |
+
function resetProgressData() {
|
| 267 |
+
localStorage.removeItem("progressData");
|
| 268 |
}
|
| 269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
document.addEventListener("DOMContentLoaded", () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 271 |
|
| 272 |
+
const profileView = document.getElementById("profileViewSection");
|
| 273 |
+
const profileEdit = document.getElementById("profileEditSection");
|
| 274 |
+
const editBtn = document.getElementById("editProfileBtn");
|
| 275 |
+
const saveBtn = document.getElementById("saveProfileBtn");
|
| 276 |
+
const cancelBtn = document.getElementById("cancelProfileBtn");
|
| 277 |
+
const inputName = document.getElementById("inputName");
|
| 278 |
+
const inputDOB = document.getElementById("inputDOB");
|
| 279 |
+
// const inputFix = document.getElementById("inputFix");
|
| 280 |
+
// const inputGoals = document.getElementById("inputGoals");
|
| 281 |
+
|
| 282 |
+
editBtn.addEventListener("click", () => {
|
| 283 |
+
inputName.value = document.getElementById("userName").textContent;
|
| 284 |
+
inputDOB.value = document.getElementById("userDOB").textContent;
|
| 285 |
+
profileView.classList.add("hidden");
|
| 286 |
+
profileEdit.classList.remove("hidden");
|
| 287 |
+
});
|
| 288 |
+
|
| 289 |
+
saveBtn.addEventListener("click", async () => {
|
| 290 |
+
const nameVal = inputName.value.trim();
|
| 291 |
+
const dobVal = inputDOB.value;
|
| 292 |
+
|
| 293 |
+
const success = await window.saveProfile(nameVal, dobVal);
|
| 294 |
+
|
| 295 |
+
if (success) {
|
| 296 |
+
document.getElementById("userName").textContent = nameVal || "Name not set";
|
| 297 |
+
document.getElementById("userDOB").textContent = dobVal || "DOB not set";
|
| 298 |
+
profileEdit.classList.add("hidden");
|
| 299 |
+
profileView.classList.remove("hidden");
|
| 300 |
+
} else {
|
| 301 |
+
alert("Error saving profile. Please try again.");
|
| 302 |
+
}
|
| 303 |
+
});
|
| 304 |
+
cancelBtn.addEventListener("click", () => {
|
| 305 |
+
profileEdit.classList.add("hidden");
|
| 306 |
+
profileView.classList.remove("hidden");
|
| 307 |
+
});
|
| 308 |
+
|
| 309 |
+
const chartSection = document.getElementById("chartSection");
|
| 310 |
+
const welcomeMessage = document.getElementById("welcomeMessage");
|
| 311 |
+
const isNewUser = localStorage.getItem("isNewUser") === "true";
|
| 312 |
+
|
| 313 |
+
if (isNewUser) {
|
| 314 |
+
welcomeMessage.classList.remove("hidden");
|
| 315 |
+
chartSection.classList.add("hidden");
|
| 316 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 317 |
|
| 318 |
+
//chart logic(line graph)
|
| 319 |
+
const stored = loadProgressData();
|
| 320 |
+
const labels = stored.map((e) => e.date);
|
| 321 |
+
const dataPoints = [
|
| 322 |
+
{x:50, y:7},
|
| 323 |
+
{x:70, y:30},
|
| 324 |
+
];
|
| 325 |
+
const ctx = document.getElementById("progressChart").getContext("2d");
|
| 326 |
+
const progressChart = new Chart(ctx, {
|
| 327 |
+
type: "line",
|
| 328 |
+
data: {
|
| 329 |
+
labels,
|
| 330 |
+
datasets: [
|
| 331 |
+
{
|
| 332 |
+
label: "Health Score",
|
| 333 |
+
data: dataPoints,
|
| 334 |
+
borderColor: "#6B9080",
|
| 335 |
+
fill: true,
|
| 336 |
+
tension: 0.4,
|
| 337 |
+
},
|
| 338 |
+
],
|
| 339 |
+
},
|
| 340 |
+
options: {
|
| 341 |
+
scales: { y: { beginAtZero: true, max: 100 } },
|
| 342 |
+
},
|
| 343 |
+
});
|
| 344 |
+
|
| 345 |
+
// Add Entry Button
|
| 346 |
+
document.getElementById("addEntryBtn").addEventListener("click", () => {
|
| 347 |
+
const date = document.getElementById("entryDate").value;
|
| 348 |
+
const score = parseInt(
|
| 349 |
+
document.getElementById("entryScore").value,
|
| 350 |
+
10
|
| 351 |
+
);
|
| 352 |
+
if (!date || isNaN(score)) {
|
| 353 |
+
alert("Please select a date and enter a valid score.");
|
| 354 |
+
return;
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
stored.push({ date, score });
|
| 358 |
+
saveProgressData(stored);
|
| 359 |
+
progressChart.data.labels.push(date);
|
| 360 |
+
progressChart.data.datasets[0].data.push(score);
|
| 361 |
+
progressChart.update();
|
| 362 |
+
|
| 363 |
+
document.getElementById("entryDate").value = "";
|
| 364 |
+
document.getElementById("entryScore").value = "";
|
| 365 |
+
|
| 366 |
+
// Hide welcome message once user adds data
|
| 367 |
+
if (isNewUser) {
|
| 368 |
+
localStorage.setItem("isNewUser", "false");
|
| 369 |
+
welcomeMessage.classList.add("hidden");
|
| 370 |
+
chartSection.classList.remove("hidden");
|
| 371 |
+
}
|
| 372 |
+
});
|
| 373 |
+
|
| 374 |
+
// Reset Button
|
| 375 |
+
document
|
| 376 |
+
.getElementById("resetChartBtn")
|
| 377 |
+
.addEventListener("click", () => {
|
| 378 |
+
if (!confirm("Are you sure you want to clear all progress data?"))
|
| 379 |
+
return;
|
| 380 |
+
resetProgressData();
|
| 381 |
+
progressChart.data.labels = [];
|
| 382 |
+
progressChart.data.datasets[0].data = [];
|
| 383 |
+
progressChart.update();
|
| 384 |
+
});
|
| 385 |
});
|
|
|
|
|
|
|
|
|
|
| 386 |
</script>
|
| 387 |
</body>
|
| 388 |
+
</html>
|