diff --git a/met-web/src/components/engagement/form/EngagementFormTabs/AdditionalDetails/Metadata/EngagementMetadata.tsx b/met-web/src/components/engagement/form/EngagementFormTabs/AdditionalDetails/Metadata/EngagementMetadata.tsx index 422634549..2c453a02a 100644 --- a/met-web/src/components/engagement/form/EngagementFormTabs/AdditionalDetails/Metadata/EngagementMetadata.tsx +++ b/met-web/src/components/engagement/form/EngagementFormTabs/AdditionalDetails/Metadata/EngagementMetadata.tsx @@ -9,7 +9,7 @@ import { TaxonFormValues } from 'components/metadataManagement/types'; import { useTheme } from '@mui/material/styles'; import { ActionContext } from '../../../ActionContext'; import * as yup from 'yup'; -import { defaultAutocomplete } from './TaxonInputComponents'; +import { DefaultAutocomplete } from './TaxonInputComponents'; import { yupResolver } from '@hookform/resolvers/yup'; import { bulkPatchEngagementMetadata } from 'services/engagementMetadataService'; import { openNotification } from 'services/notificationService/notificationSlice'; @@ -110,11 +110,11 @@ const EngagementMetadata = forwardRef((_props, ref) => { }, })); - const renderTaxonTile = (taxon: MetadataTaxon, index: number) => { + const TaxonTile = (taxon: MetadataTaxon, index: number) => { const taxonType = TaxonTypes[taxon.data_type as keyof typeof TaxonTypes]; const theme = useTheme(); const taxonValue = watch(taxon.id.toString()); - const TaxonInput = taxonType.customInput ?? defaultAutocomplete; + const TaxonInput = taxonType.customInput ?? DefaultAutocomplete; return ( { spacing={3} padding={2} > - {tenantTaxa.map(renderTaxonTile)} + {tenantTaxa.map(TaxonTile)} diff --git a/met-web/src/components/engagement/form/EngagementFormTabs/AdditionalDetails/Metadata/TaxonInputComponents.tsx b/met-web/src/components/engagement/form/EngagementFormTabs/AdditionalDetails/Metadata/TaxonInputComponents.tsx index 49aebf546..d54f36978 100644 --- a/met-web/src/components/engagement/form/EngagementFormTabs/AdditionalDetails/Metadata/TaxonInputComponents.tsx +++ b/met-web/src/components/engagement/form/EngagementFormTabs/AdditionalDetails/Metadata/TaxonInputComponents.tsx @@ -14,7 +14,7 @@ import { } from '@mui/material'; import { FieldError } from 'react-hook-form'; -export const defaultAutocomplete = ({ taxon, taxonType, field, setValue, errors, trigger }: TaxonInputProps) => { +export const DefaultAutocomplete = ({ taxon, taxonType, field, setValue, errors, trigger }: TaxonInputProps) => { const [inputValue, setInputValue] = useState(''); const valueErrors = (errors[taxon.id.toString()] as unknown as Array | FieldError) ?? []; @@ -30,7 +30,7 @@ export const defaultAutocomplete = ({ taxon, taxonType, field, setValue, errors, errorMessage = (valueErrors as Array)?.map((error: FieldError, index: number) => { errorIndices.add(index); return ( - + Entry #{index + 1}: {error.message}
diff --git a/met-web/src/components/metadataManagement/TaxonEditor.tsx b/met-web/src/components/metadataManagement/TaxonEditor.tsx index 2e601f3a7..95865262c 100644 --- a/met-web/src/components/metadataManagement/TaxonEditor.tsx +++ b/met-web/src/components/metadataManagement/TaxonEditor.tsx @@ -208,6 +208,7 @@ export const TaxonEditor = () => { orderedMetadataTaxa.map((taxon: MetadataTaxon, index) => { return ( { errorIndices.add(index); return ( - + Entry #{index + 1}: {error.message}
@@ -56,7 +56,7 @@ const PresetValuesEditor = ({ variant="outlined" label={option} {...getTagProps({ index })} - key={index} + key={option} color={errorIndices.has(index) ? 'error' : 'default'} /> ))}