@@ -4,16 +4,18 @@ import AddIcon from "@mui/icons-material/Add";
4
4
import SettingsIcon from "@mui/icons-material/Settings" ;
5
5
import type { FC , ReactNode } from "react" ;
6
6
import { Link , NavLink , useLocation , useParams } from "react-router-dom" ;
7
- import type { Organization } from "api/typesGenerated" ;
7
+ import type { Experiments , Organization } from "api/typesGenerated" ;
8
8
import { Sidebar as BaseSidebar } from "components/Sidebar/Sidebar" ;
9
9
import { Stack } from "components/Stack/Stack" ;
10
10
import { UserAvatar } from "components/UserAvatar/UserAvatar" ;
11
11
import { type ClassName , useClassName } from "hooks/useClassName" ;
12
+ import { useDashboard } from "modules/dashboard/useDashboard" ;
12
13
import { useFeatureVisibility } from "modules/dashboard/useFeatureVisibility" ;
13
14
import { linkToAuditing , linkToUsers , withFilter } from "modules/navigation" ;
14
15
import { useOrganizationSettings } from "./ManagementSettingsLayout" ;
15
16
16
17
export const Sidebar : FC = ( ) => {
18
+ const { experiments } = useDashboard ( ) ;
17
19
const { organizations } = useOrganizationSettings ( ) ;
18
20
const { organization } = useParams ( ) as { organization ?: string } ;
19
21
const { multiple_organizations : organizationsEnabled } =
@@ -49,6 +51,7 @@ export const Sidebar: FC = () => {
49
51
key = { org . id }
50
52
organization = { org }
51
53
active = { org . name === organizationName }
54
+ experiments = { experiments }
52
55
/>
53
56
) ) }
54
57
</ >
@@ -123,11 +126,12 @@ function urlForSubpage(organizationName: string, subpage: string = ""): string {
123
126
interface OrganizationSettingsNavigationProps {
124
127
organization : Organization ;
125
128
active : boolean ;
129
+ experiments : Experiments ;
126
130
}
127
131
128
132
export const OrganizationSettingsNavigation : FC <
129
133
OrganizationSettingsNavigationProps
130
- > = ( { organization, active } ) => {
134
+ > = ( { organization, active, experiments } ) => {
131
135
return (
132
136
< >
133
137
< SidebarNavItem
@@ -155,9 +159,11 @@ export const OrganizationSettingsNavigation: FC<
155
159
< SidebarNavSubItem href = { urlForSubpage ( organization . name , "groups" ) } >
156
160
Groups
157
161
</ SidebarNavSubItem >
158
- < SidebarNavSubItem href = { urlForSubpage ( organization . name , "roles" ) } >
159
- Roles
160
- </ SidebarNavSubItem >
162
+ { experiments . includes ( "custom-roles" ) && (
163
+ < SidebarNavSubItem href = { urlForSubpage ( organization . name , "roles" ) } >
164
+ Roles
165
+ </ SidebarNavSubItem >
166
+ ) }
161
167
{ /* For now redirect to the site-wide audit page with the organization
162
168
pre-filled into the filter. Based on user feedback we might want
163
169
to serve a copy of the audit page or even delete this link. */ }
0 commit comments