[Search v2] [App] Create search results page#45409
Conversation
Kicu
left a comment
There was a problem hiding this comment.
Good job, code looks pretty nice I left some minor comments
| containerStyles?: StyleProp<ViewStyle>; | ||
|
|
||
| /** Whether the subtitle should be displayed above the title */ | ||
| showSubtitleAboveTitle?: boolean; |
There was a problem hiding this comment.
Im not sure, but If I recall correctly, then our Header for SearchResults is temporary until v2.3. So if this is a temporary header, then do we have to modify the core component Header?
Could we do some dirty fix instead, and leave a comment that it's temporary?
Im afraid that in future we will change our Search header, but nobody will remember to clean up components/Header.
Does this make sense and is there anything you can come up with?
|
@ikevin127 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] |
There was a problem hiding this comment.
Looking good. Left a few comments
BUG: Other filters don't show up in the supertitle. For example, manually changing the URL to /search?q=type%3Aexpense%20status%3Aall%20category%3AUncategorized&isCustomQuery=true still shows the canned search, instead of type:expense status:all category:Uncategorized
| }; | ||
|
|
||
| function Header({title = '', subtitle = '', textStyles = [], containerStyles = [], shouldShowEnvironmentBadge = false}: HeaderProps) { | ||
| function Header({title = '', subtitle = '', textStyles = [], containerStyles = [], shouldShowEnvironmentBadge = false, showSubtitleAboveTitle = false}: HeaderProps) { |
There was a problem hiding this comment.
NAB supertitle is a common word used for this subtitle above title
| function Header({title = '', subtitle = '', textStyles = [], containerStyles = [], shouldShowEnvironmentBadge = false, showSubtitleAboveTitle = false}: HeaderProps) { | |
| function Header({title = '', subtitle = '', textStyles = [], containerStyles = [], shouldShowEnvironmentBadge = false, shouldShowSupertitle = false}: HeaderProps) { |
| searchType: SearchDataTypes; | ||
| isMobileSelectionModeActive?: boolean; | ||
| setIsMobileSelectionModeActive?: (isMobileSelectionModeActive: boolean) => void; | ||
| isCustomQueryMode?: boolean; |
There was a problem hiding this comment.
| isCustomQueryMode?: boolean; | |
| isCustomQuery?: boolean; |
| <Button | ||
| onPress={() => Navigation.navigate(ROUTES.SEARCH_ADVANCED_FILTERS)} | ||
| text={translate('search.filtersHeader')} | ||
| icon={Expensicons.Filters} | ||
| medium | ||
| /> |
There was a problem hiding this comment.
I think we should remove this button until some of the filters work, e.g. type, status, date and categories that are already merged/in review. Then we add this button to start showing this. Otherwise, we'd either have to block merging this PR until those filters work or it'd be really confusing to navigate to the filter page when it doesn't do anything.
| <Button | |
| onPress={() => Navigation.navigate(ROUTES.SEARCH_ADVANCED_FILTERS)} | |
| text={translate('search.filtersHeader')} | |
| icon={Expensicons.Filters} | |
| medium | |
| /> |
| [SCREENS.SEARCH.CENTRAL_PANE]: { | ||
| q: SearchQueryString; | ||
| isCustomQuery: boolean; | ||
| isCustomQuery: string; |
There was a problem hiding this comment.
Why this change? isCustomQuery implies a bool to me
There was a problem hiding this comment.
It's a bit misleading because this parameter is stored as a string in route.params, and we need to parse it to boolean when we read it in the component
There was a problem hiding this comment.
yeah this looks surprising but I believe its correct to type it like this. Everything that comes from route query params will always be a string I believe
There was a problem hiding this comment.
Hmm maybe we should create custom param parser in the linking config? It would simply parse string to boolean earlier to keep boolean in the state. It's weird that we use string for something like that.
| const {policyIDs, q} = route.params; | ||
|
|
||
| const {policyIDs} = route.params; | ||
| const isCustomQueryMode = SearchUtils.isCustomQuery(route.params); |
There was a problem hiding this comment.
Let's rename all of these instances
| const isCustomQueryMode = SearchUtils.isCustomQuery(route.params); | |
| const isCustomQuery = SearchUtils.isCustomQuery(route.params); |
| <Button | ||
| icon={Expensicons.Filters} | ||
| onPress={() => Navigation.navigate(ROUTES.SEARCH_ADVANCED_FILTERS)} | ||
| innerStyles={styles.searchNarrowFilterButton} | ||
| /> |
There was a problem hiding this comment.
Same here
| <Button | |
| icon={Expensicons.Filters} | |
| onPress={() => Navigation.navigate(ROUTES.SEARCH_ADVANCED_FILTERS)} | |
| innerStyles={styles.searchNarrowFilterButton} | |
| /> |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.webmAndroid: mWeb Chromeandroid-mweb.webmiOS: Nativeios.mp4iOS: mWeb Safariios-mweb.mp4 |
We should use SearchUtils.getFilters and pick only the filters that are needed, i.e. everything in Lines 5289 to 5310 in 410a6f2 |
@dubielzyk-expensify That's only happening on local dev due to To recap, based on the latest comments on the discrepancies reported in #45409 (comment) this is what I gather:
✅ Design team confirmed in #45409 (comment) that the correct design is the one shown in the design doc. We also got confirmation in #45409 (comment) that the Filters lowercase / no-spaces is to be left untouched for now - no changes required here.
✅ Design team confirmed in #45409 (comment) that we don't currently use the green icon in this case, therefore we shouldn't change that here - no changes required here.
✅ Looks like the
✅ This issue was addressed by design team in #45409 (comment) and #45409 (comment) and was demonstrated by author in #45409 (comment) as the correct behaviour. Please correct me if I left anything out! ♻️ Given the above context, I think I can move forward w/ completing the reviewer checklist. 🟢 Update: Completed PR Reviewer Checklist. Will Approve once all code change requests are addressed and conflicts resolved - will perform a double-check on the functionality. |
|
@ikevin127 All comments have been resolved :) Could you recheck it? |
luacmartins
left a comment
There was a problem hiding this comment.
LGTM and tests well. @ikevin127 all yours!
|
@WojtekBoman we have conflicts 😞 Otherwise, looks good to be merged |
|
@luacmartins Solved :) |
|
@WojtekBoman :hero: |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.0.15-0 🚀
|
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.0.15-9 🚀
|



Details
This PR adjusts the header of the Search page to display the custom query. The header displays the user's query when the route param
isCustomQueryis set totrue. This PR covers also adding theFiltersbutton to the header.Fixed Issues
$ #45028
PROPOSAL:
Tests
isCustomQueryroute param set to true, for example: https://dev.new.expensify.com:8082/search?q=type%3Aexpense%20status%3Aall&isCustomQuery=trueOffline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2024-07-26.at.16.35.24.mov
Android: mWeb Chrome
Screen.Recording.2024-07-26.at.15.59.01.mov
iOS: Native
Screen.Recording.2024-07-26.at.16.42.35.mov
iOS: mWeb Safari
Screen.Recording.2024-07-26.at.15.59.35.mov
MacOS: Chrome / Safari
Screen.Recording.2024-07-26.at.16.52.31.mov
MacOS: Desktop
Screen.Recording.2024-07-26.at.16.53.37.mov