diff --git a/app/components/component-frontpage/src/Frontpage.js b/app/components/component-frontpage/src/Frontpage.js index a8f56f3847aea4576d09da9808b81a34d06cd1ec..1d91a328de17b3a2714d53fbc0453761381cfc3a 100644 --- a/app/components/component-frontpage/src/Frontpage.js +++ b/app/components/component-frontpage/src/Frontpage.js @@ -74,13 +74,11 @@ const Frontpage = ({ history, ...props }) => { <SectionHeader> <Title>{manuscript.meta.title}</Title> </SectionHeader> - <SectionRow key={`manuscript-${manuscript.id}`}> - {manuscript.submission?.abstract ? ( + <SectionRow> + {manuscript.submission?.abstract && ( <h1>Abstract: {manuscript.submission?.abstract}</h1> - ) : ( - <br /> )} - {manuscript.visualAbstract ? ( + {manuscript.visualAbstract && ( <div> <h1>Visual abstract</h1> <VisualAbstract @@ -88,11 +86,9 @@ const Frontpage = ({ history, ...props }) => { src={manuscript.visualAbstract} /> </div> - ) : ( - <br /> )} - {manuscript.files.length > 0 ? ( + {manuscript.files.length > 0 && ( <div> {manuscript.files.map( file => @@ -100,7 +96,7 @@ const Frontpage = ({ history, ...props }) => { file.fileType !== 'visualAbstract' && ( <a href={file.url} - key={`manuscript-${manuscript.id}`} + key={`file-${file.id}`} rel="noopener noreferrer" target="_blank" > @@ -112,7 +108,7 @@ const Frontpage = ({ history, ...props }) => { file => !skipXSweet(file) && ( <Accordion - key={`manuscript-${manuscript.id}`} + key={`file-${file.id}`} label="View Manuscript Text" > <Wax content={manuscript.meta.source} readonly /> @@ -120,11 +116,9 @@ const Frontpage = ({ history, ...props }) => { ), )} </div> - ) : ( - <br /> )} - {manuscript.submission?.links ? ( + {manuscript.submission?.links && ( <div> <h1>Submitted research objects</h1> {manuscript.submission?.links?.map(link => ( @@ -138,8 +132,6 @@ const Frontpage = ({ history, ...props }) => { </a> ))} </div> - ) : ( - <br /> )} </SectionRow> </SectionContent> diff --git a/app/components/component-manuscript/src/components/ManuscriptPage.js b/app/components/component-manuscript/src/components/ManuscriptPage.js index 71be231abb2bfd26ef382a1a74fa47202b13fdb4..5a8242b4fe655ef320f71d5f0807319537c66d64 100644 --- a/app/components/component-manuscript/src/components/ManuscriptPage.js +++ b/app/components/component-manuscript/src/components/ManuscriptPage.js @@ -1,6 +1,6 @@ -import PropTypes from 'prop-types' import React from 'react' import { useQuery, gql } from '@apollo/client' +import ReactRouterPropTypes from 'react-router-prop-types' import Manuscript from './Manuscript' import { Spinner } from '../../../shared' @@ -46,7 +46,7 @@ const ManuscriptPage = ({ match, ...props }) => { }) ManuscriptPage.propTypes = { - match: PropTypes.node.isRequired, + match: ReactRouterPropTypes.match.isRequired, } if (loading) return <Spinner /> diff --git a/package.json b/package.json index 727d7bd4985bd4e091a218811e1f868b27af6a6f..d56486eec5df3bbc2a769198f88359be9c1fe73e 100644 --- a/package.json +++ b/package.json @@ -129,6 +129,7 @@ "react-mentions": "3.3.2", "react-moment": "0.9.7", "react-router-dom": "5.2.0", + "react-router-prop-types": "^1.0.5", "react-select1": "npm:react-select@1.3.0", "react-visibility-sensor": "5.1.1", "regenerator-runtime": "^0.13.7", diff --git a/yarn.lock b/yarn.lock index bba4d7cd54caded9b72595d769562d1010a136e1..285e3dc167c932c8cdc7ab35596db86e274821f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2738,6 +2738,11 @@ resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== +"@types/prop-types@^15.7.3": + version "15.7.3" + resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7" + integrity sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw== + "@types/qs@*": version "6.9.3" resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.3.tgz#b755a0934564a200d3efdf88546ec93c369abd03" @@ -15203,6 +15208,14 @@ react-router-dom@5.2.0, react-router-dom@^5.0.0: tiny-invariant "^1.0.2" tiny-warning "^1.0.0" +react-router-prop-types@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/react-router-prop-types/-/react-router-prop-types-1.0.5.tgz#2e671d8412a793106bf70dc15c9ecc83ea4bc15b" + integrity sha512-q1xlFU2ol2U5zeVbA5hyBuxD3scHenqgMgCTuJQUanA2SyG8A3Fb1S6DleOo1cnGJB5Q05hnLge64kRj+xsuPA== + dependencies: + "@types/prop-types" "^15.7.3" + prop-types "^15.7.2" + react-router-redux@5.0.0-alpha.9: version "5.0.0-alpha.9" resolved "https://registry.yarnpkg.com/react-router-redux/-/react-router-redux-5.0.0-alpha.9.tgz#825431516e0e6f1fd93b8807f6bd595e23ec3d10"