feat: improve TaskCard and TagList components, enhance task loading logic
- Updated TaskCard to conditionally render footer elements based on available data (due date, source, completion status). - Enhanced TagList to visually indicate deleting tags and improved button styles for better UX. - Modified useTasks hook to refresh tasks only if no initial data is present, optimizing loading behavior. - Updated TagsPageClient to manage local tags and handle optimistic UI updates during tag deletion.
This commit is contained in:
@@ -133,7 +133,7 @@ export const tagsService = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Supprime un tag
|
||||
* Supprime un tag et toutes ses relations
|
||||
*/
|
||||
async deleteTag(id: string): Promise<void> {
|
||||
// Vérifier que le tag existe
|
||||
@@ -142,15 +142,12 @@ export const tagsService = {
|
||||
throw new Error(`Tag avec l'ID "${id}" non trouvé`);
|
||||
}
|
||||
|
||||
// Vérifier si le tag est utilisé par des tâches via la relation TaskTag
|
||||
const taskTagCount = await prisma.taskTag.count({
|
||||
// Supprimer d'abord toutes les relations TaskTag
|
||||
await prisma.taskTag.deleteMany({
|
||||
where: { tagId: id }
|
||||
});
|
||||
|
||||
if (taskTagCount > 0) {
|
||||
throw new Error(`Impossible de supprimer le tag "${existing.name}" car il est utilisé par ${taskTagCount} tâche(s)`);
|
||||
}
|
||||
|
||||
// Puis supprimer le tag lui-même
|
||||
await prisma.tag.delete({
|
||||
where: { id }
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ export class TasksService {
|
||||
}
|
||||
}
|
||||
},
|
||||
take: filters?.limit || 100,
|
||||
take: filters?.limit, // Pas de limite par défaut - récupère toutes les tâches
|
||||
skip: filters?.offset || 0,
|
||||
orderBy: [
|
||||
{ completedAt: 'desc' },
|
||||
|
||||
Reference in New Issue
Block a user