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

add step counter to VBA flow #5255

Merged
merged 7 commits into from
Sep 27, 2021
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
16 changes: 13 additions & 3 deletions src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,28 @@ const propTypes = {
/** Title of the Header */
title: PropTypes.string.isRequired,

/** Subtitle of the header */
subtitle: PropTypes.string,

/** Should we show the environment badge (dev/stg)? */
shouldShowEnvironmentBadge: PropTypes.bool,
};

const defaultProps = {
shouldShowEnvironmentBadge: false,
subtitle: '',
};
const Header = props => (


<View style={[styles.flex1, styles.flexRow]}>
<Text numberOfLines={2} style={[styles.headerText, styles.textLarge]}>
{props.title}
</Text>
<View style={[styles.flex1, styles.flexColumn]}>
<Text numberOfLines={2} style={[styles.headerText, styles.textLarge]}>
{props.title}
</Text>
{/* If there's no subtitle then display a fragment to avoid an empty space which moves the main title */}
{props.subtitle ? <Text style={[styles.mutedTextLabel]}>{props.subtitle}</Text> : <></> }
</View>
{props.shouldShowEnvironmentBadge && (
<EnvironmentBadge />
)}
Expand Down
12 changes: 11 additions & 1 deletion src/components/HeaderWithCloseButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ const propTypes = {
/** The task ID to associate with the call button, if we show it */
inboxCallTaskID: PropTypes.string,

/** Data to display a step counter in the header */
stepCounter: PropTypes.shape({
step: PropTypes.number,
total: PropTypes.number,
}),

...withLocalizePropTypes,
};

Expand All @@ -53,6 +59,7 @@ const defaultProps = {
shouldShowDownloadButton: false,
shouldShowInboxCallButton: false,
inboxCallTaskID: '',
stepCounter: null,
};

const HeaderWithCloseButton = props => (
Expand All @@ -76,7 +83,10 @@ const HeaderWithCloseButton = props => (
</TouchableOpacity>
</Tooltip>
)}
<Header title={props.title} />
<Header
title={props.title}
subtitle={props.stepCounter ? props.translate('stepCounter', props.stepCounter) : ''}
/>
<View style={[styles.reportOptions, styles.flexRow, styles.pr5]}>
{
props.shouldShowDownloadButton && (
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ export default {
newPasswordPrompt: 'Your password must have at least 8 characters,\n1 capital letter, 1 lowercase letter, 1 number.',
passwordFormTitle: 'Welcome back to the New Expensify! Please set your password.',
},
stepCounter: ({step, total}) => `Step ${step} of ${total}`,
bankAccount: {
accountNumber: 'Account number',
routingNumber: 'Routing number',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ export default {
newPasswordPrompt: 'Su contraseña debe tener al menos 8 caracteres, \n1 letra mayúscula, 1 letra minúscula, 1 número.',
passwordFormTitle: '¡Bienvenido de vuelta al Nuevo Expensify! Por favor, elige una contraseña.',
},
stepCounter: ({step, total}) => `Paso ${step} de ${total}`,
bankAccount: {
accountNumber: 'Número de cuenta',
routingNumber: 'Número de ruta',
Expand Down
1 change: 1 addition & 0 deletions src/pages/ReimbursementAccount/BankAccountStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class BankAccountStep extends React.Component {
<View style={[styles.flex1, styles.justifyContentBetween]}>
<HeaderWithCloseButton
title={this.props.translate('bankAccount.addBankAccount')}
stepCounter={this.state.bankAccountAddMethod && {step: 1, total: 5}}
onCloseButtonPress={Navigation.dismissModal}
onBackButtonPress={() => this.setState({bankAccountAddMethod: undefined})}
shouldShowBackButton={!_.isUndefined(this.state.bankAccountAddMethod)}
Expand Down
1 change: 1 addition & 0 deletions src/pages/ReimbursementAccount/BeneficialOwnersStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class BeneficialOwnersStep extends React.Component {
<>
<HeaderWithCloseButton
title={this.props.translate('beneficialOwnersStep.additionalInformation')}
stepCounter={{step: 4, total: 5}}
onCloseButtonPress={Navigation.dismissModal}
onBackButtonPress={() => goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.REQUESTOR)}
shouldShowBackButton
Expand Down
1 change: 1 addition & 0 deletions src/pages/ReimbursementAccount/CompanyStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ class CompanyStep extends React.Component {
<>
<HeaderWithCloseButton
title={this.props.translate('companyStep.headerTitle')}
stepCounter={{step: 2, total: 5}}
shouldShowBackButton
onBackButtonPress={() => goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT)}
onCloseButtonPress={Navigation.dismissModal}
Expand Down
1 change: 1 addition & 0 deletions src/pages/ReimbursementAccount/RequestorStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class RequestorStep extends React.Component {
<>
<HeaderWithCloseButton
title={this.props.translate('requestorStep.headerTitle')}
stepCounter={{step: 3, total: 5}}
shouldShowBackButton
onBackButtonPress={() => goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.COMPANY)}
onCloseButtonPress={Navigation.dismissModal}
Expand Down
1 change: 1 addition & 0 deletions src/pages/ReimbursementAccount/ValidationStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ class ValidationStep extends React.Component {
<View style={[styles.flex1, styles.justifyContentBetween]}>
<HeaderWithCloseButton
title={this.props.translate('validationStep.headerTitle')}
stepCounter={{step: 5, total: 5}}
onCloseButtonPress={Navigation.dismissModal}
/>
{maxAttemptsReached && (
Expand Down