feat: signoz cloud - show cloud onboarding docs only when the domain is signoz.cloud (#3540)

Co-authored-by: Palash Gupta <palashgdev@gmail.com>
This commit is contained in:
Yunus M 2023-09-13 15:00:14 +05:30 committed by GitHub
parent c60f612e0e
commit 9a00998930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -32,6 +32,8 @@ function App(): JSX.Element {
const dispatch = useDispatch<Dispatch<AppActions>>(); const dispatch = useDispatch<Dispatch<AppActions>>();
const { hostname } = window.location;
const featureResponse = useGetFeatureFlag((allFlags) => { const featureResponse = useGetFeatureFlag((allFlags) => {
const isOnboardingEnabled = const isOnboardingEnabled =
allFlags.find((flag) => flag.name === FeatureKeys.ONBOARDING)?.active || 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( const newRoutes = routes.filter(
(route) => route?.key !== ROUTES.GET_STARTED, (route) => route?.path !== ROUTES.GET_STARTED,
); );
setRoutes(newRoutes); setRoutes(newRoutes);

View File

@ -40,6 +40,8 @@ function SideNav(): JSX.Element {
featureResponse, featureResponse,
} = useSelector<AppState, AppReducer>((state) => state.app); } = useSelector<AppState, AppReducer>((state) => state.app);
const { hostname } = window.location;
const menuItems = useMemo( const menuItems = useMemo(
() => () =>
defaultMenuItems.filter((item) => { defaultMenuItems.filter((item) => {
@ -48,13 +50,16 @@ function SideNav(): JSX.Element {
(feature) => feature.name === FeatureKeys.ONBOARDING, (feature) => feature.name === FeatureKeys.ONBOARDING,
)?.active || false; )?.active || false;
if (!isOnboardingEnabled) { if (
!isOnboardingEnabled ||
!(hostname && hostname.endsWith('signoz.cloud'))
) {
return item.key !== ROUTES.GET_STARTED; return item.key !== ROUTES.GET_STARTED;
} }
return true; return true;
}), }),
[featureResponse], [featureResponse.data, hostname],
); );
const { pathname, search } = useLocation(); const { pathname, search } = useLocation();