Skip to content
Snippets Groups Projects
Commit 552b08c1 authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

feat(make-recommendation): show on dashboard and sidebar

parent 28ffbb64
No related branches found
No related tags found
1 merge request!10Sprint #12
......@@ -12,8 +12,8 @@ import {
} from 'xpub-selectors'
import { get as apiGet } from 'pubsweet-client/src/helpers/api'
import { compose, lifecycle, withHandlers, withState } from 'recompose'
import { reviewerDecision } from 'pubsweet-components-faraday/src/redux/reviewers'
import { getSignedUrl } from 'pubsweet-components-faraday/src/redux/files'
import { reviewerDecision } from 'pubsweet-components-faraday/src/redux/reviewers'
import {
getHandlingEditors,
selectHandlingEditors,
......@@ -76,6 +76,8 @@ export default compose(
const isEic = get(currentUser, 'editorInChief')
const isHe = get(currentUser, 'handlingEditor')
switch (type) {
case 'isHE':
return isHe
case 'staff':
return isAdmin || isEic || isHe
case 'adminEiC':
......
import React from 'react'
import { th, Icon } from '@pubsweet/ui'
import styled from 'styled-components'
import ZipFiles from 'pubsweet-components-faraday/src/components/Files/ZipFiles'
import { Recommendation } from 'pubsweet-components-faraday/src/components/MakeRecommendation'
import { MakeDecision } from './'
const SideBarActions = ({ project, version, currentUserIs }) => (
<Root>
{currentUserIs('adminEiC') ? <MakeDecision /> : <div />}
{currentUserIs('adminEiC') && <MakeDecision />}
{currentUserIs('isHE') && (
<Recommendation
collectionId={project.id}
fragmentId={version.id}
modalKey={`recommend-${version.id}`}
/>
)}
<ZipFiles
archiveName={`ID-${project.customId}`}
collectionId={project.id}
......
......@@ -14,6 +14,7 @@ import AuthorsWithTooltip from 'pubsweet-component-manuscript/src/molecules/Auth
import ZipFiles from '../Files/ZipFiles'
import { InviteReviewers } from '../Reviewers/'
import { currentUserIs } from '../../redux/users'
import { selectInvitation } from '../../redux/reviewers'
import { ReviewerDecision, HandlingEditorSection } from './'
import { parseVersion, parseJournalIssue, mapStatusToLabel } from './../utils'
......@@ -22,17 +23,18 @@ import { ReviewerBreakdown } from '../Invitations'
import { Recommendation } from '../MakeRecommendation'
const DashboardCard = ({
deleteProject,
isHE,
theme,
journal,
history,
project,
version,
showAbstractModal,
journal,
showConfirmationModal,
theme,
invitation,
currentUser,
deleteProject,
showAbstractModal,
canInviteReviewers,
invitation,
showConfirmationModal,
...rest
}) => {
const { submitted, title, type } = parseVersion(version)
......@@ -58,11 +60,13 @@ const DashboardCard = ({
/>
</LeftDetails>
<RightDetails flex={2}>
<Recommendation
collectionId={project.id}
fragmentId={version.id}
modalKey={`recommend-${version.id}`}
/>
{isHE && (
<Recommendation
collectionId={project.id}
fragmentId={version.id}
modalKey={`recommend-${version.id}`}
/>
)}
<ZipFiles
archiveName={`ID-${project.customId}`}
collectionId={project.id}
......@@ -165,6 +169,7 @@ export default compose(
modalComponent: ConfirmationModal,
}),
connect((state, { project }) => ({
isHE: currentUserIs(state, 'handlingEditor'),
invitation: selectInvitation(state, project.id),
})),
withHandlers({
......
......@@ -10,7 +10,7 @@ import {
import { RecommendWizard } from './'
const Recommendation = ({ showFirstStep }) => (
<Root onClick={showFirstStep}>Recommend</Root>
<Root onClick={showFirstStep}>Make recommendation</Root>
)
const SHOW_WIZARD = 'SHOW_WIZARD'
......@@ -50,6 +50,7 @@ const Root = styled.div`
font-size: ${th('fontSizeBaseSmall')};
height: calc(${th('subGridUnit')} * 5);
justify-content: center;
min-width: 200px;
padding: 0 calc(${th('subGridUnit')} * 2);
text-transform: uppercase;
`
......
import { get } from 'lodash'
export const currentUserIs = (state, role) =>
get(state, `currentUser.user.${role}`)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment