Spaces:
Running
Running
File size: 20,861 Bytes
7442827 8f9e3c8 7442827 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TaskTroveProMax - Ultimate Productivity Suite</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<style>
.task-item {
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.task-item:hover {
transform: translateX(8px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.completed {
text-decoration: line-through;
opacity: 0.6;
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}
.fade-in {
animation: fadeInSlide 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
@keyframes fadeInSlide {
0% {
opacity: 0;
transform: translateY(20px) scale(0.95);
}
100% {
opacity: 1;
transform: translateY(0) scale(1);
}
}
.priority-high { border-left: 4px solid #ef4444; }
.priority-medium { border-left: 4px solid #f59e0b; }
.priority-low { border-left: 4px solid #10b981; }
.stats-card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-radius: 12px;
padding: 1.5rem;
box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}
.gradient-bg {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.floating-btn {
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.floating-btn:hover {
transform: translateY(-3px) scale(1.05);
box-shadow: 0 12px 35px rgba(102, 126, 234, 0.5);
}
</style>
</head>
<body class="bg-gray-50 min-h-screen font-sans">
<div class="max-w-4xl mx-auto px-4 py-8">
<!-- Header -->
<header class="text-center mb-12">
<div class="gradient-bg rounded-2xl p-8 mb-6 text-white">
<h1 class="text-5xl font-bold mb-2">TaskTroveProMax 📊</h1>
<p class="text-blue-100 opacity-90">Ultimate Productivity Suite</p>
<div class="mt-4 flex justify-center gap-4">
<div class="stats-card">
<div class="text-2xl font-bold" id="total-tasks">0</div>
<div class="text-sm opacity-90">Total Tasks</div>
</div>
<div class="stats-card">
<div class="text-2xl font-bold" id="completed-tasks">0</div>
<div class="text-sm opacity-90">Completed</div>
</div>
</div>
</div>
</header>
<!-- Navigation Tabs -->
<div class="flex border-b border-gray-200 mb-8">
<button id="todo-tab" class="px-6 py-3 text-blue-600 font-medium border-b-2 border-blue-600 flex items-center gap-2">
<i data-feather="list"></i> Todo List
</button>
<button id="history-tab" class="px-6 py-3 text-gray-500 font-medium flex items-center gap-2">
<i data-feather="clock"></i> History
</button>
<button id="analytics-tab" class="px-6 py-3 text-gray-500 font-medium flex items-center gap-2">
<i data-feather="bar-chart-2"></i> Analytics
</button>
</div>
<!-- Todo Section -->
<div id="todo-section" class="space-y-6">
<!-- Add Task Form -->
<div class="bg-white rounded-xl shadow-lg p-6">
<form id="add-task-form" class="space-y-4">
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<input type="text" id="task-input" placeholder="What needs to be done?"
class="col-span-2 px-4 py-3 border border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent">
<select id="priority-select" class="px-4 py-3 border border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="low">Low Priority</option>
<option value="medium" selected>Medium Priority</option>
<option value="high">High Priority</option>
</select>
</div>
<div class="flex justify-end">
<button type="submit" class="bg-blue-500 hover:bg-blue-600 text-white px-8 py-3 rounded-xl transition-all duration-300 floating-btn flex items-center gap-2">
<i data-feather="plus" class="w-5 h-5"></i> Add Task
</button>
</div>
</form>
</div>
<!-- Task List -->
<div id="task-list" class="bg-white rounded-xl shadow-lg divide-y divide-gray-100">
<!-- Tasks will be dynamically inserted here -->
</div>
</div>
<!-- History Section -->
<div id="history-section" class="hidden space-y-6">
<div class="bg-white rounded-xl shadow-lg p-6">
<div class="flex items-center justify-between mb-6">
<h2 class="text-2xl font-semibold text-gray-800 flex items-center gap-2">
<i data-feather="clock"></i> Completed Tasks History
</h2>
<button onclick="clearHistory()" class="text-red-400 hover:text-red-600 transition-colors flex items-center gap-2">
<i data-feather="trash-2" class="w-4 h-4"></i> Clear History
</button>
</div>
<div id="history-list" class="space-y-3">
<!-- History items will be dynamically inserted here -->
</div>
</div>
</div>
<!-- Analytics Section -->
<div id="analytics-section" class="hidden space-y-6">
<div class="bg-white rounded-xl shadow-lg p-6">
<h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center gap-2">
<i data-feather="bar-chart-2"></i> Productivity Analytics
</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
<div class="bg-gradient-to-r from-blue-50 to-indigo-50 p-6 rounded-xl">
<div class="text-3xl font-bold text-blue-600 mb-2" id="analytics-total">0</div>
<div class="text-sm text-blue-600 opacity-80">Total Tasks Created</div>
</div>
<div class="bg-gradient-to-r from-green-50 to-teal-50 p-6 rounded-xl">
<div class="text-3xl font-bold text-green-600 mb-2" id="analytics-completed">0</div>
<div class="text-sm text-green-600 opacity-80">Completion Rate</div>
</div>
<div class="bg-gradient-to-r from-purple-50 to-pink-50 p-6 rounded-xl">
<div class="text-3xl font-bold text-purple-600 mb-2" id="analytics-avg-time">0h</div>
<div class="text-sm text-purple-600 opacity-80">Avg Completion Time</div>
</div>
</div>
<div class="bg-gray-50 p-6 rounded-xl">
<h3 class="text-lg font-semibold text-gray-800 mb-4">Priority Distribution</h3>
<div class="grid grid-cols-3 gap-4">
<div class="text-center">
<div class="text-2xl font-bold text-red-600" id="high-priority">0</div>
<div class="text-sm text-gray-600">High Priority</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold text-yellow-600" id="medium-priority">0</div>
<div class="text-sm text-gray-600">Medium Priority</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold text-green-600" id="low-priority">0</div>
<div class="text-sm text-gray-600">Low Priority</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// Initialize Feather Icons
feather.replace();
// DOM Elements
const todoTab = document.getElementById('todo-tab');
const historyTab = document.getElementById('history-tab');
const analyticsTab = document.getElementById('analytics-tab');
const todoSection = document.getElementById('todo-section');
const historySection = document.getElementById('history-section');
const analyticsSection = document.getElementById('analytics-section');
const addTaskForm = document.getElementById('add-task-form');
const taskInput = document.getElementById('task-input');
const prioritySelect = document.getElementById('priority-select');
const taskList = document.getElementById('task-list');
const historyList = document.getElementById('history-list');
const totalTasksEl = document.getElementById('total-tasks');
const completedTasksEl = document.getElementById('completed-tasks');
// State
let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
let history = JSON.parse(localStorage.getItem('history')) || [];
// Tab Navigation
todoTab.addEventListener('click', () => {
todoTab.classList.add('text-blue-600', 'border-blue-600');
historyTab.classList.remove('text-blue-600', 'border-blue-600');
analyticsTab.classList.remove('text-blue-600', 'border-blue-600');
historyTab.classList.add('text-gray-500');
analyticsTab.classList.add('text-gray-500');
todoSection.classList.remove('hidden');
historySection.classList.add('hidden');
analyticsSection.classList.add('hidden');
});
historyTab.addEventListener('click', () => {
historyTab.classList.add('text-blue-600', 'border-blue-600');
todoTab.classList.remove('text-blue-600', 'border-blue-600');
analyticsTab.classList.remove('text-blue-600', 'border-blue-600');
todoTab.classList.add('text-gray-500');
analyticsTab.classList.add('text-gray-500');
historySection.classList.remove('hidden');
todoSection.classList.add('hidden');
analyticsSection.classList.add('hidden');
renderHistory();
});
analyticsTab.addEventListener('click', () => {
analyticsTab.classList.add('text-blue-600', 'border-blue-600');
todoTab.classList.remove('text-blue-600', 'border-blue-600');
historyTab.classList.remove('text-blue-600', 'border-blue-600');
todoTab.classList.add('text-gray-500');
historyTab.classList.add('text-gray-500');
analyticsSection.classList.remove('hidden');
todoSection.classList.add('hidden');
historySection.classList.add('hidden');
renderAnalytics();
});
// Add Task
addTaskForm.addEventListener('submit', (e) => {
e.preventDefault();
const taskText = taskInput.value.trim();
const priority = prioritySelect.value;
if (taskText) {
const newTask = {
id: Date.now(),
text: taskText,
completed: false,
priority: priority,
createdAt: new Date().toISOString()
};
tasks.push(newTask);
saveTasks();
renderTasks();
updateStats();
taskInput.value = '';
taskInput.focus();
}
});
// Toggle Task Completion
function toggleTask(id) {
const task = tasks.find(t => t.id === id);
if (task) {
task.completed = !task.completed;
if (task.completed) {
// Calculate completion time
const created = new Date(task.createdAt);
const completed = new Date();
const completionTime = Math.round((completed - created) / (1000 * 60 * 60)); // hours
// Move to history
history.push({
...task,
completedAt: new Date().toISOString(),
completionTime: completionTime
});
tasks = tasks.filter(t => t.id !== id);
}
saveTasks();
saveHistory();
renderTasks();
updateStats();
}
}
// Delete Task
function deleteTask(id) {
tasks = tasks.filter(t => t.id !== id);
saveTasks();
renderTasks();
updateStats();
}
// Clear History
function clearHistory() {
if (confirm('Are you sure you want to clear all history? This action cannot be undone.')) {
history = [];
saveHistory();
renderHistory();
}
}
// Save to localStorage
function saveTasks() {
localStorage.setItem('tasks', JSON.stringify(tasks));
}
function saveHistory() {
localStorage.setItem('history', JSON.stringify(history));
}
// Update Stats
function updateStats() {
totalTasksEl.textContent = tasks.length + history.length;
completedTasksEl.textContent = history.length;
}
// Render Tasks
function renderTasks() {
taskList.innerHTML = '';
if (tasks.length === 0) {
taskList.innerHTML = `
<div class="text-center py-12 text-gray-400">
<i data-feather="check-circle" class="w-16 h-16 mx-auto mb-4 opacity-50"></i>
<p class="text-lg">No tasks yet! Add one above.</p>
<p class="text-sm mt-1">Your organized life starts here</p>
</div>
`;
feather.replace();
return;
}
// Sort tasks by priority: high -> medium -> low
const sortedTasks = [...tasks].sort((a, b) => {
const priorityOrder = { high: 0, medium: 1, low: 2 };
return priorityOrder[a.priority] - priorityOrder[b.priority];
});
sortedTasks.forEach(task => {
const priorityClass = `priority-${task.priority}`;
const priorityIcons = {
high: 'alert-triangle',
medium: 'alert-circle',
low: 'info'
};
const taskElement = document.createElement('div');
taskElement.className = `task-item p-6 flex items-center justify-between fade-in ${task.completed ? 'completed' : ''} ${priorityClass}`;
taskElement.innerHTML = `
<div class="flex items-center gap-4 flex-1">
<button onclick="toggleTask(${task.id})" class="w-6 h-6 rounded-full border-2 ${task.completed ? 'bg-teal-500 border-teal-500 text-white' : 'border-gray-300'} flex items-center justify-center transition-all duration-300 hover:scale-110">
${task.completed ? '<i data-feather="check" class="w-4 h-4"></i>' : ''}
</button>
<div class="flex-1">
<span class="${task.completed ? 'text-gray-500' : 'text-gray-800'} text-lg font-medium">${task.text}</span>
<div class="flex items-center gap-2 mt-1">
<i data-feather="${priorityIcons[task.priority]}" class="w-4 h-4 ${task.priority === 'high' ? 'text-red-500' : task.priority === 'medium' ? 'text-yellow-500' : 'text-green-500'}"></i>
<span class="text-sm ${task.priority === 'high' ? 'text-red-600' : task.priority === 'medium' ? 'text-yellow-600' : 'text-green-600'} capitalize">${task.priority} priority</span>
</div>
</div>
</div>
<button onclick="deleteTask(${task.id})" class="text-red-400 hover:text-red-600 transition-all duration-300 hover:scale-110 ml-4">
<i data-feather="trash-2" class="w-5 h-5"></i>
</button>
`;
taskList.appendChild(taskElement);
});
feather.replace();
}
// Render History
function renderHistory() {
historyList.innerHTML = '';
if (history.length === 0) {
historyList.innerHTML = `
<div class="text-center py-12 text-gray-400">
<i data-feather="clock" class="w-16 h-16 mx-auto mb-4 opacity-50"></i>
<p class="text-lg">No completed tasks yet.</p>
<p class="text-sm mt-1">Complete some tasks to see them here</p>
</div>
`;
feather.replace();
return;
}
history.slice().reverse().forEach(item => {
const historyElement = document.createElement('div');
historyElement.className = 'flex items-center justify-between p-4 bg-gradient-to-r from-gray-50 to-blue-50 rounded-xl fade-in';
historyElement.innerHTML = `
<div class="flex items-center gap-4">
<div class="w-8 h-8 rounded-full bg-teal-500 flex items-center justify-center text-white shadow-md">
<i data-feather="check" class="w-4 h-4"></i>
</div>
<div>
<span class="text-gray-700 font-medium">${item.text}</span>
<div class="text-xs text-gray-500 mt-1">
Completed in ${item.completionTime || '<1'} hours
</div>
</div>
</div>
<span class="text-sm text-gray-500">${new Date(item.completedAt).toLocaleDateString()}</span>
`;
historyList.appendChild(historyElement);
});
feather.replace();
}
// Render Analytics
function renderAnalytics() {
const total = tasks.length + history.length;
const completed = history.length;
const completionRate = total > 0 ? Math.round((completed / total) * 100) : 0;
// Calculate average completion time
const totalCompletionTime = history.reduce((sum, item) => sum + (item.completionTime || 0), 0);
const avgCompletionTime = completed > 0 ? Math.round(totalCompletionTime / completed) : 0;
// Priority distribution
const priorityCounts = { high: 0, medium: 0, low: 0 };
tasks.concat(history).forEach(task => {
priorityCounts[task.priority]++;
});
// Update analytics elements
document.getElementById('analytics-total').textContent = total;
document.getElementById('analytics-completed').textContent = completionRate + '%';
document.getElementById('analytics-avg-time').textContent = avgCompletionTime + 'h';
document.getElementById('high-priority').textContent = priorityCounts.high;
document.getElementById('medium-priority').textContent = priorityCounts.medium;
document.getElementById('low-priority').textContent = priorityCounts.low;
}
// Initial render
renderTasks();
updateStats();
feather.replace();
</script>
</body>
</html>
|