Adding Skeleton in Project Progress Chart.

This commit is contained in:
Kartik Sharma 2025-09-18 16:04:04 +05:30
parent 4fa112b43a
commit 6391fcc888
6 changed files with 55 additions and 9 deletions

View File

@ -0,0 +1,44 @@
// ProjectProgressChartSkeleton.jsx
import React from "react";
const ProjectProgressChartSkeleton = () => {
return (
<div className="card" style={{ minHeight: "400px" }}>
<div className="card-header">
<div className="d-flex flex-wrap justify-content-between align-items-start mb-2">
{/* Left: Title */}
<div className="card-title text-start">
<div className="placeholder-glow">
<span className="placeholder col-6 mb-2"></span>
<span className="placeholder col-4"></span>
</div>
</div>
</div>
{/* Row 2: Time Range Buttons */}
<div className="d-flex flex-wrap mt-2">
{Array(7)
.fill(0)
.map((_, idx) => (
<span
key={idx}
className="placeholder bg-light col-1 me-2"
style={{ height: "25px", borderRadius: "5px" }}
></span>
))}
</div>
</div>
<div className="card-body">
<div
className="placeholder-glow"
style={{ height: "250px", width: "100%" }}
>
<span className="placeholder bg-light col-12 h-100"></span>
</div>
</div>
</div>
);
};
export default ProjectProgressChartSkeleton;

View File

@ -3,6 +3,7 @@ import LineChart from "../Charts/LineChart";
import { useProjects } from "../../hooks/useProjects"; import { useProjects } from "../../hooks/useProjects";
import { useDashboard_Data } from "../../hooks/useDashboard_Data"; import { useDashboard_Data } from "../../hooks/useDashboard_Data";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import ProjectProgressChartSkeleton from "../Charts/ProjectProgressChartSkeleton";
const ProjectProgressChart = ({ const ProjectProgressChart = ({
ShowAllProject = true, ShowAllProject = true,
@ -100,11 +101,10 @@ const ProjectProgressChart = ({
{["1D", "1W", "15D", "1M", "3M", "1Y", "5Y"].map((key) => ( {["1D", "1W", "15D", "1M", "3M", "1Y", "5Y"].map((key) => (
<button <button
key={key} key={key}
className={`border-0 bg-transparent px-2 py-1 text-sm rounded ${ className={`border-0 bg-transparent px-2 py-1 text-sm rounded ${range === key
range === key
? "border-bottom border-primary text-primary" ? "border-bottom border-primary text-primary"
: "text-muted" : "text-muted"
}`} }`}
style={{ cursor: "pointer", transition: "all 0.2s ease" }} style={{ cursor: "pointer", transition: "all 0.2s ease" }}
onClick={() => setRange(key)} onClick={() => setRange(key)}
> >
@ -114,14 +114,17 @@ const ProjectProgressChart = ({
</div> </div>
</div> </div>
<div className="card-body" > {isLineChartLoading ? (
<ProjectProgressChartSkeleton />
) : (
<LineChart <LineChart
seriesData={lineChartSeries} seriesData={lineChartSeries}
categories={lineChartCategories} categories={lineChartCategories}
loading={isLineChartLoading} loading={isLineChartLoading}
lineChartCategoriesDates={lineChartCategoriesDates} lineChartCategoriesDates={lineChartCategoriesDates}
/> />
</div> )}
</div> </div>
); );
}; };

View File

@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useState } from "react";
import { useDashboardProjectsCardData } from "../../hooks/useDashboard_Data"; import { useDashboardProjectsCardData } from "../../hooks/useDashboard_Data";
import eventBus from "../../services/eventBus"; import eventBus from "../../services/eventBus";
import GlobalRepository from "../../repositories/GlobalRepository"; import GlobalRepository from "../../repositories/GlobalRepository";
import TeamsSkeleton from "./TeamsSkeleton"; import TeamsSkeleton from "../Charts/TeamsSkeleton";
const Projects = () => { const Projects = () => {
const { projectsCardData,loading } = useDashboardProjectsCardData(); const { projectsCardData,loading } = useDashboardProjectsCardData();

View File

@ -1,8 +1,7 @@
import React from "react"; import React from "react";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { useDashboardTasksCardData } from "../../hooks/useDashboard_Data"; import { useDashboardTasksCardData } from "../../hooks/useDashboard_Data";
import TeamsSkeleton from "./TeamsSkeleton"; import TeamsSkeleton from "../Charts/TeamsSkeleton";
const TasksCard = () => { const TasksCard = () => {
const projectId = useSelector((store) => store.localVariables?.projectId); const projectId = useSelector((store) => store.localVariables?.projectId);
const { tasksCardData, loading, error } = useDashboardTasksCardData(projectId); const { tasksCardData, loading, error } = useDashboardTasksCardData(projectId);

View File

@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useState } from "react";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { useDashboardTeamsCardData } from "../../hooks/useDashboard_Data"; import { useDashboardTeamsCardData } from "../../hooks/useDashboard_Data";
import eventBus from "../../services/eventBus"; import eventBus from "../../services/eventBus";
import TeamsSkeleton from "./TeamsSkeleton"; import TeamsSkeleton from "../Charts/TeamsSkeleton";
const Teams = () => { const Teams = () => {
const projectId = useSelector((store) => store.localVariables?.projectId); const projectId = useSelector((store) => store.localVariables?.projectId);