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 { 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);

View File

@ -40,6 +40,8 @@ function SideNav(): JSX.Element {
featureResponse,
} = useSelector<AppState, AppReducer>((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();