From 8713c5923d30310bee5890a718d33cc016fd7a3a Mon Sep 17 00:00:00 2001 From: Andy Espagnolo Date: Fri, 20 Oct 2023 12:35:43 -0300 Subject: [PATCH 1/2] fix: disable grant and poll fields on submission vp not met --- .../GrantRequest/GrantRequestFundingSection.tsx | 1 + src/components/ProjectRequest/NumberSelector.tsx | 8 +++++--- src/pages/submit/grant.tsx | 10 ++++++---- src/pages/submit/poll.tsx | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/GrantRequest/GrantRequestFundingSection.tsx b/src/components/GrantRequest/GrantRequestFundingSection.tsx index 1805f08ba..aa12a1151 100644 --- a/src/components/GrantRequest/GrantRequestFundingSection.tsx +++ b/src/components/GrantRequest/GrantRequestFundingSection.tsx @@ -211,6 +211,7 @@ export default function GrantRequestFundingSection({ onChange={(value) => setValue('projectDuration', Number(value))} label={t('page.submit_grant.funding_section.project_duration_title')} unit="months" + disabled={isFormDisabled} /> diff --git a/src/components/ProjectRequest/NumberSelector.tsx b/src/components/ProjectRequest/NumberSelector.tsx index 249053d02..403ff9d98 100644 --- a/src/components/ProjectRequest/NumberSelector.tsx +++ b/src/components/ProjectRequest/NumberSelector.tsx @@ -20,9 +20,10 @@ interface Props { unit: UnitTypeLongPlural | UnitTypeLongPlural[] subtitle?: string onUnitChange?: (unit: UnitTypeLongPlural) => void + disabled?: boolean } -const NumberSelector = ({ value, onChange, min, max, label, unit, onUnitChange, subtitle }: Props) => { +const NumberSelector = ({ value, onChange, min, max, label, unit, onUnitChange, subtitle, disabled }: Props) => { const t = useFormatMessage() const handleAddClick = useCallback(() => { if (value === max) { @@ -66,11 +67,11 @@ const NumberSelector = ({ value, onChange, min, max, label, unit, onUnitChange,
- {value} -
@@ -80,6 +81,7 @@ const NumberSelector = ({ value, onChange, min, max, label, unit, onUnitChange, handleUnitChange(value as UnitTypeLongPlural)} diff --git a/src/pages/submit/grant.tsx b/src/pages/submit/grant.tsx index f513d21ab..ba7eec8a8 100644 --- a/src/pages/submit/grant.tsx +++ b/src/pages/submit/grant.tsx @@ -255,7 +255,7 @@ export default function SubmitGrant() { navigate(locations.submit(ProposalType.Grant), { replace: true }) }} onValidation={handleFundingSectionValidation} - isFormDisabled={isFormDisabled} + isFormDisabled={isFormDisabled || submissionVpNotMet} sectionNumber={getSectionNumber()} /> @@ -264,7 +264,7 @@ export default function SubmitGrant() { patchGrantRequest((prevState) => ({ ...prevState, ...data })) patchValidationState({ generalInformationSectionValid: sectionValid }) }} - isFormDisabled={isFormDisabled} + isFormDisabled={isFormDisabled || submissionVpNotMet} sectionNumber={getSectionNumber()} /> @@ -274,6 +274,7 @@ export default function SubmitGrant() { patchValidationState({ teamSectionValid: sectionValid }) }} sectionNumber={getSectionNumber()} + isDisabled={isFormDisabled || submissionVpNotMet} /> {grantRequest.category && ( )} @@ -298,7 +300,7 @@ export default function SubmitGrant() { patchValidationState({ finalConsentSectionValid: sectionValid })} - isFormDisabled={isFormDisabled} + isFormDisabled={isFormDisabled || submissionVpNotMet} sectionNumber={getSectionNumber()} /> diff --git a/src/pages/submit/poll.tsx b/src/pages/submit/poll.tsx index ac61bbe98..5e4a46575 100644 --- a/src/pages/submit/poll.tsx +++ b/src/pages/submit/poll.tsx @@ -293,7 +293,7 @@ export default function SubmitPoll() {
- +