From 7535028b44e6ca70820569fe4db48b322764dcb0 Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Wed, 23 Jul 2025 10:52:30 +0530 Subject: [PATCH] Project dropdown should only include active ,On Hold and In Progress Projects only show in Projects page. --- src/components/Layout/Header.jsx | 59 ++++++++------------------------ 1 file changed, 15 insertions(+), 44 deletions(-) diff --git a/src/components/Layout/Header.jsx b/src/components/Layout/Header.jsx index a4b5416c..7a1a6aaa 100644 --- a/src/components/Layout/Header.jsx +++ b/src/components/Layout/Header.jsx @@ -33,25 +33,10 @@ const Header = () => { /^\/dashboard$/.test(location.pathname) || /^\/$/.test(location.pathname); // Define the specific project status IDs you want to filter by - // Changed to explicitly include only 'Active', 'On Hold', 'In Progress' const allowedProjectStatusIds = [ "603e994b-a27f-4e5d-a251-f3d69b0498ba", // On Hold "cdad86aa-8a56-4ff4-b633-9c629057dfef", // In Progress - "ef1c356e-0fe0-42df-a5d3-8daee355492d", // Inactive - Removed as per requirement - "b74da4c2-d07e-46f2-9919-e75e49b12731", // Active - ]; - - const isDirectoryPath = /^\/directory$/.test(location.pathname); - const isProjectPath = /^\/projects$/.test(location.pathname); - const isDashboard = - /^\/dashboard$/.test(location.pathname) || /^\/$/.test(location.pathname); - - // Define the specific project status IDs you want to filter by - // Changed to explicitly include only 'Active', 'On Hold', 'In Progress' - const allowedProjectStatusIds = [ - "603e994b-a27f-4e5d-a251-f3d69b0498ba", // On Hold - "cdad86aa-8a56-4ff4-b633-9c629057dfef", // In Progress - "ef1c356e-0fe0-42df-a5d3-8daee355492d", // Inactive - Removed as per requirement + "ef1c356e-0fe0-42df-a5d3-8daee355492d", // Inactive "b74da4c2-d07e-46f2-9919-e75e49b12731", // Active ]; @@ -112,8 +97,8 @@ const Header = () => { const projectsForDropdown = isDashboard ? projectNames // On dashboard, show all projects : projectNames?.filter(project => - allowedProjectStatusIds.includes(project.projectStatusId) - ); + allowedProjectStatusIds.includes(project.projectStatusId) + ); // Determine the display text for the project dropdown let displayText = "All Projects"; @@ -134,7 +119,7 @@ const Header = () => { useEffect(() => { if ( - projectNames && + projectNames && // Use the original projectNames for initial setting to ensure all are considered for initial state if needed projectNames.length > 0 && selectedProject === undefined && !getCachedData("hasReceived") @@ -200,10 +185,7 @@ const Header = () => { // No navigation if on dashboard or if "All Projects" is selected }; - // Determine if the dropdown should be shown - const shouldShowDropdown = - isDashboard || (projectsForDropdown && projectsForDropdown.length > 1); - + console.log("Kartik sharma", projectNames); return (