From 18ee5b18dc3a8639987e67721c757ad8a0c5de22 Mon Sep 17 00:00:00 2001 From: Sayaka Ono Date: Mon, 29 Jul 2024 10:12:43 -0700 Subject: [PATCH 1/7] LF-4351 Set OTHER_PURPOSE_ID in useEffect --- .../ProductCard/index.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/webapp/src/components/Task/AddSoilAmendmentProducts/ProductCard/index.tsx b/packages/webapp/src/components/Task/AddSoilAmendmentProducts/ProductCard/index.tsx index 9475b3bd73..d49b83ec01 100644 --- a/packages/webapp/src/components/Task/AddSoilAmendmentProducts/ProductCard/index.tsx +++ b/packages/webapp/src/components/Task/AddSoilAmendmentProducts/ProductCard/index.tsx @@ -13,7 +13,7 @@ * GNU General Public License for more details, see . */ -import { ReactNode, useRef } from 'react'; +import { ReactNode, useEffect, useRef } from 'react'; import { Controller, useFormContext } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { GroupBase, SelectInstance } from 'react-select'; @@ -101,6 +101,7 @@ const SoilAmendmentProductCard = ({ register, watch, setValue, + getValues, formState: { errors }, } = useFormContext(); @@ -120,6 +121,12 @@ const SoilAmendmentProductCard = ({ selectRef?.current?.clearValue(); }; + useEffect(() => { + if (otherPurposeId && !getValues(OTHER_PURPOSE_ID)) { + setValue(OTHER_PURPOSE_ID, otherPurposeId); + } + }, [otherPurposeId]); + return (
{!isReadOnly && onRemove && ( @@ -185,12 +192,7 @@ const SoilAmendmentProductCard = ({ /> )} /> - + {purposes?.includes(otherPurposeId) && ( <> From 4d47fe12a0919c928c5410fc47066f23c7cef4f4 Mon Sep 17 00:00:00 2001 From: Sayaka Ono Date: Mon, 29 Jul 2024 10:17:25 -0700 Subject: [PATCH 2/7] LF-4351 Remove out-dated comment --- .../Task/AddSoilAmendmentProducts/ProductCard/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webapp/src/components/Task/AddSoilAmendmentProducts/ProductCard/index.tsx b/packages/webapp/src/components/Task/AddSoilAmendmentProducts/ProductCard/index.tsx index d49b83ec01..00fd3ed2f0 100644 --- a/packages/webapp/src/components/Task/AddSoilAmendmentProducts/ProductCard/index.tsx +++ b/packages/webapp/src/components/Task/AddSoilAmendmentProducts/ProductCard/index.tsx @@ -188,7 +188,7 @@ const SoilAmendmentProductCard = ({ const newPurposes = e.map(({ value }) => value); setValue(PURPOSES, newPurposes, { shouldValidate: true }); }} - style={{ paddingBottom: '12px' }} // TODO: remove after adding + style={{ paddingBottom: '12px' }} /> )} /> From 35967d6ab1d6738c5fd9f674e031d91aff8c1d56 Mon Sep 17 00:00:00 2001 From: Duncan-Brain Date: Mon, 29 Jul 2024 10:05:51 -0400 Subject: [PATCH 3/7] LF-4353 - update surveystack iframe url --- .../CertificationSurvey/RegisteredCertifierQuestions/index.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/webapp/src/components/CertificationSurvey/RegisteredCertifierQuestions/index.jsx b/packages/webapp/src/components/CertificationSurvey/RegisteredCertifierQuestions/index.jsx index e0df0f8841..e00712a07e 100644 --- a/packages/webapp/src/components/CertificationSurvey/RegisteredCertifierQuestions/index.jsx +++ b/packages/webapp/src/components/CertificationSurvey/RegisteredCertifierQuestions/index.jsx @@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next'; import { Info, Main, Semibold } from '../../Typography'; import { colors } from '../../../assets/theme'; import { ReactComponent as PostSurveySplash } from '../../../assets/images/certification/CompleteSurveySplash.svg'; +const surveyGroupId = import.meta.env.VITE_SURVEY_GROUP_ID; const RegisteredCertifierQuestionsSurvey = ({ certiferAcronym, @@ -49,7 +50,7 @@ const PreSurveyBody = ({ surveyId }) => { return (