Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import getSearchPageHeaderTitle from './getSearchPageHeaderTitle';

type SearchPageHeaderCommonProps = {
queryJSONType: SearchDataTypes;
shouldShowLoadingBar?: boolean;
};

function SearchPageHeaderCommon({queryJSONType, shouldShowLoadingBar}: SearchPageHeaderCommonProps) {
function SearchPageHeaderCommon({queryJSONType}: SearchPageHeaderCommonProps) {
const {translate} = useLocalize();
const typeMenuSections = useSearchTypeMenuSections();
const {currentSearchKey} = useSearchQueryContext();
Expand All @@ -24,7 +23,6 @@ function SearchPageHeaderCommon({queryJSONType, shouldShowLoadingBar}: SearchPag

return (
<TopBar
shouldShowLoadingBar={shouldShowLoadingBar}
breadcrumbLabel={title}
shouldDisplayHelpButton
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
import TopBar from '@components/Navigation/TopBar';
import type {SearchQueryJSON} from '@components/Search/types';

import useLocalize from '@hooks/useLocalize';

import SearchSelectedNarrow from '@pages/Search/SearchSelectedNarrow';

import React from 'react';

import SearchPageHeaderCommon from './SearchPageHeaderCommon';

type SearchPageHeaderNarrowProps = {
queryJSON: SearchQueryJSON;
shouldShowLoadingBar: boolean;
isMobileSelectionModeEnabled: boolean;
};

function SearchPageHeaderNarrow({queryJSON, shouldShowLoadingBar = false, isMobileSelectionModeEnabled}: SearchPageHeaderNarrowProps) {
const {translate} = useLocalize();

if (isMobileSelectionModeEnabled) {
return <SearchSelectedNarrow queryJSON={queryJSON} />;
}

// The narrow header is the top-level page title, so it stays a static "Spend". The tab selector rendered directly
// below it already names the current view, and repeating that name here would show the same label twice.
return (
<SearchPageHeaderCommon
queryJSONType={queryJSON.type}
<TopBar
shouldShowLoadingBar={shouldShowLoadingBar}
breadcrumbLabel={translate('common.spend')}
shouldDisplayHelpButton
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type SearchPageHeaderTitleDeps = {
};

/**
* Resolves the Search page header title using a single priority chain shared by the wide and narrow headers so the two
* can't diverge:
* Resolves the title for the wide Search page content header, which names the current view. The narrow header is the
* top-level page title and stays a static "Spend", so it deliberately doesn't use this helper. The priority chain is:
* a. the active saved search's display name,
* b. the matched suggested-search label, then the data-type fallbacks (task / trip / invoice / chat),
* c. the generic "Spend" fallback.
Expand Down
Loading