Skip to content

Commit

Permalink
Merge pull request #50416 from twilight2294/fixRHPIssues
Browse files Browse the repository at this point in the history
Fix: Background report changes to Tags page after clicking Custom tag name in RHP
  • Loading branch information
stitesExpensify authored Oct 22, 2024
2 parents b0db743 + 1dd6f99 commit faf48fc
Show file tree
Hide file tree
Showing 27 changed files with 461 additions and 195 deletions.
74 changes: 68 additions & 6 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,54 @@ const ROUTES = {
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, backTo = '', reportActionID?: string) =>
getUrlWithBackToParam(`${action as string}/${iouType as string}/category/${transactionID}/${reportID}${reportActionID ? `/${reportActionID}` : ''}`, backTo),
},
SETTINGS_TAGS_ROOT: {
route: 'settings/:policyID/tags',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags`, backTo),
},
SETTINGS_TAGS_SETTINGS: {
route: 'settings/:policyID/tags/settings',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags/settings` as const, backTo),
},
SETTINGS_TAGS_EDIT: {
route: 'settings/:policyID/tags/:orderWeight/edit',
getRoute: (policyID: string, orderWeight: number, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags/${orderWeight}/edit` as const, backTo),
},
SETTINGS_TAG_CREATE: {
route: 'settings/:policyID/tags/new',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags/new` as const, backTo),
},
SETTINGS_TAG_EDIT: {
route: 'settings/:policyID/tag/:orderWeight/:tagName/edit',
getRoute: (policyID: string, orderWeight: number, tagName: string, backTo = '') =>
getUrlWithBackToParam(`settings/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}/edit` as const, backTo),
},
SETTINGS_TAG_SETTINGS: {
route: 'settings/:policyID/tag/:orderWeight/:tagName',
getRoute: (policyID: string, orderWeight: number, tagName: string, backTo = '') =>
getUrlWithBackToParam(`settings/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}` as const, backTo),
},
SETTINGS_TAG_APPROVER: {
route: 'settings/:policyID/tag/:orderWeight/:tagName/approver',
getRoute: (policyID: string, orderWeight: number, tagName: string, backTo = '') =>
getUrlWithBackToParam(`settings/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}/approver` as const, backTo),
},
SETTINGS_TAG_LIST_VIEW: {
route: 'settings/:policyID/tag-list/:orderWeight',
getRoute: (policyID: string, orderWeight: number, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tag-list/${orderWeight}` as const, backTo),
},
SETTINGS_TAG_GL_CODE: {
route: 'settings/:policyID/tag/:orderWeight/:tagName/gl-code',
getRoute: (policyID: string, orderWeight: number, tagName: string, backTo = '') =>
getUrlWithBackToParam(`settings/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}/gl-code` as const, backTo),
},
SETTINGS_TAGS_IMPORT: {
route: 'settings/:policyID/tags/import',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags/import` as const, backTo),
},
SETTINGS_TAGS_IMPORTED: {
route: 'settings/:policyID/tags/imported',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags/imported` as const, backTo),
},
SETTINGS_CATEGORIES_ROOT: {
route: 'settings/:policyID/categories',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/categories`, backTo),
Expand All @@ -465,7 +513,25 @@ const ROUTES = {
},
SETTINGS_CATEGORY_EDIT: {
route: 'settings/:policyID/category/:categoryName/edit',
getRoute: (policyID: string, categoryName: string, backTo = '') => getUrlWithBackToParam(`settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/edit`, backTo),
getRoute: (policyID: string, categoryName: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/category/${encodeURIComponent(categoryName)}/edit`, backTo),
},
SETTINGS_CATEGORIES_IMPORT: {
route: 'settings/:policyID/categories/import',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/categories/import` as const, backTo),
},
SETTINGS_CATEGORIES_IMPORTED: {
route: 'settings/:policyID/categories/imported',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/categories/imported` as const, backTo),
},
SETTINGS_CATEGORY_PAYROLL_CODE: {
route: 'settings/:policyID/category/:categoryName/payroll-code',
getRoute: (policyID: string, categoryName: string, backTo = '') =>
getUrlWithBackToParam(`settings/${policyID}/category/${encodeURIComponent(categoryName)}/payroll-code` as const, backTo),
},
SETTINGS_CATEGORY_GL_CODE: {
route: 'settings/:policyID/category/:categoryName/gl-code',
getRoute: (policyID: string, categoryName: string, backTo = '') =>
getUrlWithBackToParam(`settings/${policyID}/category/${encodeURIComponent(categoryName)}/gl-code` as const, backTo),
},
MONEY_REQUEST_STEP_CURRENCY: {
route: ':action/:iouType/currency/:transactionID/:reportID/:pageIndex?',
Expand Down Expand Up @@ -517,10 +583,6 @@ const ROUTES = {
getRoute: (action: IOUAction, iouType: IOUType, orderWeight: number, transactionID: string, reportID: string, backTo = '', reportActionID?: string) =>
getUrlWithBackToParam(`${action as string}/${iouType as string}/tag/${orderWeight}/${transactionID}/${reportID}${reportActionID ? `/${reportActionID}` : ''}`, backTo),
},
SETTINGS_TAGS_ROOT: {
route: 'settings/:policyID/tags',
getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/tags`, backTo),
},
MONEY_REQUEST_STEP_WAYPOINT: {
route: ':action/:iouType/waypoint/:transactionID/:reportID/:pageIndex',
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID?: string, pageIndex = '', backTo = '') =>
Expand Down Expand Up @@ -961,7 +1023,7 @@ const ROUTES = {
},
WORKSPACE_TAG_APPROVER: {
route: 'settings/workspaces/:policyID/tag/:orderWeight/:tagName/approver',
getRoute: (policyID: string, orderWeight: number, tagName: string) => `settings/workspaces/${policyID}/tag/${orderWeight}/${tagName}/approver` as const,
getRoute: (policyID: string, orderWeight: number, tagName: string) => `settings/workspaces/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}/approver` as const,
},
WORKSPACE_TAG_LIST_VIEW: {
route: 'settings/workspaces/:policyID/tag-list/:orderWeight',
Expand Down
19 changes: 18 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ const SCREENS = {
SEARCH_ADVANCED_FILTERS: 'SearchAdvancedFilters',
SEARCH_SAVED_SEARCH: 'SearchSavedSearch',
SETTINGS_CATEGORIES: 'SettingsCategories',
SETTINGS_TAGS: 'SettingsTags',
EXPENSIFY_CARD: 'ExpensifyCard',
DOMAIN_CARD: 'DomainCard',
RESTRICTED_ACTION: 'RestrictedAction',
Expand Down Expand Up @@ -244,6 +245,10 @@ const SCREENS = {
SETTINGS_CATEGORY_CREATE: 'Settings_Category_Create',
SETTINGS_CATEGORY_EDIT: 'Settings_Category_Edit',
SETTINGS_CATEGORIES_ROOT: 'Settings_Categories',
SETTINGS_CATEGORIES_IMPORT: 'Settings_Categories_Import',
SETTINGS_CATEGORIES_IMPORTED: 'Settings_Categories_Imported',
SETTINGS_CATEGORY_PAYROLL_CODE: 'Settings_Category_Payroll_Code',
SETTINGS_CATEGORY_GL_CODE: 'Settings_Category_GL_Code',
},
EXPENSIFY_CARD: {
EXPENSIFY_CARD_DETAILS: 'Expensify_Card_Details',
Expand All @@ -256,7 +261,19 @@ const SCREENS = {
DOMAIN_CARD_REPORT_FRAUD: 'Domain_Card_Report_Fraud',
},

SETTINGS_TAGS_ROOT: 'Settings_Tags',
SETTINGS_TAGS: {
SETTINGS_TAGS_ROOT: 'Settings_Tags',
SETTINGS_TAGS_SETTINGS: 'Settings_Tags_Settings',
SETTINGS_TAGS_EDIT: 'Settings_Tags_Edit',
SETTINGS_TAG_CREATE: 'Settings_Tag_Create',
SETTINGS_TAG_EDIT: 'Settings_Tag_Edit',
SETTINGS_TAG_SETTINGS: 'Settings_Tag_Settings',
SETTINGS_TAG_APPROVER: 'Settings_Tag_Approver',
SETTINGS_TAG_LIST_VIEW: 'Settings_Tag_List_View',
SETTINGS_TAG_GL_CODE: 'Settings_Tag_GL_Code',
SETTINGS_TAGS_IMPORT: 'Settings_Tags_Import',
SETTINGS_TAGS_IMPORTED: 'Settings_Tags_Imported',
},

REPORT_SETTINGS: {
ROOT: 'Report_Settings_Root',
Expand Down
2 changes: 1 addition & 1 deletion src/components/ImportSpreadsheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function ImportSpreedsheet({backTo, goTo}: ImportSpreedsheetProps) {
<View style={[styles.flex1, safeAreaPaddingBottomStyle]}>
<HeaderWithBackButton
title={translate('spreadsheet.importSpreadsheet')}
onBackButtonPress={() => Navigation.navigate(backTo)}
onBackButtonPress={() => Navigation.goBack(backTo)}
/>

<View style={[styles.flex1, styles.uploadFileView(isSmallScreenWidth)]}>
Expand Down
20 changes: 19 additions & 1 deletion src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator<MoneyRequestNa
[SCREENS.MONEY_REQUEST.STEP_MERCHANT]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepMerchant').default,
[SCREENS.MONEY_REQUEST.STEP_PARTICIPANTS]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepParticipants').default,
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_ROOT]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default,
[SCREENS.SETTINGS_TAGS_ROOT]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/WorkspaceTagsPage').default,
[SCREENS.SETTINGS_TAGS.SETTINGS_TAGS_ROOT]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/WorkspaceTagsPage').default,
[SCREENS.MONEY_REQUEST.STEP_SCAN]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepScan').default,
[SCREENS.MONEY_REQUEST.STEP_TAG]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepTag').default,
[SCREENS.MONEY_REQUEST.STEP_WAYPOINT]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepWaypoint').default,
Expand Down Expand Up @@ -142,6 +142,23 @@ const CategoriesModalStackNavigator = createModalStackNavigator({
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_CREATE]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/CreateCategoryPage').default,
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_EDIT]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/EditCategoryPage').default,
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_SETTINGS]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/CategorySettingsPage').default,
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_IMPORT]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/ImportCategoriesPage').default,
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_IMPORTED]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/ImportedCategoriesPage').default,
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_PAYROLL_CODE]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/CategoryPayrollCodePage').default,
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_GL_CODE]: () => require<ReactComponentModule>('../../../../pages/workspace/categories/CategoryGLCodePage').default,
});

