Bencolliss commited on
Commit
25764bb
·
verified ·
1 Parent(s): 8772173

https://huggingface.co/spaces/abdul12345sd/todolist1 - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +370 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Testrun2
3
- emoji: 📉
4
- colorFrom: indigo
5
- colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: testrun2
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: gray
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,370 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Modern To-Do List</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
+ /* Custom scrollbar */
11
+ .task-list::-webkit-scrollbar {
12
+ width: 6px;
13
+ }
14
+ .task-list::-webkit-scrollbar-track {
15
+ background: #f1f1f1;
16
+ border-radius: 10px;
17
+ }
18
+ .task-list::-webkit-scrollbar-thumb {
19
+ background: #cbd5e1;
20
+ border-radius: 10px;
21
+ }
22
+ .task-list::-webkit-scrollbar-thumb:hover {
23
+ background: #94a3b8;
24
+ }
25
+
26
+ /* Animation for new tasks */
27
+ @keyframes fadeIn {
28
+ from { opacity: 0; transform: translateY(10px); }
29
+ to { opacity: 1; transform: translateY(0); }
30
+ }
31
+
32
+ .task-item {
33
+ animation: fadeIn 0.3s ease-out;
34
+ }
35
+
36
+ /* Custom checkbox */
37
+ .custom-checkbox {
38
+ appearance: none;
39
+ -webkit-appearance: none;
40
+ width: 20px;
41
+ height: 20px;
42
+ border: 2px solid #cbd5e1;
43
+ border-radius: 4px;
44
+ cursor: pointer;
45
+ position: relative;
46
+ transition: all 0.2s;
47
+ }
48
+
49
+ .custom-checkbox:checked {
50
+ background-color: #4f46e5;
51
+ border-color: #4f46e5;
52
+ }
53
+
54
+ .custom-checkbox:checked::after {
55
+ content: '\2713';
56
+ position: absolute;
57
+ color: white;
58
+ font-size: 12px;
59
+ left: 50%;
60
+ top: 50%;
61
+ transform: translate(-50%, -50%);
62
+ }
63
+
64
+ /* Dark mode toggle */
65
+ .dark-mode-toggle {
66
+ transition: all 0.3s;
67
+ }
68
+
69
+ .dark-mode-toggle:hover {
70
+ transform: rotate(30deg);
71
+ }
72
+ </style>
73
+ </head>
74
+ <body class="bg-gray-50 min-h-screen transition-colors duration-300 dark:bg-gray-900">
75
+ <div class="container mx-auto px-4 py-8 max-w-3xl">
76
+ <!-- Header -->
77
+ <header class="flex justify-between items-center mb-8">
78
+ <h1 class="text-3xl font-bold text-indigo-600 dark:text-indigo-400">TaskMaster</h1>
79
+ <button id="darkModeToggle" class="dark-mode-toggle p-2 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-yellow-300">
80
+ <i class="fas fa-moon dark:hidden"></i>
81
+ <i class="fas fa-sun hidden dark:inline"></i>
82
+ </button>
83
+ </header>
84
+
85
+ <!-- Add Task Form -->
86
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 mb-6 transition-all hover:shadow-lg">
87
+ <form id="taskForm" class="flex gap-3">
88
+ <input
89
+ type="text"
90
+ id="taskInput"
91
+ placeholder="Add a new task..."
92
+ class="flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-gray-700 dark:text-white"
93
+ autocomplete="off"
94
+ required
95
+ >
96
+ <button
97
+ type="submit"
98
+ class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg transition-colors flex items-center gap-2"
99
+ >
100
+ <i class="fas fa-plus"></i> Add
101
+ </button>
102
+ </form>
103
+ </div>
104
+
105
+ <!-- Task Filters -->
106
+ <div class="flex justify-between items-center mb-4">
107
+ <div class="text-gray-600 dark:text-gray-300">
108
+ <span id="taskCount">0</span> tasks
109
+ </div>
110
+ <div class="flex gap-2">
111
+ <button
112
+ id="filterAll"
113
+ class="filter-btn px-3 py-1 rounded-lg bg-indigo-600 text-white"
114
+ >
115
+ All
116
+ </button>
117
+ <button
118
+ id="filterActive"
119
+ class="filter-btn px-3 py-1 rounded-lg bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors"
120
+ >
121
+ Active
122
+ </button>
123
+ <button
124
+ id="filterCompleted"
125
+ class="filter-btn px-3 py-1 rounded-lg bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors"
126
+ >
127
+ Completed
128
+ </button>
129
+ </div>
130
+ </div>
131
+
132
+ <!-- Task List -->
133
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md overflow-hidden">
134
+ <ul id="taskList" class="task-list max-h-96 overflow-y-auto">
135
+ <!-- Tasks will be added here dynamically -->
136
+ <li class="text-center py-8 text-gray-500 dark:text-gray-400">
137
+ <i class="fas fa-tasks text-4xl mb-2"></i>
138
+ <p>No tasks yet. Add one above!</p>
139
+ </li>
140
+ </ul>
141
+
142
+ <!-- Task Actions -->
143
+ <div class="p-4 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center">
144
+ <button
145
+ id="clearCompleted"
146
+ class="text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 transition-colors"
147
+ >
148
+ Clear completed
149
+ </button>
150
+ <div class="text-sm text-gray-500 dark:text-gray-400">
151
+ <span id="completedCount">0</span> completed
152
+ </div>
153
+ </div>
154
+ </div>
155
+
156
+ <!-- Empty State Template (hidden by default) -->
157
+ <template id="emptyStateTemplate">
158
+ <li class="text-center py-8 text-gray-500 dark:text-gray-400">
159
+ <i class="fas fa-tasks text-4xl mb-2"></i>
160
+ <p>No tasks yet. Add one above!</p>
161
+ </li>
162
+ </template>
163
+
164
+ <!-- Task Item Template (hidden by default) -->
165
+ <template id="taskItemTemplate">
166
+ <li class="task-item border-b border-gray-200 dark:border-gray-700 last:border-0">
167
+ <div class="flex items-center px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">
168
+ <input type="checkbox" class="custom-checkbox mr-3">
169
+ <span class="flex-1 text-gray-800 dark:text-gray-200 task-text"></span>
170
+ <button class="text-gray-400 hover:text-red-500 transition-colors delete-btn p-2 rounded-full">
171
+ <i class="fas fa-trash"></i>
172
+ </button>
173
+ </div>
174
+ </li>
175
+ </template>
176
+ </div>
177
+
178
+ <script>
179
+ document.addEventListener('DOMContentLoaded', function() {
180
+ // DOM Elements
181
+ const taskForm = document.getElementById('taskForm');
182
+ const taskInput = document.getElementById('taskInput');
183
+ const taskList = document.getElementById('taskList');
184
+ const taskCount = document.getElementById('taskCount');
185
+ const completedCount = document.getElementById('completedCount');
186
+ const clearCompletedBtn = document.getElementById('clearCompleted');
187
+ const filterAllBtn = document.getElementById('filterAll');
188
+ const filterActiveBtn = document.getElementById('filterActive');
189
+ const filterCompletedBtn = document.getElementById('filterCompleted');
190
+ const darkModeToggle = document.getElementById('darkModeToggle');
191
+ const emptyStateTemplate = document.getElementById('emptyStateTemplate');
192
+ const taskItemTemplate = document.getElementById('taskItemTemplate');
193
+
194
+ // State
195
+ let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
196
+ let currentFilter = 'all';
197
+
198
+ // Initialize
199
+ renderTasks();
200
+ updateCounters();
201
+
202
+ // Event Listeners
203
+ taskForm.addEventListener('submit', addTask);
204
+ clearCompletedBtn.addEventListener('click', clearCompletedTasks);
205
+ filterAllBtn.addEventListener('click', () => setFilter('all'));
206
+ filterActiveBtn.addEventListener('click', () => setFilter('active'));
207
+ filterCompletedBtn.addEventListener('click', () => setFilter('completed'));
208
+ darkModeToggle.addEventListener('click', toggleDarkMode);
209
+
210
+ // Check for saved dark mode preference
211
+ if (localStorage.getItem('darkMode') === 'enabled') {
212
+ document.documentElement.classList.add('dark');
213
+ }
214
+
215
+ // Functions
216
+ function addTask(e) {
217
+ e.preventDefault();
218
+
219
+ const taskText = taskInput.value.trim();
220
+ if (!taskText) return;
221
+
222
+ const newTask = {
223
+ id: Date.now(),
224
+ text: taskText,
225
+ completed: false
226
+ };
227
+
228
+ tasks.unshift(newTask);
229
+ saveTasks();
230
+ renderTasks();
231
+ updateCounters();
232
+
233
+ taskInput.value = '';
234
+ taskInput.focus();
235
+ }
236
+
237
+ function renderTasks() {
238
+ // Clear the task list
239
+ taskList.innerHTML = '';
240
+
241
+ // Filter tasks based on current filter
242
+ let filteredTasks = [];
243
+
244
+ switch (currentFilter) {
245
+ case 'active':
246
+ filteredTasks = tasks.filter(task => !task.completed);
247
+ break;
248
+ case 'completed':
249
+ filteredTasks = tasks.filter(task => task.completed);
250
+ break;
251
+ default:
252
+ filteredTasks = [...tasks];
253
+ }
254
+
255
+ // Show empty state if no tasks
256
+ if (filteredTasks.length === 0) {
257
+ const emptyState = emptyStateTemplate.content.cloneNode(true);
258
+ taskList.appendChild(emptyState);
259
+ return;
260
+ }
261
+
262
+ // Render each task
263
+ filteredTasks.forEach(task => {
264
+ const taskItem = taskItemTemplate.content.cloneNode(true);
265
+ const checkbox = taskItem.querySelector('input[type="checkbox"]');
266
+ const taskText = taskItem.querySelector('.task-text');
267
+ const deleteBtn = taskItem.querySelector('.delete-btn');
268
+
269
+ checkbox.checked = task.completed;
270
+ taskText.textContent = task.text;
271
+
272
+ if (task.completed) {
273
+ taskText.classList.add('line-through', 'text-gray-400', 'dark:text-gray-500');
274
+ }
275
+
276
+ // Add event listeners to the new elements
277
+ checkbox.addEventListener('change', () => toggleTaskCompletion(task.id));
278
+ deleteBtn.addEventListener('click', () => deleteTask(task.id));
279
+
280
+ taskList.appendChild(taskItem);
281
+ });
282
+ }
283
+
284
+ function toggleTaskCompletion(taskId) {
285
+ tasks = tasks.map(task => {
286
+ if (task.id === taskId) {
287
+ return { ...task, completed: !task.completed };
288
+ }
289
+ return task;
290
+ });
291
+
292
+ saveTasks();
293
+ renderTasks();
294
+ updateCounters();
295
+ }
296
+
297
+ function deleteTask(taskId) {
298
+ tasks = tasks.filter(task => task.id !== taskId);
299
+ saveTasks();
300
+ renderTasks();
301
+ updateCounters();
302
+ }
303
+
304
+ function clearCompletedTasks() {
305
+ tasks = tasks.filter(task => !task.completed);
306
+ saveTasks();
307
+ renderTasks();
308
+ updateCounters();
309
+ }
310
+
311
+ function setFilter(filter) {
312
+ currentFilter = filter;
313
+
314
+ // Update active filter button styles
315
+ [filterAllBtn, filterActiveBtn, filterCompletedBtn].forEach(btn => {
316
+ btn.classList.remove('bg-indigo-600', 'text-white');
317
+ btn.classList.add('bg-gray-200', 'dark:bg-gray-700', 'text-gray-700', 'dark:text-gray-300');
318
+ });
319
+
320
+ switch (filter) {
321
+ case 'all':
322
+ filterAllBtn.classList.add('bg-indigo-600', 'text-white');
323
+ filterAllBtn.classList.remove('bg-gray-200', 'dark:bg-gray-700', 'text-gray-700', 'dark:text-gray-300');
324
+ break;
325
+ case 'active':
326
+ filterActiveBtn.classList.add('bg-indigo-600', 'text-white');
327
+ filterActiveBtn.classList.remove('bg-gray-200', 'dark:bg-gray-700', 'text-gray-700', 'dark:text-gray-300');
328
+ break;
329
+ case 'completed':
330
+ filterCompletedBtn.classList.add('bg-indigo-600', 'text-white');
331
+ filterCompletedBtn.classList.remove('bg-gray-200', 'dark:bg-gray-700', 'text-gray-700', 'dark:text-gray-300');
332
+ break;
333
+ }
334
+
335
+ renderTasks();
336
+ }
337
+
338
+ function updateCounters() {
339
+ const totalTasks = tasks.length;
340
+ const completedTasks = tasks.filter(task => task.completed).length;
341
+ const activeTasks = totalTasks - completedTasks;
342
+
343
+ taskCount.textContent = activeTasks;
344
+ completedCount.textContent = completedTasks;
345
+
346
+ // Show/hide clear completed button
347
+ if (completedTasks > 0) {
348
+ clearCompletedBtn.classList.remove('invisible');
349
+ } else {
350
+ clearCompletedBtn.classList.add('invisible');
351
+ }
352
+ }
353
+
354
+ function saveTasks() {
355
+ localStorage.setItem('tasks', JSON.stringify(tasks));
356
+ }
357
+
358
+ function toggleDarkMode() {
359
+ document.documentElement.classList.toggle('dark');
360
+
361
+ if (document.documentElement.classList.contains('dark')) {
362
+ localStorage.setItem('darkMode', 'enabled');
363
+ } else {
364
+ localStorage.setItem('darkMode', 'disabled');
365
+ }
366
+ }
367
+ });
368
+ </script>
369
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Bencolliss/testrun2" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
370
+ </html>