Skip to content
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

Add Share page for Workspace Profile #36907

Merged

Conversation

narefyev91
Copy link
Contributor

@narefyev91 narefyev91 commented Feb 20, 2024

Details

A new Share page for Workspace Profile

Fixed Issues

$ #36250
PROPOSAL: #36250

Tests

  1. Open Workspace profile page as an Workspace admin
  2. Verify that you can see Share button in the bottom of the Profile page
  3. Click on Share button
  4. Verify that a new page is shown with QR code, Copy and Download (only for native apps) functionality
  5. Verify that Copy, Download (only for native apps) is working
  6. Verify that QR code working as well

For user which is not an admin of the workspace:

  1. Open Workspace profile page as an regular user
  2. Verify that Share button is not visible
  • Verify that no errors appear in the JS console

Offline tests

  1. Open Workspace profile page as an Workspace admin
  2. Verify that you can see Share button in the bottom of the Profile page
  3. Click on Share button
  4. Verify that a new page is shown with QR code, Copy and Download (only for native apps) functionality
  5. Verify that Copy, Download (only for native apps) is working
  6. Verify that QR code working as well

For user which is not an admin of the workspace:

  1. Open Workspace profile page as an regular user
  2. Verify that Share button is not visible

QA Steps

  1. Open Workspace profile page as an Workspace admin
  2. Verify that you can see Share button in the bottom of the Profile page
  3. Click on Share button
  4. Verify that a new page is shown with QR code, Copy and Download (only for native apps) functionality
  5. Verify that Copy, Download (only for native apps) is working
  6. Verify that QR code working as well

For user which is not an admin of the workspace:

  1. Open Workspace profile page as an regular user
  2. Verify that Share button is not visible
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
android.mov
Android: mWeb Chrome
android-web.mov

android-not-admin

iOS: Native
ios.mov
iOS: mWeb Safari
ios-web.mov
MacOS: Chrome / Safari
web.mov
Screenshot 2024-02-21 at 14 56 14
MacOS: Desktop
desktop.mov

@narefyev91 narefyev91 marked this pull request as ready for review February 21, 2024 13:06
@narefyev91 narefyev91 requested a review from a team as a code owner February 21, 2024 13:06
@melvin-bot melvin-bot bot removed the request for review from a team February 21, 2024 13:06
Copy link

melvin-bot bot commented Feb 21, 2024

@aimane-chnaif 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]

@melvin-bot melvin-bot bot requested a review from aimane-chnaif February 21, 2024 13:06
@luacmartins luacmartins self-requested a review February 21, 2024 17:49
Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, a few observations:

  1. The Share button styles seem a bit off. It should have a fixed height of 40px. It currently has no hover style, as well.
  2. The QR code has a Section component, which is adding a background color and title that are not in the mocks
  3. The download button is missing

@Expensify/design would love your eyes on this one, since it seems like the Share code page in the design doc has a different style from the share code pages for the profile and rooms pages. One known issue is that we're not rendering the default workspace icon in the middle of the QR code. That'll be handled once this issue is done

src/pages/workspace/WorkspaceProfileSharePage.tsx Outdated Show resolved Hide resolved
src/pages/workspace/download/index.tsx Outdated Show resolved Hide resolved
@luacmartins
Copy link
Contributor

I kicked off an adhoc build for design to take a look at

@shawnborton
Copy link
Contributor

Yeah, check this thread here - we were working with @kosmydel to revert the share page that opens up in the RHP to look more like it did before - so basically no illustrated header, no h2 header, and no padded card style for the QR code.

Just want to make sure we aren't doubling up work or stepping on toes.

Also, what's up with the dark empty state image on top of the workspace info card?

@luacmartins
Copy link
Contributor

Ah cool, so those should be more aligned with this one then. This is a brand new page, so there shouldn't be any duplicated effort here.

src/pages/workspace/WorkspaceProfilePage.js Outdated Show resolved Hide resolved
src/pages/workspace/WorkspaceProfileSharePage.tsx Outdated Show resolved Hide resolved
src/pages/workspace/WorkspaceProfileSharePage.tsx Outdated Show resolved Hide resolved
src/pages/workspace/download/index.native.tsx Outdated Show resolved Hide resolved
@shawnborton
Copy link
Contributor

This is a brand new page, so there shouldn't be any duplicated effort here.

Well, the whole point is that the pages look identical no matter if it's a user or a workspace, etc. Isn't there some kind of component we should create for that then? Otherwise it seems like we are doubling or tripling the work and making it harder to maintain these views.

@luacmartins
Copy link
Contributor

Well, the whole point is that the pages look identical no matter if it's a user or a workspace, etc. Isn't there some kind of component we should create for that then? Otherwise it seems like we are doubling or tripling the work and making it harder to maintain these views.

Yes, we can extract this into a reusable component. @kosmydel do we already have one for this page, or should we create one?

This comment has been minimized.

@narefyev91
Copy link
Contributor Author

@luacmartins @aimane-chnaif updated everything based on the comments
Simulator Screenshot - iPhone 15 Pro - 2024-02-21 at 23 54 10
Screenshot 2024-02-21 at 23 53 11
Simulator Screenshot - iPhone 15 Pro - 2024-02-21 at 23 53 00

luacmartins
luacmartins previously approved these changes Feb 21, 2024
Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @narefyev91 can you merge main to fix the TS error?

@kosmydel since you're refactoring the share code pages, this page already have the correct design, would you mind extracting it into a separate component and making it reusable to profile, room share codes as part of your issue?

Copy link
Contributor

🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪

