- Updated TODO.md to reflect the new project structure and phases, marking several tasks as completed. - Enhanced Kanban components with a tech-inspired design, including new styles for columns and task cards. - Removed the obsolete reminders service and task processor, streamlining the codebase for better maintainability. - Introduced a modern API for task management, including CRUD operations and improved error handling. - Updated global styles for a cohesive dark theme and added custom scrollbar styles.
75 lines
1.6 KiB
TypeScript
75 lines
1.6 KiB
TypeScript
'use client';
|
|
|
|
import { Task, TaskStatus } from '@/lib/types';
|
|
import { KanbanColumn } from './Column';
|
|
import { useMemo } from 'react';
|
|
|
|
interface KanbanBoardProps {
|
|
tasks: Task[];
|
|
}
|
|
|
|
export function KanbanBoard({ tasks }: KanbanBoardProps) {
|
|
// Organiser les tâches par statut
|
|
const tasksByStatus = useMemo(() => {
|
|
const grouped = tasks.reduce((acc, task) => {
|
|
if (!acc[task.status]) {
|
|
acc[task.status] = [];
|
|
}
|
|
acc[task.status].push(task);
|
|
return acc;
|
|
}, {} as Record<TaskStatus, Task[]>);
|
|
|
|
return grouped;
|
|
}, [tasks]);
|
|
|
|
// Configuration des colonnes
|
|
const columns: Array<{
|
|
id: TaskStatus;
|
|
title: string;
|
|
color: string;
|
|
tasks: Task[];
|
|
}> = [
|
|
{
|
|
id: 'todo',
|
|
title: 'À faire',
|
|
color: 'gray',
|
|
tasks: tasksByStatus.todo || []
|
|
},
|
|
{
|
|
id: 'in_progress',
|
|
title: 'En cours',
|
|
color: 'blue',
|
|
tasks: tasksByStatus.in_progress || []
|
|
},
|
|
{
|
|
id: 'done',
|
|
title: 'Terminé',
|
|
color: 'green',
|
|
tasks: tasksByStatus.done || []
|
|
},
|
|
{
|
|
id: 'cancelled',
|
|
title: 'Annulé',
|
|
color: 'red',
|
|
tasks: tasksByStatus.cancelled || []
|
|
}
|
|
];
|
|
|
|
return (
|
|
<div className="h-full flex flex-col bg-slate-950">
|
|
{/* Board tech dark */}
|
|
<div className="flex-1 flex gap-6 overflow-x-auto p-6">
|
|
{columns.map((column) => (
|
|
<KanbanColumn
|
|
key={column.id}
|
|
id={column.id}
|
|
title={column.title}
|
|
color={column.color}
|
|
tasks={column.tasks}
|
|
/>
|
|
))}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|