diff --git a/src/sections/shared/form/EditCreateCollectionForm/collection-form/CollectionForm.tsx b/src/sections/shared/form/EditCreateCollectionForm/collection-form/CollectionForm.tsx index 85624e6d9..208da6a13 100644 --- a/src/sections/shared/form/EditCreateCollectionForm/collection-form/CollectionForm.tsx +++ b/src/sections/shared/form/EditCreateCollectionForm/collection-form/CollectionForm.tsx @@ -37,7 +37,7 @@ export const CollectionForm = ({ defaultCollectionFacets }: CollectionFormProps) => { const formContainerRef = useRef(null) - const { t } = useTranslation('createCollection') + const { t } = useTranslation('shared', { keyPrefix: 'collectionForm' }) const navigate = useNavigate() const { submitForm, submitError, submissionStatus } = useSubmitCollection( diff --git a/src/sections/shared/form/EditCreateCollectionForm/collection-form/browse-search-facets-section/BrowseSearchFacetsSection.tsx b/src/sections/shared/form/EditCreateCollectionForm/collection-form/browse-search-facets-section/BrowseSearchFacetsSection.tsx index fbeff0fcf..42a55b733 100644 --- a/src/sections/shared/form/EditCreateCollectionForm/collection-form/browse-search-facets-section/BrowseSearchFacetsSection.tsx +++ b/src/sections/shared/form/EditCreateCollectionForm/collection-form/browse-search-facets-section/BrowseSearchFacetsSection.tsx @@ -31,7 +31,7 @@ export const BrowseSearchFacetsSection = ({ allFacetableMetadataFields, allMetadataBlocksInfo }: BrowseSearchFacetsSectionProps) => { - const { t } = useTranslation('createCollection') + const { t } = useTranslation('shared', { keyPrefix: 'collectionForm' }) const { control } = useFormContext() const useBrowseSearchFacetsFromParentCheckedValue = useWatch({ name: USE_FACETS_FROM_PARENT diff --git a/src/sections/shared/form/EditCreateCollectionForm/collection-form/browse-search-facets-section/FacetsFromParentCheckbox.tsx b/src/sections/shared/form/EditCreateCollectionForm/collection-form/browse-search-facets-section/FacetsFromParentCheckbox.tsx index 638c33560..ab98f4d14 100644 --- a/src/sections/shared/form/EditCreateCollectionForm/collection-form/browse-search-facets-section/FacetsFromParentCheckbox.tsx +++ b/src/sections/shared/form/EditCreateCollectionForm/collection-form/browse-search-facets-section/FacetsFromParentCheckbox.tsx @@ -14,7 +14,7 @@ export const FacetsFromParentCheckbox = ({ defaultCollectionFacets, resetAvailableItems }: FacetsFromParentCheckboxProps) => { - const { t } = useTranslation('createCollection') + const { t } = useTranslation('shared', { keyPrefix: 'collectionForm' }) const { control, setValue } = useFormContext() const hostCollectionFieldValue = useWatch({ name: 'hostCollection' }) as string diff --git a/src/sections/shared/form/EditCreateCollectionForm/collection-form/metadata-fields-section/fields-from-parent-checkbox/FieldsFromParentCheckbox.tsx b/src/sections/shared/form/EditCreateCollectionForm/collection-form/metadata-fields-section/fields-from-parent-checkbox/FieldsFromParentCheckbox.tsx index 593dc05c8..8b8559342 100644 --- a/src/sections/shared/form/EditCreateCollectionForm/collection-form/metadata-fields-section/fields-from-parent-checkbox/FieldsFromParentCheckbox.tsx +++ b/src/sections/shared/form/EditCreateCollectionForm/collection-form/metadata-fields-section/fields-from-parent-checkbox/FieldsFromParentCheckbox.tsx @@ -15,7 +15,7 @@ interface FieldsFromParentCheckboxProps { } export const FieldsFromParentCheckbox = ({ defaultValues }: FieldsFromParentCheckboxProps) => { - const { t } = useTranslation('createCollection') + const { t } = useTranslation('shared', { keyPrefix: 'collectionForm' }) const checkboxID = useId() const { control, setValue } = useFormContext() const [showResetConfirmationModal, setShowResetConfirmationModal] = useState(false) diff --git a/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/ContactsField.tsx b/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/ContactsField.tsx index 9839681e4..9c149b46b 100644 --- a/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/ContactsField.tsx +++ b/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/ContactsField.tsx @@ -11,7 +11,7 @@ interface ContactsFieldProps { } export const ContactsField = ({ rules }: ContactsFieldProps) => { - const { t } = useTranslation('createCollection') + const { t } = useTranslation('shared', { keyPrefix: 'collectionForm' }) const { control } = useFormContext() const { diff --git a/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/DescriptionField.tsx b/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/DescriptionField.tsx index 4e07a4702..92e6a3b56 100644 --- a/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/DescriptionField.tsx +++ b/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/DescriptionField.tsx @@ -5,7 +5,7 @@ import { Col, Form, Stack, Tooltip } from '@iqss/dataverse-design-system' import styles from './TopFieldsSection.module.scss' export const DescriptionField = () => { - const { t } = useTranslation('createCollection') + const { t } = useTranslation('shared', { keyPrefix: 'collectionForm' }) const { control } = useFormContext() const HtmlWordTooltip = ({ children }: { children: ReactNode }) => ( diff --git a/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/IdentifierField.tsx b/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/IdentifierField.tsx index 12c6ebc40..3e22d0657 100644 --- a/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/IdentifierField.tsx +++ b/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/IdentifierField.tsx @@ -22,7 +22,7 @@ interface IdentifierFieldProps { } export const IdentifierField = ({ rules }: IdentifierFieldProps) => { - const { t } = useTranslation('createCollection') + const { t } = useTranslation('shared', { keyPrefix: 'collectionForm' }) const { control, setValue } = useFormContext() const nameFieldValue = useWatch({ name: 'name' }) as string diff --git a/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/TopFieldsSection.tsx b/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/TopFieldsSection.tsx index 61803ee6c..1c124b74d 100644 --- a/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/TopFieldsSection.tsx +++ b/src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/TopFieldsSection.tsx @@ -11,7 +11,7 @@ import { IdentifierField } from './IdentifierField' import { DescriptionField } from './DescriptionField' export const TopFieldsSection = () => { - const { t } = useTranslation('createCollection') + const { t } = useTranslation('shared', { keyPrefix: 'collectionForm' }) const { control } = useFormContext() const hostCollectionRules: UseControllerProps['rules'] = { diff --git a/src/sections/shared/form/EditCreateCollectionForm/collection-form/useSubmitCollection.ts b/src/sections/shared/form/EditCreateCollectionForm/collection-form/useSubmitCollection.ts index 91394cf0d..f2caeb537 100644 --- a/src/sections/shared/form/EditCreateCollectionForm/collection-form/useSubmitCollection.ts +++ b/src/sections/shared/form/EditCreateCollectionForm/collection-form/useSubmitCollection.ts @@ -1,12 +1,7 @@ import { useState } from 'react' import { useNavigate } from 'react-router-dom' import { WriteError } from '@iqss/dataverse-client-javascript' -import { - CollectionFormData, - CollectionFormMetadataBlocks, - CollectionFormValuesOnSubmit, - FormattedCollectionInputLevels -} from '../types' +import { CollectionFormData, CollectionFormValuesOnSubmit } from '../types' import { CollectionRepository } from '@/collection/domain/repositories/CollectionRepository' import { EditCreateCollectionFormMode, @@ -62,17 +57,17 @@ export function useSubmitCollection( const metadataBlockNamesDTO = CollectionFormHelper.formatFormMetadataBlockNamesToMetadataBlockNamesDTO( - formData[METADATA_BLOCKS_NAMES_GROUPER] as CollectionFormMetadataBlocks + formData[METADATA_BLOCKS_NAMES_GROUPER] ) const inputLevelsDTO = CollectionFormHelper.formatFormInputLevelsToInputLevelsDTO( metadataBlockNamesDTO, - formData[INPUT_LEVELS_GROUPER] as FormattedCollectionInputLevels + formData[INPUT_LEVELS_GROUPER] ) const facetIdsDTO = formData.facetIds.map((facet) => facet.value) - const useFieldsFromParentChecked = formData[USE_FIELDS_FROM_PARENT] as boolean + const useFieldsFromParentChecked = formData[USE_FIELDS_FROM_PARENT] const newCollection: CollectionDTO = { name: formData.name,