-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add basic version of AdvancedFilters Page #45407
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
Changes from all commits
f947595
44dccfc
e402736
7646837
8fd23a6
7bcb22a
a141d0e
27b4769
1352afb
1e617f6
91df1af
f34caca
4d061b0
1576b7f
d5d84d0
64428d9
45e3484
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import React, {useMemo} from 'react'; | ||
| import {View} from 'react-native'; | ||
| import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useSingleExecution from '@hooks/useSingleExecution'; | ||
| import useWaitForNavigation from '@hooks/useWaitForNavigation'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import ROUTES from '@src/ROUTES'; | ||
|
|
||
| function getFilterDisplayTitle(filters: Record<string, string>, fieldName: string) { | ||
| // This is temporary because the full parsing of search query is not yet done | ||
| // TODO once we have values from query, this value should be `filters[fieldName].value` | ||
| return fieldName; | ||
| } | ||
|
|
||
| function AdvancedSearchFilters() { | ||
| const {translate} = useLocalize(); | ||
| const {singleExecution} = useSingleExecution(); | ||
| const waitForNavigate = useWaitForNavigation(); | ||
|
|
||
| const advancedFilters = useMemo( | ||
| () => [ | ||
| { | ||
| title: getFilterDisplayTitle({}, 'title'), | ||
| description: 'common.type' as const, | ||
| route: ROUTES.SEARCH_ADVANCED_FILTERS_TYPE, | ||
| }, | ||
| { | ||
| title: getFilterDisplayTitle({}, 'date'), | ||
| description: 'common.date' as const, | ||
| route: ROUTES.SEARCH_ADVANCED_FILTERS_DATE, | ||
| }, | ||
| ], | ||
| [], | ||
| ); | ||
|
|
||
| return ( | ||
| <View> | ||
| {advancedFilters.map((item) => { | ||
| const onPress = singleExecution(waitForNavigate(() => Navigation.navigate(item.route))); | ||
|
|
||
| return ( | ||
| <MenuItemWithTopDescription | ||
| key={item.description} | ||
| title={item.title} | ||
| description={translate(item.description)} | ||
| shouldShowRightIcon | ||
| onPress={onPress} | ||
| /> | ||
| ); | ||
| })} | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| AdvancedSearchFilters.displayName = 'AdvancedSearchFilters'; | ||
|
|
||
| export default AdvancedSearchFilters; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import React from 'react'; | ||
| import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; | ||
| import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import AdvancedSearchFilters from './AdvancedSearchFilters'; | ||
|
|
||
| function SearchAdvancedFiltersPage() { | ||
luacmartins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
|
|
||
| return ( | ||
| <ScreenWrapper | ||
| testID={SearchAdvancedFiltersPage.displayName} | ||
| shouldShowOfflineIndicatorInWideScreen | ||
| offlineIndicatorStyle={styles.mtAuto} | ||
| > | ||
| <FullPageNotFoundView shouldShow={false}> | ||
| <HeaderWithBackButton title={translate('search.filtersHeader')} /> | ||
| <AdvancedSearchFilters /> | ||
| </FullPageNotFoundView> | ||
| </ScreenWrapper> | ||
| ); | ||
| } | ||
|
|
||
| SearchAdvancedFiltersPage.displayName = 'SearchAdvancedFiltersPage'; | ||
|
|
||
| export default SearchAdvancedFiltersPage; | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,7 @@ type SearchMenuFilterItem = { | |||||
| route: Route; | ||||||
| }; | ||||||
|
|
||||||
| // Because we will add have AdvancedFilters, in future rename this component to `SearchTypeMenu|Tabs|Filters` to avoid confusion | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can already rename this to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry but this can't be We should rename it I think when we are actually removing it from LHN - which this PR is not doing. |
||||||
| function SearchFilters({query}: SearchFiltersProps) { | ||||||
| const styles = useThemeStyles(); | ||||||
| const {isSmallScreenWidth} = useWindowDimensions(); | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; | ||
| import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import Text from '@src/components/Text'; | ||
|
|
||
| function SearchFiltersDatePage() { | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
|
|
||
| return ( | ||
| <ScreenWrapper | ||
| testID={SearchFiltersDatePage.displayName} | ||
| shouldShowOfflineIndicatorInWideScreen | ||
| offlineIndicatorStyle={styles.mtAuto} | ||
| > | ||
| <FullPageNotFoundView shouldShow={false}> | ||
| <HeaderWithBackButton title={translate('common.date')} /> | ||
| <View style={[styles.flex1, styles.ph3]}> | ||
| {/* temporary placeholder, will be implemented in https://github.com/Expensify/App/issues/45026 */} | ||
| <Text>Advanced filters Date form</Text> | ||
Kicu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </View> | ||
| </FullPageNotFoundView> | ||
| </ScreenWrapper> | ||
| ); | ||
| } | ||
|
|
||
| SearchFiltersDatePage.displayName = 'SearchFiltersDatePage'; | ||
|
|
||
| export default SearchFiltersDatePage; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; | ||
| import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import Text from '@src/components/Text'; | ||
|
|
||
| function SearchFiltersTypePage() { | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
|
|
||
| return ( | ||
| <ScreenWrapper | ||
| testID={SearchFiltersTypePage.displayName} | ||
| shouldShowOfflineIndicatorInWideScreen | ||
| offlineIndicatorStyle={styles.mtAuto} | ||
| > | ||
| <FullPageNotFoundView shouldShow={false}> | ||
| <HeaderWithBackButton title={translate('common.type')} /> | ||
| <View style={[styles.flex1, styles.ph3]}> | ||
| {/* temporary placeholder, will be implemented in https://github.com/Expensify/App/issues/45026 */} | ||
| <Text>Advanced filters Type form</Text> | ||
Kicu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </View> | ||
| </FullPageNotFoundView> | ||
| </ScreenWrapper> | ||
| ); | ||
| } | ||
|
|
||
| SearchFiltersTypePage.displayName = 'SearchFiltersTypePage'; | ||
|
|
||
| export default SearchFiltersTypePage; | ||
Uh oh!
There was an error while loading. Please reload this page.