From 8a91398410fd662bbbba36464f4db7de2ea73af4 Mon Sep 17 00:00:00 2001 From: Arnei Date: Fri, 3 Jan 2025 11:52:23 +0100 Subject: [PATCH] Fix metadata fields not editable during multi edit In the modal for editing multiple events at the same time, the fields "presenter(s)" and "contributor(s)" were not editable in some cases. This patch fixes that. --- .../DetailsExtendedMetadataTab.tsx | 3 +- .../ModalTabsAndPages/DetailsMetadataTab.tsx | 3 +- .../NewMetadataExtendedPage.tsx | 3 +- .../ModalTabsAndPages/NewMetadataPage.tsx | 3 +- .../modals/EditMetadataEventsModal.tsx | 4 +- .../shared/wizard/RenderMultiField.tsx | 62 +------------------ 6 files changed, 7 insertions(+), 71 deletions(-) diff --git a/src/components/events/partials/ModalTabsAndPages/DetailsExtendedMetadataTab.tsx b/src/components/events/partials/ModalTabsAndPages/DetailsExtendedMetadataTab.tsx index 5a54353fde..7e6d8bf641 100644 --- a/src/components/events/partials/ModalTabsAndPages/DetailsExtendedMetadataTab.tsx +++ b/src/components/events/partials/ModalTabsAndPages/DetailsExtendedMetadataTab.tsx @@ -118,8 +118,7 @@ const DetailsExtendedMetadataTab = ({ ) : ( {/* Render single value or multi value editable input */} - {field.type === "mixed_text" && - field.collection?.length !== 0 ? ( + {field.type === "mixed_text" ? ( {/* Render single value or multi value editable input */} - {field.type === "mixed_text" && - field.collection?.length !== 0 ? ( + {field.type === "mixed_text" ? ( ({ ) ) : ( - {field.type === "mixed_text" && - field.collection?.length !== 0 ? ( + {field.type === "mixed_text" ? ( ({ {/* Render single value or multi value input */} - {field.type === "mixed_text" && - field.collection?.length !== 0 ? ( + {field.type === "mixed_text" ? ( {/* Render single value or multi value input */} - {metadata.type === "mixed_text" && - !!metadata.collection && - metadata.collection.length !== 0 ? ( + {metadata.type === "mixed_text" ? ( - {fieldInfo.type === "mixed_text" && !!fieldInfo.collection ? ( + {fieldInfo.type === "mixed_text" && ( - ) : ( - fieldInfo.type === "mixed_text" && ( - - ) )} ) : ( @@ -193,52 +181,6 @@ const EditMultiSelect = ({ ); }; -// Renders editable field input for multiple values -const EditMultiValue = ({ - setEditMode, - inputValue, - removeItem, - handleChange, - handleKeyDown, - field, - fieldValue, -}: { - setEditMode: (e: boolean) => void - inputValue: HTMLInputElement["value"] - removeItem: (key: number) => void - handleChange: (event: React.ChangeEvent) => void - handleKeyDown: (event: React.KeyboardEvent) => void - field: FieldProps["field"] - fieldValue: FieldInputProps["value"] -}) => { - const { t } = useTranslation(); - - return ( - <> -
setEditMode(false)} ref={childRef}> - handleKeyDown(e)} - onChange={(e) => handleChange(e)} - value={inputValue} - placeholder={t("EDITABLE.MULTI.PLACEHOLDER")} - /> -
- {fieldValue instanceof Array && - fieldValue.length !== 0 && - fieldValue.map((item, key) => ( - - {item} - - - ))} - - ); -}; - // Shows the values of the array in non-edit mode const ShowValue = ({ setEditMode,