Android 🤖 iOS 🍎
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/36907/index.html ❌ FAILED ❌
Android The QR code can't be generated, because the iOS build failed
Desktop 💻 Web 🕸️
https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/36907/NewExpensify.dmg https://36907.pr-testing.expensify.com
Desktop Web

👀 View the workflow run that generated this build 👀

@aimane-chnaif
Copy link
Contributor

Layout glitch on first QR Code page load. This also happens on existing QR Code page so out of scope

Screen.Recording.2024-02-22.at.2.33.51.PM.mov

@narefyev91
Copy link
Contributor Author

narefyev91 commented Feb 22, 2024

Problem here - that Icon component which used inside Button - just have a prop small={small}
{icon && ( <View style={[styles.mr1, iconStyles]}> <Icon src={icon} fill={iconFill ?? (success || danger ? theme.textLight : theme.icon)} small={small} /> </View> )}
And small is the size of the button - which agreed to have 'medium' @shawnborton @aimane-chnaif
In that case - we either need to introduce a new prop for size of Icon and refactoring all Button component usage or add props for direct width and height of Icon and pass them
Small icon is not expected to be in a medium button

@narefyev91
Copy link
Contributor Author

It does look a little tight, but in our Figma components the gap is 4px, so it's hard to tell.

I think if it's already using the standard button component with the standard icon prop we should roll with it. We can always update that gap globally if we want to (at some point).

Spacing is correct to the right side - 4px
Screenshot 2024-02-22 at 16 44 33

@narefyev91
Copy link
Contributor Author

This is how it looks with medium button size @shawnborton @dannymcclain
Screenshot 2024-02-22 at 16 46 13

@shawnborton
Copy link
Contributor

I think this is a good opportunity to get the button styles working exactly as we intend them to from Figma, even if they are global changes. I say let's make it look exactly as we want it to here.

@dannymcclain
Copy link
Contributor

Ok interesting. The medium button should use an icon that is 16x16px. Obviously what you're showing there is 20x20px.

@shawnborton Do you want me to try to work on a write-up of the ideal button styles, or are you on that?

@shawnborton
Copy link
Contributor

I haven't started anything, so if you don't mind, that would be wonderful. Thanks Danny!

@dannymcclain
Copy link
Contributor

dannymcclain commented Feb 22, 2024

@shawnborton I knew I was going to do it and already started 😆

@narefyev91
Copy link
Contributor Author

narefyev91 commented Feb 22, 2024

@shawnborton @luacmartins @aimane-chnaif Introduced a new prop for icon in button component. No one definitely used such combination yet medium button + small icon - in that case no visual regressions should be happened. And we can move forward here. Now medium button + small icon(16x16)
Screenshot 2024-02-22 at 17 45 28

@shawnborton
Copy link
Contributor

I don't think we want any kind of prop for if the icon is small or not. I think we are just going to give you the new value at which all icons should be for medium sized buttons, as well as the correct spacing. All of our buttons are global components and we are comfortable with this being a global change.

@@ -241,7 +245,7 @@ function Button(
<Icon
src={icon}
fill={iconFill ?? (success || danger ? theme.textLight : theme.icon)}
small={small}
small={isIconSmall}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visual regression can happen when small button + icon because isIconSmall is not passed

<Button
small
innerStyles={[styles.arrowIcon]}
icon={Expensicons.BackArrow}
iconFill={theme.text}

Please test arrow buttons in attachment carousel

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left this comment elsewhere but I don't think we want this kind of prop here... we just want to globally change the size of icons in these buttons, I think at least... Danny will confirm!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will rollback that

@narefyev91
Copy link
Contributor Author

I don't think we want any kind of prop for if the icon is small or not. I think we are just going to give you the new value at which all icons should be for medium sized buttons, as well as the correct spacing. All of our buttons are global components and we are comfortable with this being a global change.

Ok cool - we have 3 kind of sizes of buttons - large, medium, small - just will wait for icon size, space and etc. Should we do it in the scope of the current ticket? or in the new GH issue?

@aimane-chnaif
Copy link
Contributor

I don't think we want any kind of prop for if the icon is small or not. I think we are just going to give you the new value at which all icons should be for medium sized buttons, as well as the correct spacing. All of our buttons are global components and we are comfortable with this being a global change.

Can we do that in a separate PR? And merge current version (without icon in button) as is?

@dannymcclain
Copy link
Contributor

Can we do that in a separate PR? And merge current version (without icon in button) as is?

That works for me. Please tag me (and @Expensify/design) in that so that I can add the design specifications and such on there!

@luacmartins
Copy link
Contributor

luacmartins commented Feb 22, 2024

Issue to add icon here. Thanks for the speedy reviews everyone!

@luacmartins luacmartins merged commit 8c17a70 into Expensify:main Feb 22, 2024
15 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@kosmydel
Copy link
Contributor

Hey, I was OOO.

Is there still anything that we have to change in Share Code screen or is everything alright?

cc @luacmartins

@luacmartins
Copy link
Contributor

@kosmydel are we creating a reusable component for all the share code pages? If so, we need to make sure to update the ShareCode page for workspace profile too.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/luacmartins in version: 1.4.44-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@kosmydel
Copy link
Contributor

@kosmydel are we creating a reusable component for all the share code pages? If so, we need to make sure to update the ShareCode page for workspace profile too.

The only thing I've changed recently is the position of the ShareCodePage from central pane to the RHP.

I believe, that it is already reusable. For instance, the ReportDetailsShareCodePage component uses the same ShareCode component. The WorkspaceProfileSharePage probably should follow the same pattern.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.44-13 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants