From 0ffcec7ffcb17a00a842607f45738118d03cea6b Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Thu, 9 Oct 2025 13:50:10 +0200 Subject: [PATCH] refactor: update CustomTooltip types in chart components for better type safety - Enhanced type definitions for the payload in CustomTooltip across multiple chart components to improve TypeScript support and maintainability. --- .../dashboard/charts/CompletionRateChart.tsx | 11 ++++++++-- .../dashboard/charts/DailyStatusChart.tsx | 16 ++++++++++++-- .../charts/PriorityBreakdownChart.tsx | 11 ++++++++-- .../charts/StatusDistributionChart.tsx | 21 +++++++++++++++---- .../dashboard/charts/VelocityTrendChart.tsx | 10 +++++++-- 5 files changed, 57 insertions(+), 12 deletions(-) diff --git a/src/components/dashboard/charts/CompletionRateChart.tsx b/src/components/dashboard/charts/CompletionRateChart.tsx index 2e97cb9..f4d09b8 100644 --- a/src/components/dashboard/charts/CompletionRateChart.tsx +++ b/src/components/dashboard/charts/CompletionRateChart.tsx @@ -30,14 +30,21 @@ export function CompletionRateChart({ total: day.totalTasks, })); - // eslint-disable-next-line @typescript-eslint/no-explicit-any const CustomTooltip = ({ active, payload, label, }: { active?: boolean; - payload?: any[]; + payload?: Array<{ + payload: { + day: string; + date: string; + completionRate: number; + completed: number; + total: number; + }; + }>; label?: string; }) => { if (active && payload && payload.length) { diff --git a/src/components/dashboard/charts/DailyStatusChart.tsx b/src/components/dashboard/charts/DailyStatusChart.tsx index f8bc0e8..8aa261d 100644 --- a/src/components/dashboard/charts/DailyStatusChart.tsx +++ b/src/components/dashboard/charts/DailyStatusChart.tsx @@ -30,14 +30,26 @@ export function DailyStatusChart({ data, className }: DailyStatusChartProps) { Nouvelles: day.newTasks, })); - // eslint-disable-next-line @typescript-eslint/no-explicit-any const CustomTooltip = ({ active, payload, label, }: { active?: boolean; - payload?: any[]; + payload?: Array<{ + dataKey: string; + value: number; + color: string; + payload: { + day: string; + date: string; + Complétées: number; + 'En cours': number; + Bloquées: number; + 'En attente': number; + Nouvelles: number; + }; + }>; label?: string; }) => { if (active && payload && payload.length) { diff --git a/src/components/dashboard/charts/PriorityBreakdownChart.tsx b/src/components/dashboard/charts/PriorityBreakdownChart.tsx index ad5c0f2..ebc3f1f 100644 --- a/src/components/dashboard/charts/PriorityBreakdownChart.tsx +++ b/src/components/dashboard/charts/PriorityBreakdownChart.tsx @@ -47,14 +47,21 @@ export function PriorityBreakdownChart({ total: item.total, })); - // eslint-disable-next-line @typescript-eslint/no-explicit-any const CustomTooltip = ({ active, payload, label, }: { active?: boolean; - payload?: any[]; + payload?: Array<{ + payload: { + priority: string; + Terminées: number; + 'En cours': number; + completionRate: number; + total: number; + }; + }>; label?: string; }) => { if (active && payload && payload.length) { diff --git a/src/components/dashboard/charts/StatusDistributionChart.tsx b/src/components/dashboard/charts/StatusDistributionChart.tsx index d74f4d2..98a687f 100644 --- a/src/components/dashboard/charts/StatusDistributionChart.tsx +++ b/src/components/dashboard/charts/StatusDistributionChart.tsx @@ -43,13 +43,20 @@ export function StatusDistributionChart({ value: item.count, })); - // eslint-disable-next-line @typescript-eslint/no-explicit-any const CustomTooltip = ({ active, payload, }: { active?: boolean; - payload?: any[]; + payload?: Array<{ + payload: { + name: string; + count: number; + percentage: number; + status: string; + value: number; + }; + }>; }) => { if (active && payload && payload.length) { const data = payload[0].payload; @@ -65,8 +72,14 @@ export function StatusDistributionChart({ return null; }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const CustomLabel = (props: any) => { + const CustomLabel = (props: { + cx: number; + cy: number; + midAngle: number; + innerRadius: number; + outerRadius: number; + percent: number; + }) => { const { cx, cy, midAngle, innerRadius, outerRadius, percent } = props; if (percent < 0.05) return null; // Ne pas afficher les labels pour les petites sections diff --git a/src/components/dashboard/charts/VelocityTrendChart.tsx b/src/components/dashboard/charts/VelocityTrendChart.tsx index 9741a50..992145d 100644 --- a/src/components/dashboard/charts/VelocityTrendChart.tsx +++ b/src/components/dashboard/charts/VelocityTrendChart.tsx @@ -21,14 +21,20 @@ export function VelocityTrendChart({ data, className, }: VelocityTrendChartProps) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any const CustomTooltip = ({ active, payload, label, }: { active?: boolean; - payload?: any[]; + payload?: Array<{ + payload: { + date: string; + completed: number; + created: number; + velocity: number; + }; + }>; label?: string; }) => { if (active && payload && payload.length) {