diff --git a/src/modules/records/components/RecommendedResource/index.js b/src/modules/records/components/RecommendedResource/index.js index 7c797e1d..774f0662 100644 --- a/src/modules/records/components/RecommendedResource/index.js +++ b/src/modules/records/components/RecommendedResource/index.js @@ -1,16 +1,16 @@ import PropTypes from 'prop-types'; import React from 'react'; -const RecommendedResource = ({ record }) => { - const isRecommended = record.fields.some((item) => { - return item.uid === 'highly_recommended'; +const RecommendedResource = ({ fields = [] }) => { + const isRecommended = fields.some(({ uid }) => { + return uid === 'highly_recommended'; }); return isRecommended ? Recommended : null; }; RecommendedResource.propTypes = { - record: PropTypes.object + fields: PropTypes.array }; export default RecommendedResource; diff --git a/src/modules/records/components/Record/index.js b/src/modules/records/components/Record/index.js index 536e97f8..1b089ba4 100644 --- a/src/modules/records/components/Record/index.js +++ b/src/modules/records/components/Record/index.js @@ -62,7 +62,7 @@ const Header = ({ datastoreUid, record }) => { ); })} - + ); }; @@ -84,8 +84,8 @@ const Record = ({ datastoreUid, list, record }) => {
- - + +
diff --git a/src/modules/records/components/RecordFull/index.js b/src/modules/records/components/RecordFull/index.js index 156ffab4..313d38da 100644 --- a/src/modules/records/components/RecordFull/index.js +++ b/src/modules/records/components/RecordFull/index.js @@ -151,14 +151,14 @@ const FullRecord = () => { ); })} - +
- +

Record info:

- + {inDatastore && (

The University of Michigan Library aims to describe its collections in a way that respects the people and communities who create, use, and are represented in them. We encourage you to diff --git a/src/modules/records/components/RecordMetadata/index.js b/src/modules/records/components/RecordMetadata/index.js index 1117715c..4f945c19 100644 --- a/src/modules/records/components/RecordMetadata/index.js +++ b/src/modules/records/components/RecordMetadata/index.js @@ -2,29 +2,28 @@ import { ContextProvider, Metadata } from '../../../reusable'; import PropTypes from 'prop-types'; import React from 'react'; -const RecordMetadata = ({ record }) => { - const { metadata } = record; - - if (!metadata) { - return null; - } - +const RecordMetadata = ({ metadata = {} }) => { return ( { + render={({ viewType }) => { + if (!metadata || Object.keys(metadata).length === 0) { + return null; + } + const data = { Full: metadata.full, Medium: metadata.medium, Preview: metadata.preview }; - return ; + + return ; }} /> ); }; RecordMetadata.propTypes = { - record: PropTypes.object + metadata: PropTypes.object }; export default RecordMetadata; diff --git a/src/modules/records/components/RecordPreview/index.js b/src/modules/records/components/RecordPreview/index.js index 148c3814..a980e740 100644 --- a/src/modules/records/components/RecordPreview/index.js +++ b/src/modules/records/components/RecordPreview/index.js @@ -53,7 +53,7 @@ const Header = ({ datastoreUid, record, searchQuery }) => { ); })} - + ); @@ -109,8 +109,8 @@ const RecordPreview = ({ datastoreUid, record, searchQuery }) => { return (

- - + +
); diff --git a/src/modules/records/components/Zotero/index.js b/src/modules/records/components/Zotero/index.js index 8a49d180..1c8362fa 100644 --- a/src/modules/records/components/Zotero/index.js +++ b/src/modules/records/components/Zotero/index.js @@ -20,9 +20,9 @@ import PropTypes from 'prop-types'; * * And tell Zotero COinS was created. */ -const Zotero = ({ record }) => { +const Zotero = ({ fields = [] }) => { const [z3988, setZ3988] = useState(null); - const [value] = getFieldValue(getField(record.fields, 'z3988')); + const [value] = getFieldValue(getField(fields, 'z3988')); useEffect(() => { setZ3988(value); @@ -46,7 +46,7 @@ const Zotero = ({ record }) => { }; Zotero.propTypes = { - record: PropTypes.object + fields: PropTypes.array }; export default Zotero;