const TagsModalStackNavigator = createModalStackNavigator({
[SCREENS.SETTINGS_TAGS.SETTINGS_TAGS_SETTINGS]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/WorkspaceTagsSettingsPage').default,
[SCREENS.SETTINGS_TAGS.SETTINGS_TAGS_EDIT]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/WorkspaceEditTagsPage').default,
[SCREENS.SETTINGS_TAGS.SETTINGS_TAGS_IMPORT]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/ImportTagsPage').default,
[SCREENS.SETTINGS_TAGS.SETTINGS_TAGS_IMPORTED]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/ImportedTagsPage').default,
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_SETTINGS]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/TagSettingsPage').default,
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_LIST_VIEW]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/WorkspaceViewTagsPage').default,
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_CREATE]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/WorkspaceCreateTagPage').default,
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_EDIT]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/EditTagPage').default,
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_APPROVER]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/TagApproverPage').default,
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_GL_CODE]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/TagGLCodePage').default,
});

const ExpensifyCardModalStackNavigator = createModalStackNavigator({
Expand Down Expand Up @@ -662,6 +679,7 @@ export {
SettingsModalStackNavigator,
SignInModalStackNavigator,
CategoriesModalStackNavigator,
TagsModalStackNavigator,
ExpensifyCardModalStackNavigator,
DomainCardModalStackNavigator,
SplitDetailsModalStackNavigator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ function RightModalNavigator({navigation, route}: RightModalNavigatorProps) {
name={SCREENS.RIGHT_MODAL.SETTINGS_CATEGORIES}
component={ModalStackNavigators.CategoriesModalStackNavigator}
/>
<Stack.Screen
name={SCREENS.RIGHT_MODAL.SETTINGS_TAGS}
component={ModalStackNavigators.TagsModalStackNavigator}
/>
<Stack.Screen
name={SCREENS.RIGHT_MODAL.EXPENSIFY_CARD}
component={ModalStackNavigators.ExpensifyCardModalStackNavigator}
Expand Down
76 changes: 75 additions & 1 deletion src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,80 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
categoryName: (categoryName: string) => decodeURIComponent(categoryName),
},
},
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_IMPORT]: {
path: ROUTES.SETTINGS_CATEGORIES_IMPORT.route,
},
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_IMPORTED]: {
path: ROUTES.SETTINGS_CATEGORIES_IMPORTED.route,
},
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_PAYROLL_CODE]: {
path: ROUTES.SETTINGS_CATEGORY_PAYROLL_CODE.route,
parse: {
categoryName: (categoryName: string) => decodeURIComponent(categoryName),
},
},
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_GL_CODE]: {
path: ROUTES.SETTINGS_CATEGORY_GL_CODE.route,
parse: {
categoryName: (categoryName: string) => decodeURIComponent(categoryName),
},
},
},
},
[SCREENS.RIGHT_MODAL.SETTINGS_TAGS]: {
screens: {
[SCREENS.SETTINGS_TAGS.SETTINGS_TAGS_SETTINGS]: {
path: ROUTES.SETTINGS_TAGS_SETTINGS.route,
},
[SCREENS.SETTINGS_TAGS.SETTINGS_TAGS_EDIT]: {
path: ROUTES.SETTINGS_TAGS_EDIT.route,
parse: {
orderWeight: Number,
},
},
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_CREATE]: {
path: ROUTES.SETTINGS_TAG_CREATE.route,
},
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_EDIT]: {
path: ROUTES.SETTINGS_TAG_EDIT.route,
parse: {
orderWeight: Number,
tagName: (tagName: string) => decodeURIComponent(tagName),
},
},
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_SETTINGS]: {
path: ROUTES.SETTINGS_TAG_SETTINGS.route,
parse: {
orderWeight: Number,
tagName: (tagName: string) => decodeURIComponent(tagName),
},
},
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_APPROVER]: {
path: ROUTES.SETTINGS_TAG_APPROVER.route,
parse: {
orderWeight: Number,
tagName: (tagName: string) => decodeURIComponent(tagName),
},
},
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_LIST_VIEW]: {
path: ROUTES.SETTINGS_TAG_LIST_VIEW.route,
parse: {
orderWeight: Number,
},
},
[SCREENS.SETTINGS_TAGS.SETTINGS_TAG_GL_CODE]: {
path: ROUTES.SETTINGS_TAG_GL_CODE.route,
parse: {
orderWeight: Number,
tagName: (tagName: string) => decodeURIComponent(tagName),
},
},
[SCREENS.SETTINGS_TAGS.SETTINGS_TAGS_IMPORT]: {
path: ROUTES.SETTINGS_TAGS_IMPORT.route,
},
[SCREENS.SETTINGS_TAGS.SETTINGS_TAGS_IMPORTED]: {
path: ROUTES.SETTINGS_TAGS_IMPORTED.route,
},
},
},
[SCREENS.RIGHT_MODAL.EXPENSIFY_CARD]: {
Expand Down Expand Up @@ -1091,7 +1165,7 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
},
},
[SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_ROOT]: ROUTES.SETTINGS_CATEGORIES_ROOT.route,
[SCREENS.SETTINGS_TAGS_ROOT]: ROUTES.SETTINGS_TAGS_ROOT.route,
[SCREENS.SETTINGS_TAGS.SETTINGS_TAGS_ROOT]: ROUTES.SETTINGS_TAGS_ROOT.route,
[SCREENS.MONEY_REQUEST.STEP_SEND_FROM]: ROUTES.MONEY_REQUEST_STEP_SEND_FROM.route,
[SCREENS.MONEY_REQUEST.STEP_COMPANY_INFO]: ROUTES.MONEY_REQUEST_STEP_COMPANY_INFO.route,
[SCREENS.MONEY_REQUEST.STEP_AMOUNT]: ROUTES.MONEY_REQUEST_STEP_AMOUNT.route,
Expand Down
Loading

0 comments on commit faf48fc

Please sign in to comment.