Spaces:
Running
Running
i want it to have a todo app section
Browse files- index.html +3 -2
- productivity.html +2 -2
- todo.html +178 -0
index.html
CHANGED
|
@@ -50,12 +50,13 @@
|
|
| 50 |
<a href="#" class="text-gray-600 hover:text-gray-900 font-medium">Features</a>
|
| 51 |
<a href="#" class="text-gray-600 hover:text-gray-900 font-medium">How It Works</a>
|
| 52 |
<a href="#" class="text-gray-600 hover:text-gray-900 font-medium">Testimonials</a>
|
|
|
|
| 53 |
</div>
|
| 54 |
-
|
| 55 |
<a href="productivity.html" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg font-medium transition">Get Started</a>
|
| 56 |
</div>
|
| 57 |
</div>
|
| 58 |
-
|
| 59 |
|
| 60 |
<!-- Hero Section -->
|
| 61 |
<section class="hero-gradient text-white py-20">
|
|
|
|
| 50 |
<a href="#" class="text-gray-600 hover:text-gray-900 font-medium">Features</a>
|
| 51 |
<a href="#" class="text-gray-600 hover:text-gray-900 font-medium">How It Works</a>
|
| 52 |
<a href="#" class="text-gray-600 hover:text-gray-900 font-medium">Testimonials</a>
|
| 53 |
+
<a href="todo.html" class="text-gray-600 hover:text-gray-900 font-medium">Todo</a>
|
| 54 |
</div>
|
| 55 |
+
<div>
|
| 56 |
<a href="productivity.html" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg font-medium transition">Get Started</a>
|
| 57 |
</div>
|
| 58 |
</div>
|
| 59 |
+
</nav>
|
| 60 |
|
| 61 |
<!-- Hero Section -->
|
| 62 |
<section class="hero-gradient text-white py-20">
|
productivity.html
CHANGED
|
@@ -30,11 +30,11 @@
|
|
| 30 |
<nav>
|
| 31 |
<ul class="flex space-x-6">
|
| 32 |
<li><a href="index.html" class="text-gray-600 hover:text-gray-900">Home</a></li>
|
|
|
|
| 33 |
</ul>
|
| 34 |
</nav>
|
| 35 |
</header>
|
| 36 |
-
|
| 37 |
-
<!-- Main Content -->
|
| 38 |
<main>
|
| 39 |
<!-- Timer Section -->
|
| 40 |
<section class="bg-white rounded-xl shadow-md p-6 mb-8">
|
|
|
|
| 30 |
<nav>
|
| 31 |
<ul class="flex space-x-6">
|
| 32 |
<li><a href="index.html" class="text-gray-600 hover:text-gray-900">Home</a></li>
|
| 33 |
+
<li><a href="todo.html" class="text-gray-600 hover:text-gray-900">Todo</a></li>
|
| 34 |
</ul>
|
| 35 |
</nav>
|
| 36 |
</header>
|
| 37 |
+
<!-- Main Content -->
|
|
|
|
| 38 |
<main>
|
| 39 |
<!-- Timer Section -->
|
| 40 |
<section class="bg-white rounded-xl shadow-md p-6 mb-8">
|
todo.html
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>Todo App - Productivity Tracker</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
+
<style>
|
| 11 |
+
.task-item {
|
| 12 |
+
transition: all 0.3s ease;
|
| 13 |
+
}
|
| 14 |
+
.task-item:hover {
|
| 15 |
+
transform: translateX(5px);
|
| 16 |
+
}
|
| 17 |
+
.completed {
|
| 18 |
+
text-decoration: line-through;
|
| 19 |
+
color: #9ca3af;
|
| 20 |
+
}
|
| 21 |
+
</style>
|
| 22 |
+
</head>
|
| 23 |
+
<body class="bg-gray-50 min-h-screen">
|
| 24 |
+
<div class="container mx-auto px-4 py-8">
|
| 25 |
+
<!-- Header -->
|
| 26 |
+
<header class="flex justify-between items-center mb-10">
|
| 27 |
+
<h1 class="text-3xl font-bold text-gray-800">Todo App</h1>
|
| 28 |
+
<nav>
|
| 29 |
+
<ul class="flex space-x-6">
|
| 30 |
+
<li><a href="index.html" class="text-gray-600 hover:text-gray-900">Home</a></li>
|
| 31 |
+
<li><a href="productivity.html" class="text-gray-600 hover:text-gray-900">Productivity</a></li>
|
| 32 |
+
</ul>
|
| 33 |
+
</nav>
|
| 34 |
+
</header>
|
| 35 |
+
|
| 36 |
+
<!-- Todo Section -->
|
| 37 |
+
<main class="max-w-2xl mx-auto">
|
| 38 |
+
<section class="bg-white rounded-xl shadow-md p-6 mb-8">
|
| 39 |
+
<h2 class="text-2xl font-semibold mb-6">My Tasks</h2>
|
| 40 |
+
|
| 41 |
+
<!-- Add Task Form -->
|
| 42 |
+
<form id="taskForm" class="mb-6 flex">
|
| 43 |
+
<input
|
| 44 |
+
type="text"
|
| 45 |
+
id="taskInput"
|
| 46 |
+
placeholder="Add a new task..."
|
| 47 |
+
class="flex-grow px-4 py-2 border border-gray-300 rounded-l-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
| 48 |
+
required
|
| 49 |
+
>
|
| 50 |
+
<button
|
| 51 |
+
type="submit"
|
| 52 |
+
class="bg-blue-500 hover:bg-blue-600 text-white px-6 py-2 rounded-r-lg font-medium transition"
|
| 53 |
+
>
|
| 54 |
+
Add
|
| 55 |
+
</button>
|
| 56 |
+
</form>
|
| 57 |
+
|
| 58 |
+
<!-- Task List -->
|
| 59 |
+
<div id="taskList" class="space-y-3">
|
| 60 |
+
<!-- Tasks will be added here dynamically -->
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
<!-- Stats -->
|
| 64 |
+
<div class="mt-6 pt-4 border-t border-gray-200 flex justify-between text-sm text-gray-500">
|
| 65 |
+
<span id="totalTasks">Total: 0 tasks</span>
|
| 66 |
+
<span id="completedTasks">Completed: 0</span>
|
| 67 |
+
</div>
|
| 68 |
+
</section>
|
| 69 |
+
</main>
|
| 70 |
+
|
| 71 |
+
<!-- Footer -->
|
| 72 |
+
<footer class="mt-12 text-center text-gray-500 text-sm">
|
| 73 |
+
<p>© 2023 Productivity Tracker. All rights reserved.</p>
|
| 74 |
+
</footer>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
<script>
|
| 78 |
+
// Initialize Feather icons
|
| 79 |
+
feather.replace();
|
| 80 |
+
|
| 81 |
+
// Todo App Functionality
|
| 82 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 83 |
+
const taskForm = document.getElementById('taskForm');
|
| 84 |
+
const taskInput = document.getElementById('taskInput');
|
| 85 |
+
const taskList = document.getElementById('taskList');
|
| 86 |
+
const totalTasksSpan = document.getElementById('totalTasks');
|
| 87 |
+
const completedTasksSpan = document.getElementById('completedTasks');
|
| 88 |
+
|
| 89 |
+
let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
|
| 90 |
+
|
| 91 |
+
// Render tasks
|
| 92 |
+
function renderTasks() {
|
| 93 |
+
taskList.innerHTML = '';
|
| 94 |
+
|
| 95 |
+
if (tasks.length === 0) {
|
| 96 |
+
taskList.innerHTML = '<p class="text-gray-500 text-center py-4">No tasks yet. Add your first task!</p>';
|
| 97 |
+
totalTasksSpan.textContent = 'Total: 0 tasks';
|
| 98 |
+
completedTasksSpan.textContent = 'Completed: 0';
|
| 99 |
+
return;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
tasks.forEach((task, index) => {
|
| 103 |
+
const taskElement = document.createElement('div');
|
| 104 |
+
taskElement.className = `task-item flex items-center justify-between p-3 rounded-lg ${task.completed ? 'bg-green-50' : 'bg-gray-50'}`;
|
| 105 |
+
taskElement.innerHTML = `
|
| 106 |
+
<div class="flex items-center">
|
| 107 |
+
<input
|
| 108 |
+
type="checkbox"
|
| 109 |
+
${task.completed ? 'checked' : ''}
|
| 110 |
+
data-index="${index}"
|
| 111 |
+
class="mr-3 h-5 w-5 text-blue-500 rounded focus:ring-blue-400"
|
| 112 |
+
>
|
| 113 |
+
<span class="${task.completed ? 'completed' : ''}">${task.text}</span>
|
| 114 |
+
</div>
|
| 115 |
+
<button
|
| 116 |
+
data-index="${index}"
|
| 117 |
+
class="delete-btn text-red-500 hover:text-red-700"
|
| 118 |
+
>
|
| 119 |
+
<i data-feather="trash-2" class="w-5 h-5"></i>
|
| 120 |
+
</button>
|
| 121 |
+
`;
|
| 122 |
+
taskList.appendChild(taskElement);
|
| 123 |
+
});
|
| 124 |
+
|
| 125 |
+
// Reinitialize Feather icons
|
| 126 |
+
feather.replace();
|
| 127 |
+
|
| 128 |
+
// Update stats
|
| 129 |
+
const total = tasks.length;
|
| 130 |
+
const completed = tasks.filter(task => task.completed).length;
|
| 131 |
+
totalTasksSpan.textContent = `Total: ${total} ${total === 1 ? 'task' : 'tasks'}`;
|
| 132 |
+
completedTasksSpan.textContent = `Completed: ${completed}`;
|
| 133 |
+
|
| 134 |
+
// Save to localStorage
|
| 135 |
+
localStorage.setItem('tasks', JSON.stringify(tasks));
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
// Add task
|
| 139 |
+
taskForm.addEventListener('submit', function(e) {
|
| 140 |
+
e.preventDefault();
|
| 141 |
+
const text = taskInput.value.trim();
|
| 142 |
+
|
| 143 |
+
if (text) {
|
| 144 |
+
tasks.push({
|
| 145 |
+
text: text,
|
| 146 |
+
completed: false,
|
| 147 |
+
createdAt: new Date()
|
| 148 |
+
});
|
| 149 |
+
|
| 150 |
+
taskInput.value = '';
|
| 151 |
+
renderTasks();
|
| 152 |
+
}
|
| 153 |
+
});
|
| 154 |
+
|
| 155 |
+
// Toggle task completion
|
| 156 |
+
taskList.addEventListener('change', function(e) {
|
| 157 |
+
if (e.target.type === 'checkbox') {
|
| 158 |
+
const index = e.target.dataset.index;
|
| 159 |
+
tasks[index].completed = e.target.checked;
|
| 160 |
+
renderTasks();
|
| 161 |
+
}
|
| 162 |
+
});
|
| 163 |
+
|
| 164 |
+
// Delete task
|
| 165 |
+
taskList.addEventListener('click', function(e) {
|
| 166 |
+
if (e.target.closest('.delete-btn')) {
|
| 167 |
+
const index = e.target.closest('.delete-btn').dataset.index;
|
| 168 |
+
tasks.splice(index, 1);
|
| 169 |
+
renderTasks();
|
| 170 |
+
}
|
| 171 |
+
});
|
| 172 |
+
|
| 173 |
+
// Initial render
|
| 174 |
+
renderTasks();
|
| 175 |
+
});
|
| 176 |
+
</script>
|
| 177 |
+
</body>
|
| 178 |
+
</html>
|