feat: complete tag management and UI integration

- Marked multiple tasks as completed in TODO.md related to tag management features.
- Replaced manual tag input with `TagInput` component in `CreateTaskForm`, `EditTaskForm`, and `QuickAddTask` for better UX.
- Updated `TaskCard` to display tags using `TagDisplay` with color support.
- Enhanced `TasksService` to manage task-tag relationships with CRUD operations.
- Integrated tag management into the global context for better accessibility across components.
This commit is contained in:
Julien Froidefond
2025-09-14 16:44:22 +02:00
parent edbd82e8ac
commit c5a7d16425
27 changed files with 2055 additions and 224 deletions

View File

@@ -2,7 +2,8 @@
import { createContext, useContext, ReactNode } from 'react';
import { useTasks } from '@/hooks/useTasks';
import { Task } from '@/lib/types';
import { useTags } from '@/hooks/useTags';
import { Task, Tag } from '@/lib/types';
import { CreateTaskData, UpdateTaskData, TaskFilters } from '@/clients/tasks-client';
interface TasksContextType {
@@ -23,6 +24,10 @@ interface TasksContextType {
deleteTask: (taskId: string) => Promise<void>;
refreshTasks: () => Promise<void>;
setFilters: (filters: TaskFilters) => void;
// Tags
tags: Tag[];
tagsLoading: boolean;
tagsError: string | null;
}
const TasksContext = createContext<TasksContextType | null>(null);
@@ -39,8 +44,17 @@ export function TasksProvider({ children, initialTasks, initialStats }: TasksPro
{ tasks: initialTasks, stats: initialStats }
);
const { tags, loading: tagsLoading, error: tagsError } = useTags();
const contextValue: TasksContextType = {
...tasksState,
tags,
tagsLoading,
tagsError
};
return (
<TasksContext.Provider value={tasksState}>
<TasksContext.Provider value={contextValue}>
{children}
</TasksContext.Provider>
);