diff --git a/packages/component-faraday-ui/src/gridItems/Row.js b/packages/component-faraday-ui/src/gridItems/Row.js index 54c7faacf72fd25255536cac2a2e5e5b0de04c7b..e430fa497742392628179339d24031399ee831c0 100644 --- a/packages/component-faraday-ui/src/gridItems/Row.js +++ b/packages/component-faraday-ui/src/gridItems/Row.js @@ -13,8 +13,6 @@ const Row = styled.div.attrs({ display: flex; flex-wrap: ${props => get(props, 'flexWrap', 'initial')}; justify-content: ${props => get(props, 'justify', 'space-evenly')}; - height: ${props => get(props, 'height', 'auto')}; - width: ${props => (props.fitContent ? 'fit-content' : '100%')}; ${heightHelper}; @@ -31,8 +29,8 @@ Row.propTypes = { flexWrap: PropTypes.string, /** Specifies alignment along the main axis. */ justifyContent: PropTypes.string, - /** Set the height in pixels. */ - height: PropTypes.string, + /** Set the height in multiple of grid units. */ + height: PropTypes.number, } Row.defaultProps = { @@ -40,7 +38,7 @@ Row.defaultProps = { bgColor: 'transparent', flexWrap: 'initial', justifyContent: 'space-evenly', - height: '100%', + height: 2, } export default Row diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.js b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.js index ed9e04dfc0e67bd3844c512eee5a6a49f9b7a0ce..edf46846083f877ea6c422308568c14fd202ce67 100644 --- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.js +++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.js @@ -1,5 +1,6 @@ import React from 'react' import { ContextualBox, AssignHE } from 'pubsweet-component-faraday-ui' +import PropTypes from 'prop-types' const ManuscriptAssignHE = ({ toggle, @@ -8,6 +9,7 @@ const ManuscriptAssignHE = ({ isFetching, currentUser: { permissions: { canAssignHE = false } }, handlingEditors = [], + inviteHandlingEditor, }) => canAssignHE ? ( <ContextualBox @@ -25,4 +27,15 @@ const ManuscriptAssignHE = ({ </ContextualBox> ) : null +ManuscriptAssignHE.propTypes = { + /** Handling editors you want to be displayed. */ + handlingEditors: PropTypes.arrayOf(PropTypes.object), + /** Callback function fired when the handling editor is invited. */ + inviteHandlingEditor: PropTypes.func, +} + +ManuscriptAssignHE.defaultProps = { + handlingEditors: [], + inviteHandlingEditor: undefined, +} export default ManuscriptAssignHE diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.md b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.md index 7787e62799867bccde289c719eaad3ece654ea85..29309b5e1745bec9febe83ab91addd1a5c210a46 100644 --- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.md +++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.md @@ -32,7 +32,7 @@ const currentUser = { {(expanded, toggle) => ( <ManuscriptAssignHE toggle={toggle} - expanded={expanded} + expanded currentUser={currentUser} handlingEditors={handlingEditors} assignHE={he => console.log('assigning...', he)} diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptDetailsTop.js b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptDetailsTop.js index 6a4c5dfb3a2d273cc235ae240e18c48561ff6fd4..5a70bfee860d9f1ae28bf8ce5ff325580a50dfcf 100644 --- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptDetailsTop.js +++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptDetailsTop.js @@ -2,6 +2,7 @@ import React from 'react' import { get } from 'lodash' import { DateParser } from '@pubsweet/ui' import { compose, withHandlers } from 'recompose' +import PropTypes from 'prop-types' import { Row, @@ -20,8 +21,8 @@ const ManuscriptDetailsTop = ({ goToEdit, getSignedUrl, goToTechnicalCheck, - fragment = {}, - collection = {}, + fragment, + collection, currentUser: { isReviewer, token, @@ -111,3 +112,18 @@ export default compose( }, }), )(ManuscriptDetailsTop) + +ManuscriptDetailsTop.propTypes = { + /** Object with details about fragment. */ + fragment: PropTypes.object, //eslint-disable-line + /** Object with details about collection. */ + collection: PropTypes.object, //eslint-disable-line + /** Object with versions of manuscript. */ + versions: PropTypes.object, //eslint-disable-line +} + +ManuscriptDetailsTop.defaultProps = { + fragment: {}, + collection: {}, + versions: {}, +} diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptDetailsTop.md b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptDetailsTop.md index f4b7fc2d8524c16945c715d88db44f52824025ab..f08d36e626c777e5ff28541097100a0f1cc39991 100644 --- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptDetailsTop.md +++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptDetailsTop.md @@ -1,11 +1,61 @@ Manuscript Details top section ```js +const authors = [ + { + email: 'john.doe@gmail.com', + firstName: 'John', + lastName: 'Doe', + isSubmitting: true, + }, + { + email: 'michael.felps@gmail.com', + firstName: 'Michael', + lastName: 'Felps', + isSubmitting: true, + isCorresponding: true, + }, + { + email: 'barrack.obama@gmail.com', + firstName: 'Barrack', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail1.com', + firstName: 'Barrack 1', + lastName: 'Obama', + }, + { + email: 'barrack.obama@gmail2.com', + firstName: 'Barrack 2', + lastName: 'Obama', + }, +] + +const collection = { + customId: '55113358', + visibleStatus: 'Pending Approval', + handlingEditor: { + id: 'he-1', + name: 'Handlington Ignashevici', + }, + invitations: [], +} + +const fragment = { + authors, + created: Date.now(), + submitted: Date.now(), + metadata: { + journal: 'Awesomeness', + title: 'A very ok title with many authors', + type: 'research', + }, +} const history = { push: () => alert('go back') }; -const fragment={}; -const collection={}; + const currentUser = { isReviewer: true, token: 'abc-123', diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptEicDecision.js b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptEicDecision.js index f0e5d8a3fd2392f511108c906a7861d73a73cec8..f628e98ff24c00eb3dd8acb7b762e112c833dcd5 100644 --- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptEicDecision.js +++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptEicDecision.js @@ -6,6 +6,7 @@ import { reduxForm } from 'redux-form' import { th } from '@pubsweet/ui-toolkit' import { required } from 'xpub-validators' import { Button, Menu, ValidatedField } from '@pubsweet/ui' +import PropTypes from 'prop-types' import { withModal } from 'pubsweet-component-modal/src/components' import { @@ -46,7 +47,8 @@ const ManuscriptEicDecision = ({ formValues, handleSubmit, messagesLabel, - collection = {}, + collection, + submitDecision, ...rest }) => ( <ContextualBox @@ -74,7 +76,6 @@ const ManuscriptEicDecision = ({ /> </ItemOverrideAlert> </Row> - {get(formValues, 'decision') !== 'publish' && ( <Row mt={2}> <Item vertical> @@ -140,6 +141,20 @@ export default compose( }), )(ManuscriptEicDecision) +ManuscriptEicDecision.propTypes = { + /** Object with details about collection. */ + collection: PropTypes.object, //eslint-disable-line + /** Label of the decision of EIC. */ + messagesLabel: PropTypes.object, //eslint-disable-line + /** Callback function fired when the handling editor submit his decision. */ + submitDecision: PropTypes.func, +} +ManuscriptEicDecision.defaultProps = { + collection: {}, + messagesLabel: undefined, + submitDecision: undefined, +} + // #region styles const Root = styled.div` display: flex; diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptFileList.js b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptFileList.js index 4f4c2ea781867330911b163f54a2b395a2cfdade..857aeba89a68801ed2957aa93703d12c6b1162bf 100644 --- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptFileList.js +++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptFileList.js @@ -1,6 +1,6 @@ +import PropTypes from 'prop-types' import React, { Fragment } from 'react' import { ManuscriptFileSection } from 'pubsweet-component-faraday-ui' - import { withFilePreview, withFileDownload } from '../helpers' const ManuscriptFileList = ({ @@ -35,5 +35,26 @@ const ManuscriptFileList = ({ /> </Fragment> ) +ManuscriptFileList.propTypes = { + /** Files that are uploaded by author. */ + files: PropTypes.shape({ + coverLetter: PropTypes.arrayOf(PropTypes.object), + manuscripts: PropTypes.arrayOf(PropTypes.object), + supplementary: PropTypes.arrayOf(PropTypes.object), + }), + /** Callback function fired when delete icon it's pressed. */ + onDelete: PropTypes.func, + /** Callback function fired when download icon it's pressed. */ + onDownload: PropTypes.func, + /** Callback function fired when preview icon it's pressed. */ + onPreview: PropTypes.func, +} + +ManuscriptFileList.defaultProps = { + files: undefined, + onDelete: undefined, + onDownload: undefined, + onPreview: undefined, +} export default withFilePreview(withFileDownload(ManuscriptFileList)) diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptFileSection.js b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptFileSection.js index c2a6867e2577f2a943a4b61c7290caa68c0f619f..7458b13be562afdc0a06617e69665860ce74daff 100644 --- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptFileSection.js +++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptFileSection.js @@ -1,7 +1,8 @@ import React, { Fragment } from 'react' import { Text, FileItem, Item, Row } from 'pubsweet-component-faraday-ui' +import PropTypes from 'prop-types' -const ManuscriptFileSection = ({ list = [], label = '', ...rest }) => ( +const ManuscriptFileSection = ({ list, label, ...rest }) => ( <Fragment> {!!list.length && ( <Fragment> @@ -28,4 +29,22 @@ const ManuscriptFileSection = ({ list = [], label = '', ...rest }) => ( </Fragment> ) +ManuscriptFileSection.propTypes = { + /** List of uploaded files */ + list: PropTypes.arrayOf(PropTypes.object), + /** Category name of uploaded files. */ + label: PropTypes.string, + /** Callback function fired when download icon it's pressed. */ + onDownload: PropTypes.func, + /** Callback function fired when preview icon it's pressed. */ + onPreview: PropTypes.func, +} + +ManuscriptFileSection.defaultProps = { + list: [], + label: '', + onDownload: undefined, + onPreview: undefined, +} + export default ManuscriptFileSection diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptVersion.js b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptVersion.js index 2f7473750f267ef12771024e3480984dd06f82f9..1738e297d41aba54886071d7d1322ddd1562e9a8 100644 --- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptVersion.js +++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptVersion.js @@ -4,7 +4,7 @@ import { Menu } from '@pubsweet/ui' const ManuscriptVersion = ({ history, - versions, + versions = {}, fragment = {}, collection = {}, }) =>