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

Display Quick Action Button #38669

Merged
merged 55 commits into from
Mar 25, 2024
Merged

Display Quick Action Button #38669

merged 55 commits into from
Mar 25, 2024

Conversation

Gonals
Copy link
Contributor

@Gonals Gonals commented Mar 20, 2024

Details

Fixed Issues

$ #38050
PROPOSAL:

Tests

Let's do this!

  1. Log into newDot from a new account
  2. Open the Global Create menu. Confirm no additional item is displayed:
Screenshot 2024-03-20 at 3 28 53 PM
  1. Request Money (manual) from someone
  2. After completing the request, confirm it displays as a quick action in the Global create menu:
Screenshot 2024-03-20 at 3 29 46 PM
  1. Confirm You can complete the request from the quickAction, and that it points to the same user the original request did.
  2. Repeat the same steps, but requesting with a receipt:
Screenshot 2024-03-20 at 3 32 46 PM
  1. And again, but with distance:
Screenshot 2024-03-20 at 3 33 29 PM
  1. Confirm all of them work for Money requests from workspaces too:
Screenshot 2024-03-20 at 11 27 55 AM
  1. Confirm all of them work for Split requests too.
  2. Send money to someone and, again, confirm it later displays as a a quick action and that it works:
Screenshot 2024-03-20 at 3 36 26 PM
  1. Assign a task to someone and confirm it later displays as a a quick action and that it works:
Screenshot 2024-03-20 at 3 40 48 PM
  • Verify that no errors appear in the JS console

Offline tests

Same, but offline

QA Steps

Same as tests

  • 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 either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • 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 UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design 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 Screenshot 2024-03-20 at 5 19 53 PM
Android: mWeb Chrome
iOS: Native Screenshot 2024-03-20 at 5 41 48 PM
iOS: mWeb Safari
MacOS: Chrome / Safari Screenshot 2024-03-20 at 4 44 30 PM
MacOS: Desktop Screenshot 2024-03-20 at 4 57 08 PM

@Gonals Gonals self-assigned this Mar 20, 2024
@Gonals Gonals requested a review from a team as a code owner March 20, 2024 12:59
@melvin-bot melvin-bot bot requested review from rlinoz and removed request for a team March 20, 2024 13:00
Copy link

melvin-bot bot commented Mar 20, 2024

@rlinoz 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]

src/languages/es.ts Outdated Show resolved Hide resolved
Comment on lines +378 to +380
personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
},
Copy link
Member

Choose a reason for hiding this comment

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

Let's use the hook for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, my bad. This is fine. I thought that this is current user's details which has a hook.

@trjExpensify
Copy link
Contributor

@shawnborton @dannymcclain @dubielzyk-expensify anyoneee wanna' take the quick action button for a spin?

@shawnborton
Copy link
Contributor

Looks good to me! Can you confirm why we have different avatars for the workspace requests though?

@shawnborton
Copy link
Contributor

Also, why isn't the truncation here using an ellipsis? Or is the username just "a"?
CleanShot 2024-03-25 at 11 28 30@2x

@Gonals
Copy link
Contributor Author

Gonals commented Mar 25, 2024

Also, why isn't the truncation here using an ellipsis? Or is the username just "a"? CleanShot 2024-03-25 at 11 28 30@2x

The username is a 🤣

@Gonals
Copy link
Contributor Author

Gonals commented Mar 25, 2024

Looks good to me! Can you confirm why we have different avatars for the workspace requests though?

Yep:

Screenshot 2024-03-25 at 4 37 52 PM

@shawnborton
Copy link
Contributor

Right, I'm saying, why is that avatar where it's just the workspace icon different from how it is displayed in the "Send to" field as well as the LHN item for it?

@Gonals
Copy link
Contributor Author

Gonals commented Mar 25, 2024

Right, I'm saying, why is that avatar where it's just the workspace icon different from how it is displayed in the "Send to" field as well as the LHN item for it?

I'm not quite sure I'm following. It looks like the mockups in the design (I think), and, as far as I can tell, it looks like the workspace avatar in the LHN (minus the user's own avatar as a subscript)

@shawnborton
Copy link
Contributor

(minus the user's own avatar as a subscript)

Yes, this is the exact point I am trying to make. Why are we choosing a different avatar for the quick action button? I would think that we should use the identical icon that we use for sending something to a workspace chat, which happens to include the subscript avatar. @trjExpensify do you agree?

@Gonals
Copy link
Contributor Author

Gonals commented Mar 25, 2024

(minus the user's own avatar as a subscript)

Yes, this is the exact point I am trying to make. Why are we choosing a different avatar for the quick action button? I would think that we should use the identical icon that we use for sending something to a workspace chat, which happens to include the subscript avatar. @trjExpensify do you agree?

I'm fine with that 🤷
Screenshot 2024-03-25 at 5 32 50 PM

@shawnborton
Copy link
Contributor

Cool, I think it makes sense to be consistent here - basically if we are choosing to show that kind of avatar when you send an expense, we should reuse the same exact one from the shortcut menu too. So that looks good to me given we use that icon style everywhere else.

@Gonals
Copy link
Contributor Author

Gonals commented Mar 25, 2024

Neat. All yours @rlinoz!

@Gonals
Copy link
Contributor Author

Gonals commented Mar 25, 2024

Are we good to merge @shawnborton?

@shawnborton
Copy link
Contributor

I think so, yup

case CONST.QUICK_ACTIONS.ASSIGN_TASK:
return 'quickAction.assignTask';
default:
return '';
Copy link
Contributor

Choose a reason for hiding this comment

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

To avoid crashes (even if we've missed some action type), we should have added some default fallback key here instead of an empty string. This caused #38972

@Gonals Gonals restored the alberto-qab branch April 11, 2024 16:14
return avatars.length <= 1 || ReportUtils.isPolicyExpenseChat(quickActionReport) ? avatars : _.filter(avatars, (avatar) => avatar.id !== props.session.accountID);
}
return [];
}, [props.personalDetails, props.session.accountID, quickActionReport]);
Copy link
Contributor

Choose a reason for hiding this comment

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

We were missing policy in the dependencies here, which caused #39045 where the avatar was not kept in sync if the workspace's avatar changed.

@@ -80,6 +144,47 @@ function FloatingActionButtonAndPopover(props) {

const prevIsFocused = usePrevious(props.isFocused);

const quickActionReport = useMemo(() => (props.quickAction ? ReportUtils.getReport(props.quickAction.chatReportID) : 0), [props.quickAction]);
Copy link
Contributor

Choose a reason for hiding this comment

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

This line created a bug where the icon and group name is not updated correctly. More details here #40536

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.

10 participants