From 2454c1379474d8206b0bd1763e887f5bf93dc050 Mon Sep 17 00:00:00 2001 From: Kevin Portable <Kevin@LAPTOP-J2LCOLEH> Date: Fri, 7 Mar 2025 14:48:43 +0100 Subject: [PATCH] =?UTF-8?q?Synchronisation=20des=20t=C3=A2ches=20existante?= =?UTF-8?q?s=20et=20du=20module=20de=20statistique=20en=20pourcentages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/dashboard/TasksStatPercent.jsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/dashboard/TasksStatPercent.jsx b/src/components/dashboard/TasksStatPercent.jsx index 92108da..b1ec843 100644 --- a/src/components/dashboard/TasksStatPercent.jsx +++ b/src/components/dashboard/TasksStatPercent.jsx @@ -1,6 +1,12 @@ -import React from 'react'; +import React, { useContext } from "react"; +import { TasksContext } from "@services/Context"; -const TasksStatPercent = ({ totalTasks, completedTasks }) => { +const TasksStatPercent = () => { + const { tasks } = useContext(TasksContext); + + const totalTasks = tasks.length; + const completedTasks = tasks.filter(task => task.isCompleted).length; + const radius = 50; const circumference = 2 * Math.PI * radius; const completedPercentage = totalTasks === 0 ? 0 : Math.round((completedTasks / totalTasks) * 100); -- GitLab