diff --git a/packages/component-faraday-ui/src/AuthorTag.js b/packages/component-faraday-ui/src/AuthorTag.js index 4ec4cf6a3b28b21216fef66e39d21175835b5a48..a0177b56199e479dda4f92547438298893fa5338 100644 --- a/packages/component-faraday-ui/src/AuthorTag.js +++ b/packages/component-faraday-ui/src/AuthorTag.js @@ -26,7 +26,7 @@ const AuthorTag = ({ AuthorTag.propTypes = { /** The author you want to be on the card. */ author: PropTypes.shape({ - id: PropTypes.string, + id: PropTypes.number, firstName: PropTypes.string, lastName: PropTypes.string, isCorresponding: PropTypes.bool, @@ -36,7 +36,14 @@ AuthorTag.propTypes = { } AuthorTag.defaultProps = { - author: undefined, + author: { + id: undefined, + firstName: undefined, + lastName: undefined, + isCorresponding: undefined, + isSubmitting: undefined, + affiliationNumber: undefined, + }, } export default AuthorTag diff --git a/packages/component-faraday-ui/src/AuthorTagList.js b/packages/component-faraday-ui/src/AuthorTagList.js index 81f95ff2cffd2a5418784028ff9a4c4c3caf7c3d..f168d53c6448116e7e5966b2e2e27bda7814ff00 100644 --- a/packages/component-faraday-ui/src/AuthorTagList.js +++ b/packages/component-faraday-ui/src/AuthorTagList.js @@ -114,15 +114,16 @@ export default compose( )(AuthorTagList) AuthorTagList.propTypes = { + /** What label we want to be seen on the card. */ authorKey: PropTypes.string, - /** All authors we wanna see. */ + /** All authors we want to be seen on the card. */ authors: PropTypes.arrayOf(PropTypes.object), - /** What separator to be used. */ + /** Separator between authors. */ separator: PropTypes.string, /** Tooltip about author details. */ withTooltip: PropTypes.bool, + /** Show authors affifiations. */ withAffiliations: PropTypes.bool, - showAffiliation: PropTypes.bool, } AuthorTagList.defaultProps = { @@ -131,7 +132,6 @@ AuthorTagList.defaultProps = { separator: `, `, withTooltip: false, withAffiliations: false, - showAffiliation: false, } // #region styles diff --git a/packages/component-faraday-ui/src/AuthorTagList.md b/packages/component-faraday-ui/src/AuthorTagList.md index 12ff3c606db6c3d514c2b94c31487707967aaf0a..d66972f14e463b8a3a75974fba87ea25d63af785 100644 --- a/packages/component-faraday-ui/src/AuthorTagList.md +++ b/packages/component-faraday-ui/src/AuthorTagList.md @@ -107,12 +107,14 @@ Use a different separator and key for mapping the authors. ```js const authors = [ { + id: 1, email: 'john.doe@gmail.com', firstName: 'John', lastName: 'Doe', isSubmitting: true, }, { + id: 2, email: 'michael.felps@gmail.com', firstName: 'Michael', lastName: 'Felps', @@ -120,6 +122,7 @@ const authors = [ isCorresponding: true, }, { + id: 3, email: 'barrack.obama@gmail.com', firstName: 'Barrack', lastName: 'Obama', diff --git a/packages/component-faraday-ui/src/AutosaveIndicator.js b/packages/component-faraday-ui/src/AutosaveIndicator.js index 1a3b309ff177e412df6fb305d087acd8b9b62a43..c219d581676d7ff376e5c5402ebeb2974310484a 100644 --- a/packages/component-faraday-ui/src/AutosaveIndicator.js +++ b/packages/component-faraday-ui/src/AutosaveIndicator.js @@ -101,7 +101,7 @@ export default compose( )(AutosaveIndicator) AutosaveIndicator.propTypes = { - /** Make appear loader until save. */ + /** Saving loader. */ autosave: PropTypes.object, // eslint-disable-line } diff --git a/packages/component-faraday-ui/src/IconButton.js b/packages/component-faraday-ui/src/IconButton.js index 58e6ce1d0646261746f92a5c5ac25f1074fb69a7..4dadbbf4704d793a28224826abeda9659fa44682 100644 --- a/packages/component-faraday-ui/src/IconButton.js +++ b/packages/component-faraday-ui/src/IconButton.js @@ -33,15 +33,18 @@ const Root = styled.div` ${positionHelper}; ` IconButton.propTypes = { - /** Icon name */ + /** What icon to be used. */ icon: PropTypes.string, - /** Icon size */ + /** Size of the icon. */ iconSize: PropTypes.number, + /** Callback function fired when the component is clicked. */ + onClick: PropTypes.func, } IconButton.defaultProps = { - icon: '', + icon: undefined, iconSize: 3, + onClick: undefined, } export default IconButton diff --git a/packages/component-faraday-ui/src/IconTooltip.js b/packages/component-faraday-ui/src/IconTooltip.js index 418cb018c3bad4791fa1e9f5c13efb90cfe71de5..487c2b7b59499fe2a10e8d131b10266dd8270d9f 100644 --- a/packages/component-faraday-ui/src/IconTooltip.js +++ b/packages/component-faraday-ui/src/IconTooltip.js @@ -33,15 +33,21 @@ const InfoTooltip = ({ theme, content }) => ( </ThemeProvider> ) IconTooltip.propTypes = { - /** Icon name */ + /** What icon to be used. */ icon: PropTypes.string, - /** Icon size */ + /** Size of the icon. */ iconSize: PropTypes.number, + /** What content to be used in tooltip. */ + content: PropTypes.func, + /** If true the content can be clicked (can be interacted with). */ + interactive: PropTypes.bool, } IconTooltip.defaultProps = { icon: 'help-circle', iconSize: 3, + content: undefined, + interactive: undefined, } export default withTheme(IconTooltip) diff --git a/packages/component-faraday-ui/src/Label.js b/packages/component-faraday-ui/src/Label.js index 18d44f023225694a04e0259f7b5a6d38c0b977da..635efd36c1a793d2d3a5ab4bd1445210d4dc063b 100644 --- a/packages/component-faraday-ui/src/Label.js +++ b/packages/component-faraday-ui/src/Label.js @@ -14,7 +14,7 @@ const Label = ({ children, required, ...rest }) => ( ) Label.propTypes = { - /** Mention if the label is require or not. */ + /** If true the label is required. */ required: PropTypes.bool, } diff --git a/packages/component-faraday-ui/src/ManuscriptCard.js b/packages/component-faraday-ui/src/ManuscriptCard.js index 8b86a6910c0b68cc5e1e5def1636f40a0691b4e1..a356b14eefcca9df3b924fb4bc3c9dd9ca430385 100644 --- a/packages/component-faraday-ui/src/ManuscriptCard.js +++ b/packages/component-faraday-ui/src/ManuscriptCard.js @@ -4,9 +4,8 @@ import styled from 'styled-components' import { th } from '@pubsweet/ui-toolkit' import { withJournal } from 'xpub-journal' import { H3, H4, DateParser } from '@pubsweet/ui' -import { compose, withHandlers, setDisplayName, withProps } from 'recompose' import PropTypes from 'prop-types' - +import { compose, withHandlers, setDisplayName, withProps } from 'recompose' import { Tag, Text, @@ -19,7 +18,6 @@ import { AuthorTagList, ReviewerBreakdown, } from './' - import { OpenModal } from './modals' const ManuscriptCard = ({ @@ -29,7 +27,7 @@ const ManuscriptCard = ({ onCardClick, canViewReports, fragment, - manuscriptType, + manuscriptType = {}, collection: { visibleStatus = 'Draft', handlingEditor, customId, id: collId }, }) => { const { @@ -115,7 +113,6 @@ const ManuscriptCard = ({ </Root> ) } - export default compose( withJournal, withHandlers({ @@ -137,13 +134,27 @@ export default compose( ), setDisplayName('ManuscriptCard'), )(ManuscriptCard) +// #region styles ManuscriptCard.propTypes = { - fragment: PropTypes.object.isRequired, // eslint-disable-line - collection: PropTypes.object.isRequired, // eslint-disable-line + fragment: PropTypes.shape({ + authors: PropTypes.arrayOf(PropTypes.object), + created: PropTypes.number, + submitted: PropTypes.number, + metadata: PropTypes.object, + }), // eslint-disable-line + collection: PropTypes.shape({ + customId: PropTypes.string, + visibleStatus: PropTypes.string, + handlingEditor: PropTypes.object, + }), // eslint-disable-line +} + +ManuscriptCard.defaultProps = { + fragment: {}, + collection: undefined, } -// #region styles const MainContainer = styled.div` justify-content: flex-start; display: flex; @@ -153,7 +164,6 @@ const MainContainer = styled.div` padding-bottom: ${th('gridUnit')}; width: calc(100% - (${th('gridUnit')} * 5 / 2)); overflow: hidden; - ${Row} { [data-tooltipped] { overflow: hidden; @@ -171,7 +181,6 @@ const MainContainer = styled.div` } } ` - const SideNavigation = styled.div` align-items: center; background-color: ${th('colorBackgroundHue2') @@ -182,7 +191,6 @@ const SideNavigation = styled.div` display: flex; width: calc(${th('gridUnit')} * 5 / 2); ` - const Root = styled.div` background-color: #fff; border-radius: ${th('borderRadius')}; @@ -191,14 +199,11 @@ const Root = styled.div` display: flex; margin: calc(${th('gridUnit')} / 4) calc(${th('gridUnit')} / 4) ${th('gridUnit')} calc(${th('gridUnit')} / 4); - &:hover { box-shadow: ${th('dashboardCard.hoverShadow')}; } - ${H3} { margin: 0; margin-bottom: ${th('gridUnit')}; } ` -// #endregion diff --git a/packages/component-faraday-ui/src/ManuscriptCard.md b/packages/component-faraday-ui/src/ManuscriptCard.md index e8d9bccea15dc25845a5784894302f5b8613cbed..ad9fc06f5ca257832768e68a4ac1d2764613455a 100644 --- a/packages/component-faraday-ui/src/ManuscriptCard.md +++ b/packages/component-faraday-ui/src/ManuscriptCard.md @@ -3,12 +3,14 @@ A manuscript card. ```js const authors = [ { + id:1, email: 'john.doe@gmail.com', firstName: 'John', lastName: 'Doe', isSubmitting: true, }, { + id:2, email: 'michael.felps@gmail.com', firstName: 'Michael', lastName: 'Felps', @@ -16,26 +18,31 @@ const authors = [ isCorresponding: true, }, { + id:3, email: 'barrack.obama@gmail.com', firstName: 'Barrack', lastName: 'Obama', }, { + id:5, email: 'barrack.obama@gmail1.com', firstName: 'Barrack 1', lastName: 'Obama', }, { + id:6, email: 'barrack.obama@gmail2.com', firstName: 'Barrack 2', lastName: 'Obama', }, { + id:7, email: 'barrack.obama@gmail3.com', firstName: 'Barrack 3', lastName: 'Obama', }, { + id:8, email: 'barrack.obama@gmail4.com', firstName: 'Barrack 4', lastName: 'Obama', diff --git a/packages/component-faraday-ui/src/PublonsTable.js b/packages/component-faraday-ui/src/PublonsTable.js index ce9f549473a84b3e60bda962f46054e93cefd1ef..cc4712d4b5ea1147e6615c1d6de7de6a1b88061b 100644 --- a/packages/component-faraday-ui/src/PublonsTable.js +++ b/packages/component-faraday-ui/src/PublonsTable.js @@ -4,7 +4,7 @@ import styled from 'styled-components' import { th } from '@pubsweet/ui-toolkit' import { Button, Spinner } from '@pubsweet/ui' import { compose, withHandlers, withProps } from 'recompose' - +import PropTypes from 'prop-types' import { Label, OpenModal, Text, withFetching, ActionLink } from '../' const TableView = ({ @@ -100,6 +100,14 @@ export default compose( }), )(PublonsTable) +TableView.propTypes = { + reviewers: PropTypes.arrayOf(PropTypes.object), +} + +TableView.defaultProps = { + reviewers: undefined, +} + // #region styles const Table = styled.table` border-collapse: collapse; diff --git a/packages/component-faraday-ui/src/PublonsTable.md b/packages/component-faraday-ui/src/PublonsTable.md index f692c2e4740672589b4ff386c06e1f13c180315e..bf7301a2e05b4e794ce16a8664bbd5095e5e009e 100644 --- a/packages/component-faraday-ui/src/PublonsTable.md +++ b/packages/component-faraday-ui/src/PublonsTable.md @@ -3,37 +3,26 @@ A list of publon reviewers. ```js const reviewers = [ { - id: 0, - email: 'email1@email.com', - publishingName: 'Name1', - recentOrganizations: { - name: 'Org1' - }, - numVerifiedReviews: '100' + name: 'Ursachi Anca', + email: 'anca@thinslices.com', + profileUrl: '', + affiliation: 'ts', + reviews: 10, }, { - id: 1, - email: 'email2@email.com', - publishingName: 'Name2', - recentOrganizations: { - name: 'Org2' - }, - numVerifiedReviews: '200' + name: 'Josh', + email: 'josh@thinslices.com', + profileUrl: '', + affiliation: 'ts', + reviews: 8, }, - { - id: 2, - email: 'email3@email.com', - publishingName: 'Name3', - recentOrganizations: { - name: 'Org3' - }, - numVerifiedReviews: '300' - }, -]; +] +;<PublonsTable + reviewers={reviewers} + onInviteReviwer={(reviewer, modalProps) => { + console.log('the reviewer', reviewer) -<PublonsTable reviewers={reviewers} onInviteReviwer={(reviewer, modalProps) => { - console.log('the reviewer', reviewer) - - modalProps.setModalError('avem eroare boss') -}}/> + modalProps.setModalError('avem eroare boss') + }} +/> ``` diff --git a/packages/component-faraday-ui/src/ReviewerReport.js b/packages/component-faraday-ui/src/ReviewerReport.js index 5d728ccdecab34b117fc9f4bf39050484e18a86a..4eeada6bcc23299b1ddde3c40b2638a42fb4ff50 100644 --- a/packages/component-faraday-ui/src/ReviewerReport.js +++ b/packages/component-faraday-ui/src/ReviewerReport.js @@ -94,20 +94,28 @@ export default withProps(({ report, journal: { recommendations } }) => ({ }))(ReviewerReport) ReviewerReport.propTypes = { - /** It's true when you want to appear the reviewer name */ + /** True when you want to show reviewer name. */ showOwner: PropTypes.bool, - /** Reviewers reports */ + /** Pass object with informations about the report. */ report: PropTypes.shape({ + /** Unique id for report. */ id: PropTypes.string, + /** Unique id for user. */ userId: PropTypes.string, + /** Comments by reviewers. */ comments: PropTypes.arrayOf(PropTypes.object), + /** When the comment was created. */ createdOn: PropTypes.number, + /** When the comment was updated. */ updatedOn: PropTypes.number, + /** When the comment was submited. */ submittedOn: PropTypes.number, + /** The recommendation given by reviewer. */ recommendation: PropTypes.string, + /** Type of recommendation. */ recommendationType: PropTypes.string, }), - /** The reviewers recommendations */ + /** Pass object with informations about recommendation. */ journal: PropTypes.shape({ recommendations: PropTypes.arrayOf(PropTypes.object), }), diff --git a/packages/component-faraday-ui/src/ReviewerReport.md b/packages/component-faraday-ui/src/ReviewerReport.md index 440b6a882e447344287e5db1a6383fd9de82e775..515b6e4651c6304a51ef780dce202c860497a98a 100644 --- a/packages/component-faraday-ui/src/ReviewerReport.md +++ b/packages/component-faraday-ui/src/ReviewerReport.md @@ -29,6 +29,7 @@ const report = { submittedOn: 1538053600624, recommendation: 'publish', recommendationType: 'review', + reviewerIndex: 1 } const journal = { diff --git a/packages/component-faraday-ui/src/ReviewerReportAuthor.js b/packages/component-faraday-ui/src/ReviewerReportAuthor.js index b10503a41a43f9181e84906122e181b54af8738b..9547f8d96752b535f5e815e81be231b4b2ffa3b7 100644 --- a/packages/component-faraday-ui/src/ReviewerReportAuthor.js +++ b/packages/component-faraday-ui/src/ReviewerReportAuthor.js @@ -85,20 +85,28 @@ export default compose( )(ReviewerReportAuthor) ReviewerReportAuthor.propTypes = { - /** It's true when you want to appear the reviewer name */ + /** True when you want to show reviewer name. */ showOwner: PropTypes.bool, - /** Reviewers reports */ + /** Pass object with informations about the report. */ report: PropTypes.shape({ + /** Unique id for report. */ id: PropTypes.string, + /** Unique id for user. */ userId: PropTypes.string, + /** Comments by reviewers. */ comments: PropTypes.arrayOf(PropTypes.object), + /** When the comment was created. */ createdOn: PropTypes.number, + /** When the comment was updated. */ updatedOn: PropTypes.number, + /** When the comment was submited. */ submittedOn: PropTypes.number, + /** The recommendation given by reviewer. */ recommendation: PropTypes.string, + /** Type of recommendation. */ recommendationType: PropTypes.string, }), - /** The reviewers recommendations */ + /** Pass object with informations about recommendation. */ journal: PropTypes.shape({ recommendations: PropTypes.arrayOf(PropTypes.object), }),