Skip to content

Add RBR/GBR chat and Account switcher tooltips#58540

Merged
MarioExpensify merged 35 commits intoExpensify:mainfrom
rayane-d:Add-RBRorGBR-and-Account-switcher-tooltips
May 1, 2025
Merged

Add RBR/GBR chat and Account switcher tooltips#58540
MarioExpensify merged 35 commits intoExpensify:mainfrom
rayane-d:Add-RBRorGBR-and-Account-switcher-tooltips

Conversation

@rayane-d
Copy link
Contributor

@rayane-d rayane-d commented Mar 17, 2025

Explanation of Change

  • [ADD] RBR/GBR chat: 💡You’ll see :large_green_circle: on actions to take, and 🔴 on errors to review.
    Priority 1900
    Conditions: role = All, the user can see a chat with a green or red dot (RBR or GBR)
  • [ADD] Account switcher/copilot access: 💡Access your copilot accounts here
    Priority 1600
    Conditions: role = All, when a user is or becomes a copilot for another account and navigates to Account/Settings page for the first time

Fixed Issues

$ #57045

The changes for the issue are divided into multiple PRs, as outlined in this comment: #57045 (comment)

Tests

  1. Create a new account A and start some chats
  2. Verify that a tooltip is displayed for one of the reports in LHN that have RBR/GBR
  3. Login with another account B
  4. Add the first account A as a copilot
  5. In account A go to settings and verify that a tooltip is displayed for the account switcher
  • Verify that no errors appear in the JS console

Offline tests

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 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 used JaimeGPT to get English > Spanish translation. I then posted it 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.ts 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.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • 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_1742174763
Screenshot_1742311733

Android: mWeb Chrome

Screenshot_1742174711
Screenshot_1742311448

iOS: Native

simulator_screenshot_E56DE5C7-C2CB-4330-88D4-75D43C8E06AA
Simulator Screenshot - iPhone 15 Pro Max - 2025-03-18 at 16 32 42

iOS: mWeb Safari

simulator_screenshot_575165AC-321F-45D7-BF17-CFA19966EA71
Simulator Screenshot - iPhone 15 Pro Max - 2025-03-18 at 16 29 34

MacOS: Chrome / Safari Screenshot 2025-03-17 at 2 22 13 AM Screenshot 2025-03-18 at 4 18 40 PM
MacOS: Desktop Screenshot 2025-03-17 at 2 25 53 AM Screenshot 2025-03-18 at 4 21 57 PM

@rayane-d rayane-d marked this pull request as ready for review March 18, 2025 15:32
@rayane-d rayane-d requested review from a team as code owners March 18, 2025 15:32
@melvin-bot melvin-bot bot requested review from ishpaul777 and removed request for a team March 18, 2025 15:33
@melvin-bot
Copy link

melvin-bot bot commented Mar 18, 2025

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

@shawnborton
Copy link
Contributor

Screenshots seem good to me 👍

@dannymcclain
Copy link
Contributor

Looking good to me too 👍

@github-actions
Copy link
Contributor

🚧 @puneetlath has triggered a test app build. You can view the workflow run here.

@github-actions
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/58540/index.html https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/58540/index.html
Android iOS
Android Hybrid 🤖🔄 iOS Hybrid 🍎🔄
Android Hybrid iOS Hybrid
Desktop 💻 Web 🕸️
❌ FAILED ❌ ❌ FAILED ❌
The QR code can't be generated, because the Desktop build failed The QR code can't be generated, because the Web build failed

👀 View the workflow run that generated this build 👀

@ishpaul777
Copy link
Contributor

bug tooltip does not show when navigate to search and navigate back

Screen.Recording.2025-03-20.at.1.19.35.AM.mov

@ishpaul777
Copy link
Contributor

@rayane-d kind bump! ^

also we have conflicts

@rayane-d
Copy link
Contributor Author

bug tooltip does not show when navigate to search and navigate back

I think this will be fixed in PR #58965, Can you please confirm?

@rayane-d rayane-d mentioned this pull request Mar 25, 2025
50 tasks
@ishpaul777
Copy link
Contributor

reviewing again

@ishpaul777
Copy link
Contributor

looks like tooltip is pointing to avatar instead of the RBR/GBR

Screenshot 2025-03-26 at 1 03 01 AM

@ishpaul777
Copy link
Contributor

@rayane-d whats the status here

@rayane-d rayane-d marked this pull request as ready for review May 1, 2025 00:44
@rayane-d
Copy link
Contributor Author

rayane-d commented May 1, 2025

@ishpaul777 This is ready for review :)

@melvin-bot melvin-bot bot requested a review from MarioExpensify May 1, 2025 15:07
@rayane-d
Copy link
Contributor Author

rayane-d commented May 1, 2025

@MarioExpensify all yours!

@MarioExpensify
Copy link
Contributor

@Expensify/design can I get a design review here in @rayane-d's screenshots? 😄

@rayane-d
Copy link
Contributor Author

rayane-d commented May 1, 2025

@MarioExpensify I think the design was already approved in #58540 (comment) and #58540 (comment)

@MarioExpensify
Copy link
Contributor

Oh, you are right. Sorry about that, thought we had a different one here.

Copy link
Contributor

@MarioExpensify MarioExpensify left a comment

