-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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] [App] Create search results page #45409
[Search v2] [App] Create search results page #45409
Conversation
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.
Good job, code looks pretty nice I left some minor comments
src/components/Header.tsx
Outdated
@@ -21,9 +21,12 @@ type HeaderProps = { | |||
|
|||
/** Additional header container styles */ | |||
containerStyles?: StyleProp<ViewStyle>; | |||
|
|||
/** Whether the subtitle should be displayed above the title */ | |||
showSubtitleAboveTitle?: boolean; |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
src/components/Header.tsx
Outdated
}; | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) { |
hash: number; | ||
data: TransactionListItemType[] | ReportListItemType[]; | ||
searchType: SearchDataTypes; | ||
isMobileSelectionModeActive?: boolean; | ||
setIsMobileSelectionModeActive?: (isMobileSelectionModeActive: boolean) => void; | ||
isCustomQueryMode?: boolean; |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |
/> |
src/libs/Navigation/types.ts
Outdated
@@ -68,7 +68,7 @@ type CentralPaneScreensParamList = { | |||
// Param types of the search central pane are also used for the search bottom tab screen. | |||
[SCREENS.SEARCH.CENTRAL_PANE]: { | |||
q: SearchQueryString; | |||
isCustomQuery: boolean; | |||
isCustomQuery: string; |
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.
Why this change? isCustomQuery
implies a bool to me
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/pages/Search/SearchPage.tsx
Outdated
|
||
const {policyIDs} = route.params; | ||
const isCustomQueryMode = SearchUtils.isCustomQuery(route.params); |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
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.
LGTM and tests well. @ikevin127 all yours!
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.
LGTM 🚀
@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
isCustomQuery
is set totrue
. This PR covers also adding theFilters
button to the header.Fixed Issues
$ #45028
PROPOSAL:
Tests
isCustomQuery
route 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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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