-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Handle error in workspace's bank account page #15394
Changes from 11 commits
99df6d7
426694b
7fb58c1
b64bfc3
814df41
5a2fb89
c502f90
5ef05fc
623e3a7
8aea1c2
654d582
3e15034
0bd46f8
a93784b
5218695
ed12f80
c1b12d0
f9a0e34
5425565
2e0bc5d
777f086
332d464
81ab0f4
f51f032
6914f4c
c957618
42dac27
7e36149
85888a7
48585ef
bd11b4c
270dc00
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 |
---|---|---|
|
@@ -21,6 +21,7 @@ import withPolicy from '../workspace/withPolicy'; | |
import * as ReimbursementAccountProps from './reimbursementAccountPropTypes'; | ||
import WorkspaceResetBankAccountModal from '../workspace/WorkspaceResetBankAccountModal'; | ||
import * as BankAccounts from '../../libs/actions/BankAccounts'; | ||
import OfflineWithFeedback from '../../components/OfflineWithFeedback'; | ||
|
||
const propTypes = { | ||
/** Bank account currently in setup */ | ||
|
@@ -29,9 +30,6 @@ const propTypes = { | |
/** Callback to continue to the next step of the setup */ | ||
continue: PropTypes.func.isRequired, | ||
|
||
/** Callback to reset the bank account */ | ||
startOver: PropTypes.func.isRequired, | ||
|
||
/** Policy values needed in the component */ | ||
policy: PropTypes.shape({ | ||
name: PropTypes.string, | ||
|
@@ -40,55 +38,67 @@ const propTypes = { | |
...withLocalizePropTypes, | ||
}; | ||
|
||
const ContinueBankAccountSetup = props => ( | ||
<ScreenWrapper includeSafeAreaPaddingBottom={false}> | ||
<FullPageNotFoundView shouldShow={_.isEmpty(props.policy)}> | ||
<HeaderWithCloseButton | ||
title={props.translate('workspace.common.bankAccount')} | ||
subtitle={lodashGet(props.policy, 'name')} | ||
onCloseButtonPress={Navigation.dismissModal} | ||
onBackButtonPress={Navigation.goBack} | ||
shouldShowGetAssistanceButton | ||
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT} | ||
shouldShowBackButton | ||
/> | ||
<ScrollView style={styles.flex1}> | ||
<Section | ||
title={props.translate('workspace.bankAccount.almostDone')} | ||
icon={Illustrations.BankArrow} | ||
> | ||
<Text> | ||
{props.translate('workspace.bankAccount.youreAlmostDone')} | ||
</Text> | ||
<Button | ||
text={props.translate('workspace.bankAccount.continueWithSetup')} | ||
onPress={props.continue} | ||
icon={Expensicons.Bank} | ||
style={[styles.mv4]} | ||
iconStyles={[styles.buttonCTAIcon]} | ||
shouldShowRightIcon | ||
large | ||
success | ||
/> | ||
<MenuItem | ||
title={props.translate('workspace.bankAccount.startOver')} | ||
icon={Expensicons.RotateLeft} | ||
onPress={() => BankAccounts.requestResetFreePlanBankAccount()} | ||
shouldShowRightIcon | ||
wrapperStyle={[styles.cardMenuItem]} | ||
/> | ||
</Section> | ||
</ScrollView> | ||
</FullPageNotFoundView> | ||
const ContinueBankAccountSetup = (props) => { | ||
const errors = lodashGet(props.reimbursementAccount, 'errors', {}); | ||
const pendingAction = lodashGet(props.reimbursementAccount, 'pendingAction', null); | ||
return ( | ||
<ScreenWrapper includeSafeAreaPaddingBottom={false}> | ||
<FullPageNotFoundView shouldShow={_.isEmpty(props.policy)}> | ||
<HeaderWithCloseButton | ||
title={props.translate('workspace.common.bankAccount')} | ||
subtitle={lodashGet(props.policy, 'name')} | ||
onCloseButtonPress={Navigation.dismissModal} | ||
onBackButtonPress={Navigation.goBack} | ||
shouldShowGetAssistanceButton | ||
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT} | ||
shouldShowBackButton | ||
/> | ||
<ScrollView style={styles.flex1}> | ||
<Section | ||
title={props.translate('workspace.bankAccount.almostDone')} | ||
icon={Illustrations.BankArrow} | ||
> | ||
<OfflineWithFeedback | ||
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. Hi all! Just dropping a note that this PR caused issue - #18517 Wrapping with 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. Nice catch, but with removing the pending action we may lose some other intended strikethough styles? https://github.com/Expensify/App/pull/15394/files#r1119420530 |
||
pendingAction={pendingAction} | ||
errors={errors} | ||
shouldShowErrorMessage | ||
onClose={BankAccounts.resetReimbursementAccount} | ||
Comment on lines
+66
to
+70
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. Wrapped in
|
||
> | ||
<Text> | ||
{props.translate('workspace.bankAccount.youreAlmostDone')} | ||
</Text> | ||
<Button | ||
text={props.translate('workspace.bankAccount.continueWithSetup')} | ||
onPress={props.continue} | ||
icon={Expensicons.Bank} | ||
style={[styles.mv4]} | ||
iconStyles={[styles.buttonCTAIcon]} | ||
shouldShowRightIcon | ||
large | ||
success | ||
isDisabled={Boolean(pendingAction)} | ||
/> | ||
<MenuItem | ||
title={props.translate('workspace.bankAccount.startOver')} | ||
icon={Expensicons.RotateLeft} | ||
onPress={() => BankAccounts.requestResetFreePlanBankAccount()} | ||
shouldShowRightIcon | ||
wrapperStyle={[styles.cardMenuItem]} | ||
disabled={Boolean(pendingAction)} | ||
/> | ||
</OfflineWithFeedback> | ||
</Section> | ||
</ScrollView> | ||
</FullPageNotFoundView> | ||
|
||
{props.reimbursementAccount.shouldShowResetModal && ( | ||
<WorkspaceResetBankAccountModal | ||
reimbursementAccount={props.reimbursementAccount} | ||
onConfirm={props.startOver} | ||
/> | ||
)} | ||
</ScreenWrapper> | ||
); | ||
{props.reimbursementAccount.shouldShowResetModal && ( | ||
<WorkspaceResetBankAccountModal | ||
reimbursementAccount={props.reimbursementAccount} | ||
/> | ||
)} | ||
</ScreenWrapper> | ||
); | ||
}; | ||
|
||
ContinueBankAccountSetup.propTypes = propTypes; | ||
ContinueBankAccountSetup.displayName = 'ContinueBankAccountSetup'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We re-load the
reimbursementAccount
data each time we enter the "Connect bank account" page of a workspace. If there is an error,errors: null,
was clearing the errors, not allowing the user to clear it with the X and not giving time to read it.