diff --git a/src/components/Activities/InfraPlanning.jsx b/src/components/Activities/InfraPlanning.jsx index e7a4003a..3b77472a 100644 --- a/src/components/Activities/InfraPlanning.jsx +++ b/src/components/Activities/InfraPlanning.jsx @@ -24,7 +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(); @@ -57,9 +57,17 @@ const InfraPlanning = () => { } if (isLoading) { - return ; + return( +
+ +
+ ); } + if (isFetched && (!projectInfra || projectInfra.length === 0)) { return (
- {/* Replace this with a skeleton or spinner if you prefer */} ); } @@ -43,8 +42,16 @@ const HorizontalBarChart = ({ categories.length === seriesData.length; if (!hasValidData) { - return
No data to display
; + return ( +
+ No data to display +
+ ); } + // Combine seriesData and categories, then sort in descending order const combined = seriesData.map((value, index) => ({ value, 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..a6aeac0c 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); @@ -163,12 +164,15 @@ const ExpenseByProject = () => { {/* Chart */}
{isLoading ? ( -

Loading chart...

+
+ +
) : !expenseApiData || expenseApiData.length === 0 ? (
No data found
) : ( )} +
diff --git a/src/components/Project/Infrastructure/WorkArea.jsx b/src/components/Project/Infrastructure/WorkArea.jsx index c5925321..8b4e439c 100644 --- a/src/components/Project/Infrastructure/WorkArea.jsx +++ b/src/components/Project/Infrastructure/WorkArea.jsx @@ -16,6 +16,7 @@ import { useParams } from "react-router-dom"; import ProgressBar from "../../common/ProgressBar"; import { formatNumber } from "../../../utils/dateUtils"; import { useServices } from "../../../hooks/masterHook/useMaster"; +import { SpinnerLoader } from "../../common/Loader"; const WorkArea = ({ workArea, floor, forBuilding }) => { const selectedProject = useSelectedProject() @@ -108,7 +109,7 @@ const WorkArea = ({ workArea, floor, forBuilding }) => { @@ -122,7 +123,12 @@ const WorkArea = ({ workArea, floor, forBuilding }) => { >
{isLoading || ProjectTaskList === undefined ? ( -
Loading activities...
+
+ +
) : ProjectTaskList?.length === 0 ? (
No activities available for this work area.
) : ProjectTaskList?.length > 0 ? ( diff --git a/src/components/Project/ProjectCardView.jsx b/src/components/Project/ProjectCardView.jsx index 1108120c..f953552a 100644 --- a/src/components/Project/ProjectCardView.jsx +++ b/src/components/Project/ProjectCardView.jsx @@ -1,6 +1,5 @@ import React from 'react' import { useProjects } from '../../hooks/useProjects' -import Loader from '../common/Loader' import ProjectCard from './ProjectCard' const ProjectCardView = ({currentItems,setCurrentPage,totalPages }) => { diff --git a/src/components/Project/ProjectInfra.jsx b/src/components/Project/ProjectInfra.jsx index 643f6106..6bf95813 100644 --- a/src/components/Project/ProjectInfra.jsx +++ b/src/components/Project/ProjectInfra.jsx @@ -29,6 +29,7 @@ import eventBus from "../../services/eventBus"; import { useParams } from "react-router-dom"; import GlobalModel from "../common/GlobalModel"; import { setService } from "../../slices/globalVariablesSlice"; +import { SpinnerLoader } from "../common/Loader"; const ProjectInfra = ({ data, onDataChange, eachSiteEngineer }) => { const projectId = useSelectedProject(); @@ -186,21 +187,24 @@ const ProjectInfra = ({ data, onDataChange, eachSiteEngineer }) => { )}
-
- {isLoading &&

Loading....

} - {projectInfra && projectInfra?.length > 0 && ( +
+ {isLoading ? ( +
+ +
+ ) : projectInfra && projectInfra.length > 0 ? ( - )} - {!isLoading && projectInfra?.length == 0 && ( -
-

No Infra Avaiable

+ ) : ( +
+

No infrastructure data available.

)}
+
diff --git a/src/components/Project/ProjectOrganization/ProjectAssignedOrgs.jsx b/src/components/Project/ProjectOrganization/ProjectAssignedOrgs.jsx index c4aec957..c7803386 100644 --- a/src/components/Project/ProjectOrganization/ProjectAssignedOrgs.jsx +++ b/src/components/Project/ProjectOrganization/ProjectAssignedOrgs.jsx @@ -2,6 +2,7 @@ import React from "react"; import { useProjectAssignedOrganizations } from "../../../hooks/useProjects"; import { useSelectedProject } from "../../../slices/apiDataManager"; import { formatUTCToLocalTime } from "../../../utils/dateUtils"; +import { SpinnerLoader } from "../../common/Loader"; const ProjectAssignedOrgs = () => { const selectedProject = useSelectedProject(); @@ -25,12 +26,12 @@ const ProjectAssignedOrgs = () => { ), align: "text-start", }, - { + { key: "service", label: "Service Name", getValue: (org) => (
- {org?.service?.name} + {org?.service?.name}
), align: "text-start", @@ -49,7 +50,7 @@ const ProjectAssignedOrgs = () => { align: "text-center", }, - { + { key: "organizationType", label: "Organization Type", getValue: (org) => ( @@ -62,7 +63,7 @@ const ProjectAssignedOrgs = () => { ), align: "text-center", }, - { + { key: "assignedDate", label: "Assigned Date", getValue: (org) => ( @@ -78,7 +79,13 @@ const ProjectAssignedOrgs = () => { }, ]; - if (isLoading) return
Loading...
; + if (isLoading) + return ( +
+ +
+ ); + if (isError) return
{error.message}
; return ( diff --git a/src/components/Project/ProjectOrganizations.jsx b/src/components/Project/ProjectOrganizations.jsx index b5a91fa6..7e5bfce5 100644 --- a/src/components/Project/ProjectOrganizations.jsx +++ b/src/components/Project/ProjectOrganizations.jsx @@ -21,7 +21,7 @@ const ProjectOrganizations = () => { -
+
diff --git a/src/components/Project/Team/Teams.jsx b/src/components/Project/Team/Teams.jsx index 31d27efa..badf81fd 100644 --- a/src/components/Project/Team/Teams.jsx +++ b/src/components/Project/Team/Teams.jsx @@ -21,6 +21,7 @@ import { import { useSelectedProject } from "../../../slices/apiDataManager"; import GlobalModel from "../../common/GlobalModel"; import TeamAssignToProject from "./TeamAssignToProject"; +import { SpinnerLoader } from "../../common/Loader"; const Teams = () => { const selectedProject = useSelectedProject(); @@ -158,16 +159,8 @@ const Teams = () => {
{!servicesLoading && ( <> - {(!assignedServices || assignedServices.length === 0) && ( - - Not Service Assigned - - )} - {assignedServices?.length === 1 && ( - - {assignedServices[0].name} - +
{assignedServices[0].name}
)} {assignedServices?.length > 1 && ( @@ -189,6 +182,7 @@ const Teams = () => { )}
+
{
- {employeeLodaing &&

Loading..

} + {employeeLodaing && ( +
+ +
+ )} + {projectEmployees && projectEmployees.length > 0 && ( @@ -290,8 +289,8 @@ const Teams = () => { )} diff --git a/src/components/Tenant/Profile.jsx b/src/components/Tenant/Profile.jsx index 963f6ce3..5c4e4085 100644 --- a/src/components/Tenant/Profile.jsx +++ b/src/components/Tenant/Profile.jsx @@ -16,9 +16,9 @@ const Profile = ({ data }) => {
-
+
-
+
{data.logoImage ? (Preview { const [hoveredImage, setHoveredImage] = useState(null); @@ -47,7 +47,7 @@ const ImageGalleryListView = ({filter}) => { if (isLoading) { return (
- +
); } diff --git a/src/pages/Directory/ContactsPage.jsx b/src/pages/Directory/ContactsPage.jsx index 195ebb96..504a672f 100644 --- a/src/pages/Directory/ContactsPage.jsx +++ b/src/pages/Directory/ContactsPage.jsx @@ -11,7 +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) => { @@ -113,7 +113,15 @@ 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..f0dea3ce 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..fc7833de 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,10 +71,14 @@ const TenantDetails = ({ if (!activeTenantId) return
No tenant selected.
; if (isLoading) return ( -
- +
+
); + if (isError) return (
@@ -110,14 +114,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 +132,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..812b3107 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/project/ProjectDetails.jsx b/src/pages/project/ProjectDetails.jsx index d6fbd55d..b7871909 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,9 +65,17 @@ const ProjectDetails = () => { }; if (projectLoading || permsLoading || !projects_Details) { - return ; + return ( +
    + +
    + ); } + const renderContent = () => { switch (activePill) { case "profile": diff --git a/src/pages/project/ProjectPage.jsx b/src/pages/project/ProjectPage.jsx index a85d6f58..fe75e390 100644 --- a/src/pages/project/ProjectPage.jsx +++ b/src/pages/project/ProjectPage.jsx @@ -7,7 +7,7 @@ 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 { SpinnerLoader } from "../../components/common/Loader"; import { useHasUserPermission } from "../../hooks/useHasUserPermission"; const ProjectContext = createContext(); @@ -96,7 +96,16 @@ const ProjectPage = () => { }, [data, isLoading, selectedStatuses]); - if (isLoading) return
    + if (isLoading) + return ( +
    + +
    + ); + if (isError) return

    {error.message}

    return (
    {emp.reAllocationDate ? moment(emp.reAllocationDate).format( - "DD-MMM-YYYY" - ) + "DD-MMM-YYYY" + ) : "Present"}