Spaces:
Running
Running
Make an app named daily life which tracks everything how many hours i slept how many hours i worked how many hours i played and etc etc and add another section for workout plans and add this also to the workout plan [ ] 150 stretching exercise...
Browse files[ ] 150 push ups...
[ ] 150 sit ups...
[ ] 150 squats...
[ ] 150 curls...
[ ] 150 inclined push ups...
[ ] 150 declined push ups...
[ ] 200 gripping (each hand)...
[ ] Do at least minimum of 30 to 40 min mewing...
[ ] 5 kilometres running...
- README.md +7 -4
- components/footer.js +61 -0
- components/navbar.js +73 -0
- index.html +141 -19
- script.js +134 -0
- style.css +47 -18
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji: 🐠
|
| 4 |
colorFrom: green
|
| 5 |
-
colorTo:
|
|
|
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: LifeTracker Pro 🏋️
|
|
|
|
| 3 |
colorFrom: green
|
| 4 |
+
colorTo: yellow
|
| 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,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomFooter extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
:host {
|
| 7 |
+
display: block;
|
| 8 |
+
width: 100%;
|
| 9 |
+
margin-top: auto;
|
| 10 |
+
}
|
| 11 |
+
footer {
|
| 12 |
+
background-color: #1f2937;
|
| 13 |
+
color: white;
|
| 14 |
+
padding: 2rem 0;
|
| 15 |
+
margin-top: 4rem;
|
| 16 |
+
}
|
| 17 |
+
.footer-container {
|
| 18 |
+
max-width: 1200px;
|
| 19 |
+
margin: 0 auto;
|
| 20 |
+
padding: 0 1rem;
|
| 21 |
+
display: grid;
|
| 22 |
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
| 23 |
+
gap: 2rem;
|
| 24 |
+
}
|
| 25 |
+
.footer-section h3 {
|
| 26 |
+
font-weight: 600;
|
| 27 |
+
margin-bottom: 1rem;
|
| 28 |
+
color: #e5e7eb;
|
| 29 |
+
}
|
| 30 |
+
.footer-links {
|
| 31 |
+
display: flex;
|
| 32 |
+
flex-direction: column;
|
| 33 |
+
gap: 0.5rem;
|
| 34 |
+
}
|
| 35 |
+
.footer-link {
|
| 36 |
+
color: #9ca3af;
|
| 37 |
+
text-decoration: none;
|
| 38 |
+
transition: color 0.2s;
|
| 39 |
+
}
|
| 40 |
+
.footer-link:hover {
|
| 41 |
+
color: white;
|
| 42 |
+
}
|
| 43 |
+
.footer-bottom {
|
| 44 |
+
text-align: center;
|
| 45 |
+
padding-top: 2rem;
|
| 46 |
+
margin-top: 2rem;
|
| 47 |
+
border-top: 1px solid #374151;
|
| 48 |
+
color: #9ca3af;
|
| 49 |
+
}
|
| 50 |
+
@media (max-width: 768px) {
|
| 51 |
+
.footer-container {
|
| 52 |
+
grid-template-columns: 1fr;
|
| 53 |
+
text-align: center;
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
</style>
|
| 57 |
+
<footer>
|
| 58 |
+
<div class="footer-container">
|
| 59 |
+
<div class="footer-section">
|
| 60 |
+
<h3>LifeTracker Pro</h3>
|
| 61 |
+
<p>Track your daily activities and achieve your fitness goals with our comprehensive life management tool.</p
|
components/navbar.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomNavbar extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
:host {
|
| 7 |
+
display: block;
|
| 8 |
+
width: 100%;
|
| 9 |
+
}
|
| 10 |
+
nav {
|
| 11 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 12 |
+
padding: 1rem 0;
|
| 13 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
| 14 |
+
}
|
| 15 |
+
.nav-container {
|
| 16 |
+
max-width: 1200px;
|
| 17 |
+
margin: 0 auto;
|
| 18 |
+
padding: 0 1rem;
|
| 19 |
+
display: flex;
|
| 20 |
+
justify-content: space-between;
|
| 21 |
+
align-items: center;
|
| 22 |
+
}
|
| 23 |
+
.logo {
|
| 24 |
+
display: flex;
|
| 25 |
+
align-items: center;
|
| 26 |
+
color: white;
|
| 27 |
+
font-weight: bold;
|
| 28 |
+
font-size: 1.5rem;
|
| 29 |
+
text-decoration: none;
|
| 30 |
+
}
|
| 31 |
+
.nav-links {
|
| 32 |
+
display: flex;
|
| 33 |
+
gap: 2rem;
|
| 34 |
+
align-items: center;
|
| 35 |
+
}
|
| 36 |
+
.nav-link {
|
| 37 |
+
color: white;
|
| 38 |
+
text-decoration: none;
|
| 39 |
+
padding: 0.5rem 1rem;
|
| 40 |
+
border-radius: 0.375rem;
|
| 41 |
+
transition: background-color 0.2s;
|
| 42 |
+
}
|
| 43 |
+
.nav-link:hover {
|
| 44 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 45 |
+
}
|
| 46 |
+
@media (max-width: 768px) {
|
| 47 |
+
.nav-links {
|
| 48 |
+
gap: 1rem;
|
| 49 |
+
}
|
| 50 |
+
.nav-link {
|
| 51 |
+
padding: 0.5rem;
|
| 52 |
+
font-size: 0.9rem;
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
</style>
|
| 56 |
+
<nav>
|
| 57 |
+
<div class="nav-container">
|
| 58 |
+
<a href="index.html" class="logo">
|
| 59 |
+
<i data-feather="activity" class="mr-2"></i>
|
| 60 |
+
LifeTracker Pro
|
| 61 |
+
</a>
|
| 62 |
+
<div class="nav-links">
|
| 63 |
+
<a href="index.html" class="nav-link">Dashboard</a>
|
| 64 |
+
<a href="stats.html" class="nav-link">Statistics</a>
|
| 65 |
+
<a href="settings.html" class="nav-link">Settings</a>
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
</nav>
|
| 69 |
+
`;
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
customElements.define('custom-navbar', CustomNavbar);
|
index.html
CHANGED
|
@@ -1,19 +1,141 @@
|
|
| 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="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>LifeTracker Pro - Daily Life Dashboard</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 11 |
+
</head>
|
| 12 |
+
<body class="bg-gray-50">
|
| 13 |
+
<custom-navbar></custom-navbar>
|
| 14 |
+
|
| 15 |
+
<main class="container mx-auto px-4 py-8">
|
| 16 |
+
<!-- Dashboard Header -->
|
| 17 |
+
<div class="mb-8 text-center">
|
| 18 |
+
<h1 class="text-4xl font-bold text-gray-800 mb-2">Daily Life Dashboard</h1>
|
| 19 |
+
<p class="text-gray-600">Track your daily activities and progress</p>
|
| 20 |
+
</div>
|
| 21 |
+
|
| 22 |
+
<!-- Activity Tracking Section -->
|
| 23 |
+
<section class="mb-12">
|
| 24 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center">
|
| 25 |
+
<i data-feather="activity" class="mr-2"></i>
|
| 26 |
+
Daily Activities
|
| 27 |
+
</h2>
|
| 28 |
+
|
| 29 |
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
| 30 |
+
<!-- Sleep Tracker -->
|
| 31 |
+
<div class="bg-white rounded-xl shadow-md p-6">
|
| 32 |
+
<div class="flex items-center justify-between mb-4">
|
| 33 |
+
<h3 class="text-lg font-semibold text-gray-800">Sleep</h3>
|
| 34 |
+
<i data-feather="moon" class="text-blue-500"></i>
|
| 35 |
+
</div>
|
| 36 |
+
<div class="text-3xl font-bold text-blue-600 mb-2">0h 0m</div>
|
| 37 |
+
<div class="w-full bg-gray-200 rounded-full h-2">
|
| 38 |
+
<div class="bg-blue-500 h-2 rounded-full" style="width: 0%"></div>
|
| 39 |
+
</div>
|
| 40 |
+
<button class="mt-4 w-full bg-blue-500 text-white py-2 rounded-lg hover:bg-blue-600 transition-colors">
|
| 41 |
+
Log Sleep
|
| 42 |
+
</button>
|
| 43 |
+
</div>
|
| 44 |
+
|
| 45 |
+
<!-- Work Tracker -->
|
| 46 |
+
<div class="bg-white rounded-xl shadow-md p-6">
|
| 47 |
+
<div class="flex items-center justify-between mb-4">
|
| 48 |
+
<h3 class="text-lg font-semibold text-gray-800">Work</h3>
|
| 49 |
+
<i data-feather="briefcase" class="text-green-500"></i>
|
| 50 |
+
</div>
|
| 51 |
+
<div class="text-3xl font-bold text-green-600 mb-2">0h 0m</div>
|
| 52 |
+
<div class="w-full bg-gray-200 rounded-full h-2">
|
| 53 |
+
<div class="bg-green-500 h-2 rounded-full" style="width: 0%"></div>
|
| 54 |
+
</div>
|
| 55 |
+
<button class="mt-4 w-full bg-green-500 text-white py-2 rounded-lg hover:bg-green-600 transition-colors">
|
| 56 |
+
Log Work
|
| 57 |
+
</button>
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
<!-- Play Tracker -->
|
| 61 |
+
<div class="bg-white rounded-xl shadow-md p-6">
|
| 62 |
+
<div class="flex items-center justify-between mb-4">
|
| 63 |
+
<h3 class="text-lg font-semibold text-gray-800">Play</h3>
|
| 64 |
+
<i data-feather="play" class="text-purple-500"></i>
|
| 65 |
+
</div>
|
| 66 |
+
<div class="text-3xl font-bold text-purple-600 mb-2">0h 0m</div>
|
| 67 |
+
<div class="w-full bg-gray-200 rounded-full h-2">
|
| 68 |
+
<div class="bg-purple-500 h-2 rounded-full" style="width: 0%"></div>
|
| 69 |
+
</div>
|
| 70 |
+
<button class="mt-4 w-full bg-purple-500 text-white py-2 rounded-lg hover:bg-purple-600 transition-colors">
|
| 71 |
+
Log Play
|
| 72 |
+
</button>
|
| 73 |
+
</div>
|
| 74 |
+
|
| 75 |
+
<!-- Exercise Tracker -->
|
| 76 |
+
<div class="bg-white rounded-xl shadow-md p-6">
|
| 77 |
+
<div class="flex items-center justify-between mb-4">
|
| 78 |
+
<h3 class="text-lg font-semibold text-gray-800">Exercise</h3>
|
| 79 |
+
<i data-feather="heart" class="text-red-500"></i>
|
| 80 |
+
</div>
|
| 81 |
+
<div class="text-3xl font-bold text-red-600 mb-2">0h 0m</div>
|
| 82 |
+
<div class="w-full bg-gray-200 rounded-full h-2">
|
| 83 |
+
<div class="bg-red-500 h-2 rounded-full" style="width: 0%"></div>
|
| 84 |
+
</div>
|
| 85 |
+
<button class="mt-4 w-full bg-red-500 text-white py-2 rounded-lg hover:bg-red-600 transition-colors">
|
| 86 |
+
Log Exercise
|
| 87 |
+
</button>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
</section>
|
| 91 |
+
|
| 92 |
+
<!-- Workout Plan Section -->
|
| 93 |
+
<section>
|
| 94 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center">
|
| 95 |
+
<i data-feather="dumbbell" class="mr-2"></i>
|
| 96 |
+
Daily Workout Plan
|
| 97 |
+
</h2>
|
| 98 |
+
|
| 99 |
+
<div class="bg-white rounded-xl shadow-md p-6">
|
| 100 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 101 |
+
<!-- Workout Checklist -->
|
| 102 |
+
<div>
|
| 103 |
+
<h3 class="text-xl font-semibold text-gray-800 mb-4">Today's Exercises</h3>
|
| 104 |
+
<div class="space-y-3" id="workout-checklist">
|
| 105 |
+
<!-- Workout items will be populated by JavaScript -->
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
|
| 109 |
+
<!-- Progress Stats -->
|
| 110 |
+
<div>
|
| 111 |
+
<h3 class="text-xl font-semibold text-gray-800 mb-4">Progress</h3>
|
| 112 |
+
<div class="bg-gray-50 rounded-lg p-4">
|
| 113 |
+
<div class="text-center mb-4">
|
| 114 |
+
<div class="text-2xl font-bold text-gray-800" id="completion-percentage">0%</div>
|
| 115 |
+
<div class="text-sm text-gray-600">Complete</div>
|
| 116 |
+
</div>
|
| 117 |
+
<button class="w-full bg-gray-800 text-white py-2 rounded-lg hover:bg-gray-900 transition-colors" id="reset-workout">
|
| 118 |
+
Reset Workout
|
| 119 |
+
</button>
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
</section>
|
| 125 |
+
</main>
|
| 126 |
+
|
| 127 |
+
<custom-footer></custom-footer>
|
| 128 |
+
|
| 129 |
+
<script src="components/navbar.js"></script>
|
| 130 |
+
<script src="components/footer.js"></script>
|
| 131 |
+
<script src="script.js"></script>
|
| 132 |
+
<script>
|
| 133 |
+
feather.replace();
|
| 134 |
+
// Initialize workout checklist
|
| 135 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 136 |
+
initializeWorkoutChecklist();
|
| 137 |
+
});
|
| 138 |
+
</script>
|
| 139 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 140 |
+
</body>
|
| 141 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Main application functionality for LifeTracker Pro
|
| 2 |
+
|
| 3 |
+
class ActivityTracker {
|
| 4 |
+
constructor() {
|
| 5 |
+
this.activities = {
|
| 6 |
+
sleep: { hours: 0, minutes: 0 },
|
| 7 |
+
work: { hours: 0, minutes: 0 },
|
| 8 |
+
play: { hours: 0, minutes: 0 },
|
| 9 |
+
exercise: { hours: 0, minutes: 0 }
|
| 10 |
+
};
|
| 11 |
+
this.initializeEventListeners();
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
initializeEventListeners() {
|
| 15 |
+
// Add event listeners for activity buttons
|
| 16 |
+
document.querySelectorAll('[class*="bg-"]:not(#reset-workout)').forEach(button => {
|
| 17 |
+
button.addEventListener('click', (e) => {
|
| 18 |
+
const activity = e.target.closest('.bg-white').querySelector('h3').textContent.toLowerCase();
|
| 19 |
+
this.logActivity(activity);
|
| 20 |
+
});
|
| 21 |
+
});
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
logActivity(activity) {
|
| 25 |
+
// Simulate adding time (in a real app, this would open a modal or form)
|
| 26 |
+
const randomHours = Math.floor(Math.random() * 3);
|
| 27 |
+
const randomMinutes = Math.floor(Math.random() * 60);
|
| 28 |
+
|
| 29 |
+
this.activities[activity] = {
|
| 30 |
+
hours: this.activities[activity].hours + randomHours,
|
| 31 |
+
minutes: this.activities[activity].minutes + randomMinutes
|
| 32 |
+
};
|
| 33 |
+
|
| 34 |
+
// Normalize minutes to hours if over 60
|
| 35 |
+
if (this.activities[activity].minutes >= 60) {
|
| 36 |
+
this.activities[activity].hours += Math.floor(this.activities[activity].minutes / 60);
|
| 37 |
+
this.activities[activity].minutes = this.activities[activity].minutes % 60;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
this.updateActivityDisplay(activity);
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
updateActivityDisplay(activity) {
|
| 44 |
+
const activityElement = document.querySelector(`.bg-white:has(h3:contains("${activity.charAt(0).toUpperCase() + activity.slice(1)}"))`);
|
| 45 |
+
const timeDisplay = activityElement.querySelector('.text-3xl');
|
| 46 |
+
const progressBar = activityElement.querySelector('.h-2:last-child');
|
| 47 |
+
|
| 48 |
+
const totalMinutes = (this.activities[activity].hours * 60) + this.activities[activity].minutes;
|
| 49 |
+
const percentage = Math.min((totalMinutes / (8 * 60)) * 100, 100); // Cap at 8 hours equivalent
|
| 50 |
+
|
| 51 |
+
timeDisplay.textContent = `${this.activities[activity].hours}h ${this.activities[activity].minutes}m`;
|
| 52 |
+
progressBar.style.width = `${percentage}%`;
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
class WorkoutTracker {
|
| 57 |
+
constructor() {
|
| 58 |
+
this.workoutItems = [
|
| 59 |
+
{ id: 1, name: "150 stretching exercise", completed: false },
|
| 60 |
+
{ id: 2, name: "150 push ups", completed: false },
|
| 61 |
+
{ id: 3, name: "150 sit ups", completed: false },
|
| 62 |
+
{ id: 4, name: "150 squats", completed: false },
|
| 63 |
+
{ id: 5, name: "150 curls", completed: false },
|
| 64 |
+
{ id: 6, name: "150 inclined push ups", completed: false },
|
| 65 |
+
{ id: 7, name: "150 declined push ups", completed: false },
|
| 66 |
+
{ id: 8, name: "200 gripping (each hand)", completed: false },
|
| 67 |
+
{ id: 9, name: "Do at least minimum of 30 to 40 min mewing", completed: false },
|
| 68 |
+
{ id: 10, name: "5 kilometres running", completed: false }
|
| 69 |
+
];
|
| 70 |
+
this.initializeWorkoutListeners();
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
initializeWorkoutListeners() {
|
| 74 |
+
document.getElementById('reset-workout').addEventListener('click', () => {
|
| 75 |
+
this.resetWorkout();
|
| 76 |
+
});
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
updateProgress() {
|
| 80 |
+
const completed = this.workoutItems.filter(item => item.completed).length;
|
| 81 |
+
const total = this.workoutItems.length;
|
| 82 |
+
const percentage = Math.round((completed / total) * 100);
|
| 83 |
+
|
| 84 |
+
document.getElementById('completion-percentage').textContent = `${percentage}%`;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
resetWorkout() {
|
| 88 |
+
this.workoutItems.forEach(item => {
|
| 89 |
+
item.completed = false;
|
| 90 |
+
});
|
| 91 |
+
this.renderChecklist();
|
| 92 |
+
this.updateProgress();
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
renderChecklist() {
|
| 96 |
+
const checklist = document.getElementById('workout-checklist');
|
| 97 |
+
checklist.innerHTML = '';
|
| 98 |
+
|
| 99 |
+
this.workoutItems.forEach(item => {
|
| 100 |
+
const div = document.createElement('div');
|
| 101 |
+
div.className = 'flex items-center p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors';
|
| 102 |
+
|
| 103 |
+
const checkbox = document.createElement('div');
|
| 104 |
+
checkbox.className = `workout-checkbox mr-3 ${item.completed ? 'checked' : ''}`;
|
| 105 |
+
checkbox.addEventListener('click', () => {
|
| 106 |
+
item.completed = !item.completed;
|
| 107 |
+
checkbox.classList.toggle('checked');
|
| 108 |
+
this.updateProgress();
|
| 109 |
+
});
|
| 110 |
+
|
| 111 |
+
const label = document.createElement('span');
|
| 112 |
+
label.className = 'text-gray-800';
|
| 113 |
+
label.textContent = item.name;
|
| 114 |
+
|
| 115 |
+
div.appendChild(checkbox);
|
| 116 |
+
div.appendChild(label);
|
| 117 |
+
checklist.appendChild(div);
|
| 118 |
+
});
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
// Initialize the application
|
| 123 |
+
function initializeApp() {
|
| 124 |
+
window.activityTracker = new ActivityTracker();
|
| 125 |
+
window.workoutTracker = new WorkoutTracker();
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
function initializeWorkoutChecklist() {
|
| 129 |
+
window.workoutTracker = new WorkoutTracker();
|
| 130 |
+
window.workoutTracker.renderChecklist();
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
// Initialize when DOM is loaded
|
| 134 |
+
document.addEventListener('DOMContentLoaded', initializeApp);
|
style.css
CHANGED
|
@@ -1,28 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
.
|
| 27 |
-
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Custom Styles for LifeTracker Pro */
|
| 2 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 3 |
+
|
| 4 |
body {
|
| 5 |
+
font-family: 'Inter', sans-serif;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
.container {
|
| 9 |
+
max-width: 1200px;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
/* Custom checkbox styles */
|
| 13 |
+
.workout-checkbox {
|
| 14 |
+
width: 20px;
|
| 15 |
+
height: 20px;
|
| 16 |
+
border: 2px solid #d1d5db;
|
| 17 |
+
border-radius: 4px;
|
| 18 |
+
cursor: pointer;
|
| 19 |
+
transition: all 0.2s ease;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
.workout-checkbox.checked {
|
| 23 |
+
background-color: #3b82f6;
|
| 24 |
+
border-color: #3b82f6;
|
| 25 |
}
|
| 26 |
|
| 27 |
+
.workout-checkbox.checked::after {
|
| 28 |
+
content: '✓';
|
| 29 |
+
color: white;
|
| 30 |
+
font-weight: bold;
|
| 31 |
+
display: flex;
|
| 32 |
+
align-items: center;
|
| 33 |
+
justify-content: center;
|
| 34 |
+
font-size: 12px;
|
| 35 |
}
|
| 36 |
|
| 37 |
+
/* Progress bar animation */
|
| 38 |
+
.progress-bar {
|
| 39 |
+
transition: width 0.3s ease-in-out;
|
|
|
|
|
|
|
| 40 |
}
|
| 41 |
|
| 42 |
+
/* Hover effects */
|
| 43 |
+
.hover-lift {
|
| 44 |
+
transition: transform 0.2s ease;
|
|
|
|
|
|
|
|
|
|
| 45 |
}
|
| 46 |
|
| 47 |
+
.hover-lift:hover {
|
| 48 |
+
transform: translateY(-2px);
|
| 49 |
}
|
| 50 |
+
|
| 51 |
+
/* Responsive adjustments */
|
| 52 |
+
@media (max-width: 768px) {
|
| 53 |
+
.container {
|
| 54 |
+
padding-left: 1rem;
|
| 55 |
+
padding-right: 1rem;
|
| 56 |
+
}
|
| 57 |
+
}
|