'use client'; import { TaskStats } from '@/lib/types'; import { Card } from '@/components/ui/Card'; 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: '📋', color: 'bg-blue-500', textColor: 'text-blue-600' }, { title: 'À Faire', value: stats.todo, icon: '⏳', color: 'bg-gray-500', textColor: 'text-gray-600' }, { title: 'En Cours', value: stats.inProgress, icon: '🔄', color: 'bg-orange-500', textColor: 'text-orange-600' }, { title: 'Terminées', value: stats.completed, icon: '✅', color: 'bg-green-500', textColor: 'text-green-600' } ]; 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
)}
); }