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..22885b6ceac5 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 the 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..cfe0397bbd11 100644 --- a/src/components/MoneyRequestHeader.tsx +++ b/src/components/MoneyRequestHeader.tsx @@ -133,6 +133,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, shouldUseNarrow }} policy={policy} shouldShowBackButton={shouldUseNarrowLayout} + shouldDisplaySearchRouter onBackButtonPress={onBackButtonPress} > {hasAllPendingRTERViolations && !shouldUseNarrowLayout && ( diff --git a/src/components/Search/SearchPageHeader.tsx b/src/components/Search/SearchPageHeader.tsx index 73829989409c..704f72055410 100644 --- a/src/components/Search/SearchPageHeader.tsx +++ b/src/components/Search/SearchPageHeader.tsx @@ -33,6 +33,7 @@ import type {SearchDataTypes, SearchReport} from '@src/types/onyx/SearchResults' import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type IconAsset from '@src/types/utils/IconAsset'; import {useSearchContext} from './SearchContext'; +import SearchButton from './SearchRouter/SearchButton'; import type {SearchQueryJSON} from './types'; type HeaderWrapperProps = Pick & { @@ -295,11 +296,13 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa } const onPress = () => { - const values = SearchUtils.getFiltersFormValues(queryJSON); + const values = SearchUtils.buildFilterFormValuesFromQuery(queryJSON); SearchActions.updateAdvancedFilters(values); Navigation.navigate(ROUTES.SEARCH_ADVANCED_FILTERS); }; + const displaySearchRouter = SearchUtils.isCannedSearchQuery(queryJSON); + return ( - {headerButtonsOptions.length > 0 ? ( - null} - shouldAlwaysShowDropdownMenu - pressOnEnter - buttonSize={CONST.DROPDOWN_BUTTON_SIZE.MEDIUM} - customText={translate('workspace.common.selected', {selectedNumber: selectedTransactionsKeys.length})} - options={headerButtonsOptions} - isSplitButton={false} - shouldUseStyleUtilityForAnchorPosition - /> - ) : ( -