-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add const / permissions function for help side panel beta #58751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.com
accountPR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop