Skip to content
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

Merged
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
cc9cfce
Add template of Search Results Page
WojtekBoman Jul 15, 2024
03d2a51
Merge branch 'main' into search-v2/search-results
WojtekBoman Jul 15, 2024
25e6034
Merge branch 'main' into search-v2/search-results
WojtekBoman Jul 22, 2024
9f9b5ef
Run prettier
WojtekBoman Jul 22, 2024
0c146d6
Merge branch 'adamgrzybowski/use-new-query-syntax' into search-result…
WojtekBoman Jul 22, 2024
ec25f9c
Adjust SearchResults to queryJSON
WojtekBoman Jul 22, 2024
90227ac
Merge branch 'main' into search-v2/search-results
WojtekBoman Jul 26, 2024
9e60aca
Remove unnecessary components
WojtekBoman Jul 26, 2024
a39a5f3
Adjust components styles to display search results
WojtekBoman Jul 26, 2024
f89a196
Replace texts with translation paths
WojtekBoman Jul 26, 2024
68c9bfa
Unify checks in SearchPageHeader
WojtekBoman Jul 26, 2024
db1600e
Remove console.log
WojtekBoman Jul 26, 2024
e1e50c6
Remove Filters button
WojtekBoman Jul 26, 2024
c6c9fca
Add Filters buttons on narrow and wide layouts
WojtekBoman Jul 26, 2024
2c296e7
cleanup destructuring route.params in SearchPage
WojtekBoman Jul 26, 2024
067f484
Rename isSearchResultsMode to isCustomQueryMode
WojtekBoman Jul 26, 2024
05dc344
Add SearchUtils.isCustomQuery and cleanup SearchPageHeader
WojtekBoman Jul 26, 2024
10bd38f
Fix SearchStatusMenuNarrow
WojtekBoman Jul 26, 2024
dda75e4
Fix filters.svg
WojtekBoman Jul 26, 2024
2bb4774
Merge branch 'main' into search-v2/search-results
WojtekBoman Jul 29, 2024
bcd2f8d
Display header title using input, remove Filters button
WojtekBoman Jul 29, 2024
c664c4b
Remove unnecessary margin from SearchStatusMenuNarrow
WojtekBoman Jul 29, 2024
8169525
Rename isCustomQueryMode to isCustomQuery
WojtekBoman Jul 29, 2024
f022bae
Add HeaderWrapper to SearchPageHeader
WojtekBoman Jul 29, 2024
b774317
Remove unnecessary styles
WojtekBoman Jul 29, 2024
01ed964
Merge branch 'main' into search-v2/search-results
WojtekBoman Jul 30, 2024
4b999a4
Modify getSearchHeaderTitle to use getFilters
WojtekBoman Jul 30, 2024
6141a77
Refactor operatorsToSignMap
WojtekBoman Jul 30, 2024
1074c1b
Fix displaying search header title
WojtekBoman Jul 30, 2024
5919064
Remove SearchUtils.isCustomQuery
WojtekBoman Jul 30, 2024
8b2bd3c
Remove unused imports
WojtekBoman Jul 30, 2024
023ecf4
Merge branch 'main' into search-v2/search-results
WojtekBoman Jul 30, 2024
6cffd47
Fix optionality of isCustomQuery in SearchListWithHeader
WojtekBoman Jul 30, 2024
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
6 changes: 6 additions & 0 deletions assets/images/filters.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ type HeaderProps = {

/** Additional header container styles */
containerStyles?: StyleProp<ViewStyle>;

/** Whether the subtitle should be displayed above the title */
showSubtitleAboveTitle?: boolean;
Copy link
Member

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?

};

function Header({title = '', subtitle = '', textStyles = [], containerStyles = [], shouldShowEnvironmentBadge = false}: HeaderProps) {
function Header({title = '', subtitle = '', textStyles = [], containerStyles = [], shouldShowEnvironmentBadge = false, showSubtitleAboveTitle = false}: HeaderProps) {
Copy link
Contributor

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

Suggested change
function Header({title = '', subtitle = '', textStyles = [], containerStyles = [], shouldShowEnvironmentBadge = false, showSubtitleAboveTitle = false}: HeaderProps) {
function Header({title = '', subtitle = '', textStyles = [], containerStyles = [], shouldShowEnvironmentBadge = false, shouldShowSupertitle = false}: HeaderProps) {

const styles = useThemeStyles();
const renderedSubtitle = useMemo(
() => (
Expand All @@ -46,6 +49,7 @@ function Header({title = '', subtitle = '', textStyles = [], containerStyles = [
return (
<View style={[styles.flex1, styles.flexRow, containerStyles]}>
<View style={styles.mw100}>
{showSubtitleAboveTitle && renderedSubtitle}
{typeof title === 'string'
? !!title && (
<Text
Expand All @@ -56,7 +60,7 @@ function Header({title = '', subtitle = '', textStyles = [], containerStyles = [
</Text>
)
: title}
{renderedSubtitle}
{!showSubtitleAboveTitle && renderedSubtitle}
</View>
{shouldShowEnvironmentBadge && <EnvironmentBadge />}
</View>
Expand Down
7 changes: 6 additions & 1 deletion src/components/HeaderWithBackButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ function HeaderWithBackButton({
shouldNavigateToTopMostReport = false,
progressBarPercentage,
style,
showSubtitleAboveTitle = false,
shouldUseBaseFontWithIcon = false,
}: HeaderWithBackButtonProps) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -102,7 +104,8 @@ function HeaderWithBackButton({
<Header
title={title}
subtitle={stepCounter ? translate('stepCounter', stepCounter) : subtitle}
textStyles={[titleColor ? StyleUtils.getTextColorStyle(titleColor) : {}, isCentralPaneSettings && styles.textHeadlineH2]}
textStyles={[titleColor ? StyleUtils.getTextColorStyle(titleColor) : {}, isCentralPaneSettings && !shouldUseBaseFontWithIcon && styles.textHeadlineH2]}
showSubtitleAboveTitle={showSubtitleAboveTitle}
/>
);
}, [
Expand All @@ -123,6 +126,8 @@ function HeaderWithBackButton({
title,
titleColor,
translate,
showSubtitleAboveTitle,
shouldUseBaseFontWithIcon,
]);

return (
Expand Down
6 changes: 6 additions & 0 deletions src/components/HeaderWithBackButton/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ type HeaderWithBackButtonProps = Partial<ChildrenProps> & {

/** Additional styles to add to the component */
style?: StyleProp<ViewStyle>;

/** Whether the subtitle should be displayed above the title */
showSubtitleAboveTitle?: boolean;

/** Whether the title should have the base font with the displayed icon */
shouldUseBaseFontWithIcon?: boolean;
};

export type {ThreeDotsMenuItem};
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import ExpensifyLogoNew from '@assets/images/expensify-logo-new.svg';
import ExpensifyWordmark from '@assets/images/expensify-wordmark.svg';
import EyeDisabled from '@assets/images/eye-disabled.svg';
import Eye from '@assets/images/eye.svg';
import Filters from '@assets/images/filters.svg';
import Flag from '@assets/images/flag.svg';
import FlagLevelOne from '@assets/images/flag_level_01.svg';
import FlagLevelTwo from '@assets/images/flag_level_02.svg';
Expand Down Expand Up @@ -373,5 +374,6 @@ export {
CheckCircle,
CheckmarkCircle,
NetSuiteSquare,
Filters,
CalendarSolid,
};
2 changes: 2 additions & 0 deletions src/components/Icon/Illustrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import CreditCardsNew from '@assets/images/simple-illustrations/simple-illustrat
import CreditCardEyes from '@assets/images/simple-illustrations/simple-illustration__creditcardeyes.svg';
import EmailAddress from '@assets/images/simple-illustrations/simple-illustration__email-address.svg';
import EmptyState from '@assets/images/simple-illustrations/simple-illustration__empty-state.svg';
import Filters from '@assets/images/simple-illustrations/simple-illustration__filters.svg';
import FolderOpen from '@assets/images/simple-illustrations/simple-illustration__folder-open.svg';
import Gears from '@assets/images/simple-illustrations/simple-illustration__gears.svg';
import HandCard from '@assets/images/simple-illustrations/simple-illustration__handcard.svg';
Expand Down Expand Up @@ -210,4 +211,5 @@ export {
FolderWithPapers,
VirtualCard,
Tire,
Filters,
};
10 changes: 6 additions & 4 deletions src/components/Search/SearchListWithHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ import * as SearchUtils from '@libs/SearchUtils';
import CONST from '@src/CONST';
import type {SearchDataTypes, SearchReport} from '@src/types/onyx/SearchResults';
import SearchPageHeader from './SearchPageHeader';
import type {SearchStatus, SelectedTransactionInfo, SelectedTransactions} from './types';
import type {SearchQueryJSON, SelectedTransactionInfo, SelectedTransactions} from './types';

type SearchListWithHeaderProps = Omit<BaseSelectionListProps<ReportListItemType | TransactionListItemType>, 'onSelectAll' | 'onCheckboxPress' | 'sections'> & {
status: SearchStatus;
queryJSON: SearchQueryJSON;
hash: number;
data: TransactionListItemType[] | ReportListItemType[];
searchType: SearchDataTypes;
isMobileSelectionModeActive?: boolean;
setIsMobileSelectionModeActive?: (isMobileSelectionModeActive: boolean) => void;
isSearchResultsMode?: boolean;
};

function mapTransactionItemToSelectedEntry(item: TransactionListItemType): [string, SelectedTransactionInfo] {
Expand All @@ -44,7 +45,7 @@ function mapToItemWithSelectionInfo(item: TransactionListItemType | ReportListIt
}

function SearchListWithHeader(
{ListItem, onSelectRow, status, hash, data, searchType, isMobileSelectionModeActive, setIsMobileSelectionModeActive, ...props}: SearchListWithHeaderProps,
{ListItem, onSelectRow, queryJSON, hash, data, searchType, isMobileSelectionModeActive, setIsMobileSelectionModeActive, isSearchResultsMode = false, ...props}: SearchListWithHeaderProps,
ref: ForwardedRef<SelectionListHandle>,
) {
const {isSmallScreenWidth} = useWindowDimensions();
Expand Down Expand Up @@ -188,11 +189,12 @@ function SearchListWithHeader(
<SearchPageHeader
selectedTransactions={selectedTransactions}
clearSelectedItems={clearSelectedItems}
status={status}
queryJSON={queryJSON}
hash={hash}
onSelectDeleteOption={handleOnSelectDeleteOption}
isMobileSelectionModeActive={isMobileSelectionModeActive}
setIsMobileSelectionModeActive={setIsMobileSelectionModeActive}
isSearchResultsMode={isSearchResultsMode}
selectedReports={selectedReports}
setOfflineModalOpen={() => setOfflineModalVisible(true)}
setDownloadErrorModalOpen={() => setDownloadErrorModalVisible(true)}
Expand Down
Loading
Loading