Skip to content

Commit e1cceaa

Browse files
MelvinBotmadmax330
andcommitted
Navigate back to feed selector after adding work email
Co-authored-by: Maxence Coulibaly <madmax330@users.noreply.github.com>
1 parent 80273cf commit e1cceaa

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

config/eslint/eslint.seatbelt.tsv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,6 @@
13461346
"../../src/pages/workspace/categories/WorkspaceCategoriesPage.tsx" "react-hooks/set-state-in-effect" 1
13471347
"../../src/pages/workspace/companyCards/BankConnection/index.tsx" "react-hooks/set-state-in-effect" 1
13481348
"../../src/pages/workspace/companyCards/DynamicWorkspaceCompanyCardDetailsPage.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
1349-
"../../src/pages/workspace/companyCards/WorkspaceCompanyCardAddWorkEmailPage.tsx" "@typescript-eslint/no-unsafe-type-assertion" 2
13501349
"../../src/pages/workspace/companyCards/WorkspaceCompanyCardEditTransactionStartDatePage.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
13511350
"../../src/pages/workspace/companyCards/WorkspaceCompanyCardFeedSelectorPage.tsx" "@typescript-eslint/no-unsafe-type-assertion" 3
13521351
"../../src/pages/workspace/companyCards/WorkspaceCompanyCardsErrorConfirmation.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1

src/pages/workspace/companyCards/WorkspaceCompanyCardAddWorkEmailPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ function WorkspaceCompanyCardAddWorkEmailPage({route}: WorkspaceCompanyCardAddWo
5252
<Button
5353
variant="success"
5454
size={CONST.BUTTON_SIZE.LARGE}
55-
onPress={() => Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS.getRoute(Navigation.getActiveRoute()))}
55+
// After the user adds their work email, the back button should take them to the feed selector to pick a feed again, not back to this now-stale prompt page.
56+
onPress={() => Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS.getRoute(ROUTES.WORKSPACE_COMPANY_CARDS_SELECT_FEED.getRoute(policyID)))}
5657
>
5758
<Button.Text>{translate('onboarding.workEmail.addWorkEmail')}</Button.Text>
5859
</Button>

src/pages/workspace/expensifyCard/WorkspaceExpensifyCardAddWorkEmailPage.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Text from '@components/Text';
77
import useLocalize from '@hooks/useLocalize';
88
import useThemeStyles from '@hooks/useThemeStyles';
99

10+
import createDynamicRoute from '@libs/Navigation/helpers/dynamicRoutesUtils/createDynamicRoute';
1011
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
1112

1213
import Navigation from '@navigation/Navigation';
@@ -15,7 +16,7 @@ import type {SettingsNavigatorParamList} from '@navigation/types';
1516
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
1617

1718
import CONST from '@src/CONST';
18-
import ROUTES from '@src/ROUTES';
19+
import ROUTES, {DYNAMIC_ROUTES} from '@src/ROUTES';
1920
import type SCREENS from '@src/SCREENS';
2021

2122
import React from 'react';
@@ -52,7 +53,14 @@ function WorkspaceExpensifyCardAddWorkEmailPage({route}: WorkspaceExpensifyCardA
5253
<Button
5354
variant="success"
5455
size={CONST.BUTTON_SIZE.LARGE}
55-
onPress={() => Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS.getRoute(Navigation.getActiveRoute()))}
56+
// After the user adds their work email, the back button should take them to the feed selector to pick a feed again, not back to this now-stale prompt page.
57+
onPress={() =>
58+
Navigation.navigate(
59+
ROUTES.SETTINGS_CONTACT_METHODS.getRoute(
60+
createDynamicRoute(DYNAMIC_ROUTES.WORKSPACE_EXPENSIFY_CARD_SELECT_FEED.path, ROUTES.WORKSPACE_EXPENSIFY_CARD.getRoute(policyID)),
61+
),
62+
)
63+
}
5664
>
5765
<Button.Text>{translate('onboarding.workEmail.addWorkEmail')}</Button.Text>
5866
</Button>

0 commit comments

Comments
 (0)