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

store applied filters in onyx #48312

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
11 changes: 0 additions & 11 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5395,11 +5395,6 @@ const CONST = {
DONE: 'done',
PAID: 'paid',
},
CHAT_STATUS: {
UNREAD: 'unread',
PINNED: 'pinned',
DRAFT: 'draft',
},
BULK_ACTION_TYPES: {
EXPORT: 'export',
HOLD: 'hold',
Expand Down Expand Up @@ -5441,10 +5436,6 @@ const CONST = {
LINKS: 'links',
},
},
CHAT_TYPES: {
LINK: 'link',
ATTACHMENT: 'attachment',
},
TABLE_COLUMNS: {
RECEIPT: 'receipt',
DATE: 'date',
Expand Down Expand Up @@ -5492,8 +5483,6 @@ const CONST = {
REPORT_ID: 'reportID',
KEYWORD: 'keyword',
IN: 'in',
HAS: 'has',
IS: 'is',
},
},

Expand Down
5 changes: 1 addition & 4 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ROUTES = {

SEARCH_CENTRAL_PANE: {
route: 'search',
getRoute: ({query}: {query: SearchQueryString}) => `search?q=${query}` as const,
getRoute: ({query}: {query: SearchQueryString}) => `search?q=${encodeURIComponent(query)}` as const,
},
SEARCH_ADVANCED_FILTERS: 'search/filters',
SEARCH_ADVANCED_FILTERS_DATE: 'search/filters/date',
Expand All @@ -53,9 +53,6 @@ const ROUTES = {
SEARCH_ADVANCED_FILTERS_FROM: 'search/filters/from',
SEARCH_ADVANCED_FILTERS_TO: 'search/filters/to',
SEARCH_ADVANCED_FILTERS_IN: 'search/filters/in',
SEARCH_ADVANCED_FILTERS_HAS: 'search/filters/has',
SEARCH_ADVANCED_FILTERS_IS: 'search/filters/is',

SEARCH_REPORT: {
route: 'search/view/:reportID/:reportActionID?',
getRoute: (reportID: string, reportActionID?: string) => {
Expand Down
2 changes: 0 additions & 2 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ const SCREENS = {
ADVANCED_FILTERS_FROM_RHP: 'Search_Advanced_Filters_From_RHP',
ADVANCED_FILTERS_TO_RHP: 'Search_Advanced_Filters_To_RHP',
ADVANCED_FILTERS_IN_RHP: 'Search_Advanced_Filters_In_RHP',
ADVANCED_FILTERS_HAS_RHP: 'Search_Advanced_Filters_Has_RHP',
ADVANCED_FILTERS_IS_RHP: 'Search_Advanced_Filters_Is_RHP',
TRANSACTION_HOLD_REASON_RHP: 'Search_Transaction_Hold_Reason_RHP',
BOTTOM_TAB: 'Search_Bottom_Tab',
},
Expand Down
8 changes: 7 additions & 1 deletion src/components/Search/SearchPageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa
return null;
}

const onPress = () => {
const values = SearchUtils.getFiltersFormValues(queryJSON);
SearchActions.updateAdvancedFilters(values);
Navigation.navigate(ROUTES.SEARCH_ADVANCED_FILTERS);
};

return (
<HeaderWrapper
title={headerTitle}
Expand All @@ -319,7 +325,7 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa
<Button
text={translate('search.filtersHeader')}
icon={Expensicons.Filters}
onPress={() => Navigation.navigate(ROUTES.SEARCH_ADVANCED_FILTERS)}
onPress={onPress}
medium
/>
</HeaderWrapper>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type QueryFilter = {
value: string | number;
};

type AdvancedFiltersKeys = ValueOf<typeof CONST.SEARCH.SYNTAX_FILTER_KEYS> | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.TYPE | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.STATUS;
type AdvancedFiltersKeys = ValueOf<typeof CONST.SEARCH.SYNTAX_FILTER_KEYS>;
289Adam289 marked this conversation as resolved.
Show resolved Hide resolved

type QueryFilters = {
[K in AdvancedFiltersKeys]?: QueryFilter[];
Expand Down
3 changes: 0 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3918,12 +3918,9 @@ export default {
keyword: 'Keyword',
hasKeywords: 'Has keywords',
currency: 'Currency',
has: 'Has',
link: 'Link',
is: 'Is',
pinned: 'Pinned',
unread: 'Unread',
draft: 'Draft',
amount: {
lessThan: (amount?: string) => `Less than ${amount ?? ''}`,
greaterThan: (amount?: string) => `Greater than ${amount ?? ''}`,
Expand Down
3 changes: 0 additions & 3 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3969,12 +3969,9 @@ export default {
keyword: 'Palabra clave',
hasKeywords: 'Tiene palabras clave',
currency: 'Divisa',
has: 'Tiene',
link: 'Enlace',
is: 'Está',
pinned: 'Fijado',
unread: 'No leído',
draft: 'Borrador',
amount: {
lessThan: (amount?: string) => `Menos de ${amount ?? ''}`,
greaterThan: (amount?: string) => `Más que ${amount ?? ''}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,6 @@ const SearchAdvancedFiltersModalStackNavigator = createModalStackNavigator<Searc
[SCREENS.SEARCH.ADVANCED_FILTERS_FROM_RHP]: () => require<ReactComponentModule>('@pages/Search/SearchAdvancedFiltersPage/SearchFiltersFromPage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_TO_RHP]: () => require<ReactComponentModule>('@pages/Search/SearchAdvancedFiltersPage/SearchFiltersToPage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_IN_RHP]: () => require<ReactComponentModule>('@pages/Search/SearchAdvancedFiltersPage/SearchFiltersInPage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_HAS_RHP]: () => require<ReactComponentModule>('@pages/Search/SearchAdvancedFiltersPage/SearchFiltersHasPage').default,
[SCREENS.SEARCH.ADVANCED_FILTERS_IS_RHP]: () => require<ReactComponentModule>('@pages/Search/SearchAdvancedFiltersPage/SearchFiltersIsPage').default,
});

const RestrictedActionModalStackNavigator = createModalStackNavigator<SearchReportParamList>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const CENTRAL_PANE_TO_RHP_MAPPING: Partial<Record<CentralPaneName, string[]>> =
SCREENS.SEARCH.ADVANCED_FILTERS_TO_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_IN_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_CARD_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_HAS_RHP,
],
[SCREENS.SETTINGS.SUBSCRIPTION.ROOT]: [
SCREENS.SETTINGS.SUBSCRIPTION.ADD_PAYMENT_CARD,
Expand Down
2 changes: 0 additions & 2 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1082,8 +1082,6 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
[SCREENS.SEARCH.ADVANCED_FILTERS_FROM_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_FROM,
[SCREENS.SEARCH.ADVANCED_FILTERS_TO_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_TO,
[SCREENS.SEARCH.ADVANCED_FILTERS_IN_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_IN,
[SCREENS.SEARCH.ADVANCED_FILTERS_HAS_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_HAS,
[SCREENS.SEARCH.ADVANCED_FILTERS_IS_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS_IS,
},
},
[SCREENS.RIGHT_MODAL.RESTRICTED_ACTION]: {
Expand Down
Loading
Loading