feat: enhance Kanban functionality and update TODO.md
- Completed the creation and validation forms for tasks in the Kanban board, improving task management capabilities. - Integrated new task creation and deletion functionalities in the `KanbanBoard` and `KanbanColumn` components. - Added quick task addition feature in `Column` component for better user experience. - Updated `TaskCard` to support task deletion with a new button. - Marked several tasks as completed in `TODO.md` to reflect the progress on Kanban features. - Updated TypeScript types to include 'manual' as a new task source.
This commit is contained in:
57
components/ui/HeaderContainer.tsx
Normal file
57
components/ui/HeaderContainer.tsx
Normal file
@@ -0,0 +1,57 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Header } from './Header';
|
||||
import { tasksClient } from '@/clients/tasks-client';
|
||||
|
||||
interface HeaderContainerProps {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
initialStats: {
|
||||
total: number;
|
||||
completed: number;
|
||||
inProgress: number;
|
||||
todo: number;
|
||||
completionRate: number;
|
||||
};
|
||||
}
|
||||
|
||||
export function HeaderContainer({ title, subtitle, initialStats }: HeaderContainerProps) {
|
||||
const [stats, setStats] = useState(initialStats);
|
||||
const [isHydrated, setIsHydrated] = useState(false);
|
||||
|
||||
// Hydratation côté client
|
||||
useEffect(() => {
|
||||
setIsHydrated(true);
|
||||
}, []);
|
||||
|
||||
// Rafraîchir les stats périodiquement côté client
|
||||
useEffect(() => {
|
||||
if (!isHydrated) return;
|
||||
|
||||
const refreshStats = async () => {
|
||||
try {
|
||||
const response = await tasksClient.getTasks({ limit: 1 }); // Juste pour les stats
|
||||
setStats(response.stats);
|
||||
} catch (error) {
|
||||
console.error('Erreur lors du rafraîchissement des stats:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// Rafraîchir les stats toutes les 30 secondes
|
||||
const interval = setInterval(refreshStats, 30000);
|
||||
|
||||
// Rafraîchir immédiatement après hydratation
|
||||
refreshStats();
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, [isHydrated]);
|
||||
|
||||
return (
|
||||
<Header
|
||||
title={title}
|
||||
subtitle={subtitle}
|
||||
stats={stats}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user