From 133bd2aca10d1aa89a5714f6b395e657aebee9a1 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Tue, 5 Nov 2024 12:56:23 +0200 Subject: [PATCH 1/3] Workspace Feed - remove prev bank name in Other Feed --- src/pages/workspace/companyCards/addNew/CardTypeStep.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx b/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx index 03dd2e9e63cd..4927d47b8ff3 100644 --- a/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx +++ b/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx @@ -91,15 +91,21 @@ function CardTypeStep() { const {canUseDirectFeeds} = usePermissions(); const [isError, setIsError] = useState(false); const data = getAvailableCompanyCardTypes({isAmexAvailable: !canUseDirectFeeds, translate, typeSelected, styles: styles.mr3}); + const bankName = addNewCard?.data?.bankName; + const bank = addNewCard?.data?.selectedBank; + const type = addNewCard?.data?.feedType; + const isOtherBankSelected = bank === CONST.COMPANY_CARDS.BANKS.OTHER; const submit = () => { if (!typeSelected) { setIsError(true); } else { + const isNewCardTypeSelected = typeSelected !== type; CompanyCards.setAddNewCompanyCardStepAndData({ step: CONST.COMPANY_CARDS.STEP.CARD_INSTRUCTIONS, data: { feedType: typeSelected, + bankName: isNewCardTypeSelected && (!canUseDirectFeeds || isOtherBankSelected) ? '' : bankName, }, isEditing: false, }); From f29f1c4defca727d89a3a54728f7bd3ebfd52e4b Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Tue, 5 Nov 2024 12:59:26 +0200 Subject: [PATCH 2/3] clean up --- src/pages/workspace/companyCards/addNew/CardTypeStep.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx b/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx index 4927d47b8ff3..ace102eb7e6c 100644 --- a/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx +++ b/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx @@ -91,16 +91,14 @@ function CardTypeStep() { const {canUseDirectFeeds} = usePermissions(); const [isError, setIsError] = useState(false); const data = getAvailableCompanyCardTypes({isAmexAvailable: !canUseDirectFeeds, translate, typeSelected, styles: styles.mr3}); - const bankName = addNewCard?.data?.bankName; - const bank = addNewCard?.data?.selectedBank; - const type = addNewCard?.data?.feedType; - const isOtherBankSelected = bank === CONST.COMPANY_CARDS.BANKS.OTHER; + const {bankName, selectedBank, feedType} = addNewCard?.data ?? {}; + const isOtherBankSelected = selectedBank === CONST.COMPANY_CARDS.BANKS.OTHER; const submit = () => { if (!typeSelected) { setIsError(true); } else { - const isNewCardTypeSelected = typeSelected !== type; + const isNewCardTypeSelected = typeSelected !== feedType; CompanyCards.setAddNewCompanyCardStepAndData({ step: CONST.COMPANY_CARDS.STEP.CARD_INSTRUCTIONS, data: { From ac155dfb36a1f5df9bb872aefacdcbcdf8a36807 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Tue, 5 Nov 2024 13:05:10 +0200 Subject: [PATCH 3/3] move check --- src/pages/workspace/companyCards/addNew/CardTypeStep.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx b/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx index ace102eb7e6c..0957bfe1d694 100644 --- a/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx +++ b/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx @@ -93,12 +93,12 @@ function CardTypeStep() { const data = getAvailableCompanyCardTypes({isAmexAvailable: !canUseDirectFeeds, translate, typeSelected, styles: styles.mr3}); const {bankName, selectedBank, feedType} = addNewCard?.data ?? {}; const isOtherBankSelected = selectedBank === CONST.COMPANY_CARDS.BANKS.OTHER; + const isNewCardTypeSelected = typeSelected !== feedType; const submit = () => { if (!typeSelected) { setIsError(true); } else { - const isNewCardTypeSelected = typeSelected !== feedType; CompanyCards.setAddNewCompanyCardStepAndData({ step: CONST.COMPANY_CARDS.STEP.CARD_INSTRUCTIONS, data: {