-
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 v1] Implement Search navigation logic #40280
[Search v1] Implement Search navigation logic #40280
Conversation
New search tab poc
1997168
to
1de5ce3
Compare
@WojtekBoman what's the status on this PR? When do you think you'll be able to get it in review? |
src/ROUTES.ts
Outdated
// This is a utility route used to go to the user's concierge chat, or the sign-in page if the user's not authenticated | ||
CONCIERGE: 'concierge', | ||
FLAG_COMMENT: { | ||
route: 'flag/:reportID/:reportActionID', | ||
getRoute: (reportID: string, reportActionID: string) => `flag/${reportID}/${reportActionID}` as const, | ||
}, | ||
SEARCH: 'search', |
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 guess this will be changed after resolving the conflicts
@@ -33,6 +33,16 @@ function getIconAndTitle(route: string, translate: LocaleContextProps['translate | |||
return {icon: Expensicons.Hashtag, title: translate('tabSelector.room')}; | |||
case CONST.TAB_REQUEST.DISTANCE: | |||
return {icon: Expensicons.Car, title: translate('common.distance')}; | |||
case CONST.TAB_SEARCH.ALL: |
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.
This was only for the POC with onyxTab I assume
src/pages/Search/SearchPage.tsx
Outdated
useCustomBackHandler(); | ||
|
||
return ( | ||
<ScreenWrapper testID="testPage"> |
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.
Please updatetestID
to the proper one
); | ||
} | ||
|
||
SearchPageBottomTab.displayName = 'SearchPage'; |
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.
Please update name here as well
@sobitneupane 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] |
It's ready for review :) |
Nice one! I asked C+ for an expedited review. |
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.
@WojtekBoman just to confirm, on small screens I should only see the filters for now, right? We'll style the filters differently for small screens and also render the search results as part of a separate PR?
Screen.Recording.2024-04-17.at.3.22.41.PM.mov
query: string; | ||
}; | ||
|
||
function SearchResults({query}: SearchResultsProps) { |
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.
This component should be called just Search
Yes, the content of this page will be added in separate PR :) |
Reviewer Checklist
Screenshots/VideosAndroid: mWeb ChromeScreen.Recording.2024-04-18.at.20.39.21.moviOS: NativeScreen.Recording.2024-04-18.at.20.48.10.moviOS: mWeb SafariScreen.Recording.2024-04-18.at.20.38.00.movMacOS: DesktopScreen.Recording.2024-04-18.at.20.50.30.mov |
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.64-6 🚀
|
const isTargetScreenDifferentThanCurrent = Boolean(topmostCentralPaneRoute && topmostCentralPaneRoute.name !== action.payload.params?.screen); | ||
const areParamsDifferent = !shallowCompare(topmostCentralPaneRoute?.params, action.payload.params?.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.
Is there a specific case this is fixing? This is causing #41198
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.
This change has been introduced to handle changing filters on the new SearchPage, on this page we can navigate to the same page with a different value of the query param, so that's why we added it. To me, we should create a custom method to compare params. Report ids should be compared as before but in other cases we can use shallowCompare
.
WDYT?
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.
Makes sense! Thanks for the context!
@@ -152,16 +152,15 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam | |||
const topRouteName = rootState?.routes?.at(-1)?.name; | |||
const isTargetNavigatorOnTop = topRouteName === action.payload.name; | |||
|
|||
const isTargetScreenDifferentThanCurrent = Boolean(topmostCentralPaneRoute && topmostCentralPaneRoute.name !== action.payload.params?.screen); | |||
const areParamsDifferent = !shallowCompare(topmostCentralPaneRoute?.params, action.payload.params?.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.
This also caused #40743
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.
The fix for that has been already merged. Could you check if it still occurs in dev environment?
useCustomBackHandler(); | ||
|
||
return ( | ||
<ScreenWrapper testID={SearchPage.displayName}> |
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.
When this page was created, the offline pattern
was omitted which led to this issue:
Details
This PR introduces changes in navigation logic connected with a new search tab. The
src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.tsx
file has been modified to share one url between two pages (SearchPageBottomTab and SearchPage display the same url).Fixed Issues
$ #40245
PROPOSAL:
Tests
Offline 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-04-17.at.18.38.56.mov
Android: mWeb Chrome
Screen.Recording.2024-04-17.at.18.42.13.mov
iOS: Native
Screen.Recording.2024-04-17.at.18.54.25.mov
iOS: mWeb Safari
Screen.Recording.2024-04-17.at.18.55.25.mov
MacOS: Chrome / Safari
Screen.Recording.2024-04-17.at.18.37.46.mov
MacOS: Desktop
Screen.Recording.2024-04-17.at.18.45.18.mov