added skeleton

This commit is contained in:
pramod.mahajan 2025-12-05 19:32:23 +05:30
parent 88053d1286
commit 94fbeef5d1
4 changed files with 57 additions and 11 deletions

View File

@ -3,7 +3,7 @@ import Chart from "react-apexcharts";
import { useGetCollectionOverview } from "../../hooks/useDashboard_Data";
import { formatFigure } from "../../utils/appUtils";
const CollectionOverview = ({ data }) => {
const CollectionOverview = ({ data, isLoading }) => {
const borderColor = "#ddd";
const labelColor = "#6c757d";
@ -104,7 +104,7 @@ const CollectionOverview = ({ data }) => {
};
export default CollectionOverview;
export const TopicBarChart = ({ data }) => {
export const TopicBarChart = ({ data,isLoading }) => {
const data1 = {
totalDueAmount: 213590,
totalCollectedAmount: 5000,

View File

@ -0,0 +1,40 @@
const SkeletonLine = ({ height = 20, width = "100%", className = "" }) => (
<div
className={`skeleton mb-2 ${className}`}
style={{ height, width }}
></div>
);
export const CollectionOverviewSkeleton = () => {
return (
<div className="card row p-1">
{/* LEFT SIDE */}
<div className="col-8">
<div className="">
{/* Header */}
<div className="d-flex align-items-center justify-content-between mb-3">
<SkeletonLine height={24} width="180px" />
</div>
{/* Due & Collected summary */}
<div className="d-flex align-items-center text-start px-6 mb-3">
<SkeletonLine height={16} width="100px" className="me-2" />
<SkeletonLine height={20} width="120px" className="me-2" />
<SkeletonLine height={16} width="120px" className="ms-2 me-2" />
<SkeletonLine height={20} width="120px" />
</div>
{/* Chart Skeleton */}
<SkeletonLine height={250} width="100%" className="mt-2" />
</div>
</div>
</div>
);
};

View File

@ -26,6 +26,7 @@ import {
TEAM_ATTENDANCE,
} from "../../utils/constants";
import CollectionOverview, { TopicBarChart } from "./CollectionOverview";
import { CollectionOverviewSkeleton } from "./CollectionOverviewSkeleton";
const Dashboard = () => {
// Get the selected project ID from Redux store
@ -35,7 +36,7 @@ const Dashboard = () => {
const canTeamAttendance = useHasUserPermission(TEAM_ATTENDANCE);
const canSelfAttendance = useHasUserPermission(SELF_ATTENDANCE);
const { data } = useGetCollectionOverview();
const { data,isLoading,isError } = useGetCollectionOverview();
console.log("data-->", data);
return (
<div className="container-fluid mt-5">
@ -98,14 +99,18 @@ const Dashboard = () => {
</div>
</div>
)}
<div className=" col-md-8">
{data && <div className="card"><TopicBarChart data={data} /></div>}
<div className="col-md-8">
{isLoading ? (
<CollectionOverviewSkeleton />
) : (
data && (
<div className="card">
<TopicBarChart data={data} />
</div>
)
)}
</div>
</div>
</div>
);
};

View File

@ -1,6 +1,7 @@
import React, { useMemo } from "react";
import Timeline from "../../common/Timeline";
import { getColorNameFromHex } from "../../../utils/appUtils";
import Timeline from "../../common/TimeLine";
const JobStatusLog = ({ data }) => {
// Prepare timeline items
@ -31,7 +32,7 @@ const JobStatusLog = ({ data }) => {
return (
<div className="card shadow-none p-0">
<div className="card-body p-3">
<Timeline items={timelineData} transparent={true} />
<Timeline items={timelineData} transparent={true} />
</div>
</div>
);