Skip to content

Commit

Permalink
feat: removed close button (Expensify#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMuzyk authored Jan 25, 2024
1 parent 671d363 commit 280c5db
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 73 deletions.
12 changes: 2 additions & 10 deletions src/pages/ReimbursementAccount/ACHContractStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,10 @@ import CompleteVerification from './CompleteVerification/CompleteVerification';
const propTypes = {
/** Goes to the previous step */
onBackButtonPress: PropTypes.func.isRequired,

/** Exits flow and goes back to the workspace initial page */
onCloseButtonPress: PropTypes.func.isRequired,
};

function ACHContractStep({onBackButtonPress, onCloseButtonPress}) {
return (
<CompleteVerification
onBackButtonPress={onBackButtonPress}
onCloseButtonPress={onCloseButtonPress}
/>
);
function ACHContractStep({onBackButtonPress}) {
return <CompleteVerification onBackButtonPress={onBackButtonPress} />;
}

ACHContractStep.propTypes = propTypes;
Expand Down
7 changes: 1 addition & 6 deletions src/pages/ReimbursementAccount/BeneficialOwnersStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ type BeneficialOwnerInfoOnyxProps = {
type BeneficialOwnersStepProps = BeneficialOwnerInfoOnyxProps & {
/** Goes to the previous step */
onBackButtonPress: () => void;

/** Exits flow and goes back to the workspace initial page */
onCloseButtonPress: () => void;
};

type BeneficialOwnerSubStepProps = SubStepProps & {beneficialOwnerBeingModifiedID: string; setBeneficialOwnerBeingModifiedID?: (id: string) => void};
Expand All @@ -45,7 +42,7 @@ const SUBSTEP = CONST.BANK_ACCOUNT.BENEFICIAL_OWNER_INFO_STEP.SUBSTEP;
const MAX_NUMBER_OF_UBOS = 4;
const bodyContent: Array<React.ComponentType<BeneficialOwnerSubStepProps>> = [LegalNameUBO, DateOfBirthUBO, SocialSecurityNumberUBO, AddressUBO, ConfirmationUBO];

function BeneficialOwnersStep({reimbursementAccount, reimbursementAccountDraft, onBackButtonPress, onCloseButtonPress}: BeneficialOwnersStepProps) {
function BeneficialOwnersStep({reimbursementAccount, reimbursementAccountDraft, onBackButtonPress}: BeneficialOwnersStepProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const companyName = reimbursementAccount?.achData?.companyName ?? '';
Expand Down Expand Up @@ -225,8 +222,6 @@ function BeneficialOwnersStep({reimbursementAccount, reimbursementAccountDraft,
<HeaderWithBackButton
title={translate('beneficialOwnerInfoStep.companyOwner')}
onBackButtonPress={handleBackButtonPress}
onCloseButtonPress={onCloseButtonPress}
shouldShowCloseButton
/>
<View style={[styles.ph5, styles.mv3, {height: CONST.BANK_ACCOUNT.STEPS_HEADER_HEIGHT}]}>
<InteractiveStepSubHeader
Expand Down
7 changes: 1 addition & 6 deletions src/pages/ReimbursementAccount/BusinessInfo/BusinessInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ type BusinessInfoOnyxProps = {
type BusinessInfoProps = BusinessInfoOnyxProps & {
/** Goes to the previous step */
onBackButtonPress: () => void;

/** Exits flow and goes back to the workspace initial page */
onCloseButtonPress: () => void;
};

const BUSINESS_INFO_STEP_KEYS = CONST.BANK_ACCOUNT.BUSINESS_INFO_STEP.INPUT_KEY;
Expand All @@ -57,7 +54,7 @@ const bodyContent: Array<React.ComponentType<SubStepProps>> = [
ConfirmationBusiness,
];

function BusinessInfo({reimbursementAccount, reimbursementAccountDraft, onBackButtonPress, onCloseButtonPress}: BusinessInfoProps) {
function BusinessInfo({reimbursementAccount, reimbursementAccountDraft, onBackButtonPress}: BusinessInfoProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();

Expand Down Expand Up @@ -108,8 +105,6 @@ function BusinessInfo({reimbursementAccount, reimbursementAccountDraft, onBackBu
title={translate('businessInfoStep.businessInfo')}
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT}
onBackButtonPress={handleBackButtonPress}
onCloseButtonPress={onCloseButtonPress}
shouldShowCloseButton
/>
<View style={[styles.ph5, styles.mv3, {height: CONST.BANK_ACCOUNT.STEPS_HEADER_HEIGHT}]}>
<InteractiveStepSubHeader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@ type CompleteVerificationOnyxProps = {
type CompleteVerificationProps = CompleteVerificationOnyxProps & {
/** Handles back button press */
onBackButtonPress: () => void;

/** Exits flow and goes back to the workspace initial page */
onCloseButtonPress: () => void;
};

const COMPLETE_VERIFICATION_KEYS = CONST.BANK_ACCOUNT.COMPLETE_VERIFICATION.INPUT_KEY;
const bodyContent: Array<ComponentType<SubStepProps>> = [ConfirmAgreements];

function CompleteVerification({reimbursementAccount, reimbursementAccountDraft, onBackButtonPress, onCloseButtonPress}: CompleteVerificationProps) {
function CompleteVerification({reimbursementAccount, reimbursementAccountDraft, onBackButtonPress}: CompleteVerificationProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();

Expand Down Expand Up @@ -75,8 +72,6 @@ function CompleteVerification({reimbursementAccount, reimbursementAccountDraft,
<HeaderWithBackButton
onBackButtonPress={handleBackButtonPress}
title={translate('completeVerificationStep.completeVerification')}
shouldShowCloseButton
onCloseButtonPress={onCloseButtonPress}
/>
<View style={[styles.ph5, styles.mt3, {height: CONST.BANK_ACCOUNT.STEPS_HEADER_HEIGHT}]}>
<InteractiveStepSubHeader
Expand Down
7 changes: 1 addition & 6 deletions src/pages/ReimbursementAccount/PersonalInfo/PersonalInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,12 @@ type PersonalInfoOnyxProps = {
type PersonalInfoProps = PersonalInfoOnyxProps & {
/** Goes to the previous step */
onBackButtonPress: () => void;

/** Exits flow and goes back to the workspace initial page */
onCloseButtonPress: () => void;
};

const PERSONAL_INFO_STEP_KEYS = CONST.BANK_ACCOUNT.PERSONAL_INFO_STEP.INPUT_KEY;
const bodyContent: Array<React.ComponentType<SubStepProps>> = [FullName, DateOfBirth, SocialSecurityNumber, Address, Confirmation];

function PersonalInfo({reimbursementAccount, reimbursementAccountDraft, onBackButtonPress, onCloseButtonPress}: PersonalInfoProps, ref: React.ForwardedRef<View>) {
function PersonalInfo({reimbursementAccount, reimbursementAccountDraft, onBackButtonPress}: PersonalInfoProps, ref: React.ForwardedRef<View>) {
const {translate} = useLocalize();
const styles = useThemeStyles();

Expand Down Expand Up @@ -77,8 +74,6 @@ function PersonalInfo({reimbursementAccount, reimbursementAccountDraft, onBackBu
<HeaderWithBackButton
title={translate('personalInfoStep.personalInfo')}
onBackButtonPress={handleBackButtonPress}
onCloseButtonPress={onCloseButtonPress}
shouldShowCloseButton
/>
<View style={[styles.ph5, styles.mv3, {height: CONST.BANK_ACCOUNT.STEPS_HEADER_HEIGHT}]}>
<InteractiveStepSubHeader
Expand Down
25 changes: 3 additions & 22 deletions src/pages/ReimbursementAccount/ReimbursementAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,6 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol
*/
const getDefaultStateForField = (fieldName, defaultValue = '') => lodashGet(reimbursementAccount, ['achData', fieldName], defaultValue);

const goBackToWorkspace = () => Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID));

const goBack = () => {
const subStep = achData.subStep;
const shouldShowOnfido = onfidoToken && !achData.isOnfidoSetupComplete;
Expand Down Expand Up @@ -493,7 +491,6 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol
reimbursementAccount={reimbursementAccount}
reimbursementAccountDraft={reimbursementAccountDraft}
onBackButtonPress={goBack}
onCloseButtonPress={goBackToWorkspace}
receivedRedirectURI={getPlaidOAuthReceivedRedirectURI()}
plaidLinkOAuthToken={plaidLinkToken}
getDefaultStateForField={getDefaultStateForField}
Expand All @@ -504,12 +501,7 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol
}

if (currentStep === CONST.BANK_ACCOUNT.STEP.COMPANY) {
return (
<CompanyStep
onBackButtonPress={goBack}
onCloseButtonPress={goBackToWorkspace}
/>
);
return <CompanyStep onBackButtonPress={goBack} />;
}

if (currentStep === CONST.BANK_ACCOUNT.STEP.REQUESTOR) {
Expand All @@ -519,27 +511,16 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol
ref={requestorStepRef}
shouldShowOnfido={Boolean(shouldShowOnfido)}
onBackButtonPress={goBack}
onCloseButtonPress={goBackToWorkspace}
/>
);
}

if (currentStep === CONST.BANK_ACCOUNT.STEP.BENEFICIAL_OWNERS) {
return (
<BeneficialOwnersStep
onBackButtonPress={goBack}
onCloseButtonPress={goBackToWorkspace}
/>
);
return <BeneficialOwnersStep onBackButtonPress={goBack} />;
}

if (currentStep === CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT) {
return (
<ACHContractStep
onBackButtonPress={goBack}
onCloseButtonPress={goBackToWorkspace}
/>
);
return <ACHContractStep onBackButtonPress={goBack} />;
}

if (currentStep === CONST.BANK_ACCOUNT.STEP.VALIDATION) {
Expand Down
13 changes: 2 additions & 11 deletions src/pages/ReimbursementAccount/RequestorStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,19 @@ const propTypes = {
/** Goes to the previous step */
onBackButtonPress: PropTypes.func.isRequired,

/** Exits flow and goes back to the workspace initial page */
onCloseButtonPress: PropTypes.func.isRequired,

/** If we should show Onfido flow */
shouldShowOnfido: PropTypes.bool.isRequired,
};

const RequestorStep = React.forwardRef(({shouldShowOnfido, onBackButtonPress, onCloseButtonPress}, ref) => {
const RequestorStep = React.forwardRef(({shouldShowOnfido, onBackButtonPress}, ref) => {
if (shouldShowOnfido) {
return (
<VerifyIdentity
onBackButtonPress={onBackButtonPress}
onCloseButtonPress={onCloseButtonPress}
/>
);
return <VerifyIdentity onBackButtonPress={onBackButtonPress} />;
}

return (
<PersonalInfo
ref={ref}
onBackButtonPress={onBackButtonPress}
onCloseButtonPress={onCloseButtonPress}
/>
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ type VerifyIdentityOnyxProps = {
type VerifyIdentityProps = VerifyIdentityOnyxProps & {
/** Goes to the previous step */
onBackButtonPress: () => void;

/** Exits flow and goes back to the workspace initial page */
onCloseButtonPress: () => void;
};

const ONFIDO_ERROR_DISPLAY_DURATION = 10000;

function VerifyIdentity({reimbursementAccount, onBackButtonPress, onCloseButtonPress, onfidoApplicantID, onfidoToken}: VerifyIdentityProps) {
function VerifyIdentity({reimbursementAccount, onBackButtonPress, onfidoApplicantID, onfidoToken}: VerifyIdentityProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();

Expand Down Expand Up @@ -67,8 +64,6 @@ function VerifyIdentity({reimbursementAccount, onBackButtonPress, onCloseButtonP
<HeaderWithBackButton
title={translate('onfidoStep.verifyIdentity')}
onBackButtonPress={onBackButtonPress}
onCloseButtonPress={onCloseButtonPress}
shouldShowCloseButton
/>
<View style={[styles.ph5, styles.mv3, {height: CONST.BANK_ACCOUNT.STEPS_HEADER_HEIGHT}]}>
<InteractiveStepSubHeader
Expand Down

0 comments on commit 280c5db

Please sign in to comment.