-
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
feat: Step 4 UI #52384
Merged
Merged
feat: Step 4 UI #52384
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
471adcf
feat: Step 4 UI
MrMuzyk 3d17ff4
Merge branch 'main' of github.com:Expensify/App into feat/step-4-ui
MrMuzyk 1b3d6d5
feat: next/prev step changes
MrMuzyk d402ec6
Merge branch 'main' of github.com:Expensify/App into feat/step-4-ui
MrMuzyk 0254d5a
fix: linter
MrMuzyk da53fea
fix: user removal upon going back
MrMuzyk 1f0eb91
fix: correctly enable feature in debug mode
MrMuzyk dcf7808
fix: error translation
MrMuzyk 79df2d6
fix: memo dependency
MrMuzyk 92264c5
Merge branch 'main' of github.com:Expensify/App into feat/step-4-ui
MrMuzyk 56bb3b9
Merge branch 'main' of github.com:Expensify/App into feat/step-4-ui
MrMuzyk 8a55c93
Merge branch 'main' of github.com:Expensify/App into feat/step-4-ui
MrMuzyk 5996997
Merge branch 'main' of github.com:Expensify/App into feat/step-4-ui
MrMuzyk fa9a839
fix: ts
MrMuzyk 3f76c3a
fix: more ts fixes
MrMuzyk ef61fd2
Merge branch 'main' of github.com:Expensify/App into feat/step-4-ui
MrMuzyk f218f1e
fix: cr fixes
MrMuzyk c5f7843
fix: ios settings link in confirmation country screen
MrMuzyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
34 changes: 0 additions & 34 deletions
34
src/pages/ReimbursementAccount/BeneficialOwnerInfo/substeps/BeneficialOwnerCheckUBO.tsx
This file was deleted.
Oops, something went wrong.
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
88 changes: 88 additions & 0 deletions
88
...ursementAccount/NonUSD/BeneficialOwnerInfo/BeneficialOwnerDetailsFormSubSteps/Address.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,88 @@ | ||
import React, {useMemo, useState} from 'react'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import AddressStep from '@components/SubStepForms/AddressStep'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useReimbursementAccountStepFormSubmit from '@hooks/useReimbursementAccountStepFormSubmit'; | ||
import type {SubStepProps} from '@hooks/useSubStep/types'; | ||
import CONST from '@src/CONST'; | ||
import type {Country} from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
||
type NameProps = SubStepProps & {isUserEnteringHisOwnData: boolean; ownerBeingModifiedID: string}; | ||
|
||
const {STREET, CITY, STATE, ZIP_CODE, COUNTRY, PREFIX} = CONST.NON_USD_BANK_ACCOUNT.BENEFICIAL_OWNER_INFO_STEP.BENEFICIAL_OWNER_DATA; | ||
|
||
function Address({onNext, isEditing, onMove, isUserEnteringHisOwnData, ownerBeingModifiedID}: NameProps) { | ||
const {translate} = useLocalize(); | ||
const [reimbursementAccountDraft] = useOnyx(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM_DRAFT); | ||
|
||
const countryInputKey: `beneficialOwner_${string}_${string}` = `${PREFIX}_${ownerBeingModifiedID}_${COUNTRY}`; | ||
const inputKeys = { | ||
street: `${PREFIX}_${ownerBeingModifiedID}_${STREET}`, | ||
city: `${PREFIX}_${ownerBeingModifiedID}_${CITY}`, | ||
state: `${PREFIX}_${ownerBeingModifiedID}_${STATE}`, | ||
zipCode: `${PREFIX}_${ownerBeingModifiedID}_${ZIP_CODE}`, | ||
country: countryInputKey, | ||
} as const; | ||
|
||
const defaultValues = { | ||
street: reimbursementAccountDraft?.[inputKeys.street] ?? '', | ||
city: reimbursementAccountDraft?.[inputKeys.city] ?? '', | ||
state: reimbursementAccountDraft?.[inputKeys.state] ?? '', | ||
zipCode: reimbursementAccountDraft?.[inputKeys.zipCode] ?? '', | ||
country: (reimbursementAccountDraft?.[inputKeys.country] ?? '') as Country | '', | ||
}; | ||
|
||
const formTitle = translate(isUserEnteringHisOwnData ? 'ownershipInfoStep.whatsYourAddress' : 'ownershipInfoStep.whatsTheOwnersAddress'); | ||
|
||
// Has to be stored in state and updated on country change due to the fact that we can't relay on onyxValues when user is editing the form (draft values are not being saved in that case) | ||
const [shouldDisplayStateSelector, setShouldDisplayStateSelector] = useState<boolean>( | ||
defaultValues.country === CONST.COUNTRY.US || defaultValues.country === CONST.COUNTRY.CA || defaultValues.country === '', | ||
); | ||
|
||
const stepFieldsWithState = useMemo( | ||
() => [inputKeys.street, inputKeys.city, inputKeys.state, inputKeys.zipCode, countryInputKey], | ||
[countryInputKey, inputKeys.city, inputKeys.state, inputKeys.street, inputKeys.zipCode], | ||
); | ||
const stepFieldsWithoutState = useMemo( | ||
() => [inputKeys.street, inputKeys.city, inputKeys.zipCode, countryInputKey], | ||
[countryInputKey, inputKeys.city, inputKeys.street, inputKeys.zipCode], | ||
); | ||
|
||
const stepFields = shouldDisplayStateSelector ? stepFieldsWithState : stepFieldsWithoutState; | ||
|
||
const handleCountryChange = (country: unknown) => { | ||
if (typeof country !== 'string' || country === '') { | ||
return; | ||
} | ||
setShouldDisplayStateSelector(country === CONST.COUNTRY.US || country === CONST.COUNTRY.CA); | ||
}; | ||
|
||
const handleSubmit = useReimbursementAccountStepFormSubmit({ | ||
fieldIds: stepFields, | ||
onNext, | ||
shouldSaveDraft: isEditing, | ||
}); | ||
|
||
return ( | ||
<AddressStep<typeof ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM> | ||
isEditing={isEditing} | ||
onNext={onNext} | ||
onMove={onMove} | ||
formID={ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM} | ||
formTitle={formTitle} | ||
formPOBoxDisclaimer={translate('common.noPO')} | ||
onSubmit={handleSubmit} | ||
stepFields={stepFields} | ||
inputFieldsIDs={inputKeys} | ||
defaultValues={defaultValues} | ||
onCountryChange={handleCountryChange} | ||
shouldDisplayStateSelector={shouldDisplayStateSelector} | ||
shouldDisplayCountrySelector | ||
/> | ||
); | ||
} | ||
|
||
Address.displayName = 'Address'; | ||
|
||
export default Address; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
https://expensify.slack.com/archives/C01GTK53T8Q/p1731423389064609
Getting a confirmation for the translation