feat: remove TaskStats from HomePageClient and Header components
- Eliminated `initialStats` prop from `HomePageClient` and `KanbanPageClient` to streamline data handling. - Updated `Header` and `HeaderContainer` components to remove references to `stats`, enhancing clarity and reducing unnecessary complexity. - Adjusted `useTasks` hook to make `stats` optional, ensuring compatibility with the updated components.
This commit is contained in:
@@ -5,7 +5,7 @@ import { KanbanBoardContainer } from '@/components/kanban/BoardContainer';
|
||||
import { Header } from '@/components/ui/Header';
|
||||
import { TasksProvider, useTasksContext } from '@/contexts/TasksContext';
|
||||
import { UserPreferencesProvider, useUserPreferences } from '@/contexts/UserPreferencesContext';
|
||||
import { Task, Tag, TaskStats, UserPreferences } from '@/lib/types';
|
||||
import { Task, Tag, UserPreferences } from '@/lib/types';
|
||||
import { CreateTaskData } from '@/clients/tasks-client';
|
||||
import { CreateTaskForm } from '@/components/forms/CreateTaskForm';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
@@ -14,13 +14,12 @@ import { FontSizeToggle } from '@/components/ui/FontSizeToggle';
|
||||
|
||||
interface KanbanPageClientProps {
|
||||
initialTasks: Task[];
|
||||
initialStats: TaskStats;
|
||||
initialTags: (Tag & { usage: number })[];
|
||||
initialPreferences: UserPreferences;
|
||||
}
|
||||
|
||||
function KanbanPageContent() {
|
||||
const { stats, syncing, createTask, activeFiltersCount, kanbanFilters, setKanbanFilters } = useTasksContext();
|
||||
const { syncing, createTask, activeFiltersCount, kanbanFilters, setKanbanFilters } = useTasksContext();
|
||||
const { preferences, updateViewPreferences } = useUserPreferences();
|
||||
const [isCreateModalOpen, setIsCreateModalOpen] = useState(false);
|
||||
|
||||
@@ -58,7 +57,6 @@ function KanbanPageContent() {
|
||||
<Header
|
||||
title="Kanban Board"
|
||||
subtitle="Gestionnaire de tâches"
|
||||
stats={stats}
|
||||
syncing={syncing}
|
||||
/>
|
||||
|
||||
@@ -181,12 +179,11 @@ function KanbanPageContent() {
|
||||
);
|
||||
}
|
||||
|
||||
export function KanbanPageClient({ initialTasks, initialStats, initialTags, initialPreferences }: KanbanPageClientProps) {
|
||||
export function KanbanPageClient({ initialTasks, initialTags, initialPreferences }: KanbanPageClientProps) {
|
||||
return (
|
||||
<UserPreferencesProvider initialPreferences={initialPreferences}>
|
||||
<TasksProvider
|
||||
initialTasks={initialTasks}
|
||||
initialStats={initialStats}
|
||||
initialTasks={initialTasks}
|
||||
initialTags={initialTags}
|
||||
>
|
||||
<KanbanPageContent />
|
||||
|
||||
@@ -8,9 +8,8 @@ export const dynamic = 'force-dynamic';
|
||||
|
||||
export default async function KanbanPage() {
|
||||
// SSR - Récupération des données côté serveur
|
||||
const [initialTasks, initialStats, initialTags, initialPreferences] = await Promise.all([
|
||||
const [initialTasks, initialTags, initialPreferences] = await Promise.all([
|
||||
tasksService.getTasks(),
|
||||
tasksService.getTaskStats(),
|
||||
tagsService.getTags(),
|
||||
userPreferencesService.getAllPreferences()
|
||||
]);
|
||||
@@ -18,7 +17,6 @@ export default async function KanbanPage() {
|
||||
return (
|
||||
<KanbanPageClient
|
||||
initialTasks={initialTasks}
|
||||
initialStats={initialStats}
|
||||
initialTags={initialTags}
|
||||
initialPreferences={initialPreferences}
|
||||
/>
|
||||
|
||||
@@ -8,9 +8,8 @@ export const dynamic = 'force-dynamic';
|
||||
|
||||
export default async function HomePage() {
|
||||
// SSR - Récupération des données côté serveur
|
||||
const [initialTasks, initialStats, initialTags, initialPreferences] = await Promise.all([
|
||||
const [initialTasks, initialTags, initialPreferences] = await Promise.all([
|
||||
tasksService.getTasks(),
|
||||
tasksService.getTaskStats(),
|
||||
tagsService.getTags(),
|
||||
userPreferencesService.getAllPreferences()
|
||||
]);
|
||||
@@ -18,7 +17,6 @@ export default async function HomePage() {
|
||||
return (
|
||||
<HomePageClient
|
||||
initialTasks={initialTasks}
|
||||
initialStats={initialStats}
|
||||
initialTags={initialTags}
|
||||
initialPreferences={initialPreferences}
|
||||
/>
|
||||
|
||||
@@ -37,14 +37,13 @@ const TasksContext = createContext<TasksContextType | null>(null);
|
||||
interface TasksProviderProps {
|
||||
children: ReactNode;
|
||||
initialTasks: Task[];
|
||||
initialStats: TaskStats;
|
||||
initialTags?: (Tag & { usage: number })[];
|
||||
}
|
||||
|
||||
export function TasksProvider({ children, initialTasks, initialStats, initialTags }: TasksProviderProps) {
|
||||
export function TasksProvider({ children, initialTasks, initialTags }: TasksProviderProps) {
|
||||
const tasksState = useTasks(
|
||||
{ limit: 20 },
|
||||
{ tasks: initialTasks, stats: initialStats }
|
||||
{ tasks: initialTasks }
|
||||
);
|
||||
|
||||
const { tags, loading: tagsLoading, error: tagsError } = useTags(initialTags);
|
||||
|
||||
Reference in New Issue
Block a user