From d11bfe1b44648142987117fda3e219a42b58d3d9 Mon Sep 17 00:00:00 2001 From: Mateusz Titz Date: Thu, 19 Sep 2024 16:59:33 +0200 Subject: [PATCH] Cleanup display SearchButton component on all Pages --- src/components/HeaderWithBackButton/index.tsx | 3 + src/components/HeaderWithBackButton/types.ts | 3 + src/components/MoneyReportHeader.tsx | 1 + src/components/MoneyRequestHeader.tsx | 1 + src/components/Search/SearchPageHeader.tsx | 44 +++-- .../Search/SearchRouter/SearchButton.tsx | 6 +- .../Search/SearchRouter/SearchRouter.tsx | 21 +-- .../Search/SearchRouter/SearchRouterInput.tsx | 5 +- .../createCustomBottomTabNavigator/TopBar.tsx | 7 +- src/libs/SearchUtils.ts | 166 +++++++----------- src/pages/AddressPage.tsx | 1 + src/pages/Search/AdvancedSearchFilters.tsx | 2 +- src/pages/Search/SearchPageBottomTab.tsx | 1 + src/pages/Search/SearchTypeMenuNarrow.tsx | 2 +- src/pages/TeachersUnite/SaveTheWorldPage.tsx | 1 + src/pages/home/HeaderView.tsx | 2 + src/pages/settings/AboutPage/AboutPage.tsx | 1 + .../settings/Preferences/PreferencesPage.tsx | 1 + src/pages/settings/Profile/ProfilePage.tsx | 1 + .../Security/SecuritySettingsPage.tsx | 1 + .../Subscription/CardSection/CardSection.tsx | 2 +- .../Troubleshoot/TroubleshootPage.tsx | 1 + .../settings/Wallet/WalletPage/WalletPage.tsx | 1 + src/pages/workspace/WorkspacesListPage.tsx | 2 + 24 files changed, 126 insertions(+), 150 deletions(-) diff --git a/src/components/HeaderWithBackButton/index.tsx b/src/components/HeaderWithBackButton/index.tsx index f1e715bface8..eb04ad5540eb 100755 --- a/src/components/HeaderWithBackButton/index.tsx +++ b/src/components/HeaderWithBackButton/index.tsx @@ -7,6 +7,7 @@ import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import PinButton from '@components/PinButton'; import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; +import SearchButton from '@components/Search/SearchRouter/SearchButton'; import ThreeDotsMenu from '@components/ThreeDotsMenu'; import Tooltip from '@components/Tooltip'; import useKeyboardState from '@hooks/useKeyboardState'; @@ -60,6 +61,7 @@ function HeaderWithBackButton({ shouldOverlayDots = false, shouldOverlay = false, shouldNavigateToTopMostReport = false, + shouldDisplaySearchRouter = false, progressBarPercentage, style, }: HeaderWithBackButtonProps) { @@ -261,6 +263,7 @@ function HeaderWithBackButton({ )} + {shouldDisplaySearchRouter && } diff --git a/src/components/HeaderWithBackButton/types.ts b/src/components/HeaderWithBackButton/types.ts index c55a7bddc80c..7423abcfe3b0 100644 --- a/src/components/HeaderWithBackButton/types.ts +++ b/src/components/HeaderWithBackButton/types.ts @@ -128,6 +128,9 @@ type HeaderWithBackButtonProps = Partial & { /** Whether we should overlay the 3 dots menu */ shouldOverlayDots?: boolean; + /** Whether we should display button that opens new SearchRouter */ + shouldDisplaySearchRouter?: boolean; + /** 0 - 100 number indicating current progress of the progress bar */ progressBarPercentage?: number; diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 4fc92d619e68..f5e2703b1a47 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -285,6 +285,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea report={moneyRequestReport} policy={policy} shouldShowBackButton={shouldUseNarrowLayout} + shouldDisplaySearchRouter onBackButtonPress={onBackButtonPress} // Shows border if no buttons or banners are showing below the header shouldShowBorderBottom={!isMoreContentShown} diff --git a/src/components/MoneyRequestHeader.tsx b/src/components/MoneyRequestHeader.tsx index 0e0633042a7d..34d3c2d54a70 100644 --- a/src/components/MoneyRequestHeader.tsx +++ b/src/components/MoneyRequestHeader.tsx @@ -134,6 +134,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, shouldUseNarrow policy={policy} shouldShowBackButton={shouldUseNarrowLayout} onBackButtonPress={onBackButtonPress} + shouldDisplaySearchRouter > {hasAllPendingRTERViolations && !shouldUseNarrowLayout && (