'use client'; import { TaskStats } from '@/lib/types'; import { Card } from '@/components/ui/Card'; import { getDashboardStatColors } from '@/lib/status-config'; interface DashboardStatsProps { stats: TaskStats; } export function DashboardStats({ stats }: DashboardStatsProps) { const totalTasks = stats.total; const completionRate = totalTasks > 0 ? Math.round((stats.completed / totalTasks) * 100) : 0; const inProgressRate = totalTasks > 0 ? Math.round((stats.inProgress / totalTasks) * 100) : 0; const statCards = [ { title: 'Total Tâches', value: stats.total, icon: '📋', type: 'total' as const, ...getDashboardStatColors('total') }, { title: 'À Faire', value: stats.todo, icon: '⏳', type: 'todo' as const, ...getDashboardStatColors('todo') }, { title: 'En Cours', value: stats.inProgress, icon: '🔄', type: 'inProgress' as const, ...getDashboardStatColors('inProgress') }, { title: 'Terminées', value: stats.completed, icon: '✅', type: 'completed' as const, ...getDashboardStatColors('completed') } ]; return (
{statCards.map((stat, index) => (

{stat.title}

{stat.value}

{stat.icon}
))} {/* Cartes de pourcentage */}

Taux de Completion

Terminées {completionRate}%
En Cours {inProgressRate}%
{/* Insights rapides */}

Aperçu Rapide

{stats.completed} tâches terminées sur {totalTasks}
{stats.inProgress} tâches en cours de traitement
{stats.todo} tâches en attente
{totalTasks > 0 && (
Productivité: {completionRate}% de completion
)}
); }