mirror of
https://github.com/R0m1k3/noteflow.git
synced 2026-10-19 05:09:54 +02:00
Feat: Ajout de l'icône de priorité pour les tâches
Implémente un système de marquage de priorité pour les tâches avec une icône étoile cliquable. Fonctionnalités ajoutées : - Champ priority (BOOLEAN) ajouté aux tables global_todos et note_todos - Migration automatique avec script add-priority-field.js - Route API PATCH /api/todos/:id/priority pour basculer la priorité - Icône étoile (Star) dans l'interface frontend - Tri automatique : tâches prioritaires en premier - Index PostgreSQL pour optimiser les performances Comportement de l'icône : - Toujours visible et jaune quand la tâche est prioritaire - Visible au survol (hover) quand la tâche n'est pas prioritaire - Un clic bascule l'état prioritaire/non prioritaire - Affichage discret (opacity 50%) pour les tâches complétées Scripts npm ajoutés : - npm run db:migrate:priority - Exécuter la migration Routes API mises à jour : - GET /api/todos - Inclut le champ priority, tri par priorité - POST /api/todos - Accepte le champ priority - PUT /api/todos/:id - Accepte le champ priority - PATCH /api/todos/:id/priority - Bascule la priorité (nouveau) UI améliorée : - Icône étoile jaune pour les tâches prioritaires - Animation au survol pour les interactions - Tooltip explicatif au survol - Onglets "Actives" et "Complétées" mis à jour
This commit is contained in:
6 files changed
+160
-8
No files matched your search
@@ -4,7 +4,7 @@ export interface Todo {
|
||||
id?: number;
|
||||
text: string;
|
||||
completed: boolean;
|
||||
priority?: 'low' | 'medium' | 'high';
|
||||
priority?: boolean;
|
||||
due_date?: string;
|
||||
created_at?: string;
|
||||
}
|
||||
@@ -32,9 +32,9 @@ class TodosService {
|
||||
}
|
||||
}
|
||||
|
||||
async createTodo(text: string, priority?: 'low' | 'medium' | 'high'): Promise<Todo> {
|
||||
async createTodo(text: string, priority?: boolean): Promise<Todo> {
|
||||
try {
|
||||
const response = await axios.post(this.baseURL, { text, priority, completed: false }, this.getAuthHeader());
|
||||
const response = await axios.post(this.baseURL, { text, priority: priority || false, completed: false }, this.getAuthHeader());
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Error creating todo:', error);
|
||||
@@ -71,6 +71,16 @@ class TodosService {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async togglePriority(todoId: number): Promise<boolean> {
|
||||
try {
|
||||
await axios.patch(`${this.baseURL}/${todoId}/priority`, {}, this.getAuthHeader());
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Error toggling priority:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new TodosService();
|
||||
Reference in new issue
Block a user