Choose a reason for hiding this comment

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

@rayane-d I've left a bunch of suggestions just to fix the spelling of RBR and GBR. Please take a look if there are no other changes required similar to these ones.

onLayout?: (event: LayoutChangeEvent) => void;

/** Whether to show the educational tooltip for the GBR or RBR */
shouldShowRBRorGPRTooltip: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
shouldShowRBRorGPRTooltip: boolean;
shouldShowRBRorGBRTooltip: boolean;

onLayout?: (event: LayoutChangeEvent) => void;

/** Whether to show the educational tooltip on the GBR or RBR */
shouldShowRBRorGPRTooltip: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
shouldShowRBRorGPRTooltip: boolean;
shouldShowRBRorGBRTooltip: boolean;

}
const lastMessageTextFromReport = getLastMessageTextForReport(itemFullReport, lastActorDetails, itemPolicy, itemReportNameValuePairs);

const shouldShowRBRorGPRTooltip = firstReportIDWithGBRorRGR === reportID;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const shouldShowRBRorGPRTooltip = firstReportIDWithGBRorRGR === reportID;
const shouldShowRBRorGBRTooltip = firstReportIDWithGBRorRBR === reportID;

hasDraftComment={hasDraftComment}
transactionViolations={transactionViolations}
onLayout={onLayoutItem}
shouldShowRBRorGPRTooltip={shouldShowRBRorGPRTooltip}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
shouldShowRBRorGPRTooltip={shouldShowRBRorGPRTooltip}
shouldShowRBRorGBRTooltip={shouldShowRBRorGBRTooltip}

const isWebOrDesktop = platform === CONST.PLATFORM.WEB || platform === CONST.PLATFORM.DESKTOP;

const {shouldShowProductTrainingTooltip} = useProductTrainingContext(CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GBR_RBR_CHAT, true);
const firstReportIDWithGBRorRGR = useMemo(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const firstReportIDWithGBRorRGR = useMemo(() => {
const firstReportIDWithGBRorRBR = useMemo(() => {

return {
tooltipToRender: tooltip,
shouldShowTooltip: shouldShowTooltips && shouldTooltipBeVisible,
shouldTooltipBeLeftAligned: shouldShowWorkspaceChatTooltip && !shouldShowRBRorGPRTooltip && !shouldShowGetStartedTooltip,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
shouldTooltipBeLeftAligned: shouldShowWorkspaceChatTooltip && !shouldShowRBRorGPRTooltip && !shouldShowGetStartedTooltip,
shouldTooltipBeLeftAligned: shouldShowWorkspaceChatTooltip && !shouldShowRBRorGBRTooltip && !shouldShowGetStartedTooltip,

shouldShowTooltip: shouldShowTooltips && shouldTooltipBeVisible,
shouldTooltipBeLeftAligned: shouldShowWorkspaceChatTooltip && !shouldShowRBRorGPRTooltip && !shouldShowGetStartedTooltip,
};
}, [shouldShowRBRorGPRTooltip, shouldShowGetStartedTooltip, shouldShowWorkspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isReportsSplitNavigatorLast, isFullscreenVisible]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}, [shouldShowRBRorGPRTooltip, shouldShowGetStartedTooltip, shouldShowWorkspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isReportsSplitNavigatorLast, isFullscreenVisible]);
}, [shouldShowRBRorGBRTooltip, shouldShowGetStartedTooltip, shouldShowWorkspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isReportsSplitNavigatorLast, isFullscreenVisible]);

let tooltip: ProductTrainingTooltipName = shouldShowGetStartedTooltip
? CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCIERGE_LHN_GBR
: CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP;
if (shouldShowRBRorGPRTooltip) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (shouldShowRBRorGPRTooltip) {
if (shouldShowRBRorGBRTooltip) {

if (shouldShowRBRorGPRTooltip) {
tooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GBR_RBR_CHAT;
}
const shouldShowTooltips = shouldShowRBRorGPRTooltip || shouldShowWorkspaceChatTooltip || shouldShowGetStartedTooltip;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const shouldShowTooltips = shouldShowRBRorGPRTooltip || shouldShowWorkspaceChatTooltip || shouldShowGetStartedTooltip;
const shouldShowTooltips = shouldShowRBRorGBRTooltip || shouldShowWorkspaceChatTooltip || shouldShowGetStartedTooltip;

style,
onLayout = () => {},
hasDraftComment,
shouldShowRBRorGPRTooltip,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
shouldShowRBRorGPRTooltip,
shouldShowRBRorGBRTooltip,

@rayane-d rayane-d requested a review from MarioExpensify May 1, 2025 19:24
@MarioExpensify MarioExpensify merged commit d34cd6b into Expensify:main May 1, 2025
16 checks passed
@OSBotify
Copy link
Contributor

OSBotify commented May 1, 2025

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

@rayane-d rayane-d deleted the Add-RBRorGBR-and-Account-switcher-tooltips branch May 1, 2025 20:15
@github-actions
Copy link
Contributor

github-actions bot commented May 1, 2025

🚀 Deployed to staging by https://github.com/MarioExpensify in version: 9.1.39-1 🚀

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

@github-actions
Copy link
Contributor

github-actions bot commented May 6, 2025

🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.1.39-8 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 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.

8 participants