From e9bb05cc5db000e40e7a9fdfbc034ad662862c7b Mon Sep 17 00:00:00 2001 From: SagarRajput-7 <162284829+SagarRajput-7@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:05:39 +0530 Subject: [PATCH] fix: added billing page condition to not show when its not either cloud or enterprise (#4827) --- frontend/src/AppRoutes/index.tsx | 6 +++++- frontend/src/container/SideNav/SideNav.tsx | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/src/AppRoutes/index.tsx b/frontend/src/AppRoutes/index.tsx index f1927c9a4c..7bc58c509e 100644 --- a/frontend/src/AppRoutes/index.tsx +++ b/frontend/src/AppRoutes/index.tsx @@ -147,7 +147,11 @@ function App(): JSX.Element { } } - if (isOnBasicPlan || (isLoggedInState && role && role !== 'ADMIN')) { + if ( + isOnBasicPlan || + (isLoggedInState && role && role !== 'ADMIN') || + !(isCloudUserVal || isEECloudUser()) + ) { const newRoutes = routes.filter((route) => route?.path !== ROUTES.BILLING); setRoutes(newRoutes); } diff --git a/frontend/src/container/SideNav/SideNav.tsx b/frontend/src/container/SideNav/SideNav.tsx index ac0028b89e..d11e1c158b 100644 --- a/frontend/src/container/SideNav/SideNav.tsx +++ b/frontend/src/container/SideNav/SideNav.tsx @@ -96,6 +96,8 @@ function SideNav({ const { registerShortcut, deregisterShortcut } = useKeyboardHotkeys(); + const isCloudUserVal = isCloudUser(); + useEffect(() => { if (inviteMembers) { const updatedUserManagementMenuItems = [ @@ -135,7 +137,11 @@ function SideNav({ license.isCurrent && license.planKey === LICENSE_PLAN_KEY.BASIC_PLAN, ) || licenseData?.payload?.licenses === null; - if (role !== USER_ROLES.ADMIN || isOnBasicPlan) { + if ( + role !== USER_ROLES.ADMIN || + isOnBasicPlan || + !(isCloudUserVal || isEECloudUser()) + ) { items = items.filter((item) => item.key !== ROUTES.BILLING); } @@ -214,8 +220,6 @@ function SideNav({ pathname, ]); - const isCloudUserVal = isCloudUser(); - useEffect(() => { if (isCloudUser() || isEECloudUser()) { const updatedUserManagementMenuItems = [helpSupportMenuItem];