diff --git a/app/components/component-dashboard/src/components/Dashboard.js b/app/components/component-dashboard/src/components/Dashboard.js index 221cb872ba1a6a73da87ae3ed866fdd4e5fead50..ea630c0d0d26b4a2d3175f88a4433e940f4f4e2b 100644 --- a/app/components/component-dashboard/src/components/Dashboard.js +++ b/app/components/component-dashboard/src/components/Dashboard.js @@ -5,7 +5,7 @@ import { Button } from '@pubsweet/ui' import queries from '../graphql/queries/' import mutations from '../graphql/mutations/' -import { Container, Heading, HeadingWithAction, Placeholder } from '../style' +import { Container, Placeholder } from '../style' import EditorItem from './sections/EditorItem' import OwnerItem from './sections/OwnerItem' import ReviewerItem from './sections/ReviewerItem' @@ -15,39 +15,20 @@ import { Title, SectionRow, SectionContent, + Heading, + HeadingWithAction, } from '../../../shared' import hasRole from '../../../../shared/hasRole' -const updateReviewer = (proxy, { data: { reviewerResponse } }) => { - const id = reviewerResponse.object.objectId - const data = proxy.readQuery({ - query: queries.dashboard, - variables: { - id, - }, - }) - - const manuscriptIndex = data.manuscripts.findIndex(manu => manu.id === id) - const teamIndex = data.manuscripts[manuscriptIndex].teams.findIndex( - team => team.id === reviewerResponse.id, - ) - - data.manuscripts[manuscriptIndex].teams[teamIndex] = reviewerResponse - proxy.writeQuery({ query: queries.dashboard, data }) -} - const Dashboard = ({ history, ...props }) => { // const uploadManuscript = upload() // const [conversion] = useContext(XpubContext) const { loading, data, error } = useQuery(queries.dashboard) - const [reviewerRespond] = useMutation(mutations.reviewerResponseMutation, { - // variables: { currentUserId, action, teamId }, - update: updateReviewer, - }) + const [reviewerRespond] = useMutation(mutations.reviewerResponseMutation) + const [deleteManuscript] = useMutation(mutations.deleteManuscriptMutation, { - // variables: { id: manuscript.id }, update: (proxy, { data: { deleteManuscript } }) => { const data = proxy.readQuery({ query: queries.dashboard }) const manuscriptIndex = data.manuscripts.findIndex( @@ -70,7 +51,12 @@ const Dashboard = ({ history, ...props }) => { ) const toReview = dashboard.filter(submission => - hasRole(submission, 'reviewer'), + hasRole(submission, [ + 'reviewer', + 'invited:reviewer', + 'accepted:reviewer', + 'completed:reviewer', + ]), ) const manuscriptsImEditorOf = dashboard.filter(submission => @@ -90,7 +76,7 @@ const Dashboard = ({ history, ...props }) => { <SectionHeader> <Title>My Submissions</Title> </SectionHeader> - {dashboard.length > 0 ? ( + {mySubmissions.length > 0 ? ( mySubmissions.map(submission => ( <SectionRow key={`submission-${submission.id}`}> <OwnerItem diff --git a/app/components/component-dashboard/src/components/metadata/MetadataSubmittedDate.js b/app/components/component-dashboard/src/components/metadata/MetadataSubmittedDate.js index dc92f04fedbab3666852d671b5b090a2435a33c3..0cdfd16542f867ab35e77c2f20c3dd7bad16af50 100644 --- a/app/components/component-dashboard/src/components/metadata/MetadataSubmittedDate.js +++ b/app/components/component-dashboard/src/components/metadata/MetadataSubmittedDate.js @@ -3,7 +3,7 @@ import Moment from 'react-moment' const MetadataSubmittedDate = ({ submitted }) => ( <span> - <Moment format="YYYY-MM-DD">{submitted}</Moment> + Submitted on <Moment format="YYYY-MM-DD">{submitted}</Moment>. </span> ) diff --git a/app/components/component-dashboard/src/components/sections/EditorItem.js b/app/components/component-dashboard/src/components/sections/EditorItem.js index dcc6d539ea3deaf6f1b557d0fd67f990d67210d4..b6abd5d49a4f11c221ff25e104bd5bffa70c0754 100644 --- a/app/components/component-dashboard/src/components/sections/EditorItem.js +++ b/app/components/component-dashboard/src/components/sections/EditorItem.js @@ -3,15 +3,13 @@ import styled from 'styled-components' import { Action, ActionGroup } from '@pubsweet/ui' import { Item, StatusBadge } from '../../style' import Meta from '../metadata/Meta' -import MetadataSections from '../metadata/MetadataSections' -import MetadataType from '../metadata/MetadataType' -import MetadataReviewType from '../metadata/MetadataReviewType' import MetadataSubmittedDate from '../metadata/MetadataSubmittedDate' import MetadataAuthors from '../metadata/MetadataAuthors' import MetadataStreamLined from '../metadata/MetadataStreamLined' import JournalLink from '../JournalLink' import Reviews from '../Reviews' import VersionTitle from './VersionTitle' +import prettyRoleText from '../../../../../shared/prettyRoleText' const VersionTitleLink = styled(JournalLink)` text-decoration: none; @@ -72,13 +70,7 @@ const EditorItem = ({ version }) => ( {getSubmitedDate(version) ? ( <MetadataSubmittedDate submitted={getSubmitedDate(version).date} /> ) : null} - <MetadataType type={getMetadataObject(version, 'articleType')} /> - <MetadataSections - sections={getMetadataObject(version, 'articleSections')} - /> - <MetadataReviewType - openPeerReview={getDeclarationsObject(version, 'openPeerReview')} - /> + You are {prettyRoleText(version._currentRoles)}. </Meta> </Item> <Item> diff --git a/app/components/component-dashboard/src/components/sections/ReviewerItem.js b/app/components/component-dashboard/src/components/sections/ReviewerItem.js index d2fa115295cfd673c9e8e01e02f6df329b8cba84..9b0eb409865a44725d800f6158fe12965faa3da0 100644 --- a/app/components/component-dashboard/src/components/sections/ReviewerItem.js +++ b/app/components/component-dashboard/src/components/sections/ReviewerItem.js @@ -26,21 +26,6 @@ const ReviewerItem = ({ version, journals, currentUser, reviewerRespond }) => { team.members.find(member => member.user.id === currentUser.id) const status = currentMember && currentMember.status - // Enable that when Team Models is updated - // const { status } = - // getUserFromTeam(version, 'reviewer').filter( - // member => member.id === currentUser.id, - // )[0] || {} - - // const review = - // (version.reviews || []).find( - // review => - // currentUser && - // review.user && - // review.user.id === currentUser.id && - // !review.isDecision, - // ) || {} - return ( <Item> <VersionTitle version={version} />