diff --git a/src/components/Admin/Document/AdminDocumentTable/AdminDocumentTable.js b/src/components/Admin/Document/AdminDocumentTable/AdminDocumentTable.js index 0ee7224a..b17531b9 100644 --- a/src/components/Admin/Document/AdminDocumentTable/AdminDocumentTable.js +++ b/src/components/Admin/Document/AdminDocumentTable/AdminDocumentTable.js @@ -103,12 +103,6 @@ const AdminDocumentTable = ({ document, alerts, setAlerts }) => { {document.publication} )} - {document.bookTitle && ( - - Book Title - {document.bookTitle} - - )} {document.edition && ( Edition diff --git a/src/components/DocumentMetadata/DocumentMetadata.js b/src/components/DocumentMetadata/DocumentMetadata.js index 1426614e..a9d3160d 100644 --- a/src/components/DocumentMetadata/DocumentMetadata.js +++ b/src/components/DocumentMetadata/DocumentMetadata.js @@ -4,6 +4,7 @@ import { FieldArray } from 'formik'; import { Button, Col, Form, InputGroup, Row, } from 'react-bootstrap'; +import { publicationFieldName } from '../../utils/metadataUtil'; const DocumentMetadata = ({ resourceType, @@ -13,17 +14,6 @@ const DocumentMetadata = ({ errors, touched, }) => { - const publicationFieldName = (type) => { - switch (type) { - case 'Book Section': return 'Book title'; - case 'Journal Article': return 'Journal title'; - case 'Newspaper Article': return 'Newspaper title'; - case 'Magazine Article': return 'Magazine title'; - case 'Web Page': return 'Website title'; - default: return 'Publication title'; - } - }; - const contributorTypes = ['Author', 'Editor', 'Translator', 'Contributor']; const [expandMeta, setExpandMeta] = useState(false); diff --git a/src/components/SecondNavbar/SecondNavbar.js b/src/components/SecondNavbar/SecondNavbar.js index 1c24a661..8190ab19 100644 --- a/src/components/SecondNavbar/SecondNavbar.js +++ b/src/components/SecondNavbar/SecondNavbar.js @@ -2,11 +2,9 @@ import React, { useState } from 'react'; import { Nav, Navbar, Breadcrumb, Container, Modal, Table, } from 'react-bootstrap'; -import { - InfoSquare, -} from 'react-bootstrap-icons'; - +import { InfoSquare } from 'react-bootstrap-icons'; import FilterPopover from '../FilterPopover'; +import { publicationFieldName } from '../../utils/metadataUtil'; const SecondNavbar = ({ session, @@ -14,22 +12,21 @@ const SecondNavbar = ({ document, docView, }) => { - const metaData = { + const metadataFields = { title: 'Title', - resourceType: 'Resource Type', + resourceType: 'Type', contributors: 'Contributors', - bookTitle: 'Book Title', - publication: 'Publication', + publication: document ? publicationFieldName(document.resourceType) : 'Publication', series: 'Series', - seriesNumber: 'Series Number', + seriesNumber: 'Series number', volume: 'Volume', issue: 'Issue', - pageNumbers: 'Page Numbers', + pageNumbers: 'Page numbers', edition: 'Edition', publisher: 'Publisher', - publicationDate: 'Publication Date', + publicationDate: 'Publication date', location: 'Location', - rightsStatus: 'Rights Status', + rightsStatus: 'Rights status', url: 'URL', accessed: 'Accessed', notes: 'Notes', @@ -106,7 +103,7 @@ const SecondNavbar = ({ - {Object.keys(metaData).map((key) => { + {Object.keys(metadataFields).map((key) => { let str = ''; if (document[key] !== undefined) { if (Array.isArray(document[key])) { @@ -120,15 +117,15 @@ const SecondNavbar = ({ } else { str = document[key]; } - } - return ( - - - - - ); + return ( + + + + + ); + } return ''; })}
- {metaData[key]} - {str}
+ {metadataFields[key]} + {str}
diff --git a/src/pages/api/document/[id].js b/src/pages/api/document/[id].js index 74578e0c..1c4c9e99 100644 --- a/src/pages/api/document/[id].js +++ b/src/pages/api/document/[id].js @@ -33,7 +33,6 @@ const handler = async (req, res) => { contributors, publisher, publicationDate, - bookTitle, edition, url, accessed, @@ -61,7 +60,6 @@ const handler = async (req, res) => { contributors, publisher, publicationDate, - bookTitle, edition, url, accessed, @@ -93,7 +91,6 @@ const handler = async (req, res) => { contributors, publisher, publicationDate, - bookTitle, edition, url, accessed, @@ -117,7 +114,6 @@ const handler = async (req, res) => { contributors, publisher, publicationDate, - bookTitle, edition, url, accessed, diff --git a/src/pages/api/document/index.js b/src/pages/api/document/index.js index dff9bae7..9ffcab56 100644 --- a/src/pages/api/document/index.js +++ b/src/pages/api/document/index.js @@ -18,7 +18,6 @@ const handler = async (req, res) => { contributors, publisher, publicationDate, - bookTitle, edition, url, accessed, @@ -43,7 +42,6 @@ const handler = async (req, res) => { contributors, publisher, publicationDate, - bookTitle, edition, url, accessed, diff --git a/src/pages/api/document/slug/[slug].js b/src/pages/api/document/slug/[slug].js index d2ecd133..49870d3f 100644 --- a/src/pages/api/document/slug/[slug].js +++ b/src/pages/api/document/slug/[slug].js @@ -33,7 +33,6 @@ const handler = async (req, res) => { contributors, publisher, publicationDate, - bookTitle, edition, url, accessed, @@ -61,7 +60,6 @@ const handler = async (req, res) => { contributors, publisher, publicationDate, - bookTitle, edition, url, accessed, diff --git a/src/utils/metadataUtil.js b/src/utils/metadataUtil.js new file mode 100644 index 00000000..fc0aa094 --- /dev/null +++ b/src/utils/metadataUtil.js @@ -0,0 +1,14 @@ +/* eslint-disable import/prefer-default-export */ + +const publicationFieldName = (type) => { + switch (type) { + case 'Book Section': return 'Book title'; + case 'Journal Article': return 'Journal title'; + case 'Newspaper Article': return 'Newspaper title'; + case 'Magazine Article': return 'Magazine title'; + case 'Web Page': return 'Website title'; + default: return 'Publication title'; + } +}; + +export { publicationFieldName };