- 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`.
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
'use client';
|
|
|
|
import { KanbanBoardContainer } from '@/components/kanban/BoardContainer';
|
|
import { Header } from '@/components/ui/Header';
|
|
import { TasksProvider, useTasksContext } from '@/contexts/TasksContext';
|
|
import { Task, Tag } from '@/lib/types';
|
|
|
|
interface HomePageClientProps {
|
|
initialTasks: Task[];
|
|
initialStats: {
|
|
total: number;
|
|
completed: number;
|
|
inProgress: number;
|
|
todo: number;
|
|
completionRate: number;
|
|
};
|
|
initialTags: (Tag & { usage: number })[];
|
|
}
|
|
|
|
function HomePageContent() {
|
|
const { stats, syncing } = useTasksContext();
|
|
|
|
return (
|
|
<div className="min-h-screen bg-slate-950">
|
|
<Header
|
|
title="TowerControl"
|
|
subtitle="Gestionnaire de tâches moderne"
|
|
stats={stats}
|
|
syncing={syncing}
|
|
/>
|
|
|
|
<main className="h-[calc(100vh-120px)]">
|
|
<KanbanBoardContainer />
|
|
</main>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function HomePageClient({ initialTasks, initialStats, initialTags }: HomePageClientProps) {
|
|
return (
|
|
<TasksProvider
|
|
initialTasks={initialTasks}
|
|
initialStats={initialStats}
|
|
initialTags={initialTags}
|
|
>
|
|
<HomePageContent />
|
|
</TasksProvider>
|
|
);
|
|
}
|