-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Search v2.3] [App] Implement Saved Search feature #48566
Conversation
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.0.35-0 🚀
|
@@ -247,7 +256,7 @@ function PopoverMenu({ | |||
restoreFocusType={restoreFocusType} | |||
> | |||
<FocusTrapForModal active={isVisible}> | |||
<View style={isSmallScreenWidth ? {} : styles.createMenuContainer}> | |||
<ScrollView style={isSmallScreenWidth ? {} : styles.createMenuContainer}> |
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.
We are looking to do something similar here but we want the scrollview to exclude the title (title should be fixed). We will move this ScrollView to wrap only currentMenuItems
. Let us know if you see a reason not to do so.
🚀 Deployed to production by https://github.com/grgia in version: 9.0.35-7 🚀
|
SearchActions.saveSearch({ | ||
queryJSON, | ||
}); | ||
|
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.
We've ended up adding additional logic – to show the educational tooltip only if we're saving the first search: #49473
const baseMenuItem: SavedSearchMenuItem = { | ||
key, | ||
title: item.name, | ||
hash: key, | ||
query: item.query, | ||
shouldShowRightComponent: true, | ||
focused: Number(key) === hash, | ||
onPress: () => { | ||
SearchActions.clearAllFilters(); | ||
Navigation.navigate(ROUTES.SEARCH_CENTRAL_PANE.getRoute({query: item?.query ?? ''})); | ||
}, | ||
rightComponent: ( | ||
<ThreeDotsMenu | ||
menuItems={getOverflowMenu(item.name, Number(key), item.query)} | ||
anchorPosition={{horizontal: 0, vertical: 380}} | ||
anchorAlignment={{ | ||
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT, | ||
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, | ||
}} | ||
/> | ||
), | ||
styles: [styles.alignItemsCenter], | ||
}; |
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.
); | ||
})} | ||
</View> | ||
{savedSearches && Object.keys(savedSearches).length > 0 && ( |
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.
We need to filter out the pending action here, link to the issue: #51028
SearchActions.deleteSavedSearch(hashToDelete); | ||
setIsDeleteModalVisible(false); | ||
SearchActions.clearAdvancedFilters(); | ||
Navigation.navigate( |
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.
We need to trigger dismissModal
before navigating to SEARCH_CENTRAL_PANE
, coming from #49943
|
||
SearchActions.saveSearch({ | ||
queryJSON, | ||
name: newName, |
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.
✋ Coming from #50225
The newName
state can be filled with an empty string and the BE will fall back to the query. So we doing something but in the FE newName?.trim() || q
, this will make the saveSearch
offline work.
</View> | ||
{savedSearches && Object.keys(savedSearches).length > 0 && ( | ||
<> | ||
<ScrollView>{renderSavedSearchesSection(savedSearchesMenuItems())}</ScrollView> |
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.
We only wrapped the saved search list with a scroll view, so it's only the saved search that was scrollable, But the design team expected that the whole menu to be scrollable, I don't have access to design doc to determine if this was expected or a missed case. But this caused #52910
Details
Video test for desktop:
Screen.Recording.2024-09-09.at.16.01.22.mov
Translations have been asked here
Note: I've decided to fix all the frontend issues in one PR, since all of them are tightly intertwined.
Fixed Issues
$ #48453
$ #48454
$ #48458
$ #48457
$ #48455
Tests
Saving a New Search
Renaming a Saved Search
Deleting a Saved Search
Viewing and Saving Filtered Results
Creating Multiple Saved Searches
Accessing Saved Searches
Review the Search Results
Offline tests
NA
QA Steps
QA Steps
Same as in tests
PR Author Checklist
I linked the correct issue in the
### Fixed Issues
section aboveI wrote clear testing steps that cover the changes made in this PR
Tests
sectionOffline steps
sectionQA steps
sectionI included screenshots or videos for tests on all platforms
I ran the tests on all platforms & verified they passed on:
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)
toggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedIf 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 usingAvatar
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:
If a new CSS style is added I verified that:
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 thatAvatar
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:
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 theTest
steps.I verified that similar component doesn't exist in the codebase
I verified that all props are defined accurately and each prop has a
/** comment above it */
I verified that each file is named correctly
I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
I verified that the only data being stored in component state is data necessary for rendering and nothing else
In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
For Class Components, any internal methods passed to components event handlers are bound to
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)I verified that component internal methods bound to
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)I verified that all JSX used for rendering exists in the render method
I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
I verified that similar component doesn't exist in the codebase
I verified that all props are defined accurately and each prop has a
/** comment above it */
I verified that each file is named correctly
I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
I verified that the only data being stored in component state is data necessary for rendering and nothing else
In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
For Class Components, any internal methods passed to components event handlers are bound to
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)I verified that component internal methods bound to
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)I verified that all JSX used for rendering exists in the render method
I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
Screenshots/Videos
Android: Native
Screen.Recording.2024-09-10.at.11.55.03.mov
Android: mWeb Chrome
Screen.Recording.2024-09-10.at.12.00.37.mov
iOS: Native
iOS: mWeb Safari
Screen.Recording.2024-09-10.at.10.54.54.mov
MacOS: Chrome / Safari
Screen.Recording.2024-09-09.at.16.01.22.mov
MacOS: Desktop
Screen.Recording.2024-09-10.at.11.59.15.mov