From 76d404d1f457d39e782377335ae3ae50138fc887 Mon Sep 17 00:00:00 2001 From: jainiksha Date: Mon, 8 Jun 2026 14:29:34 +0530 Subject: [PATCH] feat: add repository health score dashboard card --- src/components/Dashboard.tsx | 73 +++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 2 deletions(-) diff --git a/src/components/Dashboard.tsx b/src/components/Dashboard.tsx index e28358f0..b77b1c17 100644 --- a/src/components/Dashboard.tsx +++ b/src/components/Dashboard.tsx @@ -11,8 +11,16 @@ import { Tooltip, Legend, ResponsiveContainer -} from 'recharts'; -import { Paper, Typography, Box, Grid, Theme } from '@mui/material'; +}from 'recharts'; + +import { + Paper, + Typography, + Box, + Grid, + Theme, + LinearProgress +} from '@mui/material'; interface GitHubItem { id: number; @@ -63,6 +71,21 @@ const Dashboard: React.FC = ({ totalIssues, totalPrs, data, them .slice(0, 5); const hasData = totalIssues > 0 || totalPrs > 0; + const totalContributions = totalIssues + totalPrs; + +const healthScore = Math.min( + 100, + Math.round((totalContributions / 50) * 100) +); + +const healthStatus = + healthScore >= 80 + ? "Excellent" + : healthScore >= 60 + ? "Good" + : healthScore >= 40 + ? "Moderate" + : "Poor"; if (!hasData) { return ( @@ -76,6 +99,52 @@ const Dashboard: React.FC = ({ totalIssues, totalPrs, data, them return ( + + + Repository Health Score + + + + {healthScore}/100 + + + = 80 + ? "success.main" + : healthScore >= 60 + ? "info.main" + : healthScore >= 40 + ? "warning.main" + : "error.main" + } +> + Status: {healthStatus} + + + + + {/* Pie Chart: Issues vs PRs */}