diff --git a/src/client/entity-editor/alias-editor/alias-modal-body.tsx b/src/client/entity-editor/alias-editor/alias-modal-body.tsx index 3c9afb1bed..5b2e31c490 100644 --- a/src/client/entity-editor/alias-editor/alias-modal-body.tsx +++ b/src/client/entity-editor/alias-editor/alias-modal-body.tsx @@ -36,14 +36,14 @@ export const AliasModalBody = ({aliases, onAddAlias, languageOptions}:AliasModal
{ - aliases.toArray().map((_, rowId) => ( + aliases.map((_, rowId) => ( - )) + )).toArray() }
diff --git a/src/client/entity-editor/series-section/series-editor.tsx b/src/client/entity-editor/series-section/series-editor.tsx index 4ceb7ab7cd..c354ec9a6b 100644 --- a/src/client/entity-editor/series-section/series-editor.tsx +++ b/src/client/entity-editor/series-section/series-editor.tsx @@ -43,6 +43,7 @@ type EntitySearchResult = { type SeriesItemsProps = { defaultOptions: Array, + hideItemSelect: boolean baseEntity: Entity, onAdd: (_Relationship) => unknown, onEdit: (Attribute, string) => unknown, @@ -141,7 +142,7 @@ const SortableItem = SortableElement(({value, onRemove, baseEntity, handleNumber )); const SortableList = SortableContainer(({children}) =>
{children}
); -function SeriesEditor({baseEntity, relationshipTypes, seriesType, orderType, onRemove, +function SeriesEditor({baseEntity, relationshipTypes, seriesType, orderType, onRemove, hideItemSelect, onAdd, onEdit, onSort, seriesItemsArray, isUnifiedForm, defaultOptions}:SeriesItemsProps) { const [seriesItem, setSeriesItem] = useState(null); const [targetEntity, setTargetEntity] = useState(null); @@ -228,6 +229,7 @@ function SeriesEditor({baseEntity, relationshipTypes, seriesType, orderType, onR } : null } + {!hideItemSelect &&

Add an entity to the series:

@@ -250,6 +252,7 @@ function SeriesEditor({baseEntity, relationshipTypes, seriesType, orderType, onR
+ } ); } diff --git a/src/client/entity-editor/series-section/series-section.tsx b/src/client/entity-editor/series-section/series-section.tsx index 8d9fcdd313..f6381ddc3e 100644 --- a/src/client/entity-editor/series-section/series-section.tsx +++ b/src/client/entity-editor/series-section/series-section.tsx @@ -59,7 +59,7 @@ type DispatchProps = { }; type OwnProps = { - hideTypeOption?:boolean, + hideItemSelect?:boolean, entity: Entity, isUnifiedForm?: boolean, entityType: EntityType, @@ -104,7 +104,7 @@ function SeriesSection({ entity, entityName, entityType, - hideTypeOption, + hideItemSelect, onEdit, onOrderTypeChange, onRemove, @@ -181,11 +181,10 @@ function SeriesSection({ return (
{!isUnifiedForm && heading} - {!hideTypeOption && + {!hideItemSelect &&

All fields are mandatory — select the option from dropdown

} - {!hideTypeOption && @@ -232,10 +231,10 @@ function SeriesSection({ } - } .card{ margin-bottom: 10px; } -.entities-preview{ - cursor: pointer; - color: $orange; - transition: all 0.2s linear; -} -.entities-preview:hover{ - color: #754E37; +.review-section{ + display: flex; } .series-item-dialog{ max-width: 600px; +} + +.review-card{ + margin: 10px; } \ No newline at end of file diff --git a/src/client/unified-form/content-tab/content-tab.tsx b/src/client/unified-form/content-tab/content-tab.tsx index 9ba4056cc5..d83ae6fa82 100644 --- a/src/client/unified-form/content-tab/content-tab.tsx +++ b/src/client/unified-form/content-tab/content-tab.tsx @@ -81,7 +81,7 @@ export function ContentTab({works, onChange, onModalClose, onModalOpen, onSeries bbid: series?.id }, entityType: 'series', - hideTypeOption: true + hideItemSelect: true }; const checkLabel = ( <> @@ -98,6 +98,24 @@ export function ContentTab({works, onChange, onModalClose, onModalOpen, onSeries ); + const seriesWorkLabel = ( + + <> + + Add Works to Series + This will automatically add each new selected work to series items (if present)} + > + + + + + + ); const filterSeries = React.useCallback((item) => toLower(item.entityType) === 'work', []); const filters = [filterSeries]; return ( @@ -125,19 +143,23 @@ export function ContentTab({works, onChange, onModalClose, onModalOpen, onSeries type="checkbox" onChange={toggleCheck} /> +
+
+
+

Series

+

You can add all the Works above to an existing or new series if they are part of the + same a set or sequence of related Works. + Check the checkbox below to add the Works to a Series +

-
-
-
-

Series

+ {copyToSeries && - {/* - {series && } - */} - - {series && } + } + {copyToSeries && }
); diff --git a/src/client/unified-form/content-tab/reducer.ts b/src/client/unified-form/content-tab/reducer.ts index 2b69b20220..254dc31b62 100644 --- a/src/client/unified-form/content-tab/reducer.ts +++ b/src/client/unified-form/content-tab/reducer.ts @@ -16,7 +16,7 @@ export function worksReducer(state = initialState, {type, payload}:Action):State case UPDATE_WORK: return state.set(payload.id, Immutable.fromJS(payload.value)); case TOGGLE_COPY_AUTHOR_CREDITS: - return state.setIn([payload, 'checked'], !state.getIn([payload.id, 'checked'])); + return state.setIn([payload, 'checked'], !state.getIn([payload, 'checked'])); default: return state; } diff --git a/src/client/unified-form/content-tab/series-item-modal.tsx b/src/client/unified-form/content-tab/series-item-modal.tsx deleted file mode 100644 index 797d0da1db..0000000000 --- a/src/client/unified-form/content-tab/series-item-modal.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import {Modal} from 'react-bootstrap'; -import React from 'react'; -import SeriesSection from '../../entity-editor/series-section/series-section'; - - -type Props = { - show: boolean, - onHideHandler: () => void, -}; -export default function SeriesItemModal({show, onHideHandler, ...rest}:Props):JSX.Element { - const props = { - ...rest, - entityType: 'series', - hideTypeOption: true - }; - return ( - - - Series Item - - - - - - ); -} diff --git a/src/client/unified-form/interface/type.ts b/src/client/unified-form/interface/type.ts index d90c46fac2..62b7a74269 100644 --- a/src/client/unified-form/interface/type.ts +++ b/src/client/unified-form/interface/type.ts @@ -204,15 +204,7 @@ export type WorkRowOwnProps = { export type WorkRowProps = WorkRowStateProps & WorkRowDispatchProps & WorkRowOwnProps; -export type SingleEntityModalProps = { +export type SingleEntityCardProps = { entity:any, - show:boolean, - handleClose:()=>void, - languageOptions:any[] -}; - -export type SingleEntityProps = { - entity: any; - isLast: boolean; languageOptions:any[] }; diff --git a/src/client/unified-form/submit-tab/single-entity-modal.tsx b/src/client/unified-form/submit-tab/single-entity-card.tsx similarity index 81% rename from src/client/unified-form/submit-tab/single-entity-modal.tsx rename to src/client/unified-form/submit-tab/single-entity-card.tsx index 70dbdc4964..7de8bc023e 100644 --- a/src/client/unified-form/submit-tab/single-entity-modal.tsx +++ b/src/client/unified-form/submit-tab/single-entity-card.tsx @@ -1,12 +1,13 @@ -import {Modal} from 'react-bootstrap'; +import {Card} from 'react-bootstrap'; import React from 'react'; -import {SingleEntityModalProps} from '../interface/type'; +import {SingleEntityCardProps} from '../interface/type'; import _ from 'lodash'; import {dateObjectToISOString} from '../../helpers/utils'; /* eslint-disable sort-keys */ const BASE_ENTITY = { Name: 'nameSection.name', + Type: 'type', Language: 'nameSection.language', 'Sort-Name': 'nameSection.sortName', Disambiguation: 'nameSection.disambiguation', @@ -29,12 +30,12 @@ const ENTITY_FIELDS = { }, editionGroup: { ...BASE_ENTITY, - Type: 'editionGroupSection.type' + 'EditionGroup-Type': 'editionGroupSection.type' }, author: { ...BASE_ENTITY, Gender: 'authorSection.gender', - Type: 'authorSection.type', + 'Author-Type': 'authorSection.type', 'Begin-Date': 'authorSection.beginDate', 'Begin-Area': 'authorSection.beginArea.text', 'Dead?': 'authorSection.ended', @@ -43,7 +44,7 @@ const ENTITY_FIELDS = { }, publisher: { ...BASE_ENTITY, - Type: 'publisherSection.type', + 'Publihser-Type': 'publisherSection.type', 'Begin-Date': 'publisherSection.beginDate', 'Dissolved?': 'publisherSection.ended', 'End-Date': 'publisherSection.endDate' @@ -53,20 +54,20 @@ const ENTITY_FIELDS = { ...BASE_ENTITY, orderType: 'seriesSection.orderType', 'Series-Items': 'seriesSection.seriesItems', - seriesType: 'seriesSection.seriesType' + 'series-Type': 'seriesSection.seriesType' }, work: { ...BASE_ENTITY, - type: 'workSection.type', + 'Work-Type': 'workSection.type', 'Work-Languages': 'workSection.languages' } }; -export default function SingleEntityModal({entity, show, handleClose, languageOptions}:SingleEntityModalProps) { +export default function SingleEntityCard({entity, languageOptions}:SingleEntityCardProps) { const id2LanguageMap = React.useMemo(() => Object.fromEntries(_.map(languageOptions, (option) => [option.id, option.name])), []); // display formatted entity attributes in modal function renderField(path, key) { let fieldVal = _.get(entity, path, ''); - if (!fieldVal || (fieldVal.length === 0)) { + if (!fieldVal || (fieldVal.length === 0) || key === 'Name') { return; } if (key === 'Language') { @@ -98,14 +99,11 @@ export default function SingleEntityModal({entity, show, handleClose, languageOp } const entityFields = ENTITY_FIELDS[_.camelCase(entity.type)] ?? {}; return ( - - - {entity.type} - - + + {_.get(entity, entityFields.Name, '')} + {_.map(entityFields, renderField)} - - - + + ); } diff --git a/src/client/unified-form/submit-tab/single-entity.tsx b/src/client/unified-form/submit-tab/single-entity.tsx deleted file mode 100644 index 2f3e4663d1..0000000000 --- a/src/client/unified-form/submit-tab/single-entity.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import SingleEntityModal from './single-entity-modal'; -import {SingleEntityProps} from '../interface/type'; -import {get} from 'lodash'; - - -export default function SingleEntity({entity, isLast, languageOptions}:SingleEntityProps) { - const [showModal, setShowModal] = React.useState(false); - const handleClose = React.useCallback(() => { - setShowModal(false); - }, []); - const handleShow = React.useCallback(() => { - setShowModal(true); - }, []); - return ( - <> - - - {get(entity, 'text') + (isLast ? '' : ', ')} - - ); -} diff --git a/src/client/unified-form/submit-tab/summary.tsx b/src/client/unified-form/submit-tab/summary.tsx index 898da17933..0f7c707bf6 100644 --- a/src/client/unified-form/submit-tab/summary.tsx +++ b/src/client/unified-form/submit-tab/summary.tsx @@ -2,7 +2,7 @@ import {Badge, ListGroup} from 'react-bootstrap'; import {Entity, State, SummarySectionProps, SummarySectionStateProps} from '../interface/type'; import Immutable from 'immutable'; import React from 'react'; -import SingleEntity from './single-entity'; +import SingleEntityCard from './single-entity-card'; import _ from 'lodash'; import {connect} from 'react-redux'; import {convertMapToObject} from '../../helpers/utils'; @@ -25,36 +25,31 @@ function SummarySection({ Series, Works }; - function renderEntityGroup(entities: Array, entityType: string) { + function renderEntityGroup(entities: Array) { const newEntities = entities.filter((entity) => entity.__isNew__); if (newEntities.length === 0) { return null; } return ( - -
-
{entityType}
- {newEntities.map((entity, index) => ())} -
- - {newEntities.length} - -
+
+ {newEntities.map((entity) => ()) + } +
); } return (
-

New Entities

- +

New Entities

+

Below you can see a preview of the entities you are about to create + or have created in the process of filling the form. Please verify the information and + make any adjustment if necessary before submitting the form +

+
{_.map(createdEntities, renderEntityGroup)} - +
); }