diff --git a/src/components/Charts/ProjectCompletionChartSkeleton.jsx b/src/components/Charts/ProjectCompletionChartSkeleton.jsx new file mode 100644 index 00000000..56307f17 --- /dev/null +++ b/src/components/Charts/ProjectCompletionChartSkeleton.jsx @@ -0,0 +1,32 @@ +import React from "react"; + +const ProjectCompletionChartSkeleton = () => { + return ( +
+
+
+
+ +
+

+ +

+
+
+ {/* Keep a fixed height so card doesn't shrink */} +
+
+ {Array.from({ length: 5 }).map((_, i) => ( +
+ ))} +
+
+
+ ); +}; + +export default ProjectCompletionChartSkeleton; diff --git a/src/components/Dashboard/AttendanceChart.jsx b/src/components/Dashboard/AttendanceChart.jsx index 01b62eed..03d9ef7c 100644 --- a/src/components/Dashboard/AttendanceChart.jsx +++ b/src/components/Dashboard/AttendanceChart.jsx @@ -100,7 +100,7 @@ const AttendanceOverview = () => { return (
{/* Header */}
diff --git a/src/components/Dashboard/ProjectCompletionChart.jsx b/src/components/Dashboard/ProjectCompletionChart.jsx index 8ce4b13a..d2d48973 100644 --- a/src/components/Dashboard/ProjectCompletionChart.jsx +++ b/src/components/Dashboard/ProjectCompletionChart.jsx @@ -1,11 +1,13 @@ import React from "react"; import HorizontalBarChart from "../Charts/HorizontalBarChart"; import { useProjects } from "../../hooks/useProjects"; +import ProjectCompletionChartSkeleton from "../Charts/ProjectCompletionChartSkeleton"; const ProjectCompletionChart = () => { const { projects, loading } = useProjects(); - // Bar chart logic + if (loading) return ; + const projectNames = projects?.map((p) => p.name) || []; const projectProgress = projects?.map((p) => { @@ -16,14 +18,15 @@ const ProjectCompletionChart = () => { }) || []; return ( -
+
-
Projects
+
Projects

Projects Completion Status

-
+ {/* Keep same minHeight as skeleton to avoid shrinking */} +
+
{/* Left: Title */} @@ -114,7 +114,7 @@ const ProjectProgressChart = ({
-
+