Skip to content

Commit

Permalink
UIDATIMP-1501: Remove choosing default incoming type
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrHladchenko1 committed Sep 19, 2023
1 parent 6db66e6 commit ce938f8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const renderIncomingRecordMenu = props => {
onToggle={noop}
keyHandler={noop}
existingRecordType="INSTANCE"
open={props.open}
{...props}
/>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';

Expand All @@ -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 (
<Button
buttonStyle="primary"
buttonClass={classNames(css.item, className)}
style={style}
ref={triggerRef}
onClick={onClick}
onKeyDown={keyHandler}
{...ariaProps}
>
{iconKey ? (
<AppIcon
size="medium"
app="data-import"
iconKey={iconKey}
>
<FormattedMessage id={captionId} />
</AppIcon>
) : (
}) => (
<Button
buttonStyle="primary"
buttonClass={classNames(css.item, className)}
style={style}
ref={triggerRef}
onClick={onClick}
onKeyDown={keyHandler}
{...ariaProps}
>
{iconKey ? (
<AppIcon
size="medium"
app="data-import"
iconKey={iconKey}
>
<FormattedMessage id={captionId} />
)}
<Icon icon={`caret-${isExpanded ? 'up' : 'down'}`} />
</Button>
);
};
</AppIcon>
) : (
<FormattedMessage id={captionId} />
)}
<Icon icon={`caret-${isExpanded ? 'up' : 'down'}`} />
</Button>
);

IncomingRecordTrigger.propTypes = {
triggerRef: PropTypes.object.isRequired,
Expand All @@ -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,
};
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ const renderIncomingRecordTrigger = ({
captionId={captionId}
iconKey={iconKey}
isExpanded={isExpanded}
incomingType="MARC_BIBLIOGRAPHIC"
existingType="INSTANCE"
setIncomingRecord={jest.fn()}
/>
);

Expand Down
3 changes: 0 additions & 3 deletions src/components/RecordTypesSelect/components/RecordItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ export const RecordItem = memo(({
<IncomingRecordTrigger
className={className}
style={style}
setIncomingRecord={setIncomingRecord}
incomingType={incomingRecord.type}
existingType={existingRecordType}
onClick={() => setRecordSelectorOpen(!recordSelectorOpen)}
iconKey={incomingRecord.iconKey}
captionId={incomingRecord.captionId}
Expand Down

0 comments on commit ce938f8

Please sign in to comment.