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

Use SearchRouter everywhere and drop Chat finder #49984

Merged

Conversation

Kicu
Copy link
Contributor

@Kicu Kicu commented Oct 1, 2024

Details

  • this PR adds the new SearchButton everywhere, replacing old ChatFinder page
  • <SearchRouter> is not a separate Page/Screen but rather just a plain react component that is displayed in a modal and accessible from almost every page in the App
  • everything related to ChatFinder is removed, and two e2e tests are rewritten to test the new SearchRourter component
    • While SearchRouter is doing much more than old ChatFinder, the logic within router that searches rooms is directly copied from ChatFinder - so I hope old test cases and patterns still make sense
    • I have not added any more tests scenarios because the main thing search router is doing I don't expect to be very heavy; we might want to add some scenarios in future once Search v2.5 has autocomplete in place
  • please ignore failing Changed files ESLint check because I touched AuthScreens which should be migrated in a dedicated PR

Fixed Issues

$ #49123
PROPOSAL:

Tests

  • verify that the icon to open Search is available on every page and opens router when pressed
  • verify that using shortcut cmd + k opens router
  • check that e2e tests still make sense

Offline tests

QA Steps

  • verify that the icon to open Search is available on every page and opens router when pressed
  • verify that using shortcut cmd + k opens router

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
rec-router-andr.mp4
Android: mWeb Chrome
iOS: Native
rec-router-ios-mweb.mp4
iOS: mWeb Safari
rec-router-ios.mp4
MacOS: Chrome / Safari
rec-router-web-1.mp4
rec-router-web-2.mp4
MacOS: Desktop

@Kicu Kicu force-pushed the kicu/49123-search-24-cleanup branch 5 times, most recently from ac5ce3f to eaaeb5e Compare October 2, 2024 14:34
@Kicu Kicu force-pushed the kicu/49123-search-24-cleanup branch 2 times, most recently from 9b35717 to 977bbb5 Compare October 4, 2024 10:00
@Kicu Kicu force-pushed the kicu/49123-search-24-cleanup branch from aba32d3 to 078420e Compare October 4, 2024 13:40
@Kicu Kicu marked this pull request as ready for review October 4, 2024 13:49
@Kicu Kicu requested a review from a team as a code owner October 4, 2024 13:49
Copy link

melvin-bot bot commented Oct 4, 2024

@rayane-djouah 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 removed the request for review from a team October 4, 2024 13:49
@Kicu
Copy link
Contributor Author

Kicu commented Oct 4, 2024

@luacmartins @rayane-djouah This PR enables it all: takes off the Permission check for isDev and turns on SearchRouter everywhere including on cmd+k shortcut. However I'm going OOO for the next week and will be back 14 October.

Meanwhile if there are problems or deploy blockers then @SzymczakJ should be able to help with those.

I understand that we might notice some more bugs since probably now it will be tested more heavily 😅

@Kicu
Copy link
Contributor Author

Kicu commented Oct 4, 2024

CC @adhorodyski if you mind taking a look at the file tests/perf-test/SearchRouter.perf-test.tsx in which there are old file ChatFinder reassure tests rewritten to new component. The tests were passing on my local dev setup, but I'd like to now if they make sense :)

@luacmartins luacmartins self-requested a review October 4, 2024 14:16
@luacmartins
Copy link
Contributor

Nice! Really excited about this one.

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.

BUG: Pressing cmd + k with the modal open closes the modal and reopens it

  1. Press cmd + k to open the modal
  2. With the modal open, press cmd + k again
  3. Note that the modal closes and reopens

Expected behavior: the modal should just close if it is already open

@luacmartins luacmartins requested a review from a team October 4, 2024 15:04
@luacmartins
Copy link
Contributor

@Expensify/design I kicked off an adhoc build and would love your eyes on this one.

@luacmartins
Copy link
Contributor

luacmartins commented Oct 4, 2024

Should the modal have the same top margin as the search bar?
Screenshot 2024-10-04 at 9 02 59 AM

Oh actually, I think the search bar has the wrong top margin

luacmartins
luacmartins previously approved these changes Oct 15, 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! Gonna ask the product team to test as well before we get it merged

Copy link
Contributor

@shawnborton
Copy link
Contributor

Chiming in way late here but I'm back from OOO!

When you type text into the input, can we make sure the text uses our normal text color? Right now it's in text supporting which is wrong:
CleanShot 2024-10-15 at 17 55 21@2x

Also question for the @Expensify/design team - what height should the Recent searches be?
CleanShot 2024-10-15 at 17 56 18@2x

I think they are 44px tall right now, but wondering if we should make them 52px to match our button/LHN row sizes?

@shawnborton
Copy link
Contributor

Similar comment - when you actually have text into the input that displays above the table, we should update the text color here too:
CleanShot 2024-10-15 at 17 57 21@2x

And when it's focused, we should use the same lighter BG that the router uses as well:
CleanShot 2024-10-15 at 17 57 47@2x

@dannymcclain
Copy link
Contributor

I think they are 44px tall right now, but wondering if we should make them 52px to match our button/LHN row sizes?

Definitely down to try 52px for the height consistency and see how that feels. And if that feels uncomfortably big, we could go down to 40px to match medium button heights? Maybe?

@luacmartins
Copy link
Contributor

luacmartins commented Oct 15, 2024

I'll take care of the changes to the search router input in this PR since the changes won't conflict with the ones in this PR. Also, this is what the recent searches using height: 52px look like. It seems like a lot of empty space to me.

Screenshot 2024-10-15 at 12 36 52 PM

@dubielzyk-expensify
Copy link
Contributor

Saw that we brought this to Slack, but don't think 52px is bad at all. That being said, I think the other alignment fixes are more important than the height

@luacmartins
Copy link
Contributor

@Kicu @SzymczakJ we have conflicts

@Kicu
Copy link
Contributor Author

Kicu commented Oct 16, 2024

Conflicts solved.

I have a question, will be merging this PR soon or will we be holding up until autocomplete features are on?
Because if we want to wait we could keep the Permission code in this PR but still merge it to main, so that we avoid thounsands of merge commits in here

@luacmartins luacmartins merged commit 4a25c36 into Expensify:main Oct 16, 2024
18 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.

Copy link
Contributor

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

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

@MonilBhavsar
Copy link
Contributor

Looks like a minor regression came out of this PR. Would be great if anyone can make a quick fix #50977

@Kicu
Copy link
Contributor Author

Kicu commented Oct 17, 2024

I will take a look at this @MonilBhavsar

Copy link
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.0.50-8 🚀

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

@@ -173,8 +180,12 @@ function SearchRouterList(
ListItem={SearchRouterItem}
containerStyle={[styles.mh100]}
sectionListStyle={[isSmallScreenWidth ? styles.ph5 : styles.ph2, styles.pb2]}
listItemWrapperStyle={[styles.pr3, styles.pl3]}
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, this caused the following issue: #52158
We need to apply the padding to the pressable instead of the wrapper View.
More details can be found in this proposal: #52158 (comment)

true,
true,
);
Session.checkIfActionIsAllowed(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to prevent the modal from showing during the onboarding process. Ref: #50981

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.