diff --git a/src/CONST.ts b/src/CONST.ts index 9efab1de506b..ff9f4c9f9918 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -776,6 +776,7 @@ const CONST = { NSQS: 'nsqs', CUSTOM_RULES: 'customRules', TABLE_REPORT_VIEW: 'tableReportView', + HELP_SIDE_PANEL: 'newDotHelpSidePanel', RECEIPT_LINE_ITEMS: 'receiptLineItems', }, BUTTON_STATES: { diff --git a/src/hooks/useSidePane.ts b/src/hooks/useSidePane.ts index d645f9bd55fa..8a0ac2ac1177 100644 --- a/src/hooks/useSidePane.ts +++ b/src/hooks/useSidePane.ts @@ -11,6 +11,7 @@ import variables from '@styles/variables'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type * as OnyxTypes from '@src/types/onyx'; +import usePermissions from './usePermissions'; import useResponsiveLayout from './useResponsiveLayout'; import useWindowDimensions from './useWindowDimensions'; @@ -30,6 +31,7 @@ function useSidePane() { const {windowWidth} = useWindowDimensions(); const [sidePaneNVP] = useOnyx(ONYXKEYS.NVP_SIDE_PANE); + const {canUseHelpSidePanel} = usePermissions(); const [language] = useOnyx(ONYXKEYS.NVP_PREFERRED_LOCALE); const [isModalCenteredVisible = false] = useOnyx(ONYXKEYS.MODAL, { selector: (modal) => @@ -38,7 +40,7 @@ function useSidePane() { modal?.type === CONST.MODAL.MODAL_TYPE.CENTERED_SMALL, }); const isLanguageUnsupported = language !== CONST.LOCALES.EN; - const isPaneHidden = isSidePaneHidden(sidePaneNVP, isExtraLargeScreenWidth) || isLanguageUnsupported || isModalCenteredVisible; + const isPaneHidden = isSidePaneHidden(sidePaneNVP, isExtraLargeScreenWidth) || isLanguageUnsupported || isModalCenteredVisible || !canUseHelpSidePanel; const sidePaneWidth = shouldUseNarrowLayout ? windowWidth : variables.sideBarWidth; const shouldApplySidePaneOffset = isExtraLargeScreenWidth && !isPaneHidden; @@ -50,10 +52,10 @@ function useSidePane() { const shouldHideToolTip = isExtraLargeScreenWidth ? isAnimatingExtraLargeScree : !shouldHideSidePane; // The help button is hidden when: - // - side pane nvp is not set + // - the user is not part of the corresponding beta // - side pane is displayed currently // - language is unsupported - const shouldHideHelpButton = !sidePaneNVP || !isPaneHidden || isLanguageUnsupported; + const shouldHideHelpButton = !canUseHelpSidePanel || !isPaneHidden || isLanguageUnsupported; const sidePaneOffset = useRef(new Animated.Value(shouldApplySidePaneOffset ? variables.sideBarWidth : 0)); const sidePaneTranslateX = useRef(new Animated.Value(isPaneHidden ? sidePaneWidth : 0)); diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index c708518d584d..d1295ab93414 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -58,6 +58,10 @@ function canUseTableReportView(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.TABLE_REPORT_VIEW) || canUseAllBetas(betas); } +function canUseHelpSidePanel(betas: OnyxEntry): boolean { + return !!betas?.includes(CONST.BETAS.HELP_SIDE_PANEL) || canUseAllBetas(betas); +} + function canUseTalkToAISales(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.NEW_DOT_TALK_TO_AI_SALES) || canUseAllBetas(betas); } @@ -79,6 +83,7 @@ export default { canUseNSQS, canUseCustomRules, canUseTableReportView, + canUseHelpSidePanel, canUseTalkToAISales, canUseProhibitedExpenses, };