File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
site/src/components/Navbar Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
- import { useActor } from "@xstate/react"
1
+ import { useActor , useSelector } from "@xstate/react"
2
+ import { FeatureNames } from "api/types"
2
3
import React , { useContext } from "react"
4
+ import { selectFeatureVisibility } from "xServices/entitlements/entitlementsSelectors"
3
5
import { XServiceContext } from "../../xServices/StateContext"
4
6
import { NavbarView } from "../NavbarView/NavbarView"
5
7
6
8
export const Navbar : React . FC = ( ) => {
7
9
const xServices = useContext ( XServiceContext )
8
10
const [ authState , authSend ] = useActor ( xServices . authXService )
9
11
const { me, permissions } = authState . context
12
+ const featureVisibility = useSelector ( xServices . entitlementsXService , selectFeatureVisibility )
13
+ const canViewAuditLog = featureVisibility [ FeatureNames . AuditLog ] && ! ! permissions ?. viewAuditLog
10
14
const onSignOut = ( ) => authSend ( "SIGN_OUT" )
11
15
12
16
return (
13
17
< NavbarView
14
18
user = { me }
15
19
onSignOut = { onSignOut }
16
- canViewAuditLog = { permissions ?. viewAuditLog ?? false }
20
+ canViewAuditLog = { canViewAuditLog }
17
21
/>
18
22
)
19
23
}
You can’t perform that action at this time.
0 commit comments