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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>Modern To-Do App</title>
|
| 7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 8 |
+
<style>
|
| 9 |
+
* {
|
| 10 |
+
margin: 0;
|
| 11 |
+
padding: 0;
|
| 12 |
+
box-sizing: border-box;
|
| 13 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
:root {
|
| 17 |
+
--primary: #4361ee;
|
| 18 |
+
--secondary: #3a0ca3;
|
| 19 |
+
--accent: #7209b7;
|
| 20 |
+
--light: #f8f9fa;
|
| 21 |
+
--dark: #212529;
|
| 22 |
+
--success: #4cc9f0;
|
| 23 |
+
--danger: #f72585;
|
| 24 |
+
--warning: #fca311;
|
| 25 |
+
--gray: #adb5bd;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
body {
|
| 29 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 30 |
+
min-height: 100vh;
|
| 31 |
+
display: flex;
|
| 32 |
+
justify-content: center;
|
| 33 |
+
align-items: center;
|
| 34 |
+
padding: 20px;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.container {
|
| 38 |
+
width: 100%;
|
| 39 |
+
max-width: 500px;
|
| 40 |
+
background: rgba(255, 255, 255, 0.9);
|
| 41 |
+
backdrop-filter: blur(10px);
|
| 42 |
+
border-radius: 20px;
|
| 43 |
+
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
|
| 44 |
+
overflow: hidden;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.header {
|
| 48 |
+
background: var(--primary);
|
| 49 |
+
color: white;
|
| 50 |
+
padding: 25px;
|
| 51 |
+
text-align: center;
|
| 52 |
+
position: relative;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
.header h1 {
|
| 56 |
+
font-size: 28px;
|
| 57 |
+
font-weight: 700;
|
| 58 |
+
margin-bottom: 5px;
|
| 59 |
+
letter-spacing: 1px;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.header p {
|
| 63 |
+
font-size: 14px;
|
| 64 |
+
opacity: 0.9;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.built-with {
|
| 68 |
+
position: absolute;
|
| 69 |
+
top: 15px;
|
| 70 |
+
right: 15px;
|
| 71 |
+
font-size: 12px;
|
| 72 |
+
background: rgba(255, 255, 255, 0.2);
|
| 73 |
+
padding: 4px 8px;
|
| 74 |
+
border-radius: 10px;
|
| 75 |
+
text-decoration: none;
|
| 76 |
+
color: white;
|
| 77 |
+
transition: all 0.3s ease;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.built-with:hover {
|
| 81 |
+
background: rgba(255, 255, 255, 0.3);
|
| 82 |
+
transform: translateY(-2px);
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
.app-body {
|
| 86 |
+
padding: 25px;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
.input-section {
|
| 90 |
+
display: flex;
|
| 91 |
+
margin-bottom: 25px;
|
| 92 |
+
gap: 10px;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
.task-input {
|
| 96 |
+
flex: 1;
|
| 97 |
+
padding: 15px;
|
| 98 |
+
border: none;
|
| 99 |
+
background: var(--light);
|
| 100 |
+
border-radius: 12px;
|
| 101 |
+
font-size: 16px;
|
| 102 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
|
| 103 |
+
transition: all 0.3s ease;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
.task-input:focus {
|
| 107 |
+
outline: none;
|
| 108 |
+
box-shadow: 0 4px 12px rgba(67, 97, 238, 0.2);
|
| 109 |
+
transform: translateY(-2px);
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
.add-btn {
|
| 113 |
+
background: var(--primary);
|
| 114 |
+
color: white;
|
| 115 |
+
border: none;
|
| 116 |
+
padding: 15px 20px;
|
| 117 |
+
border-radius: 12px;
|
| 118 |
+
cursor: pointer;
|
| 119 |
+
font-size: 16px;
|
| 120 |
+
font-weight: 600;
|
| 121 |
+
transition: all 0.3s ease;
|
| 122 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
.add-btn:hover {
|
| 126 |
+
background: var(--secondary);
|
| 127 |
+
transform: translateY(-2px);
|
| 128 |
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
.filter-section {
|
| 132 |
+
display: flex;
|
| 133 |
+
gap: 10px;
|
| 134 |
+
margin-bottom: 20px;
|
| 135 |
+
overflow-x: auto;
|
| 136 |
+
padding-bottom: 10px;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
.filter-btn {
|
| 140 |
+
background: var(--light);
|
| 141 |
+
border: none;
|
| 142 |
+
padding: 8px 16px;
|
| 143 |
+
border-radius: 20px;
|
| 144 |
+
cursor: pointer;
|
| 145 |
+
font-size: 14px;
|
| 146 |
+
font-weight: 500;
|
| 147 |
+
transition: all 0.3s ease;
|
| 148 |
+
white-space: nowrap;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
.filter-btn.active {
|
| 152 |
+
background: var(--primary);
|
| 153 |
+
color: white;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
.filter-btn:hover:not(.active) {
|
| 157 |
+
background: #e9ecef;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
.stats {
|
| 161 |
+
display: flex;
|
| 162 |
+
justify-content: space-between;
|
| 163 |
+
margin-bottom: 20px;
|
| 164 |
+
background: var(--light);
|
| 165 |
+
padding: 15px;
|
| 166 |
+
border-radius: 12px;
|
| 167 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
.stat-item {
|
| 171 |
+
text-align: center;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
.stat-number {
|
| 175 |
+
font-size: 24px;
|
| 176 |
+
font-weight: 700;
|
| 177 |
+
color: var(--primary);
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.stat-label {
|
| 181 |
+
font-size: 12px;
|
| 182 |
+
color: var(--gray);
|
| 183 |
+
margin-top: 5px;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
.task-list {
|
| 187 |
+
list-style: none;
|
| 188 |
+
max-height: 400px;
|
| 189 |
+
overflow-y: auto;
|
| 190 |
+
padding-right: 5px;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
.task-list::-webkit-scrollbar {
|
| 194 |
+
width: 5px;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
.task-list::-webkit-scrollbar-track {
|
| 198 |
+
background: #f1f1f1;
|
| 199 |
+
border-radius: 10px;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
.task-list::-webkit-scrollbar-thumb {
|
| 203 |
+
background: var(--primary);
|
| 204 |
+
border-radius: 10px;
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
.task-item {
|
| 208 |
+
background: white;
|
| 209 |
+
margin-bottom: 12px;
|
| 210 |
+
padding: 18px;
|
| 211 |
+
border-radius: 12px;
|
| 212 |
+
display: flex;
|
| 213 |
+
align-items: center;
|
| 214 |
+
gap: 15px;
|
| 215 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
|
| 216 |
+
transition: all 0.3s ease;
|
| 217 |
+
animation: fadeIn 0.3s ease;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
@keyframes fadeIn {
|
| 221 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 222 |
+
to { opacity: 1; transform: translateY(0); }
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
.task-item:hover {
|
| 226 |
+
transform: translateY(-3px);
|
| 227 |
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
.task-item.completed {
|
| 231 |
+
opacity: 0.7;
|
| 232 |
+
background: #f8f9fa;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
.task-checkbox {
|
| 236 |
+
width: 22px;
|
| 237 |
+
height: 22px;
|
| 238 |
+
border-radius: 50%;
|
| 239 |
+
border: 2px solid var(--gray);
|
| 240 |
+
cursor: pointer;
|
| 241 |
+
display: flex;
|
| 242 |
+
align-items: center;
|
| 243 |
+
justify-content: center;
|
| 244 |
+
transition: all 0.3s ease;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
.task-checkbox.checked {
|
| 248 |
+
background: var(--success);
|
| 249 |
+
border-color: var(--success);
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
.task-checkbox.checked::after {
|
| 253 |
+
content: '✓';
|
| 254 |
+
color: white;
|
| 255 |
+
font-size: 14px;
|
| 256 |
+
font-weight: bold;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
.task-text {
|
| 260 |
+
flex: 1;
|
| 261 |
+
font-size: 16px;
|
| 262 |
+
transition: all 0.3s ease;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
.task-item.completed .task-text {
|
| 266 |
+
text-decoration: line-through;
|
| 267 |
+
color: var(--gray);
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
.task-actions {
|
| 271 |
+
display: flex;
|
| 272 |
+
gap: 10px;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
.task-action-btn {
|
| 276 |
+
background: none;
|
| 277 |
+
border: none;
|
| 278 |
+
cursor: pointer;
|
| 279 |
+
font-size: 16px;
|
| 280 |
+
transition: all 0.3s ease;
|
| 281 |
+
width: 32px;
|
| 282 |
+
height: 32px;
|
| 283 |
+
border-radius: 50%;
|
| 284 |
+
display: flex;
|
| 285 |
+
align-items: center;
|
| 286 |
+
justify-content: center;
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
.edit-btn {
|
| 290 |
+
color: var(--primary);
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
.edit-btn:hover {
|
| 294 |
+
background: rgba(67, 97, 238, 0.1);
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
.delete-btn {
|
| 298 |
+
color: var(--danger);
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
.delete-btn:hover {
|
| 302 |
+
background: rgba(247, 37, 133, 0.1);
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
.empty-state {
|
| 306 |
+
text-align: center;
|
| 307 |
+
padding: 40px 20px;
|
| 308 |
+
color: var(--gray);
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
.empty-state i {
|
| 312 |
+
font-size: 50px;
|
| 313 |
+
margin-bottom: 15px;
|
| 314 |
+
opacity: 0.5;
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
.empty-state p {
|
| 318 |
+
font-size: 16px;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
@media (max-width: 480px) {
|
| 322 |
+
.container {
|
| 323 |
+
border-radius: 15px;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
.header {
|
| 327 |
+
padding: 20px;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
.header h1 {
|
| 331 |
+
font-size: 24px;
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
.app-body {
|
| 335 |
+
padding: 20px;
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
.input-section {
|
| 339 |
+
flex-direction: column;
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
.task-input {
|
| 343 |
+
margin-bottom: 10px;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
.stats {
|
| 347 |
+
flex-direction: column;
|
| 348 |
+
gap: 15px;
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
.task-item {
|
| 352 |
+
padding: 15px;
|
| 353 |
+
}
|
| 354 |
+
}
|
| 355 |
+
</style>
|
| 356 |
+
</head>
|
| 357 |
+
<body>
|
| 358 |
+
<div class="container">
|
| 359 |
+
<div class="header">
|
| 360 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" class="built-with">Built with anycoder</a>
|
| 361 |
+
<h1>Modern To-Do App</h1>
|
| 362 |
+
<p>Organize your tasks efficiently</p>
|
| 363 |
+
</div>
|
| 364 |
+
|
| 365 |
+
<div class="app-body">
|
| 366 |
+
<div class="input-section">
|
| 367 |
+
<input type="text" class="task-input" placeholder="Add a new task..." id="taskInput">
|
| 368 |
+
<button class="add-btn" id="addTaskBtn">
|
| 369 |
+
<i class="fas fa-plus"></i> Add
|
| 370 |
+
</button>
|
| 371 |
+
</div>
|
| 372 |
+
|
| 373 |
+
<div class="filter-section">
|
| 374 |
+
<button class="filter-btn active" data-filter="all">All</button>
|
| 375 |
+
<button class="filter-btn" data-filter="active">Active</button>
|
| 376 |
+
<button class="filter-btn" data-filter="completed">Completed</button>
|
| 377 |
+
</div>
|
| 378 |
+
|
| 379 |
+
<div class="stats">
|
| 380 |
+
<div class="stat-item">
|
| 381 |
+
<div class="stat-number" id="totalTasks">0</div>
|
| 382 |
+
<div class="stat-label">Total</div>
|
| 383 |
+
</div>
|
| 384 |
+
<div class="stat-item">
|
| 385 |
+
<div class="stat-number" id="activeTasks">0</div>
|
| 386 |
+
<div class="stat-label">Active</div>
|
| 387 |
+
</div>
|
| 388 |
+
<div class="stat-item">
|
| 389 |
+
<div class="stat-number" id="completedTasks">0</div>
|
| 390 |
+
<div class="stat-label">Completed</div>
|
| 391 |
+
</div>
|
| 392 |
+
</div>
|
| 393 |
+
|
| 394 |
+
<ul class="task-list" id="taskList">
|
| 395 |
+
<div class="empty-state">
|
| 396 |
+
<i class="fas fa-clipboard-list"></i>
|
| 397 |
+
<p>No tasks yet. Add a task to get started!</p>
|
| 398 |
+
</div>
|
| 399 |
+
</ul>
|
| 400 |
+
</div>
|
| 401 |
+
</div>
|
| 402 |
+
|
| 403 |
+
<script>
|
| 404 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 405 |
+
const taskInput = document.getElementById('taskInput');
|
| 406 |
+
const addTaskBtn = document.getElementById('addTaskBtn');
|
| 407 |
+
const taskList = document.getElementById('taskList');
|
| 408 |
+
const filterBtns = document.querySelectorAll('.filter-btn');
|
| 409 |
+
const totalTasksEl = document.getElementById('totalTasks');
|
| 410 |
+
const activeTasksEl = document.getElementById('activeTasks');
|
| 411 |
+
const completedTasksEl = document.getElementById('completedTasks');
|
| 412 |
+
|
| 413 |
+
let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
|
| 414 |
+
let currentFilter = 'all';
|
| 415 |
+
|
| 416 |
+
// Load tasks from localStorage
|
| 417 |
+
loadTasks();
|
| 418 |
+
|
| 419 |
+
// Add task event
|
| 420 |
+
addTaskBtn.addEventListener('click', addTask);
|
| 421 |
+
taskInput.addEventListener('keypress', function(e) {
|
| 422 |
+
if (e.key === 'Enter') {
|
| 423 |
+
addTask();
|
| 424 |
+
}
|
| 425 |
+
});
|
| 426 |
+
|
| 427 |
+
// Filter tasks
|
| 428 |
+
filterBtns.forEach(btn => {
|
| 429 |
+
btn.addEventListener('click', function() {
|
| 430 |
+
filterBtns.forEach(b => b.classList.remove('active'));
|
| 431 |
+
this.classList.add('active');
|
| 432 |
+
currentFilter = this.getAttribute('data-filter');
|
| 433 |
+
renderTasks();
|
| 434 |
+
});
|
| 435 |
+
});
|
| 436 |
+
|
| 437 |
+
function addTask() {
|
| 438 |
+
const taskText = taskInput.value.trim();
|
| 439 |
+
|
| 440 |
+
if (taskText === '') {
|
| 441 |
+
taskInput.focus();
|
| 442 |
+
return;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
const newTask = {
|
| 446 |
+
id: Date.now(),
|
| 447 |
+
text: taskText,
|
| 448 |
+
completed: false,
|
| 449 |
+
createdAt: new Date().toISOString()
|
| 450 |
+
};
|
| 451 |
+
|
| 452 |
+
tasks.push(newTask);
|
| 453 |
+
saveTasks();
|
| 454 |
+
renderTasks();
|
| 455 |
+
|
| 456 |
+
taskInput.value = '';
|
| 457 |
+
taskInput.focus();
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
function toggleTask(id) {
|
| 461 |
+
tasks = tasks.map(task => {
|
| 462 |
+
if (task.id === id) {
|
| 463 |
+
return { ...task, completed: !task.completed };
|
| 464 |
+
}
|
| 465 |
+
return task;
|
| 466 |
+
});
|
| 467 |
+
|
| 468 |
+
saveTasks();
|
| 469 |
+
renderTasks();
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
function editTask(id) {
|
| 473 |
+
const task = tasks.find(t => t.id === id);
|
| 474 |
+
const newText = prompt('Edit task:', task.text);
|
| 475 |
+
|
| 476 |
+
if (newText && newText.trim() !== '') {
|
| 477 |
+
tasks = tasks.map(t => {
|
| 478 |
+
if (t.id === id) {
|
| 479 |
+
return { ...t, text: newText.trim() };
|
| 480 |
+
}
|
| 481 |
+
return t;
|
| 482 |
+
});
|
| 483 |
+
|
| 484 |
+
saveTasks();
|
| 485 |
+
renderTasks();
|
| 486 |
+
}
|
| 487 |
+
}
|
| 488 |
+
|
| 489 |
+
function deleteTask(id) {
|
| 490 |
+
if (confirm('Are you sure you want to delete this task?')) {
|
| 491 |
+
tasks = tasks.filter(task => task.id !== id);
|
| 492 |
+
saveTasks();
|
| 493 |
+
renderTasks();
|
| 494 |
+
}
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
function saveTasks() {
|
| 498 |
+
localStorage.setItem('tasks', JSON.stringify(tasks));
|
| 499 |
+
updateStats();
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
function loadTasks() {
|
| 503 |
+
renderTasks();
|
| 504 |
+
updateStats();
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
function renderTasks() {
|
| 508 |
+
let filteredTasks = tasks;
|
| 509 |
+
|
| 510 |
+
if (currentFilter === 'active') {
|
| 511 |
+
filteredTasks = tasks.filter(task => !task.completed);
|
| 512 |
+
} else if (currentFilter === 'completed') {
|
| 513 |
+
filteredTasks = tasks.filter(task => task.completed);
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
if (filteredTasks.length === 0) {
|
| 517 |
+
taskList.innerHTML = `
|
| 518 |
+
<div class="empty-state">
|
| 519 |
+
<i class="fas fa-clipboard-list"></i>
|
| 520 |
+
<p>No ${currentFilter !== 'all' ? currentFilter : ''} tasks yet.</p>
|
| 521 |
+
</div>
|
| 522 |
+
`;
|
| 523 |
+
return;
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
taskList.innerHTML = '';
|
| 527 |
+
|
| 528 |
+
filteredTasks.forEach(task => {
|
| 529 |
+
const taskItem = document.createElement('li');
|
| 530 |
+
taskItem.className = `task-item ${task.completed ? 'completed' : ''}`;
|
| 531 |
+
|
| 532 |
+
taskItem.innerHTML = `
|
| 533 |
+
<div class="task-checkbox ${task.completed ? 'checked' : ''}" data-id="${task.id}"></div>
|
| 534 |
+
<div class="task-text">${task.text}</div>
|
| 535 |
+
<div class="task-actions">
|
| 536 |
+
<button class="task-action-btn edit-btn" data-id="${task.id}">
|
| 537 |
+
<i class="fas fa-edit"></i>
|
| 538 |
+
</button>
|
| 539 |
+
<button class="task-action-btn delete-btn" data-id="${task.id}">
|
| 540 |
+
<i class="fas fa-trash"></i>
|
| 541 |
+
</button>
|
| 542 |
+
</div>
|
| 543 |
+
`;
|
| 544 |
+
|
| 545 |
+
taskList.appendChild(taskItem);
|
| 546 |
+
|
| 547 |
+
// Add event listeners to the new elements
|
| 548 |
+
const checkbox = taskItem.querySelector('.task-checkbox');
|
| 549 |
+
const editBtn = taskItem.querySelector('.edit-btn');
|
| 550 |
+
const deleteBtn = taskItem.querySelector('.delete-btn');
|
| 551 |
+
|
| 552 |
+
checkbox.addEventListener('click', () => toggleTask(task.id));
|
| 553 |
+
editBtn.addEventListener('click', () => editTask(task.id));
|
| 554 |
+
deleteBtn.addEventListener('click', () => deleteTask(task.id));
|
| 555 |
+
});
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
function updateStats() {
|
| 559 |
+
const totalTasks = tasks.length;
|
| 560 |
+
const completedTasks = tasks.filter(task => task.completed).length;
|
| 561 |
+
const activeTasks = totalTasks - completedTasks;
|
| 562 |
+
|
| 563 |
+
totalTasksEl.textContent = totalTasks;
|
| 564 |
+
activeTasksEl.textContent = activeTasks;
|
| 565 |
+
completedTasksEl.textContent = completedTasks;
|
| 566 |
+
}
|
| 567 |
+
});
|
| 568 |
+
</script>
|
| 569 |
+
</body>
|
| 570 |
+
</html>
|