Spaces:
Running
Running
creer moi une application - Initial Deployment
Browse files- README.md +7 -5
- index.html +466 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 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: deepseek-v2
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: pink
|
| 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,466 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="fr">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>TaskMaster - Gestionnaire de Tâches</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 |
+
/* Animation personnalisée */
|
| 11 |
+
@keyframes fadeIn {
|
| 12 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 13 |
+
to { opacity: 1; transform: translateY(0); }
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
.fade-in {
|
| 17 |
+
animation: fadeIn 0.3s ease-out forwards;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
/* Style personnalisé pour les cases à cocher */
|
| 21 |
+
.custom-checkbox {
|
| 22 |
+
appearance: none;
|
| 23 |
+
-webkit-appearance: none;
|
| 24 |
+
width: 20px;
|
| 25 |
+
height: 20px;
|
| 26 |
+
border: 2px solid #4f46e5;
|
| 27 |
+
border-radius: 4px;
|
| 28 |
+
outline: none;
|
| 29 |
+
cursor: pointer;
|
| 30 |
+
position: relative;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.custom-checkbox:checked {
|
| 34 |
+
background-color: #4f46e5;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.custom-checkbox:checked::after {
|
| 38 |
+
content: '\f00c';
|
| 39 |
+
font-family: 'Font Awesome 6 Free';
|
| 40 |
+
font-weight: 900;
|
| 41 |
+
color: white;
|
| 42 |
+
position: absolute;
|
| 43 |
+
left: 2px;
|
| 44 |
+
top: -1px;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/* Effet de survol pour les tâches */
|
| 48 |
+
.task-item:hover {
|
| 49 |
+
transform: translateX(5px);
|
| 50 |
+
transition: transform 0.2s ease;
|
| 51 |
+
}
|
| 52 |
+
</style>
|
| 53 |
+
</head>
|
| 54 |
+
<body class="bg-gradient-to-br from-indigo-50 to-purple-50 min-h-screen">
|
| 55 |
+
<div class="container mx-auto px-4 py-8 max-w-4xl">
|
| 56 |
+
<!-- En-tête -->
|
| 57 |
+
<header class="flex justify-between items-center mb-8">
|
| 58 |
+
<div>
|
| 59 |
+
<h1 class="text-3xl font-bold text-indigo-800">TaskMaster</h1>
|
| 60 |
+
<p class="text-indigo-600">Votre assistant de productivité</p>
|
| 61 |
+
</div>
|
| 62 |
+
<div class="flex items-center space-x-4">
|
| 63 |
+
<button id="theme-toggle" class="p-2 rounded-full bg-indigo-100 text-indigo-700 hover:bg-indigo-200 transition">
|
| 64 |
+
<i class="fas fa-moon"></i>
|
| 65 |
+
</button>
|
| 66 |
+
<div class="relative">
|
| 67 |
+
<button id="user-menu" class="w-10 h-10 rounded-full bg-indigo-600 text-white flex items-center justify-center">
|
| 68 |
+
<i class="fas fa-user"></i>
|
| 69 |
+
</button>
|
| 70 |
+
<div id="dropdown-menu" class="hidden absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 z-10">
|
| 71 |
+
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-indigo-50">Profil</a>
|
| 72 |
+
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-indigo-50">Paramètres</a>
|
| 73 |
+
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-indigo-50">Déconnexion</a>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
</header>
|
| 78 |
+
|
| 79 |
+
<!-- Statistiques -->
|
| 80 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-8">
|
| 81 |
+
<div class="bg-white p-4 rounded-lg shadow-sm border-l-4 border-indigo-500">
|
| 82 |
+
<h3 class="text-gray-500 text-sm font-medium">Tâches totales</h3>
|
| 83 |
+
<p id="total-tasks" class="text-2xl font-bold text-indigo-800">0</p>
|
| 84 |
+
</div>
|
| 85 |
+
<div class="bg-white p-4 rounded-lg shadow-sm border-l-4 border-green-500">
|
| 86 |
+
<h3 class="text-gray-500 text-sm font-medium">Terminées</h3>
|
| 87 |
+
<p id="completed-tasks" class="text-2xl font-bold text-green-600">0</p>
|
| 88 |
+
</div>
|
| 89 |
+
<div class="bg-white p-4 rounded-lg shadow-sm border-l-4 border-yellow-500">
|
| 90 |
+
<h3 class="text-gray-500 text-sm font-medium">En retard</h3>
|
| 91 |
+
<p id="overdue-tasks" class="text-2xl font-bold text-yellow-600">0</p>
|
| 92 |
+
</div>
|
| 93 |
+
</div>
|
| 94 |
+
|
| 95 |
+
<!-- Formulaire d'ajout de tâche -->
|
| 96 |
+
<div class="bg-white rounded-xl shadow-md p-6 mb-8">
|
| 97 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Ajouter une nouvelle tâche</h2>
|
| 98 |
+
<form id="task-form" class="space-y-4">
|
| 99 |
+
<div>
|
| 100 |
+
<label for="task-title" class="block text-sm font-medium text-gray-700 mb-1">Titre de la tâche</label>
|
| 101 |
+
<input type="text" id="task-title" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
| 102 |
+
</div>
|
| 103 |
+
<div>
|
| 104 |
+
<label for="task-description" class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
| 105 |
+
<textarea id="task-description" rows="2" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea>
|
| 106 |
+
</div>
|
| 107 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 108 |
+
<div>
|
| 109 |
+
<label for="task-date" class="block text-sm font-medium text-gray-700 mb-1">Date d'échéance</label>
|
| 110 |
+
<input type="date" id="task-date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
| 111 |
+
</div>
|
| 112 |
+
<div>
|
| 113 |
+
<label for="task-priority" class="block text-sm font-medium text-gray-700 mb-1">Priorité</label>
|
| 114 |
+
<select id="task-priority" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
| 115 |
+
<option value="low">Faible</option>
|
| 116 |
+
<option value="medium" selected>Moyenne</option>
|
| 117 |
+
<option value="high">Élevée</option>
|
| 118 |
+
</select>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
<button type="submit" class="w-full bg-indigo-600 text-white py-2 px-4 rounded-lg hover:bg-indigo-700 transition flex items-center justify-center space-x-2">
|
| 122 |
+
<i class="fas fa-plus"></i>
|
| 123 |
+
<span>Ajouter la tâche</span>
|
| 124 |
+
</button>
|
| 125 |
+
</form>
|
| 126 |
+
</div>
|
| 127 |
+
|
| 128 |
+
<!-- Filtres et recherche -->
|
| 129 |
+
<div class="flex flex-col md:flex-row justify-between items-start md:items-center mb-6 gap-4">
|
| 130 |
+
<div class="flex space-x-2">
|
| 131 |
+
<button id="filter-all" class="px-4 py-1 bg-indigo-600 text-white rounded-full text-sm">Toutes</button>
|
| 132 |
+
<button id="filter-active" class="px-4 py-1 bg-white border border-gray-300 rounded-full text-sm hover:bg-gray-50">Actives</button>
|
| 133 |
+
<button id="filter-completed" class="px-4 py-1 bg-white border border-gray-300 rounded-full text-sm hover:bg-gray-50">Terminées</button>
|
| 134 |
+
</div>
|
| 135 |
+
<div class="relative w-full md:w-auto">
|
| 136 |
+
<input type="text" id="task-search" placeholder="Rechercher des tâches..." class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
| 137 |
+
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
|
| 138 |
+
</div>
|
| 139 |
+
</div>
|
| 140 |
+
|
| 141 |
+
<!-- Liste des tâches -->
|
| 142 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden">
|
| 143 |
+
<div id="task-list" class="divide-y divide-gray-200">
|
| 144 |
+
<!-- Les tâches seront ajoutées ici dynamiquement -->
|
| 145 |
+
<div class="p-4 text-center text-gray-500">
|
| 146 |
+
Aucune tâche pour le moment. Ajoutez votre première tâche !
|
| 147 |
+
</div>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
|
| 151 |
+
<!-- Modal de confirmation -->
|
| 152 |
+
<div id="confirm-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
|
| 153 |
+
<div class="bg-white rounded-lg p-6 max-w-md w-full fade-in">
|
| 154 |
+
<h3 class="text-lg font-medium text-gray-900 mb-4">Confirmer la suppression</h3>
|
| 155 |
+
<p class="text-gray-600 mb-6">Êtes-vous sûr de vouloir supprimer cette tâche ? Cette action est irréversible.</p>
|
| 156 |
+
<div class="flex justify-end space-x-3">
|
| 157 |
+
<button id="cancel-delete" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50">Annuler</button>
|
| 158 |
+
<button id="confirm-delete" class="px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700">Supprimer</button>
|
| 159 |
+
</div>
|
| 160 |
+
</div>
|
| 161 |
+
</div>
|
| 162 |
+
</div>
|
| 163 |
+
|
| 164 |
+
<script>
|
| 165 |
+
// Variables globales
|
| 166 |
+
let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
|
| 167 |
+
let currentFilter = 'all';
|
| 168 |
+
let taskToDelete = null;
|
| 169 |
+
let darkMode = false;
|
| 170 |
+
|
| 171 |
+
// DOM Elements
|
| 172 |
+
const taskForm = document.getElementById('task-form');
|
| 173 |
+
const taskList = document.getElementById('task-list');
|
| 174 |
+
const totalTasksEl = document.getElementById('total-tasks');
|
| 175 |
+
const completedTasksEl = document.getElementById('completed-tasks');
|
| 176 |
+
const overdueTasksEl = document.getElementById('overdue-tasks');
|
| 177 |
+
const filterAllBtn = document.getElementById('filter-all');
|
| 178 |
+
const filterActiveBtn = document.getElementById('filter-active');
|
| 179 |
+
const filterCompletedBtn = document.getElementById('filter-completed');
|
| 180 |
+
const taskSearch = document.getElementById('task-search');
|
| 181 |
+
const confirmModal = document.getElementById('confirm-modal');
|
| 182 |
+
const cancelDeleteBtn = document.getElementById('cancel-delete');
|
| 183 |
+
const confirmDeleteBtn = document.getElementById('confirm-delete');
|
| 184 |
+
const themeToggleBtn = document.getElementById('theme-toggle');
|
| 185 |
+
const userMenuBtn = document.getElementById('user-menu');
|
| 186 |
+
const dropdownMenu = document.getElementById('dropdown-menu');
|
| 187 |
+
|
| 188 |
+
// Événements
|
| 189 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 190 |
+
renderTasks();
|
| 191 |
+
updateStats();
|
| 192 |
+
|
| 193 |
+
// Vérifier le thème dans le localStorage
|
| 194 |
+
if (localStorage.getItem('darkMode') === 'true') {
|
| 195 |
+
toggleDarkMode();
|
| 196 |
+
}
|
| 197 |
+
});
|
| 198 |
+
|
| 199 |
+
taskForm.addEventListener('submit', addTask);
|
| 200 |
+
filterAllBtn.addEventListener('click', () => setFilter('all'));
|
| 201 |
+
filterActiveBtn.addEventListener('click', () => setFilter('active'));
|
| 202 |
+
filterCompletedBtn.addEventListener('click', () => setFilter('completed'));
|
| 203 |
+
taskSearch.addEventListener('input', searchTasks);
|
| 204 |
+
cancelDeleteBtn.addEventListener('click', hideModal);
|
| 205 |
+
confirmDeleteBtn.addEventListener('click', deleteTask);
|
| 206 |
+
themeToggleBtn.addEventListener('click', toggleDarkMode);
|
| 207 |
+
userMenuBtn.addEventListener('click', toggleDropdown);
|
| 208 |
+
|
| 209 |
+
// Fermer le dropdown quand on clique ailleurs
|
| 210 |
+
document.addEventListener('click', (e) => {
|
| 211 |
+
if (!userMenuBtn.contains(e.target) && !dropdownMenu.contains(e.target)) {
|
| 212 |
+
dropdownMenu.classList.add('hidden');
|
| 213 |
+
}
|
| 214 |
+
});
|
| 215 |
+
|
| 216 |
+
// Fonctions
|
| 217 |
+
function addTask(e) {
|
| 218 |
+
e.preventDefault();
|
| 219 |
+
|
| 220 |
+
const title = document.getElementById('task-title').value;
|
| 221 |
+
const description = document.getElementById('task-description').value;
|
| 222 |
+
const date = document.getElementById('task-date').value;
|
| 223 |
+
const priority = document.getElementById('task-priority').value;
|
| 224 |
+
|
| 225 |
+
const newTask = {
|
| 226 |
+
id: Date.now(),
|
| 227 |
+
title,
|
| 228 |
+
description,
|
| 229 |
+
date,
|
| 230 |
+
priority,
|
| 231 |
+
completed: false,
|
| 232 |
+
createdAt: new Date().toISOString()
|
| 233 |
+
};
|
| 234 |
+
|
| 235 |
+
tasks.unshift(newTask);
|
| 236 |
+
saveTasks();
|
| 237 |
+
renderTasks();
|
| 238 |
+
updateStats();
|
| 239 |
+
|
| 240 |
+
// Réinitialiser le formulaire
|
| 241 |
+
taskForm.reset();
|
| 242 |
+
|
| 243 |
+
// Animation de la nouvelle tâche
|
| 244 |
+
const firstTask = taskList.firstElementChild;
|
| 245 |
+
if (firstTask) {
|
| 246 |
+
firstTask.classList.add('fade-in');
|
| 247 |
+
}
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
function renderTasks(filteredTasks = null) {
|
| 251 |
+
const tasksToRender = filteredTasks || filterTasks();
|
| 252 |
+
|
| 253 |
+
if (tasksToRender.length === 0) {
|
| 254 |
+
taskList.innerHTML = `
|
| 255 |
+
<div class="p-4 text-center text-gray-500">
|
| 256 |
+
${currentFilter === 'all'
|
| 257 |
+
? 'Aucune tâche pour le moment. Ajoutez votre première tâche !'
|
| 258 |
+
: currentFilter === 'active'
|
| 259 |
+
? 'Aucune tâche active.'
|
| 260 |
+
: 'Aucune tâche terminée.'}
|
| 261 |
+
</div>
|
| 262 |
+
`;
|
| 263 |
+
return;
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
taskList.innerHTML = '';
|
| 267 |
+
|
| 268 |
+
tasksToRender.forEach(task => {
|
| 269 |
+
const isOverdue = !task.completed && task.date && new Date(task.date) < new Date();
|
| 270 |
+
const priorityColors = {
|
| 271 |
+
low: 'bg-blue-100 text-blue-800',
|
| 272 |
+
medium: 'bg-yellow-100 text-yellow-800',
|
| 273 |
+
high: 'bg-red-100 text-red-800'
|
| 274 |
+
};
|
| 275 |
+
|
| 276 |
+
const taskElement = document.createElement('div');
|
| 277 |
+
taskElement.className = `p-4 task-item ${task.completed ? 'bg-gray-50' : 'bg-white'} ${isOverdue ? 'border-l-4 border-red-500' : ''}`;
|
| 278 |
+
taskElement.dataset.id = task.id;
|
| 279 |
+
taskElement.innerHTML = `
|
| 280 |
+
<div class="flex items-start space-x-3">
|
| 281 |
+
<div class="flex-shrink-0 pt-1">
|
| 282 |
+
<input type="checkbox" ${task.completed ? 'checked' : ''}
|
| 283 |
+
class="custom-checkbox toggle-complete"
|
| 284 |
+
data-id="${task.id}">
|
| 285 |
+
</div>
|
| 286 |
+
<div class="flex-1 min-w-0">
|
| 287 |
+
<div class="flex justify-between items-start">
|
| 288 |
+
<h3 class="${task.completed ? 'line-through text-gray-500' : 'text-gray-900'} font-medium">
|
| 289 |
+
${task.title}
|
| 290 |
+
</h3>
|
| 291 |
+
<div class="flex space-x-2">
|
| 292 |
+
<span class="text-xs px-2 py-1 rounded-full ${priorityColors[task.priority]}">
|
| 293 |
+
${task.priority === 'low' ? 'Faible' : task.priority === 'medium' ? 'Moyenne' : 'Élevée'}
|
| 294 |
+
</span>
|
| 295 |
+
<button class="text-gray-400 hover:text-red-500 delete-task" data-id="${task.id}">
|
| 296 |
+
<i class="fas fa-trash"></i>
|
| 297 |
+
</button>
|
| 298 |
+
</div>
|
| 299 |
+
</div>
|
| 300 |
+
${task.description ? `<p class="mt-1 text-sm ${task.completed ? 'text-gray-400' : 'text-gray-600'}">${task.description}</p>` : ''}
|
| 301 |
+
<div class="mt-2 flex flex-wrap items-center text-xs text-gray-500 space-x-3">
|
| 302 |
+
<div>
|
| 303 |
+
<i class="far fa-calendar-alt mr-1"></i>
|
| 304 |
+
${task.date ? new Date(task.date).toLocaleDateString('fr-FR') : 'Pas de date'}
|
| 305 |
+
</div>
|
| 306 |
+
<div>
|
| 307 |
+
<i class="far fa-clock mr-1"></i>
|
| 308 |
+
${new Date(task.createdAt).toLocaleDateString('fr-FR')}
|
| 309 |
+
</div>
|
| 310 |
+
${isOverdue ? '<span class="text-red-500"><i class="fas fa-exclamation-circle mr-1"></i> En retard</span>' : ''}
|
| 311 |
+
</div>
|
| 312 |
+
</div>
|
| 313 |
+
</div>
|
| 314 |
+
`;
|
| 315 |
+
|
| 316 |
+
taskList.appendChild(taskElement);
|
| 317 |
+
});
|
| 318 |
+
|
| 319 |
+
// Ajouter les événements aux nouveaux éléments
|
| 320 |
+
document.querySelectorAll('.toggle-complete').forEach(checkbox => {
|
| 321 |
+
checkbox.addEventListener('change', toggleTaskComplete);
|
| 322 |
+
});
|
| 323 |
+
|
| 324 |
+
document.querySelectorAll('.delete-task').forEach(button => {
|
| 325 |
+
button.addEventListener('click', showDeleteConfirmation);
|
| 326 |
+
});
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
function toggleTaskComplete(e) {
|
| 330 |
+
const taskId = parseInt(e.target.dataset.id);
|
| 331 |
+
const task = tasks.find(t => t.id === taskId);
|
| 332 |
+
|
| 333 |
+
if (task) {
|
| 334 |
+
task.completed = e.target.checked;
|
| 335 |
+
saveTasks();
|
| 336 |
+
renderTasks();
|
| 337 |
+
updateStats();
|
| 338 |
+
}
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
function showDeleteConfirmation(e) {
|
| 342 |
+
e.stopPropagation();
|
| 343 |
+
taskToDelete = parseInt(e.target.closest('button').dataset.id);
|
| 344 |
+
confirmModal.classList.remove('hidden');
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
function hideModal() {
|
| 348 |
+
confirmModal.classList.add('hidden');
|
| 349 |
+
taskToDelete = null;
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
function deleteTask() {
|
| 353 |
+
tasks = tasks.filter(task => task.id !== taskToDelete);
|
| 354 |
+
saveTasks();
|
| 355 |
+
renderTasks();
|
| 356 |
+
updateStats();
|
| 357 |
+
hideModal();
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
function setFilter(filter) {
|
| 361 |
+
currentFilter = filter;
|
| 362 |
+
|
| 363 |
+
// Mettre à jour les boutons actifs
|
| 364 |
+
filterAllBtn.className = 'px-4 py-1 rounded-full text-sm';
|
| 365 |
+
filterActiveBtn.className = 'px-4 py-1 rounded-full text-sm';
|
| 366 |
+
filterCompletedBtn.className = 'px-4 py-1 rounded-full text-sm';
|
| 367 |
+
|
| 368 |
+
if (filter === 'all') {
|
| 369 |
+
filterAllBtn.className += ' bg-indigo-600 text-white';
|
| 370 |
+
filterActiveBtn.className += ' bg-white border border-gray-300 hover:bg-gray-50';
|
| 371 |
+
filterCompletedBtn.className += ' bg-white border border-gray-300 hover:bg-gray-50';
|
| 372 |
+
} else if (filter === 'active') {
|
| 373 |
+
filterActiveBtn.className += ' bg-indigo-600 text-white';
|
| 374 |
+
filterAllBtn.className += ' bg-white border border-gray-300 hover:bg-gray-50';
|
| 375 |
+
filterCompletedBtn.className += ' bg-white border border-gray-300 hover:bg-gray-50';
|
| 376 |
+
} else {
|
| 377 |
+
filterCompletedBtn.className += ' bg-indigo-600 text-white';
|
| 378 |
+
filterAllBtn.className += ' bg-white border border-gray-300 hover:bg-gray-50';
|
| 379 |
+
filterActiveBtn.className += ' bg-white border border-gray-300 hover:bg-gray-50';
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
renderTasks();
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
function filterTasks() {
|
| 386 |
+
let filtered = [...tasks];
|
| 387 |
+
|
| 388 |
+
if (currentFilter === 'active') {
|
| 389 |
+
filtered = filtered.filter(task => !task.completed);
|
| 390 |
+
} else if (currentFilter === 'completed') {
|
| 391 |
+
filtered = filtered.filter(task => task.completed);
|
| 392 |
+
}
|
| 393 |
+
|
| 394 |
+
return filtered;
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
function searchTasks() {
|
| 398 |
+
const searchTerm = taskSearch.value.toLowerCase();
|
| 399 |
+
|
| 400 |
+
if (!searchTerm) {
|
| 401 |
+
renderTasks();
|
| 402 |
+
return;
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
const filtered = filterTasks().filter(task =>
|
| 406 |
+
task.title.toLowerCase().includes(searchTerm) ||
|
| 407 |
+
(task.description && task.description.toLowerCase().includes(searchTerm))
|
| 408 |
+
);
|
| 409 |
+
|
| 410 |
+
renderTasks(filtered);
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
function updateStats() {
|
| 414 |
+
totalTasksEl.textContent = tasks.length;
|
| 415 |
+
|
| 416 |
+
const completed = tasks.filter(task => task.completed).length;
|
| 417 |
+
completedTasksEl.textContent = completed;
|
| 418 |
+
|
| 419 |
+
const overdue = tasks.filter(task =>
|
| 420 |
+
!task.completed &&
|
| 421 |
+
task.date &&
|
| 422 |
+
new Date(task.date) < new Date()
|
| 423 |
+
).length;
|
| 424 |
+
overdueTasksEl.textContent = overdue;
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
+
function saveTasks() {
|
| 428 |
+
localStorage.setItem('tasks', JSON.stringify(tasks));
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
function toggleDarkMode() {
|
| 432 |
+
darkMode = !darkMode;
|
| 433 |
+
|
| 434 |
+
if (darkMode) {
|
| 435 |
+
document.documentElement.classList.add('dark');
|
| 436 |
+
themeToggleBtn.innerHTML = '<i class="fas fa-sun"></i>';
|
| 437 |
+
localStorage.setItem('darkMode', 'true');
|
| 438 |
+
} else {
|
| 439 |
+
document.documentElement.classList.remove('dark');
|
| 440 |
+
themeToggleBtn.innerHTML = '<i class="fas fa-moon"></i>';
|
| 441 |
+
localStorage.setItem('darkMode', 'false');
|
| 442 |
+
}
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
function toggleDropdown() {
|
| 446 |
+
dropdownMenu.classList.toggle('hidden');
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
// Ajouter des classes dark mode à Tailwind
|
| 450 |
+
tailwind.config = {
|
| 451 |
+
darkMode: 'class',
|
| 452 |
+
theme: {
|
| 453 |
+
extend: {
|
| 454 |
+
colors: {
|
| 455 |
+
dark: {
|
| 456 |
+
100: '#1E293B',
|
| 457 |
+
200: '#0F172A',
|
| 458 |
+
300: '#0F172A',
|
| 459 |
+
}
|
| 460 |
+
}
|
| 461 |
+
}
|
| 462 |
+
}
|
| 463 |
+
}
|
| 464 |
+
</script>
|
| 465 |
+
<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=RODRIGUE55/deepseek-v2" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 466 |
+
</html>
|