-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51019 from MrMuzyk/feat/frame-for-non-usd
feat: Frame for non USD bank account flow
- Loading branch information
Showing
15 changed files
with
661 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/pages/ReimbursementAccount/NonUSD/Agreements/Agreements.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import type {ComponentType} from 'react'; | ||
import React from 'react'; | ||
import InteractiveStepWrapper from '@components/InteractiveStepWrapper'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useSubStep from '@hooks/useSubStep'; | ||
import type {SubStepProps} from '@hooks/useSubStep/types'; | ||
import CONST from '@src/CONST'; | ||
import Confirmation from './substeps/Confirmation'; | ||
|
||
type AgreementsProps = { | ||
/** Handles back button press */ | ||
onBackButtonPress: () => void; | ||
|
||
/** Handles submit button press */ | ||
onSubmit: () => void; | ||
}; | ||
|
||
const bodyContent: Array<ComponentType<SubStepProps>> = [Confirmation]; | ||
|
||
function Agreements({onBackButtonPress, onSubmit}: AgreementsProps) { | ||
const {translate} = useLocalize(); | ||
|
||
const submit = () => { | ||
onSubmit(); | ||
}; | ||
|
||
const {componentToRender: SubStep, isEditing, screenIndex, nextScreen, prevScreen, moveTo, goToTheLastStep} = useSubStep({bodyContent, startFrom: 0, onFinished: submit}); | ||
|
||
const handleBackButtonPress = () => { | ||
if (isEditing) { | ||
goToTheLastStep(); | ||
return; | ||
} | ||
|
||
if (screenIndex === 0) { | ||
onBackButtonPress(); | ||
} else { | ||
prevScreen(); | ||
} | ||
}; | ||
|
||
return ( | ||
<InteractiveStepWrapper | ||
wrapperID={Agreements.displayName} | ||
handleBackButtonPress={handleBackButtonPress} | ||
headerTitle={translate('agreementsStep.agreements')} | ||
stepNames={CONST.NON_USD_BANK_ACCOUNT.STEP_NAMES} | ||
startStepIndex={5} | ||
> | ||
<SubStep | ||
isEditing={isEditing} | ||
onNext={nextScreen} | ||
onMove={moveTo} | ||
/> | ||
</InteractiveStepWrapper> | ||
); | ||
} | ||
|
||
Agreements.displayName = 'Agreements'; | ||
|
||
export default Agreements; |
28 changes: 28 additions & 0 deletions
28
src/pages/ReimbursementAccount/NonUSD/Agreements/substeps/Confirmation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import FormProvider from '@components/Form/FormProvider'; | ||
import Text from '@components/Text'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import type {SubStepProps} from '@hooks/useSubStep/types'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
||
function Confirmation({onNext}: SubStepProps) { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
|
||
return ( | ||
<FormProvider | ||
formID={ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM} | ||
onSubmit={onNext} | ||
submitButtonText={translate('agreementsStep.accept')} | ||
style={[styles.mh5, styles.flexGrow1]} | ||
enabledWhenOffline={false} | ||
> | ||
<Text style={[styles.textHeadlineLineHeightXXL]}>{translate('agreementsStep.pleaseConfirm')}</Text> | ||
</FormProvider> | ||
); | ||
} | ||
|
||
Confirmation.displayName = 'Confirmation'; | ||
|
||
export default Confirmation; |
61 changes: 61 additions & 0 deletions
61
src/pages/ReimbursementAccount/NonUSD/BankInfo/BankInfo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import type {ComponentType} from 'react'; | ||
import React from 'react'; | ||
import InteractiveStepWrapper from '@components/InteractiveStepWrapper'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useSubStep from '@hooks/useSubStep'; | ||
import type {SubStepProps} from '@hooks/useSubStep/types'; | ||
import CONST from '@src/CONST'; | ||
import Confirmation from './substeps/Confirmation'; | ||
|
||
type BankInfoProps = { | ||
/** Handles back button press */ | ||
onBackButtonPress: () => void; | ||
|
||
/** Handles submit button press */ | ||
onSubmit: () => void; | ||
}; | ||
|
||
const bodyContent: Array<ComponentType<SubStepProps>> = [Confirmation]; | ||
|
||
function BankInfo({onBackButtonPress, onSubmit}: BankInfoProps) { | ||
const {translate} = useLocalize(); | ||
|
||
const submit = () => { | ||
onSubmit(); | ||
}; | ||
|
||
const {componentToRender: SubStep, isEditing, screenIndex, nextScreen, prevScreen, moveTo, goToTheLastStep} = useSubStep<SubStepProps>({bodyContent, startFrom: 0, onFinished: submit}); | ||
|
||
const handleBackButtonPress = () => { | ||
if (isEditing) { | ||
goToTheLastStep(); | ||
return; | ||
} | ||
|
||
if (screenIndex === 0) { | ||
onBackButtonPress(); | ||
} else { | ||
prevScreen(); | ||
} | ||
}; | ||
|
||
return ( | ||
<InteractiveStepWrapper | ||
wrapperID={BankInfo.displayName} | ||
handleBackButtonPress={handleBackButtonPress} | ||
headerTitle={translate('bankAccount.bankInfo')} | ||
stepNames={CONST.NON_USD_BANK_ACCOUNT.STEP_NAMES} | ||
startStepIndex={1} | ||
> | ||
<SubStep | ||
isEditing={isEditing} | ||
onNext={nextScreen} | ||
onMove={moveTo} | ||
/> | ||
</InteractiveStepWrapper> | ||
); | ||
} | ||
|
||
BankInfo.displayName = 'BankInfo'; | ||
|
||
export default BankInfo; |
38 changes: 38 additions & 0 deletions
38
src/pages/ReimbursementAccount/NonUSD/BankInfo/substeps/Confirmation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import Button from '@components/Button'; | ||
import SafeAreaConsumer from '@components/SafeAreaConsumer'; | ||
import ScrollView from '@components/ScrollView'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import type {SubStepProps} from '@hooks/useSubStep/types'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
|
||
function Confirmation({onNext}: SubStepProps) { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
|
||
return ( | ||
<SafeAreaConsumer> | ||
{({safeAreaPaddingBottomStyle}) => ( | ||
<ScrollView | ||
style={styles.pt0} | ||
contentContainerStyle={[styles.flexGrow1, safeAreaPaddingBottomStyle]} | ||
> | ||
<View style={[styles.p5, styles.flexGrow1, styles.justifyContentEnd]}> | ||
<Button | ||
success | ||
style={[styles.w100]} | ||
onPress={onNext} | ||
large | ||
text={translate('common.confirm')} | ||
/> | ||
</View> | ||
</ScrollView> | ||
)} | ||
</SafeAreaConsumer> | ||
); | ||
} | ||
|
||
Confirmation.displayName = 'Confirmation'; | ||
|
||
export default Confirmation; |
44 changes: 44 additions & 0 deletions
44
src/pages/ReimbursementAccount/NonUSD/BeneficialOwnerInfo/BeneficialOwnerInfo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import Button from '@components/Button'; | ||
import InteractiveStepWrapper from '@components/InteractiveStepWrapper'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import CONST from '@src/CONST'; | ||
|
||
type BeneficialOwnerInfoProps = { | ||
/** Handles back button press */ | ||
onBackButtonPress: () => void; | ||
|
||
/** Handles submit button press */ | ||
onSubmit: () => void; | ||
}; | ||
|
||
function BeneficialOwnerInfo({onBackButtonPress, onSubmit}: BeneficialOwnerInfoProps) { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
|
||
return ( | ||
<InteractiveStepWrapper | ||
wrapperID={BeneficialOwnerInfo.displayName} | ||
handleBackButtonPress={onBackButtonPress} | ||
headerTitle={translate('beneficialOwnerInfoStep.companyOwner')} | ||
stepNames={CONST.NON_USD_BANK_ACCOUNT.STEP_NAMES} | ||
startStepIndex={3} | ||
> | ||
<View style={styles.mtAuto}> | ||
<Button | ||
success | ||
large | ||
style={[styles.w100, styles.mt2, styles.pb5, styles.ph5]} | ||
onPress={onSubmit} | ||
text={translate('common.confirm')} | ||
/> | ||
</View> | ||
</InteractiveStepWrapper> | ||
); | ||
} | ||
|
||
BeneficialOwnerInfo.displayName = 'BeneficialOwnerInfo'; | ||
|
||
export default BeneficialOwnerInfo; |
61 changes: 61 additions & 0 deletions
61
src/pages/ReimbursementAccount/NonUSD/BusinessInfo/BusinessInfo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import type {ComponentType} from 'react'; | ||
import React from 'react'; | ||
import InteractiveStepWrapper from '@components/InteractiveStepWrapper'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useSubStep from '@hooks/useSubStep'; | ||
import type {SubStepProps} from '@hooks/useSubStep/types'; | ||
import CONST from '@src/CONST'; | ||
import Confirmation from './substeps/Confirmation'; | ||
|
||
type BusinessInfoProps = { | ||
/** Handles back button press */ | ||
onBackButtonPress: () => void; | ||
|
||
/** Handles submit button press */ | ||
onSubmit: () => void; | ||
}; | ||
|
||
const bodyContent: Array<ComponentType<SubStepProps>> = [Confirmation]; | ||
|
||
function BusinessInfo({onBackButtonPress, onSubmit}: BusinessInfoProps) { | ||
const {translate} = useLocalize(); | ||
|
||
const submit = () => { | ||
onSubmit(); | ||
}; | ||
|
||
const {componentToRender: SubStep, isEditing, screenIndex, nextScreen, prevScreen, moveTo, goToTheLastStep} = useSubStep({bodyContent, startFrom: 0, onFinished: submit}); | ||
|
||
const handleBackButtonPress = () => { | ||
if (isEditing) { | ||
goToTheLastStep(); | ||
return; | ||
} | ||
|
||
if (screenIndex === 0) { | ||
onBackButtonPress(); | ||
} else { | ||
prevScreen(); | ||
} | ||
}; | ||
|
||
return ( | ||
<InteractiveStepWrapper | ||
wrapperID={BusinessInfo.displayName} | ||
handleBackButtonPress={handleBackButtonPress} | ||
headerTitle={translate('businessInfoStep.businessInfoTitle')} | ||
stepNames={CONST.NON_USD_BANK_ACCOUNT.STEP_NAMES} | ||
startStepIndex={2} | ||
> | ||
<SubStep | ||
isEditing={isEditing} | ||
onNext={nextScreen} | ||
onMove={moveTo} | ||
/> | ||
</InteractiveStepWrapper> | ||
); | ||
} | ||
|
||
BusinessInfo.displayName = 'BusinessInfo'; | ||
|
||
export default BusinessInfo; |
Oops, something went wrong.