@@ -9,6 +9,7 @@ import variables from '@styles/variables';
9
9
import CONST from '@src/CONST' ;
10
10
import ONYXKEYS from '@src/ONYXKEYS' ;
11
11
import type * as OnyxTypes from '@src/types/onyx' ;
12
+ import usePermissions from './usePermissions' ;
12
13
import useResponsiveLayout from './useResponsiveLayout' ;
13
14
import useWindowDimensions from './useWindowDimensions' ;
14
15
@@ -28,9 +29,10 @@ function useSidePane() {
28
29
const { windowWidth} = useWindowDimensions ( ) ;
29
30
30
31
const [ sidePaneNVP ] = useOnyx ( ONYXKEYS . NVP_SIDE_PANE ) ;
32
+ const { canUseHelpSidePanel} = usePermissions ( ) ;
31
33
const [ language ] = useOnyx ( ONYXKEYS . NVP_PREFERRED_LOCALE ) ;
32
34
const isLanguageUnsupported = language !== CONST . LOCALES . EN ;
33
- const isPaneHidden = isSidePaneHidden ( sidePaneNVP , isExtraLargeScreenWidth ) || isLanguageUnsupported ;
35
+ const isPaneHidden = isSidePaneHidden ( sidePaneNVP , isExtraLargeScreenWidth ) || isLanguageUnsupported || ! canUseHelpSidePanel ;
34
36
35
37
const sidePaneWidth = shouldUseNarrowLayout ? windowWidth : variables . sideBarWidth ;
36
38
const shouldApplySidePaneOffset = isExtraLargeScreenWidth && ! isPaneHidden ;
@@ -42,10 +44,10 @@ function useSidePane() {
42
44
const shouldHideToolTip = isExtraLargeScreenWidth ? isAnimatingExtraLargeScree : ! shouldHideSidePane ;
43
45
44
46
// The help button is hidden when:
45
- // - side pane nvp is not set
47
+ // - the user is not part of the corresponding beta
46
48
// - side pane is displayed currently
47
49
// - language is unsupported
48
- const shouldHideHelpButton = ! sidePaneNVP || ! isPaneHidden || isLanguageUnsupported ;
50
+ const shouldHideHelpButton = ! canUseHelpSidePanel || ! isPaneHidden || isLanguageUnsupported
49
51
50
52
const sidePaneOffset = useRef ( new Animated . Value ( shouldApplySidePaneOffset ? variables . sideBarWidth : 0 ) ) ;
51
53
const sidePaneTranslateX = useRef ( new Animated . Value ( isPaneHidden ? sidePaneWidth : 0 ) ) ;
0 commit comments