Spaces:
Running
Running
Promote version cc93e8a to main
Browse filesPromoted commit cc93e8a19be5de12006a5d272c0e5eed334512ec to main branch
- index.html +135 -0
- script.js +10 -69
- style.css +1 -25
index.html
CHANGED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>TaskMaster Pro</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 |
+
<script>
|
| 12 |
+
tailwind.config = {
|
| 13 |
+
theme: {
|
| 14 |
+
extend: {
|
| 15 |
+
colors: {
|
| 16 |
+
primary: '#6366f1',
|
| 17 |
+
secondary: '#8b5cf6',
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
</script>
|
| 23 |
+
</head>
|
| 24 |
+
<body class="bg-gray-50 min-h-screen flex flex-col">
|
| 25 |
+
<custom-navbar></custom-navbar>
|
| 26 |
+
|
| 27 |
+
<main class="flex-1 container mx-auto px-4 py-8">
|
| 28 |
+
<div class="max-w-6xl mx-auto">
|
| 29 |
+
<div class="flex justify-between items-center mb-8">
|
| 30 |
+
<h1 class="text-3xl font-bold text-gray-800">Your Tasks</h1>
|
| 31 |
+
<button id="addTaskBtn" class="bg-primary hover:bg-primary-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition">
|
| 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 |
+
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
| 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">
|
| 59 |
+
All
|
| 60 |
+
</button>
|
| 61 |
+
<button id="filterPending" class="filter-btn px-4 py-2 rounded-lg bg-gray-100 hover:bg-gray-200 text-gray-700">
|
| 62 |
+
Pending
|
| 63 |
+
</button>
|
| 64 |
+
<button id="filterCompleted" class="filter-btn px-4 py-2 rounded-lg bg-gray-100 hover:bg-gray-200 text-gray-700">
|
| 65 |
+
Completed
|
| 66 |
+
</button>
|
| 67 |
+
</div>
|
| 68 |
+
<div class="relative">
|
| 69 |
+
<input type="text" id="searchTasks" placeholder="Search tasks..." class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary outline-none">
|
| 70 |
+
<i data-feather="search" class="absolute left-3 top-2.5 text-gray-400"></i>
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
<div id="tasksContainer" class="divide-y divide-gray-100">
|
| 74 |
+
<!-- Tasks will be loaded here -->
|
| 75 |
+
<div class="p-6 text-center text-gray-500">
|
| 76 |
+
<i data-feather="inbox" class="w-12 h-12 mx-auto text-gray-300 mb-2"></i>
|
| 77 |
+
<p>No tasks found. Add your first task!</p>
|
| 78 |
+
</div>
|
| 79 |
+
</div>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
</main>
|
| 83 |
+
|
| 84 |
+
<!-- Add/Edit Task Modal -->
|
| 85 |
+
<div id="taskModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
|
| 86 |
+
<div class="bg-white rounded-xl shadow-lg w-full max-w-md mx-4">
|
| 87 |
+
<div class="flex justify-between items-center border-b border-gray-200 p-4">
|
| 88 |
+
<h3 class="text-lg font-semibold text-gray-800" id="modalTitle">Add New Task</h3>
|
| 89 |
+
<button id="closeModalBtn" class="text-gray-500 hover:text-gray-700">
|
| 90 |
+
<i data-feather="x"></i>
|
| 91 |
+
</button>
|
| 92 |
+
</div>
|
| 93 |
+
<form id="taskForm" class="p-4 space-y-4">
|
| 94 |
+
<input type="hidden" id="taskId">
|
| 95 |
+
<div>
|
| 96 |
+
<label for="taskTitle" class="block text-sm font-medium text-gray-700 mb-1">Title</label>
|
| 97 |
+
<input type="text" id="taskTitle" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary outline-none" required>
|
| 98 |
+
</div>
|
| 99 |
+
<div>
|
| 100 |
+
<label for="taskDescription" class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
| 101 |
+
<textarea id="taskDescription" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary outline-none"></textarea>
|
| 102 |
+
</div>
|
| 103 |
+
<div class="grid grid-cols-2 gap-4">
|
| 104 |
+
<div>
|
| 105 |
+
<label for="taskPriority" class="block text-sm font-medium text-gray-700 mb-1">Priority</label>
|
| 106 |
+
<select id="taskPriority" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary outline-none">
|
| 107 |
+
<option value="high">High</option>
|
| 108 |
+
<option value="medium">Medium</option>
|
| 109 |
+
<option value="low">Low</option>
|
| 110 |
+
</select>
|
| 111 |
+
</div>
|
| 112 |
+
<div>
|
| 113 |
+
<label for="taskDueDate" class="block text-sm font-medium text-gray-700 mb-1">Due Date</label>
|
| 114 |
+
<input type="date" id="taskDueDate" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary outline-none">
|
| 115 |
+
</div>
|
| 116 |
+
</div>
|
| 117 |
+
<div class="flex justify-end gap-2 pt-4">
|
| 118 |
+
<button type="button" id="cancelModalBtn" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50">Cancel</button>
|
| 119 |
+
<button type="submit" class="px-4 py-2 bg-primary hover:bg-primary-600 text-white rounded-md">Save Task</button>
|
| 120 |
+
</div>
|
| 121 |
+
</form>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
|
| 125 |
+
<custom-footer></custom-footer>
|
| 126 |
+
|
| 127 |
+
<script src="components/navbar.js"></script>
|
| 128 |
+
<script src="components/footer.js"></script>
|
| 129 |
+
<script src="script.js"></script>
|
| 130 |
+
<script>
|
| 131 |
+
feather.replace();
|
| 132 |
+
</script>
|
| 133 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 134 |
+
</body>
|
| 135 |
+
</html>
|
script.js
CHANGED
|
@@ -10,6 +10,7 @@ class TaskManager {
|
|
| 10 |
this.renderTasks();
|
| 11 |
this.updateSummary();
|
| 12 |
}
|
|
|
|
| 13 |
bindEvents() {
|
| 14 |
// Modal controls
|
| 15 |
document.getElementById('addTaskBtn').addEventListener('click', () => this.openModal());
|
|
@@ -19,8 +20,9 @@ class TaskManager {
|
|
| 19 |
e.preventDefault();
|
| 20 |
this.saveTask();
|
| 21 |
});
|
| 22 |
-
|
| 23 |
-
|
|
|
|
| 24 |
document.getElementById('filterPending').addEventListener('click', () => this.filterTasks('pending'));
|
| 25 |
document.getElementById('filterCompleted').addEventListener('click', () => this.filterTasks('completed'));
|
| 26 |
|
|
@@ -230,6 +232,7 @@ updateTaskStatus(taskId, newStatus) {
|
|
| 230 |
|
| 231 |
feather.replace();
|
| 232 |
}
|
|
|
|
| 233 |
updateSummary() {
|
| 234 |
const total = this.tasks.length;
|
| 235 |
const completed = this.tasks.filter(task => task.status === 'completed').length;
|
|
@@ -241,80 +244,18 @@ updateTaskStatus(taskId, newStatus) {
|
|
| 241 |
document.getElementById('pendingTasks').textContent = pending;
|
| 242 |
document.getElementById('highPriorityTasks').textContent = highPriority;
|
| 243 |
}
|
| 244 |
-
}
|
| 245 |
-
|
| 246 |
-
// Show tasks modal for stats cards
|
| 247 |
-
function showTasksModal(type) {
|
| 248 |
-
const tasks = JSON.parse(localStorage.getItem('tasks')) || [];
|
| 249 |
-
let filteredTasks = [];
|
| 250 |
-
let title = '';
|
| 251 |
-
|
| 252 |
-
switch(type) {
|
| 253 |
-
case 'completed':
|
| 254 |
-
filteredTasks = tasks.filter(t => t.status === 'completed');
|
| 255 |
-
title = 'Completed Tasks';
|
| 256 |
-
break;
|
| 257 |
-
case 'pending':
|
| 258 |
-
filteredTasks = tasks.filter(t => t.status === 'pending');
|
| 259 |
-
title = 'Pending Tasks';
|
| 260 |
-
break;
|
| 261 |
-
case 'high':
|
| 262 |
-
filteredTasks = tasks.filter(t => t.priority === 'high');
|
| 263 |
-
title = 'High Priority Tasks';
|
| 264 |
-
break;
|
| 265 |
-
default:
|
| 266 |
-
filteredTasks = tasks;
|
| 267 |
-
title = 'All Tasks';
|
| 268 |
-
}
|
| 269 |
|
| 270 |
-
const modal = document.getElementById('tasksStatsModal');
|
| 271 |
-
const modalTitle = document.getElementById('statsModalTitle');
|
| 272 |
-
const modalContent = document.getElementById('statsModalContent');
|
| 273 |
-
|
| 274 |
-
modalTitle.textContent = title + ` (${filteredTasks.length})`;
|
| 275 |
-
|
| 276 |
-
if (filteredTasks.length === 0) {
|
| 277 |
-
modalContent.innerHTML = `
|
| 278 |
-
<div class="text-center text-gray-500 py-8">
|
| 279 |
-
<i data-feather="inbox" class="w-12 h-12 mx-auto text-gray-300 mb-2"></i>
|
| 280 |
-
<p>No tasks found</p>
|
| 281 |
-
</div>
|
| 282 |
-
`;
|
| 283 |
-
} else {
|
| 284 |
-
modalContent.innerHTML = `
|
| 285 |
-
<div class="space-y-3">
|
| 286 |
-
${filteredTasks.map(task => `
|
| 287 |
-
<div class="p-3 border border-gray-100 rounded-lg hover:bg-gray-50">
|
| 288 |
-
<div class="flex justify-between items-start">
|
| 289 |
-
<h4 class="font-medium">${task.title}</h4>
|
| 290 |
-
<span class="text-xs px-2 py-1 rounded-full ${
|
| 291 |
-
task.priority === 'high' ? 'bg-red-100 text-red-800' :
|
| 292 |
-
task.priority === 'medium' ? 'bg-yellow-100 text-yellow-800' :
|
| 293 |
-
'bg-green-100 text-green-800'
|
| 294 |
-
}">
|
| 295 |
-
${task.priority} priority
|
| 296 |
-
</span>
|
| 297 |
-
</div>
|
| 298 |
-
<p class="text-sm text-gray-600 mt-1">${task.description || 'No description'}</p>
|
| 299 |
-
<div class="mt-2 text-xs text-gray-500">
|
| 300 |
-
${task.dueDate ? 'Due: ' + new Date(task.dueDate).toLocaleDateString() : 'No due date'}
|
| 301 |
-
</div>
|
| 302 |
-
</div>
|
| 303 |
-
`).join('')}
|
| 304 |
-
</div>
|
| 305 |
-
`;
|
| 306 |
-
}
|
| 307 |
-
|
| 308 |
-
modal.classList.remove('hidden');
|
| 309 |
-
feather.replace();
|
| 310 |
saveToLocalStorage() {
|
| 311 |
localStorage.setItem('tasks', JSON.stringify(this.tasks));
|
| 312 |
}
|
| 313 |
}
|
|
|
|
|
|
|
| 314 |
document.addEventListener('DOMContentLoaded', () => {
|
| 315 |
-
|
| 316 |
|
| 317 |
-
|
|
|
|
| 318 |
const emailInput = document.getElementById('notificationEmail');
|
| 319 |
if (emailCheckbox && emailInput) {
|
| 320 |
emailCheckbox.addEventListener('change', function() {
|
|
|
|
| 10 |
this.renderTasks();
|
| 11 |
this.updateSummary();
|
| 12 |
}
|
| 13 |
+
|
| 14 |
bindEvents() {
|
| 15 |
// Modal controls
|
| 16 |
document.getElementById('addTaskBtn').addEventListener('click', () => this.openModal());
|
|
|
|
| 20 |
e.preventDefault();
|
| 21 |
this.saveTask();
|
| 22 |
});
|
| 23 |
+
|
| 24 |
+
// Filter controls
|
| 25 |
+
document.getElementById('filterAll').addEventListener('click', () => this.filterTasks('all'));
|
| 26 |
document.getElementById('filterPending').addEventListener('click', () => this.filterTasks('pending'));
|
| 27 |
document.getElementById('filterCompleted').addEventListener('click', () => this.filterTasks('completed'));
|
| 28 |
|
|
|
|
| 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 |
document.getElementById('pendingTasks').textContent = pending;
|
| 245 |
document.getElementById('highPriorityTasks').textContent = highPriority;
|
| 246 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
saveToLocalStorage() {
|
| 249 |
localStorage.setItem('tasks', JSON.stringify(this.tasks));
|
| 250 |
}
|
| 251 |
}
|
| 252 |
+
|
| 253 |
+
// Initialize the app when DOM is loaded
|
| 254 |
document.addEventListener('DOMContentLoaded', () => {
|
| 255 |
+
const app = new TaskManager();
|
| 256 |
|
| 257 |
+
// Email notification toggle
|
| 258 |
+
const emailCheckbox = document.getElementById('emailNotifications');
|
| 259 |
const emailInput = document.getElementById('notificationEmail');
|
| 260 |
if (emailCheckbox && emailInput) {
|
| 261 |
emailCheckbox.addEventListener('change', function() {
|
style.css
CHANGED
|
@@ -45,36 +45,12 @@ body {
|
|
| 45 |
background-color: #dbeafe;
|
| 46 |
color: #1e40af;
|
| 47 |
}
|
|
|
|
| 48 |
.status-completed {
|
| 49 |
background-color: #d1fae5;
|
| 50 |
color: #065f46;
|
| 51 |
}
|
| 52 |
|
| 53 |
-
.category-badge {
|
| 54 |
-
margin-bottom: 0.5rem;
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
.task-card.category-work {
|
| 58 |
-
border-left: 4px solid #3b82f6;
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
.task-card.category-personal {
|
| 62 |
-
border-left: 4px solid #8b5cf6;
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
.task-card.category-shopping {
|
| 66 |
-
border-left: 4px solid #10b981;
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
.task-card.category-other {
|
| 70 |
-
border-left: 4px solid #6b7280;
|
| 71 |
-
}
|
| 72 |
-
/* Stats cards hover effect */
|
| 73 |
-
.grid > div:hover {
|
| 74 |
-
transform: translateY(-2px);
|
| 75 |
-
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
/* Animation for task completion */
|
| 79 |
@keyframes fadeIn {
|
| 80 |
from { opacity: 0; transform: translateY(10px); }
|
|
|
|
| 45 |
background-color: #dbeafe;
|
| 46 |
color: #1e40af;
|
| 47 |
}
|
| 48 |
+
|
| 49 |
.status-completed {
|
| 50 |
background-color: #d1fae5;
|
| 51 |
color: #065f46;
|
| 52 |
}
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
/* Animation for task completion */
|
| 55 |
@keyframes fadeIn {
|
| 56 |
from { opacity: 0; transform: translateY(10px); }
|