-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45407 from software-mansion-labs/kicu/45026-searc…
…h-advanced-filters Add basic version of AdvancedFilters Page
- Loading branch information
Showing
14 changed files
with
206 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { | ||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
</View> | ||
</FullPageNotFoundView> | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
SearchFiltersDatePage.displayName = 'SearchFiltersDatePage'; | ||
|
||
export default SearchFiltersDatePage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
</View> | ||
</FullPageNotFoundView> | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
SearchFiltersTypePage.displayName = 'SearchFiltersTypePage'; | ||
|
||
export default SearchFiltersTypePage; |