feat: integrate tags into HomePage and TasksContext

- Added `initialTags` prop to `HomePageClient` for passing tag data.
- Updated `TasksProvider` to accept and utilize `initialTags`, enhancing tag management.
- Modified `useTags` hook to initialize state with provided tags and conditionally refresh tags based on initial data.
- Updated server-side data fetching in `HomePage` to include tags from the `tagsService`.
This commit is contained in:
Julien Froidefond
2025-09-14 22:45:52 +02:00
parent da64221407
commit 95af83b0bc
4 changed files with 25 additions and 13 deletions

View File

@@ -3,7 +3,7 @@
import { KanbanBoardContainer } from '@/components/kanban/BoardContainer';
import { Header } from '@/components/ui/Header';
import { TasksProvider, useTasksContext } from '@/contexts/TasksContext';
import { Task } from '@/lib/types';
import { Task, Tag } from '@/lib/types';
interface HomePageClientProps {
initialTasks: Task[];
@@ -14,6 +14,7 @@ interface HomePageClientProps {
todo: number;
completionRate: number;
};
initialTags: (Tag & { usage: number })[];
}
function HomePageContent() {
@@ -35,9 +36,13 @@ function HomePageContent() {
);
}
export function HomePageClient({ initialTasks, initialStats }: HomePageClientProps) {
export function HomePageClient({ initialTasks, initialStats, initialTags }: HomePageClientProps) {
return (
<TasksProvider initialTasks={initialTasks} initialStats={initialStats}>
<TasksProvider
initialTasks={initialTasks}
initialStats={initialStats}
initialTags={initialTags}
>
<HomePageContent />
</TasksProvider>
);