Skip to content

Commit

Permalink
Merge branch 'main' into patch/translations
Browse files Browse the repository at this point in the history
  • Loading branch information
kathyavini committed Sep 17, 2024
2 parents 0a6783a + 650c16f commit 253b899
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -49,7 +50,7 @@ const PreSurveyBody = ({ surveyId }) => {
return (
<iframe
title="temp iframe title"
src={`https://app.surveystack.io/surveys/${surveyId}?minimal_ui=true`}
src={`https://app.surveystack.io/groups/${surveyGroupId}/surveys/${surveyId}/submissions/new?minimal_ui=true`}
className={styles.surveyFrame}
allow="geolocation"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* GNU General Public License for more details, see <https://www.gnu.org/licenses/>.
*/

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';
Expand Down Expand Up @@ -101,6 +101,7 @@ const SoilAmendmentProductCard = ({
register,
watch,
setValue,
getValues,
formState: { errors },
} = useFormContext();

Expand All @@ -120,6 +121,12 @@ const SoilAmendmentProductCard = ({
selectRef?.current?.clearValue();
};

useEffect(() => {
if (otherPurposeId && !getValues(OTHER_PURPOSE_ID)) {
setValue(OTHER_PURPOSE_ID, otherPurposeId);
}
}, [otherPurposeId]);

return (
<div className={styles.productCard}>
{!isReadOnly && onRemove && (
Expand Down Expand Up @@ -181,16 +188,11 @@ const SoilAmendmentProductCard = ({
const newPurposes = e.map(({ value }) => value);
setValue(PURPOSES, newPurposes, { shouldValidate: true });
}}
style={{ paddingBottom: '12px' }} // TODO: remove after adding <QuantityApplicationRate />
style={{ paddingBottom: '12px' }}
/>
)}
/>
<input
type="hidden"
value={otherPurposeId}
defaultValue={otherPurposeId}
{...register(OTHER_PURPOSE_ID)}
/>
<input type="hidden" {...register(OTHER_PURPOSE_ID)} />

{purposes?.includes(otherPurposeId) && (
<>
Expand Down

0 comments on commit 253b899

Please sign in to comment.