HI7RAI commited on
Commit
cd8cd62
·
verified ·
1 Parent(s): b4ca030

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +809 -19
index.html CHANGED
@@ -1,19 +1,809 @@
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>TaskFlow - Productivity App</title>
7
+ <link rel="preconnect" href="https://fonts.googleapis.com">
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
10
+ <style>
11
+ :root {
12
+ --primary: #6366f1;
13
+ --primary-dark: #4f46e5;
14
+ --primary-light: #818cf8;
15
+ --secondary: #10b981;
16
+ --danger: #ef4444;
17
+ --warning: #f59e0b;
18
+ --background: #0f172a;
19
+ --surface: #1e293b;
20
+ --surface-light: #334155;
21
+ --text: #f8fafc;
22
+ --text-muted: #94a3b8;
23
+ --border: #475569;
24
+ --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
25
+ }
26
+
27
+ * {
28
+ margin: 0;
29
+ padding: 0;
30
+ box-sizing: border-box;
31
+ }
32
+
33
+ body {
34
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
35
+ background: var(--background);
36
+ color: var(--text);
37
+ min-height: 100vh;
38
+ line-height: 1.6;
39
+ }
40
+
41
+ /* Animated background */
42
+ .bg-pattern {
43
+ position: fixed;
44
+ top: 0;
45
+ left: 0;
46
+ width: 100%;
47
+ height: 100%;
48
+ z-index: -1;
49
+ overflow: hidden;
50
+ }
51
+
52
+ .bg-pattern::before {
53
+ content: '';
54
+ position: absolute;
55
+ top: -50%;
56
+ left: -50%;
57
+ width: 200%;
58
+ height: 200%;
59
+ background:
60
+ radial-gradient(ellipse at 20% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
61
+ radial-gradient(ellipse at 80% 70%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
62
+ radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.08) 0%, transparent 60%);
63
+ animation: float 20s ease-in-out infinite;
64
+ }
65
+
66
+ @keyframes float {
67
+ 0%, 100% { transform: translate(0, 0) rotate(0deg); }
68
+ 33% { transform: translate(2%, 2%) rotate(1deg); }
69
+ 66% { transform: translate(-1%, 1%) rotate(-1deg); }
70
+ }
71
+
72
+ /* Header */
73
+ header {
74
+ background: rgba(30, 41, 59, 0.8);
75
+ backdrop-filter: blur(20px);
76
+ border-bottom: 1px solid var(--border);
77
+ padding: 1rem 2rem;
78
+ position: sticky;
79
+ top: 0;
80
+ z-index: 100;
81
+ }
82
+
83
+ .header-content {
84
+ max-width: 1200px;
85
+ margin: 0 auto;
86
+ display: flex;
87
+ justify-content: space-between;
88
+ align-items: center;
89
+ }
90
+
91
+ .logo {
92
+ display: flex;
93
+ align-items: center;
94
+ gap: 0.75rem;
95
+ font-size: 1.5rem;
96
+ font-weight: 700;
97
+ color: var(--text);
98
+ text-decoration: none;
99
+ }
100
+
101
+ .logo-icon {
102
+ width: 40px;
103
+ height: 40px;
104
+ background: linear-gradient(135deg, var(--primary), var(--primary-light));
105
+ border-radius: 10px;
106
+ display: flex;
107
+ align-items: center;
108
+ justify-content: center;
109
+ font-size: 1.25rem;
110
+ }
111
+
112
+ .nav-links {
113
+ display: flex;
114
+ gap: 2rem;
115
+ list-style: none;
116
+ }
117
+
118
+ .nav-links a {
119
+ color: var(--text-muted);
120
+ text-decoration: none;
121
+ font-weight: 500;
122
+ transition: color 0.3s;
123
+ }
124
+
125
+ .nav-links a:hover {
126
+ color: var(--text);
127
+ }
128
+
129
+ /* Main content */
130
+ main {
131
+ max-width: 1200px;
132
+ margin: 0 auto;
133
+ padding: 2rem;
134
+ }
135
+
136
+ /* Stats cards */
137
+ .stats-grid {
138
+ display: grid;
139
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
140
+ gap: 1.5rem;
141
+ margin-bottom: 2rem;
142
+ }
143
+
144
+ .stat-card {
145
+ background: var(--surface);
146
+ border: 1px solid var(--border);
147
+ border-radius: 16px;
148
+ padding: 1.5rem;
149
+ transition: all 0.3s;
150
+ }
151
+
152
+ .stat-card:hover {
153
+ transform: translateY(-4px);
154
+ border-color: var(--primary);
155
+ box-shadow: 0 20px 40px rgba(99, 102, 241, 0.15);
156
+ }
157
+
158
+ .stat-icon {
159
+ width: 48px;
160
+ height: 48px;
161
+ border-radius: 12px;
162
+ display: flex;
163
+ align-items: center;
164
+ justify-content: center;
165
+ font-size: 1.5rem;
166
+ margin-bottom: 1rem;
167
+ }
168
+
169
+ .stat-icon.primary { background: rgba(99, 102, 241, 0.2); }
170
+ .stat-icon.success { background: rgba(16, 185, 129, 0.2); }
171
+ .stat-icon.warning { background: rgba(245, 158, 11, 0.2); }
172
+ .stat-icon.danger { background: rgba(239, 68, 68, 0.2); }
173
+
174
+ .stat-value {
175
+ font-size: 2rem;
176
+ font-weight: 700;
177
+ margin-bottom: 0.25rem;
178
+ }
179
+
180
+ .stat-label {
181
+ color: var(--text-muted);
182
+ font-size: 0.875rem;
183
+ }
184
+
185
+ /* Task input */
186
+ .task-input-section {
187
+ background: var(--surface);
188
+ border: 1px solid var(--border);
189
+ border-radius: 16px;
190
+ padding: 1.5rem;
191
+ margin-bottom: 2rem;
192
+ }
193
+
194
+ .task-input-wrapper {
195
+ display: flex;
196
+ gap: 1rem;
197
+ flex-wrap: wrap;
198
+ }
199
+
200
+ .task-input {
201
+ flex: 1;
202
+ min-width: 250px;
203
+ padding: 1rem 1.25rem;
204
+ background: var(--background);
205
+ border: 2px solid var(--border);
206
+ border-radius: 12px;
207
+ color: var(--text);
208
+ font-size: 1rem;
209
+ font-family: inherit;
210
+ transition: all 0.3s;
211
+ }
212
+
213
+ .task-input:focus {
214
+ outline: none;
215
+ border-color: var(--primary);
216
+ box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
217
+ }
218
+
219
+ .task-input::placeholder {
220
+ color: var(--text-muted);
221
+ }
222
+
223
+ .priority-select {
224
+ padding: 1rem 1.25rem;
225
+ background: var(--background);
226
+ border: 2px solid var(--border);
227
+ border-radius: 12px;
228
+ color: var(--text);
229
+ font-size: 1rem;
230
+ font-family: inherit;
231
+ cursor: pointer;
232
+ transition: all 0.3s;
233
+ }
234
+
235
+ .priority-select:focus {
236
+ outline: none;
237
+ border-color: var(--primary);
238
+ }
239
+
240
+ .add-btn {
241
+ padding: 1rem 2rem;
242
+ background: linear-gradient(135deg, var(--primary), var(--primary-dark));
243
+ border: none;
244
+ border-radius: 12px;
245
+ color: white;
246
+ font-size: 1rem;
247
+ font-weight: 600;
248
+ font-family: inherit;
249
+ cursor: pointer;
250
+ transition: all 0.3s;
251
+ display: flex;
252
+ align-items: center;
253
+ gap: 0.5rem;
254
+ }
255
+
256
+ .add-btn:hover {
257
+ transform: translateY(-2px);
258
+ box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
259
+ }
260
+
261
+ /* Task list */
262
+ .tasks-section {
263
+ background: var(--surface);
264
+ border: 1px solid var(--border);
265
+ border-radius: 16px;
266
+ padding: 1.5rem;
267
+ }
268
+
269
+ .section-header {
270
+ display: flex;
271
+ justify-content: space-between;
272
+ align-items: center;
273
+ margin-bottom: 1.5rem;
274
+ }
275
+
276
+ .section-title {
277
+ font-size: 1.25rem;
278
+ font-weight: 600;
279
+ }
280
+
281
+ .filter-btns {
282
+ display: flex;
283
+ gap: 0.5rem;
284
+ }
285
+
286
+ .filter-btn {
287
+ padding: 0.5rem 1rem;
288
+ background: transparent;
289
+ border: 1px solid var(--border);
290
+ border-radius: 8px;
291
+ color: var(--text-muted);
292
+ font-size: 0.875rem;
293
+ font-family: inherit;
294
+ cursor: pointer;
295
+ transition: all 0.3s;
296
+ }
297
+
298
+ .filter-btn.active, .filter-btn:hover {
299
+ background: var(--primary);
300
+ border-color: var(--primary);
301
+ color: white;
302
+ }
303
+
304
+ .task-list {
305
+ display: flex;
306
+ flex-direction: column;
307
+ gap: 0.75rem;
308
+ }
309
+
310
+ .task-item {
311
+ display: flex;
312
+ align-items: center;
313
+ gap: 1rem;
314
+ padding: 1rem 1.25rem;
315
+ background: var(--background);
316
+ border: 1px solid var(--border);
317
+ border-radius: 12px;
318
+ transition: all 0.3s;
319
+ animation: slideIn 0.3s ease-out;
320
+ }
321
+
322
+ @keyframes slideIn {
323
+ from {
324
+ opacity: 0;
325
+ transform: translateX(-20px);
326
+ }
327
+ to {
328
+ opacity: 1;
329
+ transform: translateX(0);
330
+ }
331
+ }
332
+
333
+ .task-item:hover {
334
+ border-color: var(--surface-light);
335
+ }
336
+
337
+ .task-item.completed {
338
+ opacity: 0.6;
339
+ }
340
+
341
+ .task-item.completed .task-text {
342
+ text-decoration: line-through;
343
+ }
344
+
345
+ .task-checkbox {
346
+ width: 24px;
347
+ height: 24px;
348
+ border: 2px solid var(--border);
349
+ border-radius: 6px;
350
+ cursor: pointer;
351
+ display: flex;
352
+ align-items: center;
353
+ justify-content: center;
354
+ transition: all 0.3s;
355
+ flex-shrink: 0;
356
+ }
357
+
358
+ .task-checkbox:hover {
359
+ border-color: var(--primary);
360
+ }
361
+
362
+ .task-checkbox.checked {
363
+ background: var(--secondary);
364
+ border-color: var(--secondary);
365
+ }
366
+
367
+ .task-content {
368
+ flex: 1;
369
+ min-width: 0;
370
+ }
371
+
372
+ .task-text {
373
+ font-weight: 500;
374
+ margin-bottom: 0.25rem;
375
+ word-break: break-word;
376
+ }
377
+
378
+ .task-meta {
379
+ display: flex;
380
+ gap: 1rem;
381
+ font-size: 0.75rem;
382
+ color: var(--text-muted);
383
+ }
384
+
385
+ .priority-badge {
386
+ padding: 0.25rem 0.75rem;
387
+ border-radius: 20px;
388
+ font-size: 0.75rem;
389
+ font-weight: 600;
390
+ text-transform: uppercase;
391
+ }
392
+
393
+ .priority-badge.high {
394
+ background: rgba(239, 68, 68, 0.2);
395
+ color: #f87171;
396
+ }
397
+
398
+ .priority-badge.medium {
399
+ background: rgba(245, 158, 11, 0.2);
400
+ color: #fbbf24;
401
+ }
402
+
403
+ .priority-badge.low {
404
+ background: rgba(16, 185, 129, 0.2);
405
+ color: #34d399;
406
+ }
407
+
408
+ .delete-btn {
409
+ padding: 0.5rem;
410
+ background: transparent;
411
+ border: none;
412
+ color: var(--text-muted);
413
+ cursor: pointer;
414
+ border-radius: 8px;
415
+ transition: all 0.3s;
416
+ font-size: 1.25rem;
417
+ }
418
+
419
+ .delete-btn:hover {
420
+ background: rgba(239, 68, 68, 0.2);
421
+ color: var(--danger);
422
+ }
423
+
424
+ /* Empty state */
425
+ .empty-state {
426
+ text-align: center;
427
+ padding: 3rem;
428
+ color: var(--text-muted);
429
+ }
430
+
431
+ .empty-icon {
432
+ font-size: 4rem;
433
+ margin-bottom: 1rem;
434
+ opacity: 0.5;
435
+ }
436
+
437
+ /* Progress bar */
438
+ .progress-section {
439
+ margin-top: 2rem;
440
+ padding: 1.5rem;
441
+ background: var(--surface);
442
+ border: 1px solid var(--border);
443
+ border-radius: 16px;
444
+ }
445
+
446
+ .progress-header {
447
+ display: flex;
448
+ justify-content: space-between;
449
+ align-items: center;
450
+ margin-bottom: 1rem;
451
+ }
452
+
453
+ .progress-bar {
454
+ height: 12px;
455
+ background: var(--background);
456
+ border-radius: 6px;
457
+ overflow: hidden;
458
+ }
459
+
460
+ .progress-fill {
461
+ height: 100%;
462
+ background: linear-gradient(90deg, var(--primary), var(--secondary));
463
+ border-radius: 6px;
464
+ transition: width 0.5s ease;
465
+ }
466
+
467
+ /* Footer */
468
+ footer {
469
+ text-align: center;
470
+ padding: 2rem;
471
+ color: var(--text-muted);
472
+ font-size: 0.875rem;
473
+ }
474
+
475
+ footer a {
476
+ color: var(--primary-light);
477
+ text-decoration: none;
478
+ }
479
+
480
+ footer a:hover {
481
+ text-decoration: underline;
482
+ }
483
+
484
+ /* Responsive */
485
+ @media (max-width: 768px) {
486
+ .header-content {
487
+ flex-direction: column;
488
+ gap: 1rem;
489
+ }
490
+
491
+ .nav-links {
492
+ gap: 1rem;
493
+ }
494
+
495
+ main {
496
+ padding: 1rem;
497
+ }
498
+
499
+ .task-input-wrapper {
500
+ flex-direction: column;
501
+ }
502
+
503
+ .task-input, .priority-select, .add-btn {
504
+ width: 100%;
505
+ }
506
+
507
+ .filter-btns {
508
+ flex-wrap: wrap;
509
+ }
510
+ }
511
+
512
+ /* Notification toast */
513
+ .toast {
514
+ position: fixed;
515
+ bottom: 2rem;
516
+ right: 2rem;
517
+ padding: 1rem 1.5rem;
518
+ background: var(--surface);
519
+ border: 1px solid var(--border);
520
+ border-radius: 12px;
521
+ box-shadow: var(--shadow);
522
+ animation: slideUp 0.3s ease-out;
523
+ z-index: 1000;
524
+ }
525
+
526
+ @keyframes slideUp {
527
+ from {
528
+ opacity: 0;
529
+ transform: translateY(20px);
530
+ }
531
+ to {
532
+ opacity: 1;
533
+ transform: translateY(0);
534
+ }
535
+ }
536
+
537
+ .toast.success {
538
+ border-color: var(--secondary);
539
+ }
540
+
541
+ .toast.error {
542
+ border-color: var(--danger);
543
+ }
544
+ </style>
545
+ </head>
546
+ <body>
547
+ <div class="bg-pattern"></div>
548
+
549
+ <header>
550
+ <div class="header-content">
551
+ <a href="#" class="logo">
552
+ <div class="logo-icon">✓</div>
553
+ <span>TaskFlow</span>
554
+ </a>
555
+ <nav>
556
+ <ul class="nav-links">
557
+ <li><a href="#" onclick="filterTasks('all')">All Tasks</a></li>
558
+ <li><a href="#" onclick="filterTasks('active')">Active</a></li>
559
+ <li><a href="#" onclick="filterTasks('completed')">Completed</a></li>
560
+ </ul>
561
+ </nav>
562
+ </div>
563
+ </header>
564
+
565
+ <main>
566
+ <!-- Stats Grid -->
567
+ <div class="stats-grid">
568
+ <div class="stat-card">
569
+ <div class="stat-icon primary">📋</div>
570
+ <div class="stat-value" id="totalTasks">0</div>
571
+ <div class="stat-label">Total Tasks</div>
572
+ </div>
573
+ <div class="stat-card">
574
+ <div class="stat-icon success">✅</div>
575
+ <div class="stat-value" id="completedTasks">0</div>
576
+ <div class="stat-label">Completed</div>
577
+ </div>
578
+ <div class="stat-card">
579
+ <div class="stat-icon warning">⏳</div>
580
+ <div class="stat-value" id="pendingTasks">0</div>
581
+ <div class="stat-label">Pending</div>
582
+ </div>
583
+ <div class="stat-card">
584
+ <div class="stat-icon danger">🔥</div>
585
+ <div class="stat-value" id="highPriorityTasks">0</div>
586
+ <div class="stat-label">High Priority</div>
587
+ </div>
588
+ </div>
589
+
590
+ <!-- Task Input -->
591
+ <div class="task-input-section">
592
+ <div class="task-input-wrapper">
593
+ <input type="text" class="task-input" id="taskInput" placeholder="What needs to be done?" onkeypress="handleEnter(event)">
594
+ <select class="priority-select" id="prioritySelect">
595
+ <option value="low">Low Priority</option>
596
+ <option value="medium" selected>Medium Priority</option>
597
+ <option value="high">High Priority</option>
598
+ </select>
599
+ <button class="add-btn" onclick="addTask()">
600
+ <span>+</span> Add Task
601
+ </button>
602
+ </div>
603
+ </div>
604
+
605
+ <!-- Task List -->
606
+ <div class="tasks-section">
607
+ <div class="section-header">
608
+ <h2 class="section-title">Your Tasks</h2>
609
+ <div class="filter-btns">
610
+ <button class="filter-btn active" onclick="filterTasks('all')">All</button>
611
+ <button class="filter-btn" onclick="filterTasks('active')">Active</button>
612
+ <button class="filter-btn" onclick="filterTasks('completed')">Completed</button>
613
+ </div>
614
+ </div>
615
+ <div class="task-list" id="taskList">
616
+ <div class="empty-state">
617
+ <div class="empty-icon">📝</div>
618
+ <p>No tasks yet. Add your first task above!</p>
619
+ </div>
620
+ </div>
621
+ </div>
622
+
623
+ <!-- Progress -->
624
+ <div class="progress-section">
625
+ <div class="progress-header">
626
+ <span class="section-title">Progress</span>
627
+ <span id="progressText">0% Complete</span>
628
+ </div>
629
+ <div class="progress-bar">
630
+ <div class="progress-fill" id="progressFill" style="width: 0%"></div>
631
+ </div>
632
+ </div>
633
+ </main>
634
+
635
+ <footer>
636
+ <p>Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">anycoder</a> - AI-Powered Code Generation</p>
637
+ </footer>
638
+
639
+ <script>
640
+ // Task storage
641
+ let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
642
+ let currentFilter = 'all';
643
+
644
+ // Initialize
645
+ document.addEventListener('DOMContentLoaded', () => {
646
+ renderTasks();
647
+ updateStats();
648
+ });
649
+
650
+ // Add task
651
+ function addTask() {
652
+ const input = document.getElementById('taskInput');
653
+ const priority = document.getElementById('prioritySelect');
654
+ const text = input.value.trim();
655
+
656
+ if (!text) {
657
+ showToast('Please enter a task!', 'error');
658
+ return;
659
+ }
660
+
661
+ const task = {
662
+ id: Date.now(),
663
+ text: text,
664
+ priority: priority.value,
665
+ completed: false,
666
+ createdAt: new Date().toLocaleDateString()
667
+ };
668
+
669
+ tasks.push(task);
670
+ saveTasks();
671
+ renderTasks();
672
+ updateStats();
673
+
674
+ input.value = '';
675
+ input.focus();
676
+ showToast('Task added successfully!', 'success');
677
+ }
678
+
679
+ // Handle Enter key
680
+ function handleEnter(event) {
681
+ if (event.key === 'Enter') {
682
+ addTask();
683
+ }
684
+ }
685
+
686
+ // Toggle task completion
687
+ function toggleTask(id) {
688
+ tasks = tasks.map(task => {
689
+ if (task.id === id) {
690
+ return { ...task, completed: !task.completed };
691
+ }
692
+ return task;
693
+ });
694
+ saveTasks();
695
+ renderTasks();
696
+ updateStats();
697
+ }
698
+
699
+ // Delete task
700
+ function deleteTask(id) {
701
+ tasks = tasks.filter(task => task.id !== id);
702
+ saveTasks();
703
+ renderTasks();
704
+ updateStats();
705
+ showToast('Task deleted!', 'success');
706
+ }
707
+
708
+ // Filter tasks
709
+ function filterTasks(filter) {
710
+ currentFilter = filter;
711
+
712
+ // Update button states
713
+ document.querySelectorAll('.filter-btn').forEach(btn => {
714
+ btn.classList.remove('active');
715
+ if (btn.textContent.toLowerCase().includes(filter === 'all' ? 'all' : filter)) {
716
+ btn.classList.add('active');
717
+ }
718
+ });
719
+
720
+ renderTasks();
721
+ }
722
+
723
+ // Render tasks
724
+ function renderTasks() {
725
+ const taskList = document.getElementById('taskList');
726
+
727
+ let filteredTasks = tasks;
728
+ if (currentFilter === 'active') {
729
+ filteredTasks = tasks.filter(task => !task.completed);
730
+ } else if (currentFilter === 'completed') {
731
+ filteredTasks = tasks.filter(task => task.completed);
732
+ }
733
+
734
+ if (filteredTasks.length === 0) {
735
+ taskList.innerHTML = `
736
+ <div class="empty-state">
737
+ <div class="empty-icon">${currentFilter === 'completed' ? '🎉' : '📝'}</div>
738
+ <p>${currentFilter === 'completed' ? 'No completed tasks yet!' : 'No tasks found. Add your first task!'}</p>
739
+ </div>
740
+ `;
741
+ return;
742
+ }
743
+
744
+ taskList.innerHTML = filteredTasks.map(task => `
745
+ <div class="task-item ${task.completed ? 'completed' : ''}">
746
+ <div class="task-checkbox ${task.completed ? 'checked' : ''}" onclick="toggleTask(${task.id})">
747
+ ${task.completed ? '✓' : ''}
748
+ </div>
749
+ <div class="task-content">
750
+ <div class="task-text">${escapeHtml(task.text)}</div>
751
+ <div class="task-meta">
752
+ <span class="priority-badge ${task.priority}">${task.priority}</span>
753
+ <span>${task.createdAt}</span>
754
+ </div>
755
+ </div>
756
+ <button class="delete-btn" onclick="deleteTask(${task.id})" title="Delete task">×</button>
757
+ </div>
758
+ `).join('');
759
+ }
760
+
761
+ // Update statistics
762
+ function updateStats() {
763
+ const total = tasks.length;
764
+ const completed = tasks.filter(t => t.completed).length;
765
+ const pending = total - completed;
766
+ const highPriority = tasks.filter(t => t.priority === 'high' && !t.completed).length;
767
+
768
+ document.getElementById('totalTasks').textContent = total;
769
+ document.getElementById('completedTasks').textContent = completed;
770
+ document.getElementById('pendingTasks').textContent = pending;
771
+ document.getElementById('highPriorityTasks').textContent = highPriority;
772
+
773
+ // Update progress
774
+ const percentage = total > 0 ? Math.round((completed / total) * 100) : 0;
775
+ document.getElementById('progressFill').style.width = percentage + '%';
776
+ document.getElementById('progressText').textContent = percentage + '% Complete';
777
+ }
778
+
779
+ // Save to localStorage
780
+ function saveTasks() {
781
+ localStorage.setItem('tasks', JSON.stringify(tasks));
782
+ }
783
+
784
+ // Show toast notification
785
+ function showToast(message, type) {
786
+ const existingToast = document.querySelector('.toast');
787
+ if (existingToast) {
788
+ existingToast.remove();
789
+ }
790
+
791
+ const toast = document.createElement('div');
792
+ toast.className = `toast ${type}`;
793
+ toast.textContent = message;
794
+ document.body.appendChild(toast);
795
+
796
+ setTimeout(() => {
797
+ toast.remove();
798
+ }, 3000);
799
+ }
800
+
801
+ // Escape HTML to prevent XSS
802
+ function escapeHtml(text) {
803
+ const div = document.createElement('div');
804
+ div.textContent = text;
805
+ return div.innerHTML;
806
+ }
807
+ </script>
808
+ </body>
809
+ </html>