Spaces:
Running
Running
Add 2 files
Browse files- index.html +156 -97
- prompts.txt +2 -1
index.html
CHANGED
|
@@ -5,6 +5,22 @@
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Advanced Task Manager</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
<style>
|
| 10 |
.task-item:hover .task-actions {
|
|
@@ -33,9 +49,15 @@
|
|
| 33 |
.calendar-day.has-tasks {
|
| 34 |
background-color: #e0e7ff;
|
| 35 |
}
|
|
|
|
|
|
|
|
|
|
| 36 |
.calendar-day.has-tasks:hover {
|
| 37 |
background-color: #c7d2fe;
|
| 38 |
}
|
|
|
|
|
|
|
|
|
|
| 39 |
.calendar-day.today {
|
| 40 |
border: 2px solid #6366f1;
|
| 41 |
}
|
|
@@ -55,37 +77,46 @@
|
|
| 55 |
.dot-low {
|
| 56 |
background-color: #10b981;
|
| 57 |
}
|
|
|
|
|
|
|
|
|
|
| 58 |
</style>
|
| 59 |
</head>
|
| 60 |
-
<body class="bg-gray-100 min-h-screen">
|
| 61 |
<div class="container mx-auto px-4 py-8">
|
| 62 |
-
<header class="mb-8">
|
| 63 |
-
<
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
</header>
|
| 66 |
|
| 67 |
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
| 68 |
<!-- Task Input Section -->
|
| 69 |
<div class="lg:col-span-2">
|
| 70 |
-
<div class="bg-white rounded-lg shadow-md p-6 mb-6">
|
| 71 |
-
<h2 class="text-xl font-semibold mb-4 text-indigo-700">Add New Task</h2>
|
| 72 |
<form id="taskForm" class="space-y-4">
|
| 73 |
<div>
|
| 74 |
-
<label for="taskTitle" class="block text-sm font-medium text-gray-700">Task Title</label>
|
| 75 |
-
<input type="text" id="taskTitle" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 p-2 border" required>
|
| 76 |
</div>
|
| 77 |
<div>
|
| 78 |
-
<label for="taskDescription" class="block text-sm font-medium text-gray-700">Description</label>
|
| 79 |
-
<textarea id="taskDescription" rows="2" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 p-2 border"></textarea>
|
| 80 |
</div>
|
| 81 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 82 |
<div>
|
| 83 |
-
<label for="taskDueDate" class="block text-sm font-medium text-gray-700">Due Date</label>
|
| 84 |
-
<input type="date" id="taskDueDate" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 p-2 border">
|
| 85 |
</div>
|
| 86 |
<div>
|
| 87 |
-
<label for="taskPriority" class="block text-sm font-medium text-gray-700">Priority</label>
|
| 88 |
-
<select id="taskPriority" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 p-2 border">
|
| 89 |
<option value="low">Low</option>
|
| 90 |
<option value="medium">Medium</option>
|
| 91 |
<option value="high">High</option>
|
|
@@ -93,8 +124,8 @@
|
|
| 93 |
</div>
|
| 94 |
</div>
|
| 95 |
<div class="flex items-center">
|
| 96 |
-
<input id="pinTask" type="checkbox" class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500">
|
| 97 |
-
<label for="pinTask" class="ml-2 block text-sm text-gray-700">Pin this task</label>
|
| 98 |
</div>
|
| 99 |
<button type="submit" class="w-full bg-indigo-600 text-white py-2 px-4 rounded-md hover:bg-indigo-700 transition duration-200 flex items-center justify-center">
|
| 100 |
<i class="fas fa-plus-circle mr-2"></i> Add Task
|
|
@@ -103,31 +134,31 @@
|
|
| 103 |
</div>
|
| 104 |
|
| 105 |
<!-- Pinned Tasks Section -->
|
| 106 |
-
<div class="bg-white rounded-lg shadow-md p-6 mb-6">
|
| 107 |
<div class="flex justify-between items-center mb-4">
|
| 108 |
-
<h2 class="text-xl font-semibold text-indigo-700">
|
| 109 |
<i class="fas fa-thumbtack mr-2 text-red-500"></i> Pinned Tasks
|
| 110 |
</h2>
|
| 111 |
-
<span id="pinnedCount" class="bg-indigo-100 text-indigo-800 text-xs font-medium px-2.5 py-0.5 rounded-full">0</span>
|
| 112 |
</div>
|
| 113 |
<div id="pinnedTasks" class="space-y-3">
|
| 114 |
<!-- Pinned tasks will appear here -->
|
| 115 |
-
<div class="text-center text-gray-500 py-4">
|
| 116 |
No pinned tasks yet. Pin important tasks to see them here.
|
| 117 |
</div>
|
| 118 |
</div>
|
| 119 |
</div>
|
| 120 |
|
| 121 |
<!-- All Tasks Section -->
|
| 122 |
-
<div class="bg-white rounded-lg shadow-md p-6">
|
| 123 |
<div class="flex justify-between items-center mb-4">
|
| 124 |
-
<h2 class="text-xl font-semibold text-indigo-700">
|
| 125 |
<i class="fas fa-tasks mr-2"></i> All Tasks
|
| 126 |
</h2>
|
| 127 |
<div class="flex space-x-2">
|
| 128 |
<button id="filterAll" class="text-xs bg-indigo-600 text-white px-3 py-1 rounded-full">All</button>
|
| 129 |
-
<button id="filterPending" class="text-xs bg-gray-200 text-gray-700 px-3 py-1 rounded-full">Pending</button>
|
| 130 |
-
<button id="filterCompleted" class="text-xs bg-gray-200 text-gray-700 px-3 py-1 rounded-full">Completed</button>
|
| 131 |
</div>
|
| 132 |
</div>
|
| 133 |
<div id="allTasks" class="space-y-3">
|
|
@@ -138,29 +169,29 @@
|
|
| 138 |
|
| 139 |
<!-- Calendar and Stats Section -->
|
| 140 |
<div class="lg:col-span-1">
|
| 141 |
-
<div class="bg-white rounded-lg shadow-md p-6 mb-6">
|
| 142 |
<div class="flex justify-between items-center mb-4">
|
| 143 |
-
<h2 class="text-xl font-semibold text-indigo-700">
|
| 144 |
<i class="fas fa-calendar-alt mr-2"></i> Schedule
|
| 145 |
</h2>
|
| 146 |
<div class="flex space-x-2">
|
| 147 |
-
<button id="prevMonth" class="text-gray-600 hover:text-indigo-700">
|
| 148 |
<i class="fas fa-chevron-left"></i>
|
| 149 |
</button>
|
| 150 |
-
<span id="currentMonth" class="font-medium">June 2023</span>
|
| 151 |
-
<button id="nextMonth" class="text-gray-600 hover:text-indigo-700">
|
| 152 |
<i class="fas fa-chevron-right"></i>
|
| 153 |
</button>
|
| 154 |
</div>
|
| 155 |
</div>
|
| 156 |
<div class="grid grid-cols-7 gap-1 mb-2">
|
| 157 |
-
<div class="text-center text-xs font-medium text-gray-500">Sun</div>
|
| 158 |
-
<div class="text-center text-xs font-medium text-gray-500">Mon</div>
|
| 159 |
-
<div class="text-center text-xs font-medium text-gray-500">Tue</div>
|
| 160 |
-
<div class="text-center text-xs font-medium text-gray-500">Wed</div>
|
| 161 |
-
<div class="text-center text-xs font-medium text-gray-500">Thu</div>
|
| 162 |
-
<div class="text-center text-xs font-medium text-gray-500">Fri</div>
|
| 163 |
-
<div class="text-center text-xs font-medium text-gray-500">Sat</div>
|
| 164 |
</div>
|
| 165 |
<div id="calendarDays" class="grid grid-cols-7 gap-1">
|
| 166 |
<!-- Calendar days will be generated here -->
|
|
@@ -168,8 +199,8 @@
|
|
| 168 |
</div>
|
| 169 |
|
| 170 |
<!-- Upcoming Tasks Preview -->
|
| 171 |
-
<div class="bg-white rounded-lg shadow-md p-6 mb-6">
|
| 172 |
-
<h2 class="text-xl font-semibold mb-4 text-indigo-700">
|
| 173 |
<i class="fas fa-calendar-day mr-2"></i> Upcoming Tasks
|
| 174 |
</h2>
|
| 175 |
<div id="upcomingTasks" class="space-y-3">
|
|
@@ -178,36 +209,36 @@
|
|
| 178 |
</div>
|
| 179 |
|
| 180 |
<!-- Stats Section -->
|
| 181 |
-
<div class="bg-white rounded-lg shadow-md p-6">
|
| 182 |
-
<h2 class="text-xl font-semibold mb-4 text-indigo-700">
|
| 183 |
<i class="fas fa-chart-pie mr-2"></i> Productivity Stats
|
| 184 |
</h2>
|
| 185 |
<div class="space-y-4">
|
| 186 |
<div>
|
| 187 |
<div class="flex justify-between mb-1">
|
| 188 |
-
<span class="text-sm font-medium text-gray-700">Tasks Completed</span>
|
| 189 |
-
<span id="completedPercentage" class="text-sm font-medium text-indigo-700">0%</span>
|
| 190 |
</div>
|
| 191 |
-
<div class="w-full bg-gray-200 rounded-full h-2.5">
|
| 192 |
<div id="completedProgress" class="bg-indigo-600 h-2.5 rounded-full" style="width: 0%"></div>
|
| 193 |
</div>
|
| 194 |
</div>
|
| 195 |
<div>
|
| 196 |
<div class="flex justify-between mb-1">
|
| 197 |
-
<span class="text-sm font-medium text-gray-700">High Priority Tasks</span>
|
| 198 |
-
<span id="highPriorityCount" class="text-sm font-medium text-red-600">0</span>
|
| 199 |
</div>
|
| 200 |
</div>
|
| 201 |
<div>
|
| 202 |
<div class="flex justify-between mb-1">
|
| 203 |
-
<span class="text-sm font-medium text-gray-700">Pending Tasks</span>
|
| 204 |
-
<span id="pendingTasksCount" class="text-sm font-medium text-yellow-600">0</span>
|
| 205 |
</div>
|
| 206 |
</div>
|
| 207 |
<div>
|
| 208 |
<div class="flex justify-between mb-1">
|
| 209 |
-
<span class="text-sm font-medium text-gray-700">Total Tasks</span>
|
| 210 |
-
<span id="totalTasksCount" class="text-sm font-medium text-indigo-700">0</span>
|
| 211 |
</div>
|
| 212 |
</div>
|
| 213 |
</div>
|
|
@@ -218,14 +249,14 @@
|
|
| 218 |
|
| 219 |
<!-- Task Details Modal -->
|
| 220 |
<div id="taskModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
|
| 221 |
-
<div class="bg-white rounded-lg shadow-xl p-6 w-full max-w-md">
|
| 222 |
<div class="flex justify-between items-center mb-4">
|
| 223 |
-
<h3 id="modalTaskTitle" class="text-xl font-semibold text-indigo-700"></h3>
|
| 224 |
-
<button id="closeModal" class="text-gray-500 hover:text-gray-700">
|
| 225 |
<i class="fas fa-times"></i>
|
| 226 |
</button>
|
| 227 |
</div>
|
| 228 |
-
<div id="modalTaskDetails" class="space-y-3">
|
| 229 |
<!-- Task details will appear here -->
|
| 230 |
</div>
|
| 231 |
<div class="mt-4 flex justify-end space-x-3">
|
|
@@ -365,6 +396,7 @@
|
|
| 365 |
const modalTaskDetails = document.getElementById('modalTaskDetails');
|
| 366 |
const completeTaskBtn = document.getElementById('completeTaskBtn');
|
| 367 |
const deleteTaskBtn = document.getElementById('deleteTaskBtn');
|
|
|
|
| 368 |
|
| 369 |
// Stats elements
|
| 370 |
const completedPercentage = document.getElementById('completedPercentage');
|
|
@@ -386,6 +418,13 @@
|
|
| 386 |
renderCalendar();
|
| 387 |
renderUpcomingTasks();
|
| 388 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 389 |
// Event listeners
|
| 390 |
taskForm.addEventListener('submit', addTask);
|
| 391 |
prevMonthBtn.addEventListener('click', () => {
|
|
@@ -405,30 +444,30 @@
|
|
| 405 |
renderCalendar();
|
| 406 |
});
|
| 407 |
filterAll.addEventListener('click', () => {
|
| 408 |
-
filterAll.classList.remove('bg-gray-200', 'text-gray-700');
|
| 409 |
filterAll.classList.add('bg-indigo-600', 'text-white');
|
| 410 |
filterPending.classList.remove('bg-indigo-600', 'text-white');
|
| 411 |
-
filterPending.classList.add('bg-gray-200', 'text-gray-700');
|
| 412 |
filterCompleted.classList.remove('bg-indigo-600', 'text-white');
|
| 413 |
-
filterCompleted.classList.add('bg-gray-200', 'text-gray-700');
|
| 414 |
renderAllTasks();
|
| 415 |
});
|
| 416 |
filterPending.addEventListener('click', () => {
|
| 417 |
-
filterPending.classList.remove('bg-gray-200', 'text-gray-700');
|
| 418 |
filterPending.classList.add('bg-indigo-600', 'text-white');
|
| 419 |
filterAll.classList.remove('bg-indigo-600', 'text-white');
|
| 420 |
-
filterAll.classList.add('bg-gray-200', 'text-gray-700');
|
| 421 |
filterCompleted.classList.remove('bg-indigo-600', 'text-white');
|
| 422 |
-
filterCompleted.classList.add('bg-gray-200', 'text-gray-700');
|
| 423 |
renderAllTasks('pending');
|
| 424 |
});
|
| 425 |
filterCompleted.addEventListener('click', () => {
|
| 426 |
-
filterCompleted.classList.remove('bg-gray-200', 'text-gray-700');
|
| 427 |
filterCompleted.classList.add('bg-indigo-600', 'text-white');
|
| 428 |
filterAll.classList.remove('bg-indigo-600', 'text-white');
|
| 429 |
-
filterAll.classList.add('bg-gray-200', 'text-gray-700');
|
| 430 |
filterPending.classList.remove('bg-indigo-600', 'text-white');
|
| 431 |
-
filterPending.classList.add('bg-gray-200', 'text-gray-700');
|
| 432 |
renderAllTasks('completed');
|
| 433 |
});
|
| 434 |
closeModal.addEventListener('click', () => {
|
|
@@ -446,8 +485,28 @@
|
|
| 446 |
taskModal.classList.add('hidden');
|
| 447 |
}
|
| 448 |
});
|
|
|
|
| 449 |
|
| 450 |
// Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 451 |
function addTask(e) {
|
| 452 |
e.preventDefault();
|
| 453 |
|
|
@@ -493,7 +552,7 @@
|
|
| 493 |
|
| 494 |
if (filteredTasks.length === 0) {
|
| 495 |
allTasksContainer.innerHTML = `
|
| 496 |
-
<div class="text-center text-gray-500 py-4">
|
| 497 |
No tasks found. Add a new task to get started!
|
| 498 |
</div>
|
| 499 |
`;
|
|
@@ -529,7 +588,7 @@
|
|
| 529 |
|
| 530 |
if (pinnedTasks.length === 0) {
|
| 531 |
pinnedTasksContainer.innerHTML = `
|
| 532 |
-
<div class="text-center text-gray-500 py-4">
|
| 533 |
No pinned tasks yet. Pin important tasks to see them here.
|
| 534 |
</div>
|
| 535 |
`;
|
|
@@ -566,7 +625,7 @@
|
|
| 566 |
|
| 567 |
if (upcomingTasks.length === 0) {
|
| 568 |
upcomingTasksContainer.innerHTML = `
|
| 569 |
-
<div class="text-center text-gray-500 py-4">
|
| 570 |
No upcoming tasks in the next 7 days.
|
| 571 |
</div>
|
| 572 |
`;
|
|
@@ -582,17 +641,17 @@
|
|
| 582 |
const dueDateStr = dueDate.toLocaleDateString('en-US', options);
|
| 583 |
|
| 584 |
const taskElement = document.createElement('div');
|
| 585 |
-
taskElement.className = `bg-white rounded-md shadow-sm p-3 border-l-4 priority-${task.priority} cursor-pointer hover:bg-gray-50`;
|
| 586 |
taskElement.dataset.id = task.id;
|
| 587 |
taskElement.addEventListener('click', () => showTaskDetails(task.id));
|
| 588 |
|
| 589 |
taskElement.innerHTML = `
|
| 590 |
<div class="flex justify-between items-start">
|
| 591 |
<div>
|
| 592 |
-
<h3 class="text-sm font-medium">${task.title}</h3>
|
| 593 |
-
<p class="text-xs text-gray-500 mt-1">${dueDateStr}</p>
|
| 594 |
</div>
|
| 595 |
-
<span class="text-xs font-medium ${task.priority === 'high' ? 'text-red-500' : task.priority === 'medium' ? 'text-yellow-500' : 'text-green-500'}">
|
| 596 |
${task.priority.charAt(0).toUpperCase() + task.priority.slice(1)}
|
| 597 |
</span>
|
| 598 |
</div>
|
|
@@ -612,7 +671,7 @@
|
|
| 612 |
const isDueToday = dueDate && dueDate.getTime() === today.getTime() && !task.completed;
|
| 613 |
|
| 614 |
const taskElement = document.createElement('div');
|
| 615 |
-
taskElement.className = `task-item bg-white rounded-md shadow-sm p-4 border-l-4 priority-${task.priority} ${isOverdue ? 'pending-task' : ''} ${task.completed ? 'opacity-70' : ''} cursor-pointer`;
|
| 616 |
taskElement.dataset.id = task.id;
|
| 617 |
taskElement.addEventListener('click', () => showTaskDetails(task.id));
|
| 618 |
|
|
@@ -625,17 +684,17 @@
|
|
| 625 |
dueDateText = `<span class="text-red-500 font-medium">${daysOverdue} day${daysOverdue !== 1 ? 's' : ''} overdue</span>`;
|
| 626 |
} else {
|
| 627 |
const options = { month: 'short', day: 'numeric' };
|
| 628 |
-
dueDateText = `<span class="text-gray-600">Due: ${new Date(task.dueDate).toLocaleDateString('en-US', options)}</span>`;
|
| 629 |
}
|
| 630 |
}
|
| 631 |
|
| 632 |
taskElement.innerHTML = `
|
| 633 |
<div class="flex justify-between items-start">
|
| 634 |
<div class="flex items-start">
|
| 635 |
-
<input type="checkbox" ${task.completed ? 'checked' : ''} class="mt-1 h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 task-completed">
|
| 636 |
<div class="ml-3">
|
| 637 |
-
<h3 class="text-sm font-medium ${task.completed ? 'line-through text-gray-500' : 'text-gray-900'}">${task.title}</h3>
|
| 638 |
-
${task.description ? `<p class="text-xs text-gray-500 mt-1">${task.description}</p>` : ''}
|
| 639 |
${dueDateText ? `<p class="text-xs mt-1">${dueDateText}</p>` : ''}
|
| 640 |
</div>
|
| 641 |
</div>
|
|
@@ -708,28 +767,28 @@
|
|
| 708 |
modalTaskDetails.innerHTML = `
|
| 709 |
<div class="flex justify-between">
|
| 710 |
<div>
|
| 711 |
-
<span class="text-sm font-medium text-gray-500">Status</span>
|
| 712 |
-
<p class="mt-1">${task.completed ? 'Completed' : 'Pending'}</p>
|
| 713 |
</div>
|
| 714 |
<div>
|
| 715 |
-
<span class="text-sm font-medium text-gray-500">Priority</span>
|
| 716 |
-
<p class="mt-1 ${task.priority === 'high' ? 'text-red-500' : task.priority === 'medium' ? 'text-yellow-500' : 'text-green-500'}">
|
| 717 |
${task.priority.charAt(0).toUpperCase() + task.priority.slice(1)}
|
| 718 |
</p>
|
| 719 |
</div>
|
| 720 |
</div>
|
| 721 |
<div>
|
| 722 |
-
<span class="text-sm font-medium text-gray-500">Due Date</span>
|
| 723 |
-
<p class="mt-1">${dueDateText}</p>
|
| 724 |
</div>
|
| 725 |
<div>
|
| 726 |
-
<span class="text-sm font-medium text-gray-500">Created</span>
|
| 727 |
-
<p class="mt-1">${new Date(task.createdAt).toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' })}</p>
|
| 728 |
</div>
|
| 729 |
${task.description ? `
|
| 730 |
<div>
|
| 731 |
-
<span class="text-sm font-medium text-gray-500">Description</span>
|
| 732 |
-
<p class="mt-1">${task.description}</p>
|
| 733 |
</div>
|
| 734 |
` : ''}
|
| 735 |
`;
|
|
@@ -831,7 +890,7 @@
|
|
| 831 |
// Create day elements for previous month
|
| 832 |
for (let i = 0; i < firstDay; i++) {
|
| 833 |
const dayElement = document.createElement('div');
|
| 834 |
-
dayElement.className = 'text-center text-gray-400 text-sm py-1';
|
| 835 |
dayElement.textContent = prevMonthDays - firstDay + i + 1;
|
| 836 |
calendarDays.appendChild(dayElement);
|
| 837 |
}
|
|
@@ -857,7 +916,7 @@
|
|
| 857 |
const isToday = dayDate.getTime() === today.getTime();
|
| 858 |
|
| 859 |
const dayElement = document.createElement('div');
|
| 860 |
-
dayElement.className = `calendar-day text-center text-sm py-1 rounded-md cursor-pointer ${isToday ? 'today font-bold' : ''} ${dayTasks.length > 0 ? 'has-tasks' : ''}`;
|
| 861 |
dayElement.textContent = i;
|
| 862 |
dayElement.dataset.date = dayDate.toISOString().split('T')[0];
|
| 863 |
|
|
@@ -878,7 +937,7 @@
|
|
| 878 |
// If more than 3 tasks, show a + indicator
|
| 879 |
if (dayTasks.length > 3) {
|
| 880 |
const more = document.createElement('span');
|
| 881 |
-
more.className = 'text-xs text-gray-500';
|
| 882 |
more.textContent = `+${dayTasks.length - 3}`;
|
| 883 |
indicators.appendChild(more);
|
| 884 |
}
|
|
@@ -901,7 +960,7 @@
|
|
| 901 |
// Add days from next month if needed
|
| 902 |
for (let i = 1; i <= remainingDays; i++) {
|
| 903 |
const dayElement = document.createElement('div');
|
| 904 |
-
dayElement.className = 'text-center text-gray-400 text-sm py-1';
|
| 905 |
dayElement.textContent = i;
|
| 906 |
calendarDays.appendChild(dayElement);
|
| 907 |
}
|
|
@@ -929,21 +988,21 @@
|
|
| 929 |
|
| 930 |
let tasksHTML = `
|
| 931 |
<div class="mb-4">
|
| 932 |
-
<h3 class="text-lg font-semibold text-indigo-700">Tasks for ${dateStr}</h3>
|
| 933 |
-
<p class="text-sm text-gray-500">${tasksForDate.length} task${tasksForDate.length !== 1 ? 's' : ''}</p>
|
| 934 |
</div>
|
| 935 |
<div class="space-y-3 max-h-96 overflow-y-auto">
|
| 936 |
`;
|
| 937 |
|
| 938 |
tasksForDate.forEach(task => {
|
| 939 |
tasksHTML += `
|
| 940 |
-
<div class="task-item bg-white rounded-md shadow-sm p-3 border-l-4 priority-${task.priority} ${task.completed ? 'opacity-70' : ''}">
|
| 941 |
<div class="flex justify-between items-start">
|
| 942 |
<div class="flex items-start">
|
| 943 |
-
<input type="checkbox" ${task.completed ? 'checked' : ''} class="mt-1 h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 task-completed">
|
| 944 |
<div class="ml-3">
|
| 945 |
-
<h3 class="text-sm font-medium ${task.completed ? 'line-through text-gray-500' : 'text-gray-900'}">${task.title}</h3>
|
| 946 |
-
${task.description ? `<p class="text-xs text-gray-500 mt-1">${task.description}</p>` : ''}
|
| 947 |
</div>
|
| 948 |
</div>
|
| 949 |
<div class="flex space-x-2">
|
|
@@ -965,10 +1024,10 @@
|
|
| 965 |
const modal = document.createElement('div');
|
| 966 |
modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
|
| 967 |
modal.innerHTML = `
|
| 968 |
-
<div class="bg-white rounded-lg shadow-xl p-6 w-full max-w-md">
|
| 969 |
<div class="flex justify-between items-center mb-4">
|
| 970 |
-
<h3 class="text-xl font-semibold text-indigo-700">Tasks for ${dateStr}</h3>
|
| 971 |
-
<button class="close-modal text-gray-500 hover:text-gray-700">
|
| 972 |
<i class="fas fa-times"></i>
|
| 973 |
</button>
|
| 974 |
</div>
|
|
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Advanced Task Manager</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script>
|
| 9 |
+
tailwind.config = {
|
| 10 |
+
darkMode: 'class',
|
| 11 |
+
theme: {
|
| 12 |
+
extend: {
|
| 13 |
+
colors: {
|
| 14 |
+
dark: {
|
| 15 |
+
100: '#1E293B',
|
| 16 |
+
200: '#0F172A',
|
| 17 |
+
300: '#0B1120',
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
</script>
|
| 24 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 25 |
<style>
|
| 26 |
.task-item:hover .task-actions {
|
|
|
|
| 49 |
.calendar-day.has-tasks {
|
| 50 |
background-color: #e0e7ff;
|
| 51 |
}
|
| 52 |
+
.dark .calendar-day.has-tasks {
|
| 53 |
+
background-color: #1e40af;
|
| 54 |
+
}
|
| 55 |
.calendar-day.has-tasks:hover {
|
| 56 |
background-color: #c7d2fe;
|
| 57 |
}
|
| 58 |
+
.dark .calendar-day.has-tasks:hover {
|
| 59 |
+
background-color: #1e3a8a;
|
| 60 |
+
}
|
| 61 |
.calendar-day.today {
|
| 62 |
border: 2px solid #6366f1;
|
| 63 |
}
|
|
|
|
| 77 |
.dot-low {
|
| 78 |
background-color: #10b981;
|
| 79 |
}
|
| 80 |
+
.dark-mode-toggle {
|
| 81 |
+
transition: all 0.3s ease;
|
| 82 |
+
}
|
| 83 |
</style>
|
| 84 |
</head>
|
| 85 |
+
<body class="bg-gray-100 dark:bg-dark-200 min-h-screen">
|
| 86 |
<div class="container mx-auto px-4 py-8">
|
| 87 |
+
<header class="mb-8 flex justify-between items-center">
|
| 88 |
+
<div>
|
| 89 |
+
<h1 class="text-3xl font-bold text-indigo-800 dark:text-indigo-400">TaskMaster Pro</h1>
|
| 90 |
+
<p class="text-gray-600 dark:text-gray-400">Your ultimate productivity companion</p>
|
| 91 |
+
</div>
|
| 92 |
+
<button id="darkModeToggle" class="dark-mode-toggle bg-gray-200 dark:bg-dark-100 text-gray-700 dark:text-gray-200 p-2 rounded-full hover:bg-gray-300 dark:hover:bg-dark-300">
|
| 93 |
+
<i class="fas fa-moon dark:hidden"></i>
|
| 94 |
+
<i class="fas fa-sun hidden dark:block"></i>
|
| 95 |
+
</button>
|
| 96 |
</header>
|
| 97 |
|
| 98 |
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
| 99 |
<!-- Task Input Section -->
|
| 100 |
<div class="lg:col-span-2">
|
| 101 |
+
<div class="bg-white dark:bg-dark-100 rounded-lg shadow-md p-6 mb-6">
|
| 102 |
+
<h2 class="text-xl font-semibold mb-4 text-indigo-700 dark:text-indigo-400">Add New Task</h2>
|
| 103 |
<form id="taskForm" class="space-y-4">
|
| 104 |
<div>
|
| 105 |
+
<label for="taskTitle" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Task Title</label>
|
| 106 |
+
<input type="text" id="taskTitle" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 p-2 border dark:bg-dark-200 dark:border-gray-600 dark:text-white" required>
|
| 107 |
</div>
|
| 108 |
<div>
|
| 109 |
+
<label for="taskDescription" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Description</label>
|
| 110 |
+
<textarea id="taskDescription" rows="2" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 p-2 border dark:bg-dark-200 dark:border-gray-600 dark:text-white"></textarea>
|
| 111 |
</div>
|
| 112 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 113 |
<div>
|
| 114 |
+
<label for="taskDueDate" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Due Date</label>
|
| 115 |
+
<input type="date" id="taskDueDate" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 p-2 border dark:bg-dark-200 dark:border-gray-600 dark:text-white">
|
| 116 |
</div>
|
| 117 |
<div>
|
| 118 |
+
<label for="taskPriority" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Priority</label>
|
| 119 |
+
<select id="taskPriority" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 p-2 border dark:bg-dark-200 dark:border-gray-600 dark:text-white">
|
| 120 |
<option value="low">Low</option>
|
| 121 |
<option value="medium">Medium</option>
|
| 122 |
<option value="high">High</option>
|
|
|
|
| 124 |
</div>
|
| 125 |
</div>
|
| 126 |
<div class="flex items-center">
|
| 127 |
+
<input id="pinTask" type="checkbox" class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 dark:border-gray-600">
|
| 128 |
+
<label for="pinTask" class="ml-2 block text-sm text-gray-700 dark:text-gray-300">Pin this task</label>
|
| 129 |
</div>
|
| 130 |
<button type="submit" class="w-full bg-indigo-600 text-white py-2 px-4 rounded-md hover:bg-indigo-700 transition duration-200 flex items-center justify-center">
|
| 131 |
<i class="fas fa-plus-circle mr-2"></i> Add Task
|
|
|
|
| 134 |
</div>
|
| 135 |
|
| 136 |
<!-- Pinned Tasks Section -->
|
| 137 |
+
<div class="bg-white dark:bg-dark-100 rounded-lg shadow-md p-6 mb-6">
|
| 138 |
<div class="flex justify-between items-center mb-4">
|
| 139 |
+
<h2 class="text-xl font-semibold text-indigo-700 dark:text-indigo-400">
|
| 140 |
<i class="fas fa-thumbtack mr-2 text-red-500"></i> Pinned Tasks
|
| 141 |
</h2>
|
| 142 |
+
<span id="pinnedCount" class="bg-indigo-100 dark:bg-indigo-900 text-indigo-800 dark:text-indigo-200 text-xs font-medium px-2.5 py-0.5 rounded-full">0</span>
|
| 143 |
</div>
|
| 144 |
<div id="pinnedTasks" class="space-y-3">
|
| 145 |
<!-- Pinned tasks will appear here -->
|
| 146 |
+
<div class="text-center text-gray-500 dark:text-gray-400 py-4">
|
| 147 |
No pinned tasks yet. Pin important tasks to see them here.
|
| 148 |
</div>
|
| 149 |
</div>
|
| 150 |
</div>
|
| 151 |
|
| 152 |
<!-- All Tasks Section -->
|
| 153 |
+
<div class="bg-white dark:bg-dark-100 rounded-lg shadow-md p-6">
|
| 154 |
<div class="flex justify-between items-center mb-4">
|
| 155 |
+
<h2 class="text-xl font-semibold text-indigo-700 dark:text-indigo-400">
|
| 156 |
<i class="fas fa-tasks mr-2"></i> All Tasks
|
| 157 |
</h2>
|
| 158 |
<div class="flex space-x-2">
|
| 159 |
<button id="filterAll" class="text-xs bg-indigo-600 text-white px-3 py-1 rounded-full">All</button>
|
| 160 |
+
<button id="filterPending" class="text-xs bg-gray-200 dark:bg-dark-200 text-gray-700 dark:text-gray-300 px-3 py-1 rounded-full">Pending</button>
|
| 161 |
+
<button id="filterCompleted" class="text-xs bg-gray-200 dark:bg-dark-200 text-gray-700 dark:text-gray-300 px-3 py-1 rounded-full">Completed</button>
|
| 162 |
</div>
|
| 163 |
</div>
|
| 164 |
<div id="allTasks" class="space-y-3">
|
|
|
|
| 169 |
|
| 170 |
<!-- Calendar and Stats Section -->
|
| 171 |
<div class="lg:col-span-1">
|
| 172 |
+
<div class="bg-white dark:bg-dark-100 rounded-lg shadow-md p-6 mb-6">
|
| 173 |
<div class="flex justify-between items-center mb-4">
|
| 174 |
+
<h2 class="text-xl font-semibold text-indigo-700 dark:text-indigo-400">
|
| 175 |
<i class="fas fa-calendar-alt mr-2"></i> Schedule
|
| 176 |
</h2>
|
| 177 |
<div class="flex space-x-2">
|
| 178 |
+
<button id="prevMonth" class="text-gray-600 dark:text-gray-300 hover:text-indigo-700 dark:hover:text-indigo-400">
|
| 179 |
<i class="fas fa-chevron-left"></i>
|
| 180 |
</button>
|
| 181 |
+
<span id="currentMonth" class="font-medium dark:text-gray-300">June 2023</span>
|
| 182 |
+
<button id="nextMonth" class="text-gray-600 dark:text-gray-300 hover:text-indigo-700 dark:hover:text-indigo-400">
|
| 183 |
<i class="fas fa-chevron-right"></i>
|
| 184 |
</button>
|
| 185 |
</div>
|
| 186 |
</div>
|
| 187 |
<div class="grid grid-cols-7 gap-1 mb-2">
|
| 188 |
+
<div class="text-center text-xs font-medium text-gray-500 dark:text-gray-400">Sun</div>
|
| 189 |
+
<div class="text-center text-xs font-medium text-gray-500 dark:text-gray-400">Mon</div>
|
| 190 |
+
<div class="text-center text-xs font-medium text-gray-500 dark:text-gray-400">Tue</div>
|
| 191 |
+
<div class="text-center text-xs font-medium text-gray-500 dark:text-gray-400">Wed</div>
|
| 192 |
+
<div class="text-center text-xs font-medium text-gray-500 dark:text-gray-400">Thu</div>
|
| 193 |
+
<div class="text-center text-xs font-medium text-gray-500 dark:text-gray-400">Fri</div>
|
| 194 |
+
<div class="text-center text-xs font-medium text-gray-500 dark:text-gray-400">Sat</div>
|
| 195 |
</div>
|
| 196 |
<div id="calendarDays" class="grid grid-cols-7 gap-1">
|
| 197 |
<!-- Calendar days will be generated here -->
|
|
|
|
| 199 |
</div>
|
| 200 |
|
| 201 |
<!-- Upcoming Tasks Preview -->
|
| 202 |
+
<div class="bg-white dark:bg-dark-100 rounded-lg shadow-md p-6 mb-6">
|
| 203 |
+
<h2 class="text-xl font-semibold mb-4 text-indigo-700 dark:text-indigo-400">
|
| 204 |
<i class="fas fa-calendar-day mr-2"></i> Upcoming Tasks
|
| 205 |
</h2>
|
| 206 |
<div id="upcomingTasks" class="space-y-3">
|
|
|
|
| 209 |
</div>
|
| 210 |
|
| 211 |
<!-- Stats Section -->
|
| 212 |
+
<div class="bg-white dark:bg-dark-100 rounded-lg shadow-md p-6">
|
| 213 |
+
<h2 class="text-xl font-semibold mb-4 text-indigo-700 dark:text-indigo-400">
|
| 214 |
<i class="fas fa-chart-pie mr-2"></i> Productivity Stats
|
| 215 |
</h2>
|
| 216 |
<div class="space-y-4">
|
| 217 |
<div>
|
| 218 |
<div class="flex justify-between mb-1">
|
| 219 |
+
<span class="text-sm font-medium text-gray-700 dark:text-gray-300">Tasks Completed</span>
|
| 220 |
+
<span id="completedPercentage" class="text-sm font-medium text-indigo-700 dark:text-indigo-400">0%</span>
|
| 221 |
</div>
|
| 222 |
+
<div class="w-full bg-gray-200 dark:bg-dark-200 rounded-full h-2.5">
|
| 223 |
<div id="completedProgress" class="bg-indigo-600 h-2.5 rounded-full" style="width: 0%"></div>
|
| 224 |
</div>
|
| 225 |
</div>
|
| 226 |
<div>
|
| 227 |
<div class="flex justify-between mb-1">
|
| 228 |
+
<span class="text-sm font-medium text-gray-700 dark:text-gray-300">High Priority Tasks</span>
|
| 229 |
+
<span id="highPriorityCount" class="text-sm font-medium text-red-600 dark:text-red-400">0</span>
|
| 230 |
</div>
|
| 231 |
</div>
|
| 232 |
<div>
|
| 233 |
<div class="flex justify-between mb-1">
|
| 234 |
+
<span class="text-sm font-medium text-gray-700 dark:text-gray-300">Pending Tasks</span>
|
| 235 |
+
<span id="pendingTasksCount" class="text-sm font-medium text-yellow-600 dark:text-yellow-400">0</span>
|
| 236 |
</div>
|
| 237 |
</div>
|
| 238 |
<div>
|
| 239 |
<div class="flex justify-between mb-1">
|
| 240 |
+
<span class="text-sm font-medium text-gray-700 dark:text-gray-300">Total Tasks</span>
|
| 241 |
+
<span id="totalTasksCount" class="text-sm font-medium text-indigo-700 dark:text-indigo-400">0</span>
|
| 242 |
</div>
|
| 243 |
</div>
|
| 244 |
</div>
|
|
|
|
| 249 |
|
| 250 |
<!-- Task Details Modal -->
|
| 251 |
<div id="taskModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
|
| 252 |
+
<div class="bg-white dark:bg-dark-100 rounded-lg shadow-xl p-6 w-full max-w-md">
|
| 253 |
<div class="flex justify-between items-center mb-4">
|
| 254 |
+
<h3 id="modalTaskTitle" class="text-xl font-semibold text-indigo-700 dark:text-indigo-400"></h3>
|
| 255 |
+
<button id="closeModal" class="text-gray-500 dark:text-gray-300 hover:text-gray-700 dark:hover:text-gray-100">
|
| 256 |
<i class="fas fa-times"></i>
|
| 257 |
</button>
|
| 258 |
</div>
|
| 259 |
+
<div id="modalTaskDetails" class="space-y-3 dark:text-gray-300">
|
| 260 |
<!-- Task details will appear here -->
|
| 261 |
</div>
|
| 262 |
<div class="mt-4 flex justify-end space-x-3">
|
|
|
|
| 396 |
const modalTaskDetails = document.getElementById('modalTaskDetails');
|
| 397 |
const completeTaskBtn = document.getElementById('completeTaskBtn');
|
| 398 |
const deleteTaskBtn = document.getElementById('deleteTaskBtn');
|
| 399 |
+
const darkModeToggle = document.getElementById('darkModeToggle');
|
| 400 |
|
| 401 |
// Stats elements
|
| 402 |
const completedPercentage = document.getElementById('completedPercentage');
|
|
|
|
| 418 |
renderCalendar();
|
| 419 |
renderUpcomingTasks();
|
| 420 |
|
| 421 |
+
// Check for saved dark mode preference
|
| 422 |
+
if (localStorage.getItem('darkMode') === 'enabled') {
|
| 423 |
+
document.documentElement.classList.add('dark');
|
| 424 |
+
darkModeToggle.querySelector('.fa-moon').classList.add('hidden');
|
| 425 |
+
darkModeToggle.querySelector('.fa-sun').classList.remove('hidden');
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
// Event listeners
|
| 429 |
taskForm.addEventListener('submit', addTask);
|
| 430 |
prevMonthBtn.addEventListener('click', () => {
|
|
|
|
| 444 |
renderCalendar();
|
| 445 |
});
|
| 446 |
filterAll.addEventListener('click', () => {
|
| 447 |
+
filterAll.classList.remove('bg-gray-200', 'text-gray-700', 'dark:bg-dark-200', 'dark:text-gray-300');
|
| 448 |
filterAll.classList.add('bg-indigo-600', 'text-white');
|
| 449 |
filterPending.classList.remove('bg-indigo-600', 'text-white');
|
| 450 |
+
filterPending.classList.add('bg-gray-200', 'text-gray-700', 'dark:bg-dark-200', 'dark:text-gray-300');
|
| 451 |
filterCompleted.classList.remove('bg-indigo-600', 'text-white');
|
| 452 |
+
filterCompleted.classList.add('bg-gray-200', 'text-gray-700', 'dark:bg-dark-200', 'dark:text-gray-300');
|
| 453 |
renderAllTasks();
|
| 454 |
});
|
| 455 |
filterPending.addEventListener('click', () => {
|
| 456 |
+
filterPending.classList.remove('bg-gray-200', 'text-gray-700', 'dark:bg-dark-200', 'dark:text-gray-300');
|
| 457 |
filterPending.classList.add('bg-indigo-600', 'text-white');
|
| 458 |
filterAll.classList.remove('bg-indigo-600', 'text-white');
|
| 459 |
+
filterAll.classList.add('bg-gray-200', 'text-gray-700', 'dark:bg-dark-200', 'dark:text-gray-300');
|
| 460 |
filterCompleted.classList.remove('bg-indigo-600', 'text-white');
|
| 461 |
+
filterCompleted.classList.add('bg-gray-200', 'text-gray-700', 'dark:bg-dark-200', 'dark:text-gray-300');
|
| 462 |
renderAllTasks('pending');
|
| 463 |
});
|
| 464 |
filterCompleted.addEventListener('click', () => {
|
| 465 |
+
filterCompleted.classList.remove('bg-gray-200', 'text-gray-700', 'dark:bg-dark-200', 'dark:text-gray-300');
|
| 466 |
filterCompleted.classList.add('bg-indigo-600', 'text-white');
|
| 467 |
filterAll.classList.remove('bg-indigo-600', 'text-white');
|
| 468 |
+
filterAll.classList.add('bg-gray-200', 'text-gray-700', 'dark:bg-dark-200', 'dark:text-gray-300');
|
| 469 |
filterPending.classList.remove('bg-indigo-600', 'text-white');
|
| 470 |
+
filterPending.classList.add('bg-gray-200', 'text-gray-700', 'dark:bg-dark-200', 'dark:text-gray-300');
|
| 471 |
renderAllTasks('completed');
|
| 472 |
});
|
| 473 |
closeModal.addEventListener('click', () => {
|
|
|
|
| 485 |
taskModal.classList.add('hidden');
|
| 486 |
}
|
| 487 |
});
|
| 488 |
+
darkModeToggle.addEventListener('click', toggleDarkMode);
|
| 489 |
|
| 490 |
// Functions
|
| 491 |
+
function toggleDarkMode() {
|
| 492 |
+
const html = document.documentElement;
|
| 493 |
+
html.classList.toggle('dark');
|
| 494 |
+
|
| 495 |
+
const isDark = html.classList.contains('dark');
|
| 496 |
+
localStorage.setItem('darkMode', isDark ? 'enabled' : 'disabled');
|
| 497 |
+
|
| 498 |
+
const moonIcon = darkModeToggle.querySelector('.fa-moon');
|
| 499 |
+
const sunIcon = darkModeToggle.querySelector('.fa-sun');
|
| 500 |
+
|
| 501 |
+
if (isDark) {
|
| 502 |
+
moonIcon.classList.add('hidden');
|
| 503 |
+
sunIcon.classList.remove('hidden');
|
| 504 |
+
} else {
|
| 505 |
+
moonIcon.classList.remove('hidden');
|
| 506 |
+
sunIcon.classList.add('hidden');
|
| 507 |
+
}
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
function addTask(e) {
|
| 511 |
e.preventDefault();
|
| 512 |
|
|
|
|
| 552 |
|
| 553 |
if (filteredTasks.length === 0) {
|
| 554 |
allTasksContainer.innerHTML = `
|
| 555 |
+
<div class="text-center text-gray-500 dark:text-gray-400 py-4">
|
| 556 |
No tasks found. Add a new task to get started!
|
| 557 |
</div>
|
| 558 |
`;
|
|
|
|
| 588 |
|
| 589 |
if (pinnedTasks.length === 0) {
|
| 590 |
pinnedTasksContainer.innerHTML = `
|
| 591 |
+
<div class="text-center text-gray-500 dark:text-gray-400 py-4">
|
| 592 |
No pinned tasks yet. Pin important tasks to see them here.
|
| 593 |
</div>
|
| 594 |
`;
|
|
|
|
| 625 |
|
| 626 |
if (upcomingTasks.length === 0) {
|
| 627 |
upcomingTasksContainer.innerHTML = `
|
| 628 |
+
<div class="text-center text-gray-500 dark:text-gray-400 py-4">
|
| 629 |
No upcoming tasks in the next 7 days.
|
| 630 |
</div>
|
| 631 |
`;
|
|
|
|
| 641 |
const dueDateStr = dueDate.toLocaleDateString('en-US', options);
|
| 642 |
|
| 643 |
const taskElement = document.createElement('div');
|
| 644 |
+
taskElement.className = `bg-white dark:bg-dark-200 rounded-md shadow-sm p-3 border-l-4 priority-${task.priority} cursor-pointer hover:bg-gray-50 dark:hover:bg-dark-300`;
|
| 645 |
taskElement.dataset.id = task.id;
|
| 646 |
taskElement.addEventListener('click', () => showTaskDetails(task.id));
|
| 647 |
|
| 648 |
taskElement.innerHTML = `
|
| 649 |
<div class="flex justify-between items-start">
|
| 650 |
<div>
|
| 651 |
+
<h3 class="text-sm font-medium dark:text-gray-300">${task.title}</h3>
|
| 652 |
+
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">${dueDateStr}</p>
|
| 653 |
</div>
|
| 654 |
+
<span class="text-xs font-medium ${task.priority === 'high' ? 'text-red-500 dark:text-red-400' : task.priority === 'medium' ? 'text-yellow-500 dark:text-yellow-400' : 'text-green-500 dark:text-green-400'}">
|
| 655 |
${task.priority.charAt(0).toUpperCase() + task.priority.slice(1)}
|
| 656 |
</span>
|
| 657 |
</div>
|
|
|
|
| 671 |
const isDueToday = dueDate && dueDate.getTime() === today.getTime() && !task.completed;
|
| 672 |
|
| 673 |
const taskElement = document.createElement('div');
|
| 674 |
+
taskElement.className = `task-item bg-white dark:bg-dark-200 rounded-md shadow-sm p-4 border-l-4 priority-${task.priority} ${isOverdue ? 'pending-task' : ''} ${task.completed ? 'opacity-70' : ''} cursor-pointer`;
|
| 675 |
taskElement.dataset.id = task.id;
|
| 676 |
taskElement.addEventListener('click', () => showTaskDetails(task.id));
|
| 677 |
|
|
|
|
| 684 |
dueDateText = `<span class="text-red-500 font-medium">${daysOverdue} day${daysOverdue !== 1 ? 's' : ''} overdue</span>`;
|
| 685 |
} else {
|
| 686 |
const options = { month: 'short', day: 'numeric' };
|
| 687 |
+
dueDateText = `<span class="text-gray-600 dark:text-gray-400">Due: ${new Date(task.dueDate).toLocaleDateString('en-US', options)}</span>`;
|
| 688 |
}
|
| 689 |
}
|
| 690 |
|
| 691 |
taskElement.innerHTML = `
|
| 692 |
<div class="flex justify-between items-start">
|
| 693 |
<div class="flex items-start">
|
| 694 |
+
<input type="checkbox" ${task.completed ? 'checked' : ''} class="mt-1 h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 dark:border-gray-600 task-completed">
|
| 695 |
<div class="ml-3">
|
| 696 |
+
<h3 class="text-sm font-medium ${task.completed ? 'line-through text-gray-500 dark:text-gray-400' : 'text-gray-900 dark:text-gray-300'}">${task.title}</h3>
|
| 697 |
+
${task.description ? `<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">${task.description}</p>` : ''}
|
| 698 |
${dueDateText ? `<p class="text-xs mt-1">${dueDateText}</p>` : ''}
|
| 699 |
</div>
|
| 700 |
</div>
|
|
|
|
| 767 |
modalTaskDetails.innerHTML = `
|
| 768 |
<div class="flex justify-between">
|
| 769 |
<div>
|
| 770 |
+
<span class="text-sm font-medium text-gray-500 dark:text-gray-400">Status</span>
|
| 771 |
+
<p class="mt-1 dark:text-gray-300">${task.completed ? 'Completed' : 'Pending'}</p>
|
| 772 |
</div>
|
| 773 |
<div>
|
| 774 |
+
<span class="text-sm font-medium text-gray-500 dark:text-gray-400">Priority</span>
|
| 775 |
+
<p class="mt-1 ${task.priority === 'high' ? 'text-red-500 dark:text-red-400' : task.priority === 'medium' ? 'text-yellow-500 dark:text-yellow-400' : 'text-green-500 dark:text-green-400'}">
|
| 776 |
${task.priority.charAt(0).toUpperCase() + task.priority.slice(1)}
|
| 777 |
</p>
|
| 778 |
</div>
|
| 779 |
</div>
|
| 780 |
<div>
|
| 781 |
+
<span class="text-sm font-medium text-gray-500 dark:text-gray-400">Due Date</span>
|
| 782 |
+
<p class="mt-1 dark:text-gray-300">${dueDateText}</p>
|
| 783 |
</div>
|
| 784 |
<div>
|
| 785 |
+
<span class="text-sm font-medium text-gray-500 dark:text-gray-400">Created</span>
|
| 786 |
+
<p class="mt-1 dark:text-gray-300">${new Date(task.createdAt).toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' })}</p>
|
| 787 |
</div>
|
| 788 |
${task.description ? `
|
| 789 |
<div>
|
| 790 |
+
<span class="text-sm font-medium text-gray-500 dark:text-gray-400">Description</span>
|
| 791 |
+
<p class="mt-1 dark:text-gray-300">${task.description}</p>
|
| 792 |
</div>
|
| 793 |
` : ''}
|
| 794 |
`;
|
|
|
|
| 890 |
// Create day elements for previous month
|
| 891 |
for (let i = 0; i < firstDay; i++) {
|
| 892 |
const dayElement = document.createElement('div');
|
| 893 |
+
dayElement.className = 'text-center text-gray-400 dark:text-gray-500 text-sm py-1';
|
| 894 |
dayElement.textContent = prevMonthDays - firstDay + i + 1;
|
| 895 |
calendarDays.appendChild(dayElement);
|
| 896 |
}
|
|
|
|
| 916 |
const isToday = dayDate.getTime() === today.getTime();
|
| 917 |
|
| 918 |
const dayElement = document.createElement('div');
|
| 919 |
+
dayElement.className = `calendar-day text-center text-sm py-1 rounded-md cursor-pointer ${isToday ? 'today font-bold' : ''} ${dayTasks.length > 0 ? 'has-tasks' : ''} dark:text-gray-300`;
|
| 920 |
dayElement.textContent = i;
|
| 921 |
dayElement.dataset.date = dayDate.toISOString().split('T')[0];
|
| 922 |
|
|
|
|
| 937 |
// If more than 3 tasks, show a + indicator
|
| 938 |
if (dayTasks.length > 3) {
|
| 939 |
const more = document.createElement('span');
|
| 940 |
+
more.className = 'text-xs text-gray-500 dark:text-gray-400';
|
| 941 |
more.textContent = `+${dayTasks.length - 3}`;
|
| 942 |
indicators.appendChild(more);
|
| 943 |
}
|
|
|
|
| 960 |
// Add days from next month if needed
|
| 961 |
for (let i = 1; i <= remainingDays; i++) {
|
| 962 |
const dayElement = document.createElement('div');
|
| 963 |
+
dayElement.className = 'text-center text-gray-400 dark:text-gray-500 text-sm py-1';
|
| 964 |
dayElement.textContent = i;
|
| 965 |
calendarDays.appendChild(dayElement);
|
| 966 |
}
|
|
|
|
| 988 |
|
| 989 |
let tasksHTML = `
|
| 990 |
<div class="mb-4">
|
| 991 |
+
<h3 class="text-lg font-semibold text-indigo-700 dark:text-indigo-400">Tasks for ${dateStr}</h3>
|
| 992 |
+
<p class="text-sm text-gray-500 dark:text-gray-400">${tasksForDate.length} task${tasksForDate.length !== 1 ? 's' : ''}</p>
|
| 993 |
</div>
|
| 994 |
<div class="space-y-3 max-h-96 overflow-y-auto">
|
| 995 |
`;
|
| 996 |
|
| 997 |
tasksForDate.forEach(task => {
|
| 998 |
tasksHTML += `
|
| 999 |
+
<div class="task-item bg-white dark:bg-dark-200 rounded-md shadow-sm p-3 border-l-4 priority-${task.priority} ${task.completed ? 'opacity-70' : ''}">
|
| 1000 |
<div class="flex justify-between items-start">
|
| 1001 |
<div class="flex items-start">
|
| 1002 |
+
<input type="checkbox" ${task.completed ? 'checked' : ''} class="mt-1 h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 dark:border-gray-600 task-completed">
|
| 1003 |
<div class="ml-3">
|
| 1004 |
+
<h3 class="text-sm font-medium ${task.completed ? 'line-through text-gray-500 dark:text-gray-400' : 'text-gray-900 dark:text-gray-300'}">${task.title}</h3>
|
| 1005 |
+
${task.description ? `<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">${task.description}</p>` : ''}
|
| 1006 |
</div>
|
| 1007 |
</div>
|
| 1008 |
<div class="flex space-x-2">
|
|
|
|
| 1024 |
const modal = document.createElement('div');
|
| 1025 |
modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
|
| 1026 |
modal.innerHTML = `
|
| 1027 |
+
<div class="bg-white dark:bg-dark-100 rounded-lg shadow-xl p-6 w-full max-w-md">
|
| 1028 |
<div class="flex justify-between items-center mb-4">
|
| 1029 |
+
<h3 class="text-xl font-semibold text-indigo-700 dark:text-indigo-400">Tasks for ${dateStr}</h3>
|
| 1030 |
+
<button class="close-modal text-gray-500 dark:text-gray-300 hover:text-gray-700 dark:hover:text-gray-100">
|
| 1031 |
<i class="fas fa-times"></i>
|
| 1032 |
</button>
|
| 1033 |
</div>
|
prompts.txt
CHANGED
|
@@ -1,2 +1,3 @@
|
|
| 1 |
Make an advanced task manager and schedule planner. Make sure to add a section where important tasks can be pinned. There should be another section where pending tasks should be highlighted. Populate the calendar with a few random tasks in the beginning.
|
| 2 |
-
Now enter a few tasks randomly. Add a calendar to show the preview of those added tasks.
|
|
|
|
|
|
| 1 |
Make an advanced task manager and schedule planner. Make sure to add a section where important tasks can be pinned. There should be another section where pending tasks should be highlighted. Populate the calendar with a few random tasks in the beginning.
|
| 2 |
+
Now enter a few tasks randomly. Add a calendar to show the preview of those added tasks.
|
| 3 |
+
Add a dark mode button
|