Add const / permissions function for help side panel beta#58751
Add const / permissions function for help side panel beta#58751francoisl wants to merge 6 commits into
Conversation
|
@AndrewGable Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
First of all, thank you for adding this @francoisl 😄 Please add my test account: |
|
Would you consider adding logic to put the side pane behind beta? I've prepared a diff for you: diff --git a/src/hooks/useSidePane.ts b/src/hooks/useSidePane.ts
index a879696359f..3a56b8adadf 100644
--- a/src/hooks/useSidePane.ts
+++ b/src/hooks/useSidePane.ts
@@ -9,6 +9,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';
@@ -28,9 +29,10 @@ function useSidePane() {
const {windowWidth} = useWindowDimensions();
const [sidePaneNVP] = useOnyx(ONYXKEYS.NVP_SIDE_PANE);
+ const {canUseHelpSidePanel} = usePermissions();
const [language] = useOnyx(ONYXKEYS.NVP_PREFERRED_LOCALE);
const isLanguageUnsupported = language !== CONST.LOCALES.EN;
- const isPaneHidden = isSidePaneHidden(sidePaneNVP, isExtraLargeScreenWidth) || isLanguageUnsupported;
+ const isPaneHidden = isSidePaneHidden(sidePaneNVP, isExtraLargeScreenWidth) || isLanguageUnsupported || !canUseHelpSidePanel;
const sidePaneWidth = shouldUseNarrowLayout ? windowWidth : variables.sideBarWidth;
const shouldApplySidePaneOffset = isExtraLargeScreenWidth && !isPaneHidden;
@@ -42,10 +44,10 @@ function useSidePane() {
const shouldHideToolTip = isExtraLargeScreenWidth ? isAnimatingExtraLargeScree : !shouldHideSidePane;
// The help button is hidden when:
- // - side pane nvp is not set
+ // - side pane beta is disabled
// - 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)); |
|
Sounds good. I didn't update |
7e8c91f to
9a02023
Compare
Reviewer Checklist
Screenshots/VideosAndroid: Native58751_android_native.movAndroid: mWeb Chrome58751_android_native.moviOS: Native58751_ios_native.moviOS: mWeb Safari58751_ios_web.movMacOS: Chrome / Safari58751_web_chrome.mp4MacOS: Desktop58751_web_desktop.mov |
brunovjk
left a comment
There was a problem hiding this comment.
As it stands in this PR, the Help Panel is initially controlled only by the beta permission, if we change the ONYXKEYS.NVP_SIDE_PANE we just close the panel:
58751_web_desktop_expected_behavior.mov
I believe this is intentional, but can you confirm @blazejkustra and @francoisl? If yes, the PR LGTM, if not, let me know and I will test again and update the checklist.
Yeah, my view would be that from now on we'd only use the beta to tell which accounts can see the help button, and not the snippet anymore. I fixed the conflict, not sure what's going on with the Jest actions that keep failing though :/ |
dangrous
left a comment
There was a problem hiding this comment.
Code seems fine to me - though it looks like sometimes we call it a side pane and sometimes a side panel (with / without the l) - do we want to standardize? Not really a blocker since it's pretty clear either way.
|
Code looks good, would prefer not to merge with failing tests |
|
Tests fail with a cryptic message, seems unrelated 🤔 @francoisl Could you merge the newest main? I believe it should fix this |
|
I created a new PR, turns out usePermissions was the culprit for some reason 🤔 |
|
Sounds good, going to close this then. |
Explanation of Change
Add a function
canUseHelpSidePanel()for theusePermissions()hook, that we can use to check if a user should see the help panel button.There was a bug that caused users on production to see the button at some point, so we thought it might be safer to use a beta instead.
Let me know if you have any account you want to be added to the beta
cc @blazejkustra
Fixed Issues
N/A
Part of #56988
Tests
newDotHelpSidePanel, or part of all betasOffline tests
N/A
QA Steps
*expensifail.comaccountPR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop