Skip to content

Commit

Permalink
Add SEARCH_QUERIES consts, hide new features
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Apr 16, 2024
1 parent 1de5ce3 commit f84911b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4345,6 +4345,12 @@ const CONST = {

MAX_TAX_RATE_INTEGER_PLACES: 4,
MAX_TAX_RATE_DECIMAL_PLACES: 4,

SEARCH_QUERIES: {
ALL: 'all',
SENT: 'sent',
DRAFTS: 'drafts'
}
} as const;

type Country = keyof typeof CONST.ALL_COUNTRIES;
Expand Down
11 changes: 11 additions & 0 deletions src/components/TestToolMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as Network from '@userActions/Network';
import * as Session from '@userActions/Session';
import * as User from '@userActions/User';
import CONFIG from '@src/CONFIG';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {Network as NetworkOnyx, User as UserOnyx} from '@src/types/onyx';
Expand Down Expand Up @@ -103,6 +104,16 @@ function TestToolMenu({user = USER_DEFAULT, network}: TestToolMenuProps) {
}}
/>
</TestToolRow>
{/* Navigate to the new Search Page. This button is temporary and should be removed after passing QA tests. */}
<TestToolRow title="New Search Page">
<Button
small
text="Navigate"
onPress={() => {
Navigation.navigate(ROUTES.SEARCH.getRoute(CONST.SEARCH_QUERIES.ALL));
}}
/>
</TestToolRow>
</>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ function BottomTabBar({isLoadingApp = false}: PurposeForUsingExpensifyModalProps
</View>
</PressableWithFeedback>
</Tooltip>
<Tooltip text={translate('common.search')}>
{/** @TODO: Uncomment this code and change order of the items according to the designs once the new search tab is ready */}
{/* <Tooltip text={translate('common.search')}>
<PressableWithFeedback
onPress={() => {
Navigation.navigate(ROUTES.SEARCH.getRoute('all'));
Navigation.navigate(ROUTES.SEARCH.getRoute(CONST.SEARCH_QUERIES.ALL));
}}
role={CONST.ROLE.BUTTON}
accessibilityLabel={translate('common.search')}
Expand All @@ -121,9 +122,9 @@ function BottomTabBar({isLoadingApp = false}: PurposeForUsingExpensifyModalProps
/>
</View>
</PressableWithFeedback>
</Tooltip>
<BottomTabAvatar isSelected={currentTabName === SCREENS.SETTINGS.ROOT} />
</Tooltip> */}
<BottomTabBarFloatingActionButton />
<BottomTabAvatar isSelected={currentTabName === SCREENS.SETTINGS.ROOT} />
</View>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Search/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function SearchPage({route}: SearchPageProps) {

return (
<ScreenWrapper testID="testPage">
<SearchResults filter={route.params.query} />
<SearchResults query={route.params.query} />
</ScreenWrapper>
);
}
Expand Down
9 changes: 5 additions & 4 deletions src/pages/Search/SearchPageBottomTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import useSingleExecution from '@hooks/useSingleExecution';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import * as Expensicons from '@src/components/Icon/Expensicons';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import type IconAsset from '@src/types/utils/IconAsset';

Expand All @@ -20,23 +21,23 @@ function SearchPageBottomTab() {
const styles = useThemeStyles();
const {singleExecution} = useSingleExecution();
const activeRoute = useActiveRoute();
const currentQuery = activeRoute?.params?.query;
const currentQuery = activeRoute?.params && 'query' in activeRoute.params ? activeRoute?.params?.query : '';

const searchMenuItems: SearchMenuItem[] = [
{
title: 'All',
icon: Expensicons.ExpensifyLogoNew,
action: singleExecution(() => Navigation.navigate(ROUTES.SEARCH.getRoute('all'))),
action: singleExecution(() => Navigation.navigate(ROUTES.SEARCH.getRoute(CONST.SEARCH_QUERIES.ALL))),
},
{
title: 'Sent',
icon: Expensicons.ExpensifyLogoNew,
action: singleExecution(() => Navigation.navigate(ROUTES.SEARCH.getRoute('sent'))),
action: singleExecution(() => Navigation.navigate(ROUTES.SEARCH.getRoute(CONST.SEARCH_QUERIES.SENT))),
},
{
title: 'Drafts',
icon: Expensicons.ExpensifyLogoNew,
action: singleExecution(() => Navigation.navigate(ROUTES.SEARCH.getRoute('drafts'))),
action: singleExecution(() => Navigation.navigate(ROUTES.SEARCH.getRoute(CONST.SEARCH_QUERIES.DRAFTS))),
},
];

Expand Down
9 changes: 6 additions & 3 deletions src/pages/Search/SearchResults.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import React from 'react';
import Text from '@components/Text';
import useThemeStyles from '@hooks/useThemeStyles';

type SearchResultsProps = {
filter: string;
query: string;
};

function SearchResults({filter}: SearchResultsProps) {
return <Text style={{color: 'white', fontSize: 30}}>Search results for: |{filter}| filter</Text>;
function SearchResults({query}: SearchResultsProps) {
const styles = useThemeStyles();

return <Text style={styles.textHeadlineH1}>Search results for: |{query}| filter</Text>;
}

SearchResults.displayName = 'SearchResults';
Expand Down

0 comments on commit f84911b

Please sign in to comment.