From a973a49c97b9d9b3d4ab579c4e602d92346938ee Mon Sep 17 00:00:00 2001 From: SeSo Date: Tue, 24 Jan 2023 12:28:40 -0800 Subject: [PATCH] fix: show yellow bg color when removing funding agreement --- .../ProjectFundingAgreementFormSummary.tsx | 28 +++++++++++++------ ...rojectFundingAgreementFormSummary.test.tsx | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/components/Form/ProjectFundingAgreementFormSummary.tsx b/app/components/Form/ProjectFundingAgreementFormSummary.tsx index 8c7f3b0b4b..2c0f863fa8 100644 --- a/app/components/Form/ProjectFundingAgreementFormSummary.tsx +++ b/app/components/Form/ProjectFundingAgreementFormSummary.tsx @@ -208,19 +208,26 @@ const ProjectFundingAgreementFormSummary: React.FC = ({ const fundingAgreementFormNotUpdated = useMemo( () => - (!fundingAgreementSummary || - fundingAgreementSummary?.isPristine || - (fundingAgreementSummary?.isPristine === null && - Object.keys(fundingAgreementSummary?.newFormData).length === 0)) && - allAdditionalFundingSourceFormChangesPristine, - [allAdditionalFundingSourceFormChangesPristine, fundingAgreementSummary] + !fundingAgreementSummary || + fundingAgreementSummary?.isPristine || + (fundingAgreementSummary?.isPristine === null && + Object.keys(fundingAgreementSummary?.newFormData).length === 0), + [fundingAgreementSummary] ); // Update the hasDiff state in the CollapsibleFormWidget to define if the form has diffs to show useEffect( - () => setHasDiff && setHasDiff(!fundingAgreementFormNotUpdated), - [fundingAgreementFormNotUpdated, setHasDiff] + () => + setHasDiff && + setHasDiff( + !fundingAgreementFormNotUpdated || + !allAdditionalFundingSourceFormChangesPristine + ), + [ + allAdditionalFundingSourceFormChangesPristine, + fundingAgreementFormNotUpdated, + setHasDiff, + ] ); - // This condition handles the case where the form is archived if ( @@ -240,6 +247,9 @@ const ProjectFundingAgreementFormSummary: React.FC = ({ } formTitle="Budgets, Expenses & Payments" /> + {!isOnAmendmentsAndOtherRevisionsPage && ( +

Project Additional Funding Source

+ )}
{additionalFundingSourcesJSX}
) : ( diff --git a/app/tests/unit/components/Form/ProjectFundingAgreementFormSummary.test.tsx b/app/tests/unit/components/Form/ProjectFundingAgreementFormSummary.test.tsx index df34524f6d..7468820c81 100644 --- a/app/tests/unit/components/Form/ProjectFundingAgreementFormSummary.test.tsx +++ b/app/tests/unit/components/Form/ProjectFundingAgreementFormSummary.test.tsx @@ -336,6 +336,6 @@ describe("The Project Funding Agreement Form Summary", () => { expect( screen.getByText(/budgets, expenses & payments removed/i) - ).toHaveClass("diffOld"); + ).toHaveClass("diffReviewAndSubmitInformationOld"); }); });