Spaces:
Running
Running
task page the "total Task" "completed" "pending " and "high priority" when i click on them it shows a pop up to whats it is linked to so i can refer to it and once click away from the pop up it vanishes allowing to progress where i stopped
Browse files- index.html +20 -6
- script.js +66 -2
- style.css +5 -0
index.html
CHANGED
|
@@ -32,27 +32,41 @@
|
|
| 32 |
<i data-feather="plus"></i> Add Task
|
| 33 |
</button>
|
| 34 |
</div>
|
| 35 |
-
|
| 36 |
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
|
| 37 |
-
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
|
| 38 |
<h3 class="text-gray-500 text-sm font-medium mb-1">Total Tasks</h3>
|
| 39 |
<p id="totalTasks" class="text-3xl font-bold text-gray-800">0</p>
|
| 40 |
</div>
|
| 41 |
-
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
|
| 42 |
<h3 class="text-gray-500 text-sm font-medium mb-1">Completed</h3>
|
| 43 |
<p id="completedTasks" class="text-3xl font-bold text-green-500">0</p>
|
| 44 |
</div>
|
| 45 |
-
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
|
| 46 |
<h3 class="text-gray-500 text-sm font-medium mb-1">Pending</h3>
|
| 47 |
<p id="pendingTasks" class="text-3xl font-bold text-yellow-500">0</p>
|
| 48 |
</div>
|
| 49 |
-
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
|
| 50 |
<h3 class="text-gray-500 text-sm font-medium mb-1">High Priority</h3>
|
| 51 |
<p id="highPriorityTasks" class="text-3xl font-bold text-red-500">0</p>
|
| 52 |
</div>
|
| 53 |
</div>
|
| 54 |
|
| 55 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
<div class="flex justify-between items-center p-4 border-b border-gray-100">
|
| 57 |
<div class="flex gap-2">
|
| 58 |
<button id="filterAll" class="filter-btn active px-4 py-2 rounded-lg bg-primary text-white">
|
|
|
|
| 32 |
<i data-feather="plus"></i> Add Task
|
| 33 |
</button>
|
| 34 |
</div>
|
|
|
|
| 35 |
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
|
| 36 |
+
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100 cursor-pointer hover:bg-gray-50 transition" onclick="showTasksModal('all')">
|
| 37 |
<h3 class="text-gray-500 text-sm font-medium mb-1">Total Tasks</h3>
|
| 38 |
<p id="totalTasks" class="text-3xl font-bold text-gray-800">0</p>
|
| 39 |
</div>
|
| 40 |
+
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100 cursor-pointer hover:bg-gray-50 transition" onclick="showTasksModal('completed')">
|
| 41 |
<h3 class="text-gray-500 text-sm font-medium mb-1">Completed</h3>
|
| 42 |
<p id="completedTasks" class="text-3xl font-bold text-green-500">0</p>
|
| 43 |
</div>
|
| 44 |
+
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100 cursor-pointer hover:bg-gray-50 transition" onclick="showTasksModal('pending')">
|
| 45 |
<h3 class="text-gray-500 text-sm font-medium mb-1">Pending</h3>
|
| 46 |
<p id="pendingTasks" class="text-3xl font-bold text-yellow-500">0</p>
|
| 47 |
</div>
|
| 48 |
+
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100 cursor-pointer hover:bg-gray-50 transition" onclick="showTasksModal('high')">
|
| 49 |
<h3 class="text-gray-500 text-sm font-medium mb-1">High Priority</h3>
|
| 50 |
<p id="highPriorityTasks" class="text-3xl font-bold text-red-500">0</p>
|
| 51 |
</div>
|
| 52 |
</div>
|
| 53 |
|
| 54 |
+
<!-- Tasks Stats Modal -->
|
| 55 |
+
<div id="tasksStatsModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden" onclick="if(event.target === this) this.classList.add('hidden')">
|
| 56 |
+
<div class="bg-white rounded-xl shadow-lg w-full max-w-md mx-4 max-h-[80vh] overflow-y-auto" onclick="event.stopPropagation()">
|
| 57 |
+
<div class="flex justify-between items-center sticky top-0 bg-white p-4 border-b border-gray-200 z-10">
|
| 58 |
+
<h3 id="statsModalTitle" class="text-xl font-semibold text-gray-800">Tasks</h3>
|
| 59 |
+
<button onclick="document.getElementById('tasksStatsModal').classList.add('hidden')"
|
| 60 |
+
class="text-gray-500 hover:text-gray-700 p-1 rounded-full hover:bg-gray-100">
|
| 61 |
+
<i data-feather="x"></i>
|
| 62 |
+
</button>
|
| 63 |
+
</div>
|
| 64 |
+
<div class="p-4" id="statsModalContent">
|
| 65 |
+
<!-- Tasks will be loaded here -->
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
| 70 |
<div class="flex justify-between items-center p-4 border-b border-gray-100">
|
| 71 |
<div class="flex gap-2">
|
| 72 |
<button id="filterAll" class="filter-btn active px-4 py-2 rounded-lg bg-primary text-white">
|
script.js
CHANGED
|
@@ -232,7 +232,6 @@ updateTaskStatus(taskId, newStatus) {
|
|
| 232 |
|
| 233 |
feather.replace();
|
| 234 |
}
|
| 235 |
-
|
| 236 |
updateSummary() {
|
| 237 |
const total = this.tasks.length;
|
| 238 |
const completed = this.tasks.filter(task => task.status === 'completed').length;
|
|
@@ -244,8 +243,73 @@ updateTaskStatus(taskId, newStatus) {
|
|
| 244 |
document.getElementById('pendingTasks').textContent = pending;
|
| 245 |
document.getElementById('highPriorityTasks').textContent = highPriority;
|
| 246 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
|
| 248 |
-
|
|
|
|
|
|
|
| 249 |
localStorage.setItem('tasks', JSON.stringify(this.tasks));
|
| 250 |
}
|
| 251 |
}
|
|
|
|
| 232 |
|
| 233 |
feather.replace();
|
| 234 |
}
|
|
|
|
| 235 |
updateSummary() {
|
| 236 |
const total = this.tasks.length;
|
| 237 |
const completed = this.tasks.filter(task => task.status === 'completed').length;
|
|
|
|
| 243 |
document.getElementById('pendingTasks').textContent = pending;
|
| 244 |
document.getElementById('highPriorityTasks').textContent = highPriority;
|
| 245 |
}
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
// Show tasks modal for stats cards
|
| 249 |
+
function showTasksModal(type) {
|
| 250 |
+
const tasks = JSON.parse(localStorage.getItem('tasks')) || [];
|
| 251 |
+
let filteredTasks = [];
|
| 252 |
+
let title = '';
|
| 253 |
+
|
| 254 |
+
switch(type) {
|
| 255 |
+
case 'completed':
|
| 256 |
+
filteredTasks = tasks.filter(t => t.status === 'completed');
|
| 257 |
+
title = 'Completed Tasks';
|
| 258 |
+
break;
|
| 259 |
+
case 'pending':
|
| 260 |
+
filteredTasks = tasks.filter(t => t.status === 'pending');
|
| 261 |
+
title = 'Pending Tasks';
|
| 262 |
+
break;
|
| 263 |
+
case 'high':
|
| 264 |
+
filteredTasks = tasks.filter(t => t.priority === 'high');
|
| 265 |
+
title = 'High Priority Tasks';
|
| 266 |
+
break;
|
| 267 |
+
default:
|
| 268 |
+
filteredTasks = tasks;
|
| 269 |
+
title = 'All Tasks';
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
const modal = document.getElementById('tasksStatsModal');
|
| 273 |
+
const modalTitle = document.getElementById('statsModalTitle');
|
| 274 |
+
const modalContent = document.getElementById('statsModalContent');
|
| 275 |
+
|
| 276 |
+
modalTitle.textContent = title + ` (${filteredTasks.length})`;
|
| 277 |
+
|
| 278 |
+
if (filteredTasks.length === 0) {
|
| 279 |
+
modalContent.innerHTML = `
|
| 280 |
+
<div class="text-center text-gray-500 py-8">
|
| 281 |
+
<i data-feather="inbox" class="w-12 h-12 mx-auto text-gray-300 mb-2"></i>
|
| 282 |
+
<p>No tasks found</p>
|
| 283 |
+
</div>
|
| 284 |
+
`;
|
| 285 |
+
} else {
|
| 286 |
+
modalContent.innerHTML = `
|
| 287 |
+
<div class="space-y-3">
|
| 288 |
+
${filteredTasks.map(task => `
|
| 289 |
+
<div class="p-3 border border-gray-100 rounded-lg hover:bg-gray-50">
|
| 290 |
+
<div class="flex justify-between items-start">
|
| 291 |
+
<h4 class="font-medium">${task.title}</h4>
|
| 292 |
+
<span class="text-xs px-2 py-1 rounded-full ${
|
| 293 |
+
task.priority === 'high' ? 'bg-red-100 text-red-800' :
|
| 294 |
+
task.priority === 'medium' ? 'bg-yellow-100 text-yellow-800' :
|
| 295 |
+
'bg-green-100 text-green-800'
|
| 296 |
+
}">
|
| 297 |
+
${task.priority} priority
|
| 298 |
+
</span>
|
| 299 |
+
</div>
|
| 300 |
+
<p class="text-sm text-gray-600 mt-1">${task.description || 'No description'}</p>
|
| 301 |
+
<div class="mt-2 text-xs text-gray-500">
|
| 302 |
+
${task.dueDate ? 'Due: ' + new Date(task.dueDate).toLocaleDateString() : 'No due date'}
|
| 303 |
+
</div>
|
| 304 |
+
</div>
|
| 305 |
+
`).join('')}
|
| 306 |
+
</div>
|
| 307 |
+
`;
|
| 308 |
+
}
|
| 309 |
|
| 310 |
+
modal.classList.remove('hidden');
|
| 311 |
+
feather.replace();
|
| 312 |
+
saveToLocalStorage() {
|
| 313 |
localStorage.setItem('tasks', JSON.stringify(this.tasks));
|
| 314 |
}
|
| 315 |
}
|
style.css
CHANGED
|
@@ -50,6 +50,11 @@ body {
|
|
| 50 |
background-color: #d1fae5;
|
| 51 |
color: #065f46;
|
| 52 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
/* Animation for task completion */
|
| 55 |
@keyframes fadeIn {
|
|
|
|
| 50 |
background-color: #d1fae5;
|
| 51 |
color: #065f46;
|
| 52 |
}
|
| 53 |
+
/* Stats cards hover effect */
|
| 54 |
+
.grid > div:hover {
|
| 55 |
+
transform: translateY(-2px);
|
| 56 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
| 57 |
+
}
|
| 58 |
|
| 59 |
/* Animation for task completion */
|
| 60 |
@keyframes fadeIn {
|