Skip to content

Commit

Permalink
feat: add upload field to the confirmation screen
Browse files Browse the repository at this point in the history
  • Loading branch information
pasyukevich committed Nov 6, 2024
1 parent cd911d1 commit 22e7921
Showing 1 changed file with 29 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import getSubstepValues from '@pages/ReimbursementAccount/utils/getSubstepValues
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ReimbursementAccountForm} from '@src/types/form/ReimbursementAccountForm';
import INPUT_IDS from '@src/types/form/ReimbursementAccountForm';

function Confirmation({onNext, onMove, corpayFields}: BankInfoSubStepProps) {
const {translate} = useLocalize();
Expand All @@ -30,26 +31,37 @@ function Confirmation({onNext, onMove, corpayFields}: BankInfoSubStepProps) {
const values = useMemo(() => getSubstepValues(inputKeys, reimbursementAccountDraft, reimbursementAccount), [inputKeys, reimbursementAccount, reimbursementAccountDraft]);

const items = useMemo(
() =>
corpayFields.map((field) => {
return (
() => (
<>
{corpayFields.map((field) => {
return (
<MenuItemWithTopDescription
description={field.label}
title={values[field.id] ? String(values[field.id]) : ''}
shouldShowRightIcon
onPress={() => {
if (field.id.includes(CONST.NON_USD_BANK_ACCOUNT.BANK_INFO_STEP_ACCOUNT_HOLDER_KEY_PREFIX)) {
onMove(1);
return;
}

onMove(0);
}}
key={field.id}
/>
);
})}
{reimbursementAccountDraft?.[INPUT_IDS.ADDITIONAL_DATA.CORPAY.BANK_STATEMENT] && (

Check failure on line 54 in src/pages/ReimbursementAccount/NonUSD/BankInfo/substeps/Confirmation.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

The left side of conditional rendering should be a boolean, not "FileObject[] | undefined"
<MenuItemWithTopDescription
description={field.label}
title={values[field.id] ? String(values[field.id]) : ''}
description={translate('bankInfoStep.bankStatement')}
title={reimbursementAccountDraft[INPUT_IDS.ADDITIONAL_DATA.CORPAY.BANK_STATEMENT].map((file) => file.name).join(', ')}
shouldShowRightIcon
onPress={() => {
if (field.id.includes(CONST.NON_USD_BANK_ACCOUNT.BANK_INFO_STEP_ACCOUNT_HOLDER_KEY_PREFIX)) {
onMove(1);
return;
}

onMove(0);
}}
key={field.id}
onPress={() => onMove(2)}
/>
);
}),
[corpayFields, onMove, values],
)}
</>
),
[corpayFields, onMove, reimbursementAccountDraft, translate, values],
);

return (
Expand Down

0 comments on commit 22e7921

Please sign in to comment.