added skeleton
This commit is contained in:
parent
88053d1286
commit
94fbeef5d1
@ -3,7 +3,7 @@ import Chart from "react-apexcharts";
|
|||||||
import { useGetCollectionOverview } from "../../hooks/useDashboard_Data";
|
import { useGetCollectionOverview } from "../../hooks/useDashboard_Data";
|
||||||
import { formatFigure } from "../../utils/appUtils";
|
import { formatFigure } from "../../utils/appUtils";
|
||||||
|
|
||||||
const CollectionOverview = ({ data }) => {
|
const CollectionOverview = ({ data, isLoading }) => {
|
||||||
const borderColor = "#ddd";
|
const borderColor = "#ddd";
|
||||||
const labelColor = "#6c757d";
|
const labelColor = "#6c757d";
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ const CollectionOverview = ({ data }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default CollectionOverview;
|
export default CollectionOverview;
|
||||||
export const TopicBarChart = ({ data }) => {
|
export const TopicBarChart = ({ data,isLoading }) => {
|
||||||
const data1 = {
|
const data1 = {
|
||||||
totalDueAmount: 213590,
|
totalDueAmount: 213590,
|
||||||
totalCollectedAmount: 5000,
|
totalCollectedAmount: 5000,
|
||||||
|
|||||||
40
src/components/Dashboard/CollectionOverviewSkeleton.jsx
Normal file
40
src/components/Dashboard/CollectionOverviewSkeleton.jsx
Normal 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>
|
||||||
|
|
||||||
|
);
|
||||||
|
};
|
||||||
@ -26,6 +26,7 @@ import {
|
|||||||
TEAM_ATTENDANCE,
|
TEAM_ATTENDANCE,
|
||||||
} from "../../utils/constants";
|
} from "../../utils/constants";
|
||||||
import CollectionOverview, { TopicBarChart } from "./CollectionOverview";
|
import CollectionOverview, { TopicBarChart } from "./CollectionOverview";
|
||||||
|
import { CollectionOverviewSkeleton } from "./CollectionOverviewSkeleton";
|
||||||
|
|
||||||
const Dashboard = () => {
|
const Dashboard = () => {
|
||||||
// Get the selected project ID from Redux store
|
// Get the selected project ID from Redux store
|
||||||
@ -35,7 +36,7 @@ const Dashboard = () => {
|
|||||||
const canTeamAttendance = useHasUserPermission(TEAM_ATTENDANCE);
|
const canTeamAttendance = useHasUserPermission(TEAM_ATTENDANCE);
|
||||||
const canSelfAttendance = useHasUserPermission(SELF_ATTENDANCE);
|
const canSelfAttendance = useHasUserPermission(SELF_ATTENDANCE);
|
||||||
|
|
||||||
const { data } = useGetCollectionOverview();
|
const { data,isLoading,isError } = useGetCollectionOverview();
|
||||||
console.log("data-->", data);
|
console.log("data-->", data);
|
||||||
return (
|
return (
|
||||||
<div className="container-fluid mt-5">
|
<div className="container-fluid mt-5">
|
||||||
@ -98,14 +99,18 @@ const Dashboard = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className=" col-md-8">
|
<div className="col-md-8">
|
||||||
{data && <div className="card"><TopicBarChart data={data} /></div>}
|
{isLoading ? (
|
||||||
|
<CollectionOverviewSkeleton />
|
||||||
|
) : (
|
||||||
|
data && (
|
||||||
|
<div className="card">
|
||||||
|
<TopicBarChart data={data} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import React, { useMemo } from "react";
|
import React, { useMemo } from "react";
|
||||||
import Timeline from "../../common/Timeline";
|
|
||||||
import { getColorNameFromHex } from "../../../utils/appUtils";
|
import { getColorNameFromHex } from "../../../utils/appUtils";
|
||||||
|
import Timeline from "../../common/TimeLine";
|
||||||
|
|
||||||
const JobStatusLog = ({ data }) => {
|
const JobStatusLog = ({ data }) => {
|
||||||
// Prepare timeline items
|
// Prepare timeline items
|
||||||
@ -31,7 +32,7 @@ const JobStatusLog = ({ data }) => {
|
|||||||
return (
|
return (
|
||||||
<div className="card shadow-none p-0">
|
<div className="card shadow-none p-0">
|
||||||
<div className="card-body p-3">
|
<div className="card-body p-3">
|
||||||
<Timeline items={timelineData} transparent={true} />
|
<Timeline items={timelineData} transparent={true} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user