ishash commited on
Commit
07a3927
·
verified ·
1 Parent(s): 91bd017

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +546 -19
index.html CHANGED
@@ -1,19 +1,546 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Keep Going - Motivational Habit Tracker</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap" rel="stylesheet">
9
+ <style>
10
+ body {
11
+ font-family: 'Outfit', sans-serif;
12
+ background-color: #0f172a;
13
+ overflow-x: hidden;
14
+ }
15
+
16
+ /* Custom Scrollbar */
17
+ ::-webkit-scrollbar {
18
+ width: 8px;
19
+ }
20
+ ::-webkit-scrollbar-track {
21
+ background: #1e293b;
22
+ }
23
+ ::-webkit-scrollbar-thumb {
24
+ background: #4f46e5;
25
+ border-radius: 4px;
26
+ }
27
+
28
+ /* Animations */
29
+ @keyframes float {
30
+ 0% { transform: translateY(0px); }
31
+ 50% { transform: translateY(-10px); }
32
+ 100% { transform: translateY(0px); }
33
+ }
34
+
35
+ @keyframes pulse-glow {
36
+ 0%, 100% { box-shadow: 0 0 15px rgba(79, 70, 229, 0.2); }
37
+ 50% { box-shadow: 0 0 25px rgba(79, 70, 229, 0.6); }
38
+ }
39
+
40
+ @keyframes slideIn {
41
+ from { opacity: 0; transform: translateY(20px); }
42
+ to { opacity: 1; transform: translateY(0); }
43
+ }
44
+
45
+ @keyframes confetti-fall {
46
+ 0% { transform: translateY(-100vh) rotate(0deg); }
47
+ 100% { transform: translateY(100vh) rotate(720deg); }
48
+ }
49
+
50
+ .glass-panel {
51
+ background: rgba(30, 41, 59, 0.7);
52
+ backdrop-filter: blur(12px);
53
+ -webkit-backdrop-filter: blur(12px);
54
+ border: 1px solid rgba(255, 255, 255, 0.1);
55
+ }
56
+
57
+ .habit-card {
58
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
59
+ }
60
+ .habit-card:hover {
61
+ transform: translateY(-2px);
62
+ border-color: rgba(99, 102, 241, 0.5);
63
+ }
64
+
65
+ .checkbox-wrapper input:checked + div {
66
+ background-color: #4f46e5;
67
+ border-color: #4f46e5;
68
+ }
69
+ .checkbox-wrapper input:checked + div svg {
70
+ display: block;
71
+ }
72
+
73
+ .progress-ring__circle {
74
+ transition: stroke-dashoffset 0.5s ease-in-out;
75
+ transform: rotate(-90deg);
76
+ transform-origin: 50% 50%;
77
+ }
78
+
79
+ /* Confetti Particle */
80
+ .confetti {
81
+ position: fixed;
82
+ width: 10px;
83
+ height: 10px;
84
+ background-color: #f00;
85
+ z-index: 9999;
86
+ pointer-events: none;
87
+ }
88
+
89
+ /* Gradient Text */
90
+ .text-gradient {
91
+ background: linear-gradient(to right, #818cf8, #c084fc, #f472b6);
92
+ -webkit-background-clip: text;
93
+ -webkit-text-fill-color: transparent;
94
+ }
95
+
96
+ .streak-flame {
97
+ animation: flicker 1.5s infinite alternate;
98
+ }
99
+ @keyframes flicker {
100
+ 0%, 100% { opacity: 1; transform: scale(1); }
101
+ 50% { opacity: 0.8; transform: scale(1.1); }
102
+ }
103
+ </style>
104
+ </head>
105
+ <body class="text-slate-200 min-h-screen flex flex-col relative">
106
+
107
+ <!-- Background Canvas for Particles -->
108
+ <canvas id="bgCanvas" class="fixed top-0 left-0 w-full h-full -z-10 opacity-30"></canvas>
109
+
110
+ <!-- Header -->
111
+ <header class="w-full p-6 flex justify-between items-center glass-panel sticky top-0 z-50">
112
+ <div class="flex items-center gap-3">
113
+ <div class="w-10 h-10 rounded-full bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-lg shadow-indigo-500/30">
114
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
115
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
116
+ </svg>
117
+ </div>
118
+ <div>
119
+ <h1 class="text-2xl font-bold tracking-tight text-white">Keep Going</h1>
120
+ <p class="text-xs text-slate-400 uppercase tracking-wider">Daily Momentum Builder</p>
121
+ </div>
122
+ </div>
123
+
124
+ <div class="hidden md:flex items-center gap-4">
125
+ <div class="text-right">
126
+ <div id="current-date" class="text-sm font-semibold text-slate-300"></div>
127
+ <div id="current-time" class="text-xs text-slate-500 font-mono"></div>
128
+ </div>
129
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="px-4 py-2 rounded-full bg-slate-800 hover:bg-slate-700 border border-slate-700 text-xs font-medium transition-colors flex items-center gap-2 group">
130
+ <span>Built with anycoder</span>
131
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3 group-hover:translate-x-1 transition-transform" fill="none" viewBox="0 0 24 24" stroke="currentColor">
132
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
133
+ </svg>
134
+ </a>
135
+ </div>
136
+ </header>
137
+
138
+ <!-- Main Content -->
139
+ <main class="flex-grow container mx-auto px-4 py-8 flex flex-col lg:flex-row gap-8">
140
+
141
+ <!-- Left Column: Stats & Motivation -->
142
+ <aside class="w-full lg:w-1/3 flex flex-col gap-6">
143
+
144
+ <!-- Daily Progress Card -->
145
+ <div class="glass-panel rounded-2xl p-6 relative overflow-hidden group">
146
+ <div class="absolute top-0 right-0 w-32 h-32 bg-indigo-500/20 rounded-full blur-3xl -mr-10 -mt-10 transition-all group-hover:bg-indigo-500/30"></div>
147
+
148
+ <h2 class="text-lg font-semibold mb-4 flex items-center gap-2">
149
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-indigo-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
150
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 3.055A9.001 9.001 0 1020.945 13H11V3.055z" />
151
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.488 9H15V3.512A9.025 9.025 0 0120.488 9z" />
152
+ </svg>
153
+ Daily Progress
154
+ </h2>
155
+
156
+ <div class="flex items-center justify-center py-4">
157
+ <div class="relative w-40 h-40">
158
+ <svg class="w-full h-full" viewBox="0 0 100 100">
159
+ <circle class="text-slate-700 stroke-current" stroke-width="8" cx="50" cy="50" r="40" fill="transparent"></circle>
160
+ <circle id="progress-ring" class="text-indigo-500 progress-ring__circle stroke-current" stroke-width="8" stroke-linecap="round" cx="50" cy="50" r="40" fill="transparent" stroke-dasharray="251.2" stroke-dashoffset="251.2"></circle>
161
+ </svg>
162
+ <div class="absolute top-0 left-0 w-full h-full flex flex-col items-center justify-center">
163
+ <span id="progress-text" class="text-3xl font-bold text-white">0%</span>
164
+ <span class="text-xs text-slate-400 uppercase">Done</span>
165
+ </div>
166
+ </div>
167
+ </div>
168
+
169
+ <div class="mt-4 text-center">
170
+ <p id="motivational-quote" class="text-sm text-slate-300 italic">"Small steps every day."</p>
171
+ </div>
172
+ </div>
173
+
174
+ <!-- Streak Card -->
175
+ <div class="glass-panel rounded-2xl p-6 flex items-center justify-between">
176
+ <div>
177
+ <p class="text-sm text-slate-400 uppercase tracking-wide">Current Streak</p>
178
+ <div class="flex items-baseline gap-1 mt-1">
179
+ <span id="streak-count" class="text-4xl font-bold text-white">12</span>
180
+ <span class="text-sm text-slate-400">days</span>
181
+ </div>
182
+ </div>
183
+ <div class="h-12 w-12 rounded-full bg-orange-500/20 flex items-center justify-center streak-flame">
184
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-orange-500" viewBox="0 0 20 20" fill="currentColor">
185
+ <path fill-rule="evenodd" d="M12.395 2.553a1 1 0 00-1.45-.385c-.345.23-.614.558-.822.88-.214.33-.403.713-.57 1.116-.334.804-.614 1.768-.84 2.734a31.365 31.365 0 00-.613 3.58 2.64 2.64 0 01-.945-1.067c-.328-.68-.398-1.534-.398-2.654A1 1 0 005.05 6.05 6.981 6.981 0 003 11a7 7 0 1011.95-4.95c-.592-.591-.98-.985-1.348-1.467-.363-.476-.724-1.063-1.207-2.03zM12.12 15.12A3 3 0 017 13s.879.5 2.5.5c0-1 .5-4 1.25-4.5.5 1 .786 1.293 1.371 1.879A2.99 2.99 0 0113 13a2.99 2.99 0 01-.879 2.121z" clip-rule="evenodd" />
186
+ </svg>
187
+ </div>
188
+ </div>
189
+
190
+ <!-- Add Habit Form -->
191
+ <div class="glass-panel rounded-2xl p-6">
192
+ <h3 class="text-md font-semibold mb-4 text-white">Add New Habit</h3>
193
+ <form id="add-habit-form" class="flex flex-col gap-3">
194
+ <input type="text" id="new-habit-input" placeholder="e.g., Read 10 pages..." class="w-full bg-slate-800/50 border border-slate-700 rounded-lg px-4 py-3 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 transition-all">
195
+ <div class="flex gap-2">
196
+ <select id="new-habit-category" class="bg-slate-800/50 border border-slate-700 rounded-lg px-3 py-3 text-sm text-slate-300 focus:outline-none focus:border-indigo-500 flex-grow">
197
+ <option value="health">Health</option>
198
+ <option value="work">Work</option>
199
+ <option value="learning">Learning</option>
200
+ <option value="mindfulness">Mindfulness</option>
201
+ </select>
202
+ <button type="submit" class="bg-indigo-600 hover:bg-indigo-500 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors flex items-center justify-center">
203
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
204
+ <path fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" clip-rule="evenodd" />
205
+ </svg>
206
+ </button>
207
+ </div>
208
+ </form>
209
+ </div>
210
+
211
+ </aside>
212
+
213
+ <!-- Right Column: Habit List -->
214
+ <section class="w-full lg:w-2/3">
215
+ <div class="flex justify-between items-end mb-6">
216
+ <div>
217
+ <h2 class="text-2xl font-bold text-white">Your Habits</h2>
218
+ <p class="text-slate-400 text-sm mt-1">Consistency is key to mastery.</p>
219
+ </div>
220
+ <div class="flex gap-2">
221
+ <button onclick="filterHabits('all')" class="filter-btn active px-3 py-1 rounded-full text-xs font-medium bg-indigo-600 text-white transition-all">All</button>
222
+ <button onclick="filterHabits('active')" class="filter-btn px-3 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-400 hover:bg-slate-700 transition-all">Active</button>
223
+ <button onclick="filterHabits('completed')" class="filter-btn px-3 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-400 hover:bg-slate-700 transition-all">Completed</button>
224
+ </div>
225
+ </div>
226
+
227
+ <div id="habit-list" class="grid grid-cols-1 gap-4">
228
+ <!-- Habits will be injected here via JS -->
229
+ </div>
230
+
231
+ <!-- Empty State (Hidden by default) -->
232
+ <div id="empty-state" class="hidden flex flex-col items-center justify-center py-12 text-center">
233
+ <div class="w-16 h-16 bg-slate-800 rounded-full flex items-center justify-center mb-4">
234
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-slate-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
235
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
236
+ </svg>
237
+ </div>
238
+ <h3 class="text-lg font-medium text-white">All caught up!</h3>
239
+ <p class="text-slate-500 text-sm mt-1">You've completed all your habits for today.</p>
240
+ </div>
241
+ </section>
242
+ </main>
243
+
244
+ <!-- Footer -->
245
+ <footer class="w-full py-6 text-center text-slate-600 text-sm border-t border-slate-800/50 mt-auto">
246
+ <p>&copy; 2023 Keep Going. Stay consistent.</p>
247
+ </footer>
248
+
249
+ <!-- Canvas for Confetti -->
250
+ <div id="confetti-container" class="fixed inset-0 pointer-events-none z-[100] overflow-hidden"></div>
251
+
252
+ <script>
253
+ // --- Data & State ---
254
+ const quotes = [
255
+ "Success is the sum of small efforts, repeated day in and day out.",
256
+ "Don't watch the clock; do what it does. Keep going.",
257
+ "The secret of getting ahead is getting started.",
258
+ "It always seems impossible until it's done.",
259
+ "Your future is created by what you do today, not tomorrow.",
260
+ "Believe you can and you're halfway there."
261
+ ];
262
+
263
+ const categories = {
264
+ health: { color: 'text-emerald-400', bg: 'bg-emerald-500/10', border: 'border-emerald-500/20', icon: '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z" />' },
265
+ work: { color: 'text-blue-400', bg: 'bg-blue-500/10', border: 'border-blue-500/20', icon: '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />' },
266
+ learning: { color: 'text-amber-400', bg: 'bg-amber-500/10', border: 'border-amber-500/20', icon: '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" />' },
267
+ mindfulness: { color: 'text-purple-400', bg: 'bg-purple-500/10', border: 'border-purple-500/20', icon: '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />' }
268
+ };
269
+
270
+ let habits = [
271
+ { id: 1, title: "Morning Meditation", category: "mindfulness", completed: false, streak: 5 },
272
+ { id: 2, title: "Drink 2L Water", category: "health", completed: false, streak: 12 },
273
+ { id: 3, title: "Read 10 Pages", category: "learning", completed: true, streak: 3 },
274
+ { id: 4, title: "Deep Work Session", category: "work", completed: false, streak: 8 },
275
+ { id: 5, title: "Evening Walk", category: "health", completed: false, streak: 2 }
276
+ ];
277
+
278
+ let currentFilter = 'all';
279
+
280
+ // --- DOM Elements ---
281
+ const habitListEl = document.getElementById('habit-list');
282
+ const emptyStateEl = document.getElementById('empty-state');
283
+ const progressRing = document.getElementById('progress-ring');
284
+ const progressText = document.getElementById('progress-text');
285
+ const quoteEl = document.getElementById('motivational-quote');
286
+ const form = document.getElementById('add-habit-form');
287
+ const input = document.getElementById('new-habit-input');
288
+ const categorySelect = document.getElementById('new-habit-category');
289
+ const dateEl = document.getElementById('current-date');
290
+ const timeEl = document.getElementById('current-time');
291
+
292
+ // --- Initialization ---
293
+ document.addEventListener('DOMContentLoaded', () => {
294
+ updateTime();
295
+ setInterval(updateTime, 1000);
296
+ renderHabits();
297
+ updateStats();
298
+ initBackgroundParticles();
299
+
300
+ // Random Quote
301
+ quoteEl.textContent = `"${quotes[Math.floor(Math.random() * quotes.length)]}"`;
302
+ });
303
+
304
+ // --- Core Functions ---
305
+
306
+ function updateTime() {
307
+ const now = new Date();
308
+ dateEl.textContent = now.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric' });
309
+ timeEl.textContent = now.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' });
310
+ }
311
+
312
+ function renderHabits() {
313
+ habitListEl.innerHTML = '';
314
+
315
+ const filteredHabits = habits.filter(h => {
316
+ if (currentFilter === 'active') return !h.completed;
317
+ if (currentFilter === 'completed') return h.completed;
318
+ return true;
319
+ });
320
+
321
+ if (filteredHabits.length === 0) {
322
+ emptyStateEl.classList.remove('hidden');
323
+ } else {
324
+ emptyStateEl.classList.add('hidden');
325
+ filteredHabits.forEach(habit => {
326
+ const style = categories[habit.category];
327
+ const el = document.createElement('div');
328
+ el.className = `habit-card glass-panel rounded-xl p-4 flex items-center justify-between border border-slate-700/50 ${habit.completed ? 'opacity-60' : ''}`;
329
+ el.style.animation = 'slideIn 0.4s ease-out forwards';
330
+
331
+ el.innerHTML = `
332
+ <div class="flex items-center gap-4">
333
+ <div class="w-10 h-10 rounded-lg ${style.bg} ${style.color} flex items-center justify-center border ${style.border}">
334
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
335
+ ${style.icon}
336
+ </svg>
337
+ </div>
338
+ <div>
339
+ <h4 class="font-medium text-white ${habit.completed ? 'line-through text-slate-500' : ''}">${habit.title}</h4>
340
+ <div class="flex items-center gap-2 mt-1">
341
+ <span class="text-xs px-2 py-0.5 rounded-full bg-slate-800 text-slate-400 capitalize border border-slate-700">${habit.category}</span>
342
+ <span class="text-xs text-orange-400 flex items-center gap-1">
343
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3" viewBox="0 0 20 20" fill="currentColor">
344
+ <path fill-rule="evenodd" d="M12.395 2.553a1 1 0 00-1.45-.385c-.345.23-.614.558-.822.88-.214.33-.403.713-.57 1.116-.334.804-.614 1.768-.84 2.734a31.365 31.365 0 00-.613 3.58 2.64 2.64 0 01-.945-1.067c-.328-.68-.398-1.534-.398-2.654A1 1 0 005.05 6.05 6.981 6.981 0 003 11a7 7 0 1011.95-4.95c-.592-.591-.98-.985-1.348-1.467-.363-.476-.724-1.063-1.207-2.03zM12.12 15.12A3 3 0 017 13s.879.5 2.5.5c0-1 .5-4 1.25-4.5.5 1 .786 1.293 1.371 1.879A2.99 2.99 0 0113 13a2.99 2.99 0 01-.879 2.121z" clip-rule="evenodd" />
345
+ </svg>
346
+ ${habit.streak} day streak
347
+ </span>
348
+ </div>
349
+ </div>
350
+ </div>
351
+ <div class="flex items-center gap-3">
352
+ <button onclick="deleteHabit(${habit.id})" class="text-slate-600 hover:text-red-400 transition-colors p-2">
353
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
354
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
355
+ </svg>
356
+ </button>
357
+ <label class="checkbox-wrapper cursor-pointer relative w-8 h-8">
358
+ <input type="checkbox" class="appearance-none w-full h-full" ${habit.completed ? 'checked' : ''} onchange="toggleHabit(${habit.id})">
359
+ <div class="w-8 h-8 border-2 border-slate-600 rounded-lg flex items-center justify-center transition-all hover:border-indigo-400">
360
+ <svg class="w-5 h-5 text-white hidden pointer-events-none" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M5 13l4 4L19 7"></path></svg>
361
+ </div>
362
+ </label>
363
+ </div>
364
+ `;
365
+ habitListEl.appendChild(el);
366
+ });
367
+ }
368
+ }
369
+
370
+ function toggleHabit(id) {
371
+ const habit = habits.find(h => h.id === id);
372
+ if (habit) {
373
+ habit.completed = !habit.completed;
374
+ if (habit.completed) {
375
+ habit.streak++;
376
+ triggerConfetti();
377
+ } else {
378
+ habit.streak--;
379
+ }
380
+ renderHabits();
381
+ updateStats();
382
+ }
383
+ }
384
+
385
+ function deleteHabit(id) {
386
+ if(confirm('Delete this habit?')) {
387
+ habits = habits.filter(h => h.id !== id);
388
+ renderHabits();
389
+ updateStats();
390
+ }
391
+ }
392
+
393
+ function addHabit(e) {
394
+ e.preventDefault();
395
+ const title = input.value.trim();
396
+ const category = categorySelect.value;
397
+
398
+ if (title) {
399
+ const newHabit = {
400
+ id: Date.now(),
401
+ title: title,
402
+ category: category,
403
+ completed: false,
404
+ streak: 0
405
+ };
406
+ habits.unshift(newHabit); // Add to top
407
+ input.value = '';
408
+ renderHabits();
409
+ updateStats();
410
+ }
411
+ }
412
+
413
+ form.addEventListener('submit', addHabit);
414
+
415
+ function filterHabits(filter) {
416
+ currentFilter = filter;
417
+
418
+ // Update buttons
419
+ document.querySelectorAll('.filter-btn').forEach(btn => {
420
+ if (btn.textContent.toLowerCase() === filter) {
421
+ btn.classList.remove('bg-slate-800', 'text-slate-400');
422
+ btn.classList.add('bg-indigo-600', 'text-white');
423
+ } else {
424
+ btn.classList.add('bg-slate-800', 'text-slate-400');
425
+ btn.classList.remove('bg-indigo-600', 'text-white');
426
+ }
427
+ });
428
+
429
+ renderHabits();
430
+ }
431
+
432
+ function updateStats() {
433
+ const total = habits.length;
434
+ const completed = habits.filter(h => h.completed).length;
435
+ const percent = total === 0 ? 0 : Math.round((completed / total) * 100);
436
+
437
+ // Update Ring
438
+ const radius = 40;
439
+ const circumference = 2 * Math.PI * radius;
440
+ const offset = circumference - (percent / 100) * circumference;
441
+
442
+ progressRing.style.strokeDashoffset = offset;
443
+ progressText.textContent = `${percent}%`;
444
+
445
+ // Update Streak (Max streak of all habits)
446
+ const maxStreak = habits.length > 0 ? Math.max(...habits.map(h => h.streak)) : 0;
447
+ document.getElementById('streak-count').textContent = maxStreak;
448
+ }
449
+
450
+ // --- Visual Effects ---
451
+
452
+ function triggerConfetti() {
453
+ const colors = ['#4f46e5', '#ec4899', '#10b981', '#f59e0b'];
454
+ const container = document.getElementById('confetti-container');
455
+
456
+ for (let i = 0; i < 50; i++) {
457
+ const confetti = document.createElement('div');
458
+ confetti.className = 'confetti';
459
+ confetti.style.left = Math.random() * 100 + 'vw';
460
+ confetti.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
461
+ confetti.style.animation = `confetti-fall ${Math.random() * 3 + 2}s linear forwards`;
462
+ container.appendChild(confetti);
463
+
464
+ // Cleanup
465
+ setTimeout(() => {
466
+ confetti.remove();
467
+ }, 5000);
468
+ }
469
+ }
470
+
471
+ function initBackgroundParticles() {
472
+ const canvas = document.getElementById('bgCanvas');
473
+ const ctx = canvas.getContext('2d');
474
+ let width, height;
475
+ let particles = [];
476
+
477
+ function resize() {
478
+ width = canvas.width = window.innerWidth;
479
+ height = canvas.height = window.innerHeight;
480
+ }
481
+
482
+ class Particle {
483
+ constructor() {
484
+ this.x = Math.random() * width;
485
+ this.y = Math.random() * height;
486
+ this.vx = (Math.random() - 0.5) * 0.5;
487
+ this.vy = (Math.random() - 0.5) * 0.5;
488
+ this.size = Math.random() * 2;
489
+ this.color = `rgba(${Math.random() > 0.5 ? '99, 102, 241' : '236, 72, 153'}, ${Math.random() * 0.5})`;
490
+ }
491
+ update() {
492
+ this.x += this.vx;
493
+ this.y += this.vy;
494
+ if (this.x < 0 || this.x > width) this.vx *= -1;
495
+ if (this.y < 0 || this.y > height) this.vy *= -1;
496
+ }
497
+ draw() {
498
+ ctx.fillStyle = this.color;
499
+ ctx.beginPath();
500
+ ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
501
+ ctx.fill();
502
+ }
503
+ }
504
+
505
+ function init() {
506
+ particles = [];
507
+ for (let i = 0; i < 50; i++) {
508
+ particles.push(new Particle());
509
+ }
510
+ }
511
+
512
+ function animate() {
513
+ ctx.clearRect(0, 0, width, height);
514
+ particles.forEach(p => {
515
+ p.update();
516
+ p.draw();
517
+ });
518
+
519
+ // Draw connections
520
+ particles.forEach((p1, i) => {
521
+ particles.slice(i + 1).forEach(p2 => {
522
+ const dx = p1.x - p2.x;
523
+ const dy = p1.y - p2.y;
524
+ const dist = Math.sqrt(dx * dx + dy * dy);
525
+ if (dist < 150) {
526
+ ctx.strokeStyle = `rgba(148, 163, 184, ${0.1 - dist/1500})`;
527
+ ctx.lineWidth = 1;
528
+ ctx.beginPath();
529
+ ctx.moveTo(p1.x, p1.y);
530
+ ctx.lineTo(p2.x, p2.y);
531
+ ctx.stroke();
532
+ }
533
+ });
534
+ });
535
+
536
+ requestAnimationFrame(animate);
537
+ }
538
+
539
+ window.addEventListener('resize', resize);
540
+ resize();
541
+ init();
542
+ animate();
543
+ }
544
+ </script>
545
+ </body>
546
+ </html>