Skip to content

Commit

Permalink
fix: show yellow bg color when removing funding agreement
Browse files Browse the repository at this point in the history
  • Loading branch information
Sepehr-Sobhani committed Feb 1, 2023
1 parent daac49a commit a973a49
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
28 changes: 19 additions & 9 deletions app/components/Form/ProjectFundingAgreementFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,26 @@ const ProjectFundingAgreementFormSummary: React.FC<Props> = ({

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 (
Expand All @@ -240,6 +247,9 @@ const ProjectFundingAgreementFormSummary: React.FC<Props> = ({
}
formTitle="Budgets, Expenses & Payments"
/>
{!isOnAmendmentsAndOtherRevisionsPage && (
<h3>Project Additional Funding Source</h3>
)}
<dd>{additionalFundingSourcesJSX}</dd>
</>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,6 @@ describe("The Project Funding Agreement Form Summary", () => {

expect(
screen.getByText(/budgets, expenses & payments removed/i)
).toHaveClass("diffOld");
).toHaveClass("diffReviewAndSubmitInformationOld");
});
});

0 comments on commit a973a49

Please sign in to comment.