From 9a00998930044838414343e29e54ad5e2e6d0e99 Mon Sep 17 00:00:00 2001 From: Yunus M Date: Wed, 13 Sep 2023 15:00:14 +0530 Subject: [PATCH] feat: signoz cloud - show cloud onboarding docs only when the domain is signoz.cloud (#3540) Co-authored-by: Palash Gupta --- frontend/src/AppRoutes/index.tsx | 9 +++++++-- frontend/src/container/SideNav/SideNav.tsx | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/frontend/src/AppRoutes/index.tsx b/frontend/src/AppRoutes/index.tsx index 341cc78580..11f9d79d51 100644 --- a/frontend/src/AppRoutes/index.tsx +++ b/frontend/src/AppRoutes/index.tsx @@ -32,6 +32,8 @@ function App(): JSX.Element { const dispatch = useDispatch>(); + const { hostname } = window.location; + const featureResponse = useGetFeatureFlag((allFlags) => { const isOnboardingEnabled = allFlags.find((flag) => flag.name === FeatureKeys.ONBOARDING)?.active || @@ -49,9 +51,12 @@ function App(): JSX.Element { }, }); - if (isOnboardingEnabled) { + if ( + !isOnboardingEnabled || + !(hostname && hostname.endsWith('signoz.cloud')) + ) { const newRoutes = routes.filter( - (route) => route?.key !== ROUTES.GET_STARTED, + (route) => route?.path !== ROUTES.GET_STARTED, ); setRoutes(newRoutes); diff --git a/frontend/src/container/SideNav/SideNav.tsx b/frontend/src/container/SideNav/SideNav.tsx index 1ef5222a53..1570e12b70 100644 --- a/frontend/src/container/SideNav/SideNav.tsx +++ b/frontend/src/container/SideNav/SideNav.tsx @@ -40,6 +40,8 @@ function SideNav(): JSX.Element { featureResponse, } = useSelector((state) => state.app); + const { hostname } = window.location; + const menuItems = useMemo( () => defaultMenuItems.filter((item) => { @@ -48,13 +50,16 @@ function SideNav(): JSX.Element { (feature) => feature.name === FeatureKeys.ONBOARDING, )?.active || false; - if (!isOnboardingEnabled) { + if ( + !isOnboardingEnabled || + !(hostname && hostname.endsWith('signoz.cloud')) + ) { return item.key !== ROUTES.GET_STARTED; } return true; }), - [featureResponse], + [featureResponse.data, hostname], ); const { pathname, search } = useLocation();