Created two new env variables (#2120)

* created the two env variables

* modify according to comments
This commit is contained in:
bosiraphael
2023-10-19 14:57:16 +02:00
committed by GitHub
parent c04f6bf371
commit 2b8a81a05c
13 changed files with 118 additions and 23 deletions

View File

@ -1,7 +1,10 @@
import { useCallback } from 'react';
import { useMatch, useNavigate, useResolvedPath } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import { useAuth } from '@/auth/hooks/useAuth';
import { isDataModelSettingsEnabledState } from '@/client-config/states/isDataModelSettingsEnabled';
import { isDevelopersSettingsEnabledState } from '@/client-config/states/isDevelopersSettingsEnabled';
import { AppPath } from '@/types/AppPath';
import {
IconColorSwatch,
@ -26,6 +29,22 @@ export const SettingsNavbar = () => {
navigate(AppPath.SignIn);
}, [signOut, navigate]);
const isDataModelSettingsEnabled = useRecoilValue(
isDataModelSettingsEnabledState,
);
const isDevelopersSettingsEnabled = useRecoilValue(
isDevelopersSettingsEnabledState,
);
const isDataModelSettingsActive = !!useMatch({
path: useResolvedPath('/settings/objects').pathname,
end: false,
});
const isDevelopersSettingsActive = !!useMatch({
path: useResolvedPath('/settings/api').pathname,
end: true,
});
return (
<SubMenuNavbar backButtonTitle="Settings" displayVersion={true}>
<NavTitle label="User" />
@ -74,28 +93,22 @@ export const SettingsNavbar = () => {
})
}
/>
<NavItem
label="Data model"
to="/settings/objects"
Icon={IconHierarchy2}
active={
!!useMatch({
path: useResolvedPath('/settings/objects').pathname,
end: false,
})
}
/>
<NavItem
label="Developers"
to="/settings/apis"
Icon={IconRobot}
active={
!!useMatch({
path: useResolvedPath('/settings/api').pathname,
end: true,
})
}
/>
{isDataModelSettingsEnabled && (
<NavItem
label="Data model"
to="/settings/objects"
Icon={IconHierarchy2}
active={isDataModelSettingsActive}
/>
)}
{isDevelopersSettingsEnabled && (
<NavItem
label="Developers"
to="/settings/apis"
Icon={IconRobot}
active={isDevelopersSettingsActive}
/>
)}
<NavTitle label="Other" />
<NavItem label="Logout" onClick={handleLogout} Icon={IconLogout} />
</SubMenuNavbar>