From 1c64fac499cd2b9286936c6dbda105b1bcc5178b Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Fri, 31 Oct 2025 15:06:11 +0530 Subject: [PATCH] Adding Spinners in all files. --- src/components/Activities/InfraPlanning.jsx | 12 +++-- src/components/Charts/HorizontalBarChart.jsx | 1 - src/components/Dashboard/ExpenseAnalysis.jsx | 2 +- src/components/Dashboard/ExpenseByProject.jsx | 8 ++- src/components/Employee/EmpActivities.jsx | 50 +++++++++---------- src/components/Employee/EmpAttendance.jsx | 33 ++++++------ .../Project/Infrastructure/WorkArea.jsx | 10 +++- src/components/Project/ProjectInfra.jsx | 17 ++++--- .../ProjectAssignedOrgs.jsx | 16 ++++-- .../Project/ProjectOrganizations.jsx | 2 +- src/components/Project/Team/Teams.jsx | 21 ++++---- .../gallary/ImageGalleryListView.jsx | 7 ++- src/pages/Directory/ContactsPage.jsx | 12 +++-- src/pages/Tenant/SelfTenantDetails.jsx | 4 +- src/pages/Tenant/TenantDetails.jsx | 33 ++++++------ src/pages/authentication/SwitchTenant.jsx | 5 +- .../authentication/TenantSelectionPage.jsx | 4 +- src/pages/employee/EmployeeList.jsx | 24 +++++---- src/pages/project/ProjectDetails.jsx | 13 +++-- src/pages/project/ProjectPage.jsx | 12 ++++- 20 files changed, 164 insertions(+), 122 deletions(-) diff --git a/src/components/Activities/InfraPlanning.jsx b/src/components/Activities/InfraPlanning.jsx index e7a4003a..08f03a93 100644 --- a/src/components/Activities/InfraPlanning.jsx +++ b/src/components/Activities/InfraPlanning.jsx @@ -24,8 +24,7 @@ import { useProfile } from "../../hooks/useProfile"; import { refreshData, setProjectId } from "../../slices/localVariablesSlice"; import InfraTable from "../Project/Infrastructure/InfraTable"; import { useSelectedProject } from "../../slices/apiDataManager"; -import Loader from "../common/Loader"; - +import { SpinnerLoader } from "../common/Loader"; const InfraPlanning = () => { const { profile: LoggedUser, refetch: fetchData } = useProfile(); const dispatch = useDispatch(); @@ -57,7 +56,14 @@ const InfraPlanning = () => { } if (isLoading) { - return ; + return ( +
+ +
+ ); } if (isFetched && (!projectInfra || projectInfra.length === 0)) { diff --git a/src/components/Charts/HorizontalBarChart.jsx b/src/components/Charts/HorizontalBarChart.jsx index 5aec5e12..c28778fc 100644 --- a/src/components/Charts/HorizontalBarChart.jsx +++ b/src/components/Charts/HorizontalBarChart.jsx @@ -30,7 +30,6 @@ const HorizontalBarChart = ({ > - {/* Replace this with a skeleton or spinner if you prefer */} ); } diff --git a/src/components/Dashboard/ExpenseAnalysis.jsx b/src/components/Dashboard/ExpenseAnalysis.jsx index ae7c9f37..92465d13 100644 --- a/src/components/Dashboard/ExpenseAnalysis.jsx +++ b/src/components/Dashboard/ExpenseAnalysis.jsx @@ -99,7 +99,7 @@ const ExpenseAnalysis = () => { {isLoading && (
diff --git a/src/components/Dashboard/ExpenseByProject.jsx b/src/components/Dashboard/ExpenseByProject.jsx index 96e3fb56..6dc2f49a 100644 --- a/src/components/Dashboard/ExpenseByProject.jsx +++ b/src/components/Dashboard/ExpenseByProject.jsx @@ -7,6 +7,7 @@ import { formatCurrency } from "../../utils/appUtils"; import { formatDate_DayMonth } from "../../utils/dateUtils"; import { useProjectName } from "../../hooks/useProjects"; import { useSelectedProject } from "../../slices/apiDataManager"; +import { SpinnerLoader } from "../common/Loader"; const ExpenseByProject = () => { const projectId = useSelector((store) => store.localVariables.projectId); @@ -161,14 +162,17 @@ const ExpenseByProject = () => { {/* Chart */} -
+
{isLoading ? ( -

Loading chart...

+
+ +
) : !expenseApiData || expenseApiData.length === 0 ? (
No data found
) : ( )} +
diff --git a/src/components/Employee/EmpActivities.jsx b/src/components/Employee/EmpActivities.jsx index e79b181d..8d23b68a 100644 --- a/src/components/Employee/EmpActivities.jsx +++ b/src/components/Employee/EmpActivities.jsx @@ -12,13 +12,13 @@ const EmpActivities = ({ employee }) => { const { data, -isError, -isLoading, -error, + isError, + isLoading, + error, refetch, - } = useProjectTasksByEmployee(employee?.id,dateRange.startDate,dateRange.endDate); + } = useProjectTasksByEmployee(employee?.id, dateRange.startDate, dateRange.endDate); - if(isLoading) return
Loading...
+ if (isLoading) return
Loading...
return ( <>
@@ -31,28 +31,28 @@ error, />
    - {data?.map((activity)=>( -
  • - -
    -
    -
    {activity.projectName}
    - - {useFormattedDate(activity.assignmentDate, "dd-MMM-yyyy")} - + {data?.map((activity) => ( +
  • + +
    +
    +
    {activity.projectName}
    + + {useFormattedDate(activity.assignmentDate, "dd-MMM-yyyy")} + +
    +

    Activity:{activity.activityName}

    +

    + Location: {activity.location} +

    +

    + Planned: {activity.plannedTask} + Completed : {activity.completedTask} +

    -

    Activity:{activity.activityName}

    -

    - Location: {activity.location} -

    -

    - Planned: {activity.plannedTask} - Completed : {activity.completedTask} -

    - -
  • + ))} - + {/*
  • diff --git a/src/components/Employee/EmpAttendance.jsx b/src/components/Employee/EmpAttendance.jsx index 686d820c..481cd03f 100644 --- a/src/components/Employee/EmpAttendance.jsx +++ b/src/components/Employee/EmpAttendance.jsx @@ -15,6 +15,7 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; import { localToUtc } from "../../utils/appUtils"; import { useParams } from "react-router-dom"; +import { SpinnerLoader } from "../common/Loader"; const EmpAttendance = () => { const { employeeId } = useParams(); @@ -82,21 +83,19 @@ const EmpAttendance = () => { -
    - refetch()} - /> -
    - {!loading && data.length === 0 && No employee logs} + {!loading && data.length === 0 && ( +
    No employee logs
    + )} + {isError &&
    {error.message}
    } - {loading && !data &&
    Loading...
    } + {loading && ( +
    + +
    + )} + {data && data.length > 0 && ( @@ -179,9 +178,8 @@ const EmpAttendance = () => { {[...Array(totalPages)].map((_, index) => (
  • ))}
  • @@ -290,8 +287,8 @@ const Teams = () => { )} diff --git a/src/components/gallary/ImageGalleryListView.jsx b/src/components/gallary/ImageGalleryListView.jsx index 6973f6f0..af5cfbc2 100644 --- a/src/components/gallary/ImageGalleryListView.jsx +++ b/src/components/gallary/ImageGalleryListView.jsx @@ -7,8 +7,7 @@ import { useSelectedProject } from "../../slices/apiDataManager"; import { ITEMS_PER_PAGE } from "../../utils/constants"; import Pagination from "../common/Pagination"; import { formatUTCToLocalTime } from "../../utils/dateUtils"; -import Loader from "../common/Loader"; - +import { SpinnerLoader } from "../common/Loader"; const ImageGalleryListView = ({filter}) => { const [hoveredImage, setHoveredImage] = useState(null); const selectedProject = useSelectedProject(); @@ -44,10 +43,10 @@ const ImageGalleryListView = ({filter}) => { } - if (isLoading) { + if (isLoading) { return (
    - +
    ); } diff --git a/src/pages/Directory/ContactsPage.jsx b/src/pages/Directory/ContactsPage.jsx index 195ebb96..15fc9535 100644 --- a/src/pages/Directory/ContactsPage.jsx +++ b/src/pages/Directory/ContactsPage.jsx @@ -11,8 +11,7 @@ import { defaultContactFilter } from "../../components/Directory/DirectorySchema import { useDebounce } from "../../utils/appUtils"; import Pagination from "../../components/common/Pagination"; import ListViewContact from "../../components/Directory/ListViewContact"; -import Loader from "../../components/common/Loader"; - +import { SpinnerLoader } from "../../components/common/Loader"; // Utility for CSV export const formatExportData = (contacts) => { return contacts.map((contact) => ({ @@ -113,7 +112,14 @@ const ContactsPage = ({ projectId, searchText, onExport }) => { {/* Grid / List View */} {gridView ? ( <> - {isLoading && } + {isLoading && ( +
    + +
    + )} {data?.data?.length === 0 && (
    diff --git a/src/pages/Tenant/SelfTenantDetails.jsx b/src/pages/Tenant/SelfTenantDetails.jsx index ea4b107d..2e3fbb38 100644 --- a/src/pages/Tenant/SelfTenantDetails.jsx +++ b/src/pages/Tenant/SelfTenantDetails.jsx @@ -3,7 +3,7 @@ import { useProfile } from "../../hooks/useProfile"; import TenantDetails from "./TenantDetails"; import { VIEW_TENANTS } from "../../utils/constants"; import { useNavigate } from "react-router-dom"; -import Loader from "../../components/common/Loader"; +import { SpinnerLoader } from "../../components/common/Loader"; import { useHasUserPermission } from "../../hooks/useHasUserPermission"; const SelfTenantDetails = () => { @@ -19,7 +19,7 @@ const SelfTenantDetails = () => { }, [isSelfTenantView, navigate]); if (loading || !tenantId) { - return ; + return ; } return ( diff --git a/src/pages/Tenant/TenantDetails.jsx b/src/pages/Tenant/TenantDetails.jsx index d799522e..8d744293 100644 --- a/src/pages/Tenant/TenantDetails.jsx +++ b/src/pages/Tenant/TenantDetails.jsx @@ -7,7 +7,7 @@ import { ComingSoonPage } from "../Misc/ComingSoonPage"; import GlobalModel from "../../components/common/GlobalModel"; import EditProfile from "../../components/Tenant/EditProfile"; import SubScriptionHistory from "../../components/Tenant/SubScriptionHistory"; -import Loader from "../../components/common/Loader"; +import { SpinnerLoader } from "../../components/common/Loader"; import { useHasUserPermission } from "../../hooks/useHasUserPermission"; import { MANAGE_TENANTS, SUPPER_TENANT } from "../../utils/constants"; @@ -71,8 +71,11 @@ const TenantDetails = ({ if (!activeTenantId) return
    No tenant selected.
    ; if (isLoading) return ( -
    - +
    +
    ); if (isError) @@ -110,14 +113,14 @@ const TenantDetails = ({ data={ iTSelf ? [ - { label: "Home", link: "/dashboard" }, - { label: "Tenant Details", link: null }, - ] + { label: "Home", link: "/dashboard" }, + { label: "Tenant Details", link: null }, + ] : [ - { label: "Home", link: "/dashboard" }, - { label: "Tenant", link: "/tenants" }, - { label: "Tenant Details", link: null }, - ] + { label: "Home", link: "/dashboard" }, + { label: "Tenant", link: "/tenants" }, + { label: "Tenant Details", link: null }, + ] } /> )} @@ -128,9 +131,8 @@ const TenantDetails = ({
  • ); - return :contentBody} />; + return :contentBody} />; }; export default SwitchTenant; \ No newline at end of file diff --git a/src/pages/authentication/TenantSelectionPage.jsx b/src/pages/authentication/TenantSelectionPage.jsx index b8a5398d..5dac4e62 100644 --- a/src/pages/authentication/TenantSelectionPage.jsx +++ b/src/pages/authentication/TenantSelectionPage.jsx @@ -2,7 +2,7 @@ import { useEffect, useState } from "react"; import { useTenants, useSelectTenant, useLogout } from "../../hooks/useAuth.jsx"; import { Link, useNavigate } from "react-router-dom"; import Dashboard from "../../components/Dashboard/Dashboard.jsx"; -import Loader from "../../components/common/Loader.jsx"; +import { SpinnerLoader } from "../../components/common/Loader.jsx"; const TenantSelectionPage = () => { const [pendingTenant, setPendingTenant] = useState(null); @@ -45,7 +45,7 @@ const TenantSelectionPage = () => { isPending || (data?.data?.length === 1 && pendingTenant !== null) ) { - return ; + return ; } if (!data?.data?.length) { diff --git a/src/pages/employee/EmployeeList.jsx b/src/pages/employee/EmployeeList.jsx index 10db6786..d675d5d2 100644 --- a/src/pages/employee/EmployeeList.jsx +++ b/src/pages/employee/EmployeeList.jsx @@ -39,6 +39,7 @@ import { setProjectId } from "../../slices/localVariablesSlice"; import { useHasUserPermission } from "../../hooks/useHasUserPermission"; import Pagination from "../../components/common/Pagination"; import handleEmployeeExport from "../../components/Employee/handleEmployeeExport"; +import { SpinnerLoader } from "../../components/common/Loader"; const EmployeeList = () => { const selectedProjectId = useSelector( @@ -468,12 +469,15 @@ const EmployeeList = () => {
    {loading && ( - )} + {!loading && displayData?.length === 0 && (!searchText) ? ( @@ -649,16 +653,16 @@ const EmployeeList = () => { ))} -
    {emp.reAllocationDate ? moment(emp.reAllocationDate).format( - "DD-MMM-YYYY" - ) + "DD-MMM-YYYY" + ) : "Present"}
    -

    Loading...

    +
    +
    + +
    +
    - {displayData?.length > 0 && ( - - )} + {displayData?.length > 0 && ( + + )} ) : (
    diff --git a/src/pages/project/ProjectDetails.jsx b/src/pages/project/ProjectDetails.jsx index d6fbd55d..011d1e9b 100644 --- a/src/pages/project/ProjectDetails.jsx +++ b/src/pages/project/ProjectDetails.jsx @@ -7,7 +7,7 @@ import AboutProject from "../../components/Project/AboutProject"; import ProjectNav from "../../components/Project/ProjectNav"; import Teams from "../../components/Project/Team/Teams"; import ProjectInfra from "../../components/Project/ProjectInfra"; -import Loader from "../../components/common/Loader"; +import { SpinnerLoader } from "../../components/common/Loader"; import WorkPlan from "../../components/Project/WorkPlan"; import Breadcrumb from "../../components/common/Breadcrumb"; import { useSelectedProject } from "../../slices/apiDataManager"; @@ -20,7 +20,7 @@ import { setProjectId } from "../../slices/localVariablesSlice"; import ProjectDocuments from "../../components/Project/ProjectDocuments"; import ProjectSetting from "../../components/Project/ProjectSetting"; import DirectoryPage from "../Directory/DirectoryPage"; -import { useProjectAccess } from "../../hooks/useProjectAccess"; +import { useProjectAccess } from "../../hooks/useProjectAccess"; import "./ProjectDetails.css"; import ProjectOrganizations from "../../components/Project/ProjectOrganizations"; @@ -65,7 +65,14 @@ const ProjectDetails = () => { }; if (projectLoading || permsLoading || !projects_Details) { - return ; + return ( +
    + +
    + ); } const renderContent = () => { diff --git a/src/pages/project/ProjectPage.jsx b/src/pages/project/ProjectPage.jsx index a85d6f58..3806608d 100644 --- a/src/pages/project/ProjectPage.jsx +++ b/src/pages/project/ProjectPage.jsx @@ -7,8 +7,8 @@ import ManageProjectInfo from "../../components/Project/ManageProjectInfo"; import ProjectCardView from "../../components/Project/ProjectCardView"; import usePagination from "../../hooks/usePagination"; import { useProjects } from "../../hooks/useProjects"; -import Loader from "../../components/common/Loader"; import { useHasUserPermission } from "../../hooks/useHasUserPermission"; +import { SpinnerLoader } from "../../components/common/Loader"; const ProjectContext = createContext(); export const useProjectContext = () => { @@ -95,8 +95,16 @@ const ProjectPage = () => { } }, [data, isLoading, selectedStatuses]); + if (isLoading) + return ( +
    + +
    + ); - if (isLoading) return
    if (isError) return

    {error.message}

    return (