File size: 35,974 Bytes
fe0ded4 2c66e46 fe0ded4 2c66e46 fe0ded4 2c66e46 fe0ded4 2c66e46 fe0ded4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 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 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 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 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HealthTrack Pro | Wellness Dashboard</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#4F46E5',
secondary: '#10B981',
dark: '#1E293B',
light: '#F8FAFC'
}
}
}
}
</script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Poppins', sans-serif;
background: linear-gradient(135deg, #f0f9ff 0%, #e6f7ff 100%);
min-height: 100vh;
}
.dashboard-grid {
display: grid;
grid-template-columns: 280px 1fr;
gap: 20px;
}
.progress-ring {
transform: rotate(-90deg);
}
.progress-ring__circle {
transition: stroke-dashoffset 0.5s;
}
.achievement-badge {
transition: transform 0.3s ease;
}
.achievement-badge:hover {
transform: scale(1.05);
}
.health-card {
transition: all 0.3s ease;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.health-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}
.todo-item {
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.pulse {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
70% { box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); }
100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}
/* Hamburger menu animation */
.hamburger.active span:nth-child(1) {
transform: translateY(4px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
opacity: 0;
}
.hamburger.active span:nth-child(3) {
transform: translateY(-4px) rotate(-45deg);
}
@media (max-width: 768px) {
.dashboard-grid {
grid-template-columns: 1fr;
padding: 0;
}
.sidebar {
position: fixed;
left: -100%;
top: 0;
z-index: 50;
height: 100vh;
width: 85%;
transition: left 0.3s ease;
border-radius: 0;
}
.sidebar.active {
left: 0;
}
.health-card {
margin: 0 10px 15px;
}
.stats-overview {
grid-template-columns: 1fr 1fr;
gap: 10px;
padding: 0 10px;
}
.main-content-grid {
grid-template-columns: 1fr;
padding: 0 10px;
}
header {
border-radius: 0;
margin-bottom: 10px;
}
}
</style>
</head>
<body class="bg-gray-50">
<!-- Mobile Menu Button -->
<div class="md:hidden fixed top-4 left-4 z-50">
<button id="mobileMenuBtn" class="bg-primary text-white p-3 rounded-full shadow-lg focus:outline-none">
<div class="w-6 flex flex-col items-center hamburger">
<span class="block w-6 h-0.5 bg-white mb-1.5 transition-all duration-300"></span>
<span class="block w-6 h-0.5 bg-white mb-1.5 transition-all duration-300"></span>
<span class="block w-6 h-0.5 bg-white transition-all duration-300"></span>
</div>
</button>
</div>
<div class="dashboard-grid p-4 max-w-7xl mx-auto">
<!-- Sidebar -->
<aside class="sidebar bg-white rounded-xl shadow-md p-6">
<div class="flex justify-between items-center mb-10">
<div class="flex items-center">
<div class="bg-primary w-10 h-10 rounded-full flex items-center justify-center text-white font-bold">HT</div>
<h1 class="text-xl font-bold ml-3">HealthTrack<span class="text-primary">Pro</span></h1>
</div>
<button id="closeSidebar" class="md:hidden text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<nav class="mb-10">
<ul class="space-y-2">
<li>
<a href="#" class="flex items-center p-3 rounded-lg bg-primary text-white">
<i class="fas fa-home mr-3"></i>
<span>Dashboard</span>
</a>
</li>
<li>
<a href="#" class="flex items-center p-3 rounded-lg text-gray-600 hover:bg-gray-100">
<i class="fas fa-tasks mr-3"></i>
<span>To-Do List</span>
</a>
</li>
<li>
<a href="#" class="flex items-center p-3 rounded-lg text-gray-600 hover:bg-gray-100">
<i class="fas fa-trophy mr-3"></i>
<span>Achievements</span>
</a>
</li>
<li>
<a href="#" class="flex items-center p-3 rounded-lg text-gray-600 hover:bg-gray-100">
<i class="fas fa-heartbeat mr-3"></i>
<span>Health Metrics</span>
</a>
</li>
<li>
<a href="#" class="flex items-center p-3 rounded-lg text-gray-600 hover:bg-gray-100">
<i class="fas fa-chart-line mr-3"></i>
<span>Analytics</span>
</a>
</li>
<li>
<a href="#" class="flex items-center p-3 rounded-lg text-gray-600 hover:bg-gray-100">
<i class="fas fa-cog mr-3"></i>
<span>Settings</span>
</a>
</li>
</ul>
</nav>
<div class="mt-auto">
<div class="bg-light rounded-xl p-4 mb-6">
<h3 class="font-bold mb-2">Daily Goal Progress</h3>
<div class="flex items-center">
<div class="w-10 h-10 rounded-full bg-primary flex items-center justify-center text-white mr-3">
<i class="fas fa-medal"></i>
</div>
<div class="flex-1">
<div class="h-2 bg-gray-200 rounded-full overflow-hidden">
<div class="h-full bg-secondary rounded-full" style="width: 75%"></div>
</div>
<p class="text-xs mt-1 text-gray-500">75% completed</p>
</div>
</div>
</div>
<div class="flex items-center p-3 bg-gray-50 rounded-lg">
<div class="w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center mr-3">
<i class="fas fa-user text-gray-600"></i>
</div>
<div>
<p class="font-medium">Alex Morgan</p>
<p class="text-xs text-gray-500">Premium Member</p>
</div>
</div>
</div>
</aside>
<!-- Main Content -->
<main class="ml-0 md:ml-0">
<!-- Header -->
<header class="bg-white rounded-xl shadow-md p-6 mb-6">
<div class="flex flex-col md:flex-row md:items-center md:justify-between">
<div>
<h1 class="text-2xl font-bold text-dark">Welcome back, Alex!</h1>
<p class="text-gray-500">Track your health and wellness journey</p>
</div>
<div class="mt-4 md:mt-0 flex items-center">
<div class="relative">
<input type="text" placeholder="Search..." class="pl-10 pr-4 py-2 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
<button class="ml-4 bg-primary text-white p-2 rounded-full w-10 h-10 flex items-center justify-center">
<i class="fas fa-bell"></i>
</button>
</div>
</div>
</header>
<!-- Stats Overview -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
<div class="health-card bg-white rounded-xl shadow-md p-5 flex items-center">
<div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mr-4">
<i class="fas fa-glass-water text-blue-500 text-xl"></i>
</div>
<div>
<p class="text-gray-500 text-sm">Water Intake</p>
<p class="text-xl font-bold">1.8<span class="text-gray-500 text-sm">/2.5 L</span></p>
</div>
</div>
<div class="health-card bg-white rounded-xl shadow-md p-5 flex items-center">
<div class="w-12 h-12 rounded-full bg-green-100 flex items-center justify-center mr-4">
<i class="fas fa-shoe-prints text-green-500 text-xl"></i>
</div>
<div>
<p class="text-gray-500 text-sm">Steps Today</p>
<p class="text-xl font-bold">8,452<span class="text-gray-500 text-sm">/10k</span></p>
</div>
</div>
<div class="health-card bg-white rounded-xl shadow-md p-5 flex items-center">
<div class="w-12 h-12 rounded-full bg-red-100 flex items-center justify-center mr-4">
<i class="fas fa-heart-pulse text-red-500 text-xl"></i>
</div>
<div>
<p class="text-gray-500 text-sm">Heart Rate</p>
<p class="text-xl font-bold">72<span class="text-gray-500 text-sm"> BPM</span></p>
</div>
</div>
<div class="health-card bg-white rounded-xl shadow-md p-5 flex items-center">
<div class="w-12 h-12 rounded-full bg-purple-100 flex items-center justify-center mr-4">
<i class="fas fa-pills text-purple-500 text-xl"></i>
</div>
<div>
<p class="text-gray-500 text-sm">Medications</p>
<p class="text-xl font-bold">2<span class="text-gray-500 text-sm">/3 Taken</span></p>
</div>
</div>
</div>
<!-- Main Content Grid -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Todo Section -->
<div class="lg:col-span-2">
<div class="health-card bg-white rounded-xl shadow-md p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-dark">Today's Tasks</h2>
<button class="text-primary hover:text-primary-dark">
<i class="fas fa-ellipsis-h"></i>
</button>
</div>
<div class="mb-4">
<div class="flex">
<input type="text" id="newTodo" placeholder="Add a new task..." class="flex-1 border border-gray-300 rounded-l-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
<button id="addTodoBtn" class="bg-primary text-white px-4 py-2 rounded-r-lg hover:bg-primary-dark transition">Add</button>
</div>
</div>
<div id="todoList" class="space-y-3">
<div class="todo-item flex items-center p-3 bg-gray-50 rounded-lg">
<input type="checkbox" class="mr-3 h-5 w-5 text-primary rounded focus:ring-primary">
<div class="flex-1">
<p class="font-medium">Morning meditation</p>
<p class="text-xs text-gray-500">7:00 AM</p>
</div>
<button class="text-gray-400 hover:text-gray-600">
<i class="fas fa-trash"></i>
</button>
</div>
<div class="todo-item flex items-center p-3 bg-gray-50 rounded-lg">
<input type="checkbox" class="mr-3 h-5 w-5 text-primary rounded focus:ring-primary">
<div class="flex-1">
<p class="font-medium">Take vitamin supplements</p>
<p class="text-xs text-gray-500">8:30 AM</p>
</div>
<button class="text-gray-400 hover:text-gray-600">
<i class="fas fa-trash"></i>
</button>
</div>
<div class="todo-item flex items-center p-3 bg-gray-50 rounded-lg">
<input type="checkbox" class="mr-3 h-5 w-5 text-primary rounded focus:ring-primary" checked>
<div class="flex-1">
<p class="font-medium text-gray-400 line-through">30-min morning walk</p>
<p class="text-xs text-gray-500">Completed at 7:45 AM</p>
</div>
<button class="text-gray-400 hover:text-gray-600">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Achievements Section -->
<div>
<div class="health-card bg-white rounded-xl shadow-md p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-dark">Achievements</h2>
<button class="text-primary hover:text-primary-dark">
<i class="fas fa-trophy"></i>
</button>
</div>
<div class="grid grid-cols-3 gap-4">
<div class="achievement-badge flex flex-col items-center">
<div class="w-16 h-16 rounded-full bg-yellow-100 flex items-center justify-center mb-2">
<i class="fas fa-glass-water text-yellow-500 text-2xl"></i>
</div>
<p class="text-xs font-medium text-center">Hydration Hero</p>
</div>
<div class="achievement-badge flex flex-col items-center">
<div class="w-16 h-16 rounded-full bg-green-100 flex items-center justify-center mb-2">
<i class="fas fa-walking text-green-500 text-2xl"></i>
</div>
<p class="text-xs font-medium text-center">10k Steps</p>
</div>
<div class="achievement-badge flex flex-col items-center">
<div class="w-16 h-16 rounded-full bg-blue-100 flex items-center justify-center mb-2">
<i class="fas fa-moon text-blue-500 text-2xl"></i>
</div>
<p class="text-xs font-medium text-center">Sleep Master</p>
</div>
<div class="achievement-badge flex flex-col items-center">
<div class="w-16 h-16 rounded-full bg-purple-100 flex items-center justify-center mb-2">
<i class="fas fa-dumbbell text-purple-500 text-2xl"></i>
</div>
<p class="text-xs font-medium text-center">Workout Warrior</p>
</div>
<div class="achievement-badge flex flex-col items-center">
<div class="w-16 h-16 rounded-full bg-red-100 flex items-center justify-center mb-2">
<i class="fas fa-apple-alt text-red-500 text-2xl"></i>
</div>
<p class="text-xs font-medium text-center">Healthy Eating</p>
</div>
<div class="achievement-badge flex flex-col items-center">
<div class="w-16 h-16 rounded-full bg-gray-200 flex items-center justify-center mb-2 opacity-50">
<i class="fas fa-lock text-gray-500 text-2xl"></i>
</div>
<p class="text-xs font-medium text-center">Coming Soon</p>
</div>
</div>
<div class="mt-6">
<div class="flex justify-between mb-2">
<span class="text-sm font-medium">Your Progress</span>
<span class="text-sm font-medium">6/12</span>
</div>
<div class="h-2 bg-gray-200 rounded-full overflow-hidden">
<div class="h-full bg-secondary rounded-full" style="width: 50%"></div>
</div>
</div>
</div>
</div>
<!-- Water Tracker -->
<div>
<div class="health-card bg-white rounded-xl shadow-md p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-dark">Water Intake</h2>
<button class="text-primary hover:text-primary-dark">
<i class="fas fa-plus"></i>
</button>
</div>
<div class="flex justify-center mb-6">
<div class="relative">
<svg width="120" height="120" viewBox="0 0 120 120">
<circle cx="60" cy="60" r="54" fill="none" stroke="#e2e8f0" stroke-width="8" />
<circle class="progress-ring__circle" cx="60" cy="60" r="54" fill="none" stroke="#3b82f6" stroke-width="8" stroke-dasharray="339.292" stroke-dashoffset="84.823" stroke-linecap="round" transform="rotate(-90 60 60)" />
</svg>
<div class="absolute inset-0 flex flex-col items-center justify-center">
<span class="text-2xl font-bold">1.8L</span>
<span class="text-gray-500 text-sm">of 2.5L</span>
</div>
</div>
</div>
<div class="grid grid-cols-4 gap-2">
<button id="add250ml" class="bg-blue-50 text-blue-500 py-2 rounded-lg hover:bg-blue-100 transition">
<i class="fas fa-plus"></i> 250ml
</button>
<button id="add500ml" class="bg-blue-50 text-blue-500 py-2 rounded-lg hover:bg-blue-100 transition">
<i class="fas fa-plus"></i> 500ml
</button>
<button class="bg-blue-100 text-blue-700 py-2 rounded-lg font-medium">
Goal: 2.5L
</button>
<button class="bg-blue-500 text-white py-2 rounded-lg hover:bg-blue-600 transition">
Reset
</button>
</div>
</div>
</div>
<!-- Steps Tracker -->
<div>
<div class="health-card bg-white rounded-xl shadow-md p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-dark">Step Counter</h2>
<button class="text-primary hover:text-primary-dark">
<i class="fas fa-sync"></i>
</button>
</div>
<div class="flex justify-center mb-6">
<div class="relative">
<div class="w-32 h-32 rounded-full border-8 border-green-200 flex items-center justify-center">
<div class="text-center">
<div class="text-3xl font-bold">8,452</div>
<div class="text-gray-500 text-sm">steps</div>
</div>
</div>
</div>
</div>
<div class="mb-4">
<div class="flex justify-between mb-2">
<span class="text-sm">Daily Goal: 10,000 steps</span>
<span class="text-sm font-medium">84.5%</span>
</div>
<div class="h-3 bg-gray-200 rounded-full overflow-hidden">
<div class="h-full bg-green-500 rounded-full" style="width: 84.5%"></div>
</div>
</div>
<button class="w-full bg-green-500 text-white py-3 rounded-lg hover:bg-green-600 transition flex items-center justify-center">
<i class="fas fa-shoe-prints mr-2"></i> Sync with Smart Watch
</button>
</div>
</div>
<!-- Medication Tracker -->
<div class="lg:col-span-2">
<div class="health-card bg-white rounded-xl shadow-md p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-dark">Medication Schedule</h2>
<button class="text-primary hover:text-primary-dark">
<i class="fas fa-plus"></i>
</button>
</div>
<div class="space-y-4">
<div class="flex items-center p-4 bg-purple-50 rounded-lg">
<div class="w-12 h-12 rounded-full bg-purple-100 flex items-center justify-center mr-4">
<i class="fas fa-pills text-purple-500"></i>
</div>
<div class="flex-1">
<p class="font-medium">Vitamin D</p>
<p class="text-sm text-gray-500">1 capsule after breakfast</p>
</div>
<div class="text-right">
<p class="font-medium">8:30 AM</p>
<p class="text-sm text-green-500 flex items-center">
<i class="fas fa-check-circle mr-1"></i> Taken
</p>
</div>
</div>
<div class="flex items-center p-4 bg-amber-50 rounded-lg pulse">
<div class="w-12 h-12 rounded-full bg-amber-100 flex items-center justify-center mr-4">
<i class="fas fa-pills text-amber-500"></i>
</div>
<div class="flex-1">
<p class="font-medium">Blood Pressure Meds</p>
<p class="text-sm text-gray-500">1 tablet with water</p>
</div>
<div class="text-right">
<p class="font-medium">2:00 PM</p>
<p class="text-sm text-amber-500 flex items-center">
<i class="fas fa-clock mr-1"></i> Pending
</p>
</div>
</div>
<div class="flex items-center p-4 bg-gray-50 rounded-lg">
<div class="w-12 h-12 rounded-full bg-gray-200 flex items-center justify-center mr-4">
<i class="fas fa-pills text-gray-500"></i>
</div>
<div class="flex-1">
<p class="font-medium">Omega-3</p>
<p class="text-sm text-gray-500">1 softgel with dinner</p>
</div>
<div class="text-right">
<p class="font-medium">7:00 PM</p>
<p class="text-sm text-gray-500 flex items-center">
<i class="fas fa-clock mr-1"></i> Upcoming
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<script>
// This would be replaced with Flutter code
// Here's a basic Flutter structure example:
/*
import 'package:flutter/material.dart';
void main() => runApp(HealthTrackApp());
class HealthTrackApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'HealthTrack Pro',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MainScreen(),
);
}
}
class MainScreen extends StatefulWidget {
@override
_MainScreenState createState() => _MainScreenState();
}
class _MainScreenState extends State<MainScreen> {
// State management would go here
// This would include all the tracking functionality
// and UI components from the HTML version
}
*/
// Mobile menu toggle with hamburger animation
const mobileMenuBtn = document.getElementById('mobileMenuBtn');
const closeSidebar = document.getElementById('closeSidebar');
const sidebar = document.querySelector('.sidebar');
const hamburger = document.querySelector('.hamburger');
mobileMenuBtn.addEventListener('click', () => {
sidebar.classList.add('active');
hamburger.classList.add('active');
});
closeSidebar.addEventListener('click', () => {
sidebar.classList.remove('active');
hamburger.classList.remove('active');
});
// Close sidebar when clicking outside
document.addEventListener('click', (e) => {
if (!sidebar.contains(e.target) && !mobileMenuBtn.contains(e.target)) {
sidebar.classList.remove('active');
hamburger.classList.remove('active');
}
});
// Todo functionality
document.getElementById('addTodoBtn').addEventListener('click', addTodo);
document.getElementById('newTodo').addEventListener('keypress', function(e) {
if (e.key === 'Enter') addTodo();
});
function addTodo() {
const input = document.getElementById('newTodo');
const task = input.value.trim();
if (task) {
const todoList = document.getElementById('todoList');
const time = new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
const todoItem = document.createElement('div');
todoItem.className = 'todo-item flex items-center p-3 bg-gray-50 rounded-lg';
todoItem.innerHTML = `
<input type="checkbox" class="mr-3 h-5 w-5 text-primary rounded focus:ring-primary">
<div class="flex-1">
<p class="font-medium">${task}</p>
<p class="text-xs text-gray-500">Added at ${time}</p>
</div>
<button class="text-gray-400 hover:text-gray-600 delete-todo">
<i class="fas fa-trash"></i>
</button>
`;
todoList.prepend(todoItem);
input.value = '';
// Add event listener to delete button
todoItem.querySelector('.delete-todo').addEventListener('click', function() {
todoItem.remove();
});
// Add event listener to checkbox
const checkbox = todoItem.querySelector('input[type="checkbox"]');
checkbox.addEventListener('change', function() {
if (this.checked) {
todoItem.querySelector('p.font-medium').classList.add('text-gray-400', 'line-through');
} else {
todoItem.querySelector('p.font-medium').classList.remove('text-gray-400', 'line-through');
}
});
}
}
// Initialize existing todo delete buttons
document.querySelectorAll('.delete-todo').forEach(button => {
button.addEventListener('click', function() {
this.closest('.todo-item').remove();
});
});
// Initialize existing todo checkboxes
document.querySelectorAll('#todoList input[type="checkbox"]').forEach(checkbox => {
checkbox.addEventListener('change', function() {
const text = this.closest('.todo-item').querySelector('p.font-medium');
if (this.checked) {
text.classList.add('text-gray-400', 'line-through');
} else {
text.classList.remove('text-gray-400', 'line-through');
}
});
});
// Water intake functionality
let waterIntake = 1.8;
const maxWaterIntake = 2.5;
const waterDisplay = document.querySelector('.absolute.inset-0 span.text-2xl');
const waterCircle = document.querySelector('.progress-ring__circle');
// Update water display and progress circle
function updateWaterDisplay() {
waterDisplay.textContent = `${waterIntake.toFixed(1)}L`;
const percentage = (waterIntake / maxWaterIntake) * 100;
const circumference = 2 * Math.PI * 54;
const offset = circumference - (percentage / 100) * circumference;
waterCircle.style.strokeDashoffset = offset;
}
// Add 250ml button
document.getElementById('add250ml').addEventListener('click', function() {
waterIntake += 0.25;
if (waterIntake > maxWaterIntake) waterIntake = maxWaterIntake;
updateWaterDisplay();
});
// Add 500ml button
document.getElementById('add500ml').addEventListener('click', function() {
waterIntake += 0.5;
if (waterIntake > maxWaterIntake) waterIntake = maxWaterIntake;
updateWaterDisplay();
});
// Reset button
document.querySelector('.bg-blue-500').addEventListener('click', function() {
waterIntake = 0;
updateWaterDisplay();
});
// Sync steps button
document.querySelector('.bg-green-500').addEventListener('click', function() {
// In a real app, this would sync with a smartwatch
alert('Syncing with smartwatch...');
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=HakDEV/tracking" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |