From ce938f80cc687ae685a4ab748b52592366fe304a Mon Sep 17 00:00:00 2001 From: Oleksandr Hladchenko1 Date: Tue, 19 Sep 2023 11:20:52 +0300 Subject: [PATCH] UIDATIMP-1501: Remove choosing default incoming type --- .../components/IncomingRecordMenu.test.js | 1 + .../components/IncomingRecordTrigger.js | 66 +++++++------------ .../components/IncomingRecordTrigger.test.js | 3 - .../components/RecordItem.js | 3 - 4 files changed, 25 insertions(+), 48 deletions(-) diff --git a/src/components/RecordTypesSelect/components/IncomingRecordMenu.test.js b/src/components/RecordTypesSelect/components/IncomingRecordMenu.test.js index a650485c9..816c26f9c 100644 --- a/src/components/RecordTypesSelect/components/IncomingRecordMenu.test.js +++ b/src/components/RecordTypesSelect/components/IncomingRecordMenu.test.js @@ -20,6 +20,7 @@ const renderIncomingRecordMenu = props => { onToggle={noop} keyHandler={noop} existingRecordType="INSTANCE" + open={props.open} {...props} /> ); diff --git a/src/components/RecordTypesSelect/components/IncomingRecordTrigger.js b/src/components/RecordTypesSelect/components/IncomingRecordTrigger.js index b6e22912d..c04ca60bb 100644 --- a/src/components/RecordTypesSelect/components/IncomingRecordTrigger.js +++ b/src/components/RecordTypesSelect/components/IncomingRecordTrigger.js @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React from 'react'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; import classNames from 'classnames'; @@ -8,9 +8,6 @@ import { Icon, } from '@folio/stripes/components'; import { AppIcon } from '@folio/stripes/core'; -import { FOLIO_RECORD_TYPES } from '@folio/stripes-data-transfer-components'; - -import { ALLOWED_INCOMING_RECORD_TYPES } from '../../../utils'; import css from '../RecordTypesSelect.css'; @@ -24,42 +21,30 @@ export const IncomingRecordTrigger = ({ className, isExpanded, style, - incomingType, - existingType, - setIncomingRecord, -}) => { - useEffect(() => { - const allowedIncomingType = ALLOWED_INCOMING_RECORD_TYPES[existingType][incomingType]; - const incomingRecord = allowedIncomingType || FOLIO_RECORD_TYPES.MARC_BIBLIOGRAPHIC; - - setIncomingRecord(incomingRecord); - }, [existingType]); // eslint-disable-line react-hooks/exhaustive-deps - - return ( - - ); -}; + + ) : ( + + )} + + +); IncomingRecordTrigger.propTypes = { triggerRef: PropTypes.object.isRequired, @@ -70,8 +55,5 @@ IncomingRecordTrigger.propTypes = { iconKey: PropTypes.string, className: PropTypes.string, isExpanded: PropTypes.bool, - setIncomingRecord: PropTypes.func, - incomingType: PropTypes.string, - existingType: PropTypes.string, style: PropTypes.object, }; diff --git a/src/components/RecordTypesSelect/components/IncomingRecordTrigger.test.js b/src/components/RecordTypesSelect/components/IncomingRecordTrigger.test.js index 54c52f469..3fec3d401 100644 --- a/src/components/RecordTypesSelect/components/IncomingRecordTrigger.test.js +++ b/src/components/RecordTypesSelect/components/IncomingRecordTrigger.test.js @@ -36,9 +36,6 @@ const renderIncomingRecordTrigger = ({ captionId={captionId} iconKey={iconKey} isExpanded={isExpanded} - incomingType="MARC_BIBLIOGRAPHIC" - existingType="INSTANCE" - setIncomingRecord={jest.fn()} /> ); diff --git a/src/components/RecordTypesSelect/components/RecordItem.js b/src/components/RecordTypesSelect/components/RecordItem.js index c996e84f3..2b9f0dfc2 100644 --- a/src/components/RecordTypesSelect/components/RecordItem.js +++ b/src/components/RecordTypesSelect/components/RecordItem.js @@ -42,9 +42,6 @@ export const RecordItem = memo(({ setRecordSelectorOpen(!recordSelectorOpen)} iconKey={incomingRecord.iconKey} captionId={incomingRecord.captionId}