From 7cd7867db7e7f5c4c5f62cad882f2ff5db8e14ec Mon Sep 17 00:00:00 2001
From: Kevin Portable <Kevin@LAPTOP-J2LCOLEH>
Date: Fri, 7 Mar 2025 14:52:10 +0100
Subject: [PATCH] =?UTF-8?q?Synchronisation=20des=20t=C3=A2ches=20existante?=
 =?UTF-8?q?s=20et=20du=20module=20de=20statistique=20de=20stat=20global?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/components/dashboard/TaskStats.jsx | 12 +++++++++---
 src/pages/Home.jsx                     |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/components/dashboard/TaskStats.jsx b/src/components/dashboard/TaskStats.jsx
index 65ac6ac..92a8331 100644
--- a/src/components/dashboard/TaskStats.jsx
+++ b/src/components/dashboard/TaskStats.jsx
@@ -1,12 +1,18 @@
-import React from "react";
+import React, { useContext } from "react";
 import TaskCard from "@components/dashboard/TaskCard";
+import { TasksContext } from "@services/Context";
+
+const TaskStats = () => {
+  const { tasks } = useContext(TasksContext);
+
+  const completed = tasks.filter(task => task.isCompleted).length;
+  const incompleted = tasks.filter(task => !task.isCompleted).length;
+  const total = tasks.length;
 
-const TaskStats = ({ completed, incompleted, canceled, total }) => {
   return (
     <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
       <TaskCard title="Completed Tasks" count={completed} />
       <TaskCard title="Incompleted Tasks" count={incompleted} />
-      <TaskCard title="Overdue Tasks" count={canceled} />
       <TaskCard title="Total Tasks" count={total} />
     </div>
   );
diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx
index 2304b57..a879a32 100644
--- a/src/pages/Home.jsx
+++ b/src/pages/Home.jsx
@@ -8,7 +8,7 @@ const Home = () => {
   return (
       <div>
           <div className="p-6 bg-gray">
-              <TaskStats completed={100} incompleted={18} canceled={4} total={118} />
+              <TaskStats />
           </div>
           <div className="min-h-screen bg-gray-100 p-8">
               <div className="grid grid-cols-2 gap-6">
-- 
GitLab