diff --git a/src/components/Employee/EmployeeNav.jsx b/src/components/Employee/EmployeeNav.jsx index d55b5936..74fbeeda 100644 --- a/src/components/Employee/EmployeeNav.jsx +++ b/src/components/Employee/EmployeeNav.jsx @@ -2,47 +2,49 @@ import React from "react"; const EmployeeNav = ({ onPillClick, activePill }) => { return ( -
-
- -
+
+
); }; diff --git a/src/components/Project/Infrastructure/WorkItem.jsx b/src/components/Project/Infrastructure/WorkItem.jsx index 787381c0..682b208a 100644 --- a/src/components/Project/Infrastructure/WorkItem.jsx +++ b/src/components/Project/Infrastructure/WorkItem.jsx @@ -87,7 +87,7 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => { NewWorkItem?.workItem?.completedWork || workItem?.completedWork ), - height: "10px", + height: "5px", }} aria-valuenow={ hasWorkItem diff --git a/src/components/Project/ProjectNav.jsx b/src/components/Project/ProjectNav.jsx index 5516c464..6081958f 100644 --- a/src/components/Project/ProjectNav.jsx +++ b/src/components/Project/ProjectNav.jsx @@ -1,53 +1,51 @@ import React from "react"; -import {hasUserPermission} from "../../utils/authUtils"; -import {useHasUserPermission} from "../../hooks/useHasUserPermission"; -import { VIEW_PROJECT_INFRA} from "../../utils/constants"; +import { hasUserPermission } from "../../utils/authUtils"; +import { useHasUserPermission } from "../../hooks/useHasUserPermission"; +import { VIEW_PROJECT_INFRA } from "../../utils/constants"; + +const ProjectNav = ({ onPillClick, activePill }) => { + const HasViewInfraStructure = useHasUserPermission(VIEW_PROJECT_INFRA); -const ProjectNav = ( {onPillClick, activePill} ) => -{ - const HasViewInfraStructure = useHasUserPermission( VIEW_PROJECT_INFRA ) - return ( -
-
-
); }; diff --git a/src/components/common/Loader.jsx b/src/components/common/Loader.jsx index 58766453..c34e0069 100644 --- a/src/components/common/Loader.jsx +++ b/src/components/common/Loader.jsx @@ -3,12 +3,13 @@ import React from "react"; const Loader = () => { return (
-
- Loading... -
Loading...
+ {/*
+ Loading... +
+
Loading...
@@ -23,13 +24,13 @@ const Loader = () => {
Loading... -
+
*/}
Loading...
-
+ {/*
Loading... -
+
*/}
); }; diff --git a/src/pages/project/ProjectDetails.jsx b/src/pages/project/ProjectDetails.jsx index 3dbd7bb0..58ecb85d 100644 --- a/src/pages/project/ProjectDetails.jsx +++ b/src/pages/project/ProjectDetails.jsx @@ -15,52 +15,51 @@ import { cacheData, getCachedData } from "../../slices/apiDataManager"; import ProjectRepository from "../../repositories/ProjectRepository"; import { ActivityeRepository } from "../../repositories/MastersRepository"; import "./ProjectDetails.css"; -import {useEmployeesByProjectAllocated, useProjectDetails} from "../../hooks/useProjects"; -import {useDispatch} from "react-redux"; -import {setProjectId} from "../../slices/localVariablesSlice"; +import { + useEmployeesByProjectAllocated, + useProjectDetails, +} from "../../hooks/useProjects"; +import { useDispatch } from "react-redux"; +import { setProjectId } from "../../slices/localVariablesSlice"; import { ComingSoonPage } from "../Misc/ComingSoonPage"; - const ProjectDetails = () => { - let {projectId} = useParams(); - const {projects_Details,loading:projectLoading,error:ProjectError} = useProjectDetails(projectId) - const dispatch = useDispatch() + let { projectId } = useParams(); + const { + projects_Details, + loading: projectLoading, + error: ProjectError, + } = useProjectDetails(projectId); + const dispatch = useDispatch(); const [project, setProject] = useState(null); - const [ projectDetails, setProjectDetails ] = useState( null ); + const [projectDetails, setProjectDetails] = useState(null); const [loading, setLoading] = useState(true); - const [ error, setError ] = useState( "" ); - - + const [error, setError] = useState(""); const fetchData = async () => { - - const project_cache = getCachedData("projectInfo"); - if (!project_cache || project_cache?.projectId !== projectId) { - ProjectRepository.getProjectByprojectId(projectId) - .then( ( response ) => - { - setProjectDetails( response.data ); - setProject( response.data ); - cacheData("projectInfo", {projectId,data: response.data} ); - setLoading(false) - }) - .catch((error) => { - console.error(error); - setError( "Failed to fetch data." ); - setLoading(false) - }); - } else { - setProjectDetails( project_cache.data ); - setProject( project_cache.data ); - setLoading(false) - } - + const project_cache = getCachedData("projectInfo"); + if (!project_cache || project_cache?.projectId !== projectId) { + ProjectRepository.getProjectByprojectId(projectId) + .then((response) => { + setProjectDetails(response.data); + setProject(response.data); + cacheData("projectInfo", { projectId, data: response.data }); + setLoading(false); + }) + .catch((error) => { + console.error(error); + setError("Failed to fetch data."); + setLoading(false); + }); + } else { + setProjectDetails(project_cache.data); + setProject(project_cache.data); + setLoading(false); + } }; - const [activePill, setActivePill] = useState("profile"); - const handlePillClick = (pillKey) => { setActivePill(pillKey); }; @@ -69,19 +68,18 @@ const ProjectDetails = () => { fetchData(); }; - const renderContent = () => { if (projectLoading) return ; switch (activePill) { case "profile": { return (
-
+
{/* About User */} {/* About User */}
-
+
{/* Profile Overview */} {/* Profile Overview */} @@ -128,17 +126,17 @@ const ProjectDetails = () => {
); } - + default: - return ; + return ; } }; useEffect(() => { - dispatch(setProjectId(projectId)) - setProject( projects_Details ) - setProjectDetails(projects_Details) - }, [projects_Details,projectId]); + dispatch(setProjectId(projectId)); + setProject(projects_Details); + setProjectDetails(projects_Details); + }, [projects_Details, projectId]); return ( <> @@ -154,16 +152,18 @@ const ProjectDetails = () => {
{projectLoading &&

Loading....

} - {(!projectLoading && project) && } -
- -
+ {!projectLoading && project && ( + + )} +
+
+ {renderContent()}