Skip to content
Snippets Groups Projects
Commit 7207d12f authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

fix: fixes on manuscript detailed view

parent 5b9ac3a9
No related branches found
No related tags found
1 merge request!8Sprint #10
...@@ -20,8 +20,8 @@ import { ...@@ -20,8 +20,8 @@ import {
} from './' } from './'
const ManuscriptLayout = ({ const ManuscriptLayout = ({
project, project = {},
version, version = {},
journal, journal,
history, history,
currentUser, currentUser,
......
...@@ -45,6 +45,7 @@ export default compose( ...@@ -45,6 +45,7 @@ export default compose(
replace, replace,
updateVersion: actions.updateFragment, updateVersion: actions.updateFragment,
getSignedUrl, getSignedUrl,
getCollection: actions.getCollection,
}, },
), ),
ConnectPage(({ currentUser, handlingEditors, project }) => { ConnectPage(({ currentUser, handlingEditors, project }) => {
...@@ -64,18 +65,6 @@ export default compose( ...@@ -64,18 +65,6 @@ export default compose(
id: version.id, id: version.id,
...data, ...data,
}), }),
downloadFile: ({ getSignedUrl }) => (fileId, fileName) => e => {
e.preventDefault()
getSignedUrl(fileId).then(({ signedUrl }) => {
const a = document.createElement('a')
a.href = `${signedUrl}`
a.download = fileName
a.target = '_blank'
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
})
},
setEditorInChief: ({ setEiC }) => eic => { setEditorInChief: ({ setEiC }) => eic => {
if (eic) { if (eic) {
const { firstName = '', lastName = '' } = eic const { firstName = '', lastName = '' } = eic
...@@ -104,14 +93,15 @@ export default compose( ...@@ -104,14 +93,15 @@ export default compose(
location, location,
match, match,
setEditorInChief, setEditorInChief,
getCollection,
} = this.props } = this.props
const collectionId = match.params.project const collectionId = match.params.project
const { agree, invitationId } = parseSearchParams(location.search) const { agree, invitationId } = parseSearchParams(location.search)
if (agree === 'true') { if (agree === 'true') {
replace(location.pathname) replace(location.pathname)
reviewerDecision(invitationId, collectionId, true).catch( reviewerDecision(invitationId, collectionId, true)
redirectToError(replace), .then(() => getCollection({ id: match.params.project }))
) .catch(redirectToError(replace))
} }
apiGet(`/users?editorInChief=true`).then(res => apiGet(`/users?editorInChief=true`).then(res =>
......
...@@ -8,20 +8,21 @@ import { withRouter } from 'react-router-dom' ...@@ -8,20 +8,21 @@ import { withRouter } from 'react-router-dom'
import { parseVersionOptions } from './utils' import { parseVersionOptions } from './utils'
const ManuscriptVersion = ({ project, fragments = [], history, match }) => ( const ManuscriptVersion = ({ project = {}, fragments = [], history, match }) =>
<Menu !!fragments.length && (
inline <Menu
onChange={v => inline
history.push(`/projects/${project.id}/versions/${v}/details`) onChange={v =>
} history.push(`/projects/${project.id}/versions/${v}/details`)
options={parseVersionOptions(fragments)} }
value={get(match, 'params.version')} options={parseVersionOptions(fragments)}
/> value={get(match, 'params.version')}
) />
)
export default compose( export default compose(
withRouter, withRouter,
connect((state, { project }) => ({ connect((state, { project }) => ({
fragments: selectFragments(state, project.fragments), fragments: selectFragments(state, get(project, 'fragments') || []),
})), })),
)(ManuscriptVersion) )(ManuscriptVersion)
import React, { Fragment } from 'react' import React, { Fragment } from 'react'
import moment from 'moment' import moment from 'moment'
import { get } from 'lodash'
import { th } from '@pubsweet/ui' import { th } from '@pubsweet/ui'
import { compose } from 'recompose' import { compose } from 'recompose'
import { withJournal } from 'xpub-journal' import { withJournal } from 'xpub-journal'
...@@ -21,24 +22,41 @@ const ReviewReportCard = ({ report = {}, journal: { recommendations } }) => ( ...@@ -21,24 +22,41 @@ const ReviewReportCard = ({ report = {}, journal: { recommendations } }) => (
{recommendations.find(r => report.recommendation === r.value).label} {recommendations.find(r => report.recommendation === r.value).label}
</Text> </Text>
</Row> </Row>
<Spacing /> {get(report, 'comments[0].content') && (
<Row left>
<Label>Report Text</Label>
</Row>
<Row>
<Text>{report.comments[0].content}</Text>
</Row>
<Spacing />
{!!report.comments[0].files.length && (
<Fragment> <Fragment>
<Spacing />
<Row left> <Row left>
<Label>Files</Label> <Label>Report Text</Label>
</Row>
<Row>
<Text>{report.comments[0].content}</Text>
</Row> </Row>
</Fragment>
)}
{get(report, 'comments[0].content.files') &&
!!report.comments[0].files.length && (
<Fragment>
<Spacing />
<Row left>
<Label>Files</Label>
</Row>
<Row left>
{report.comments[0].files.map(file => (
<FileItem compact id={file.id} key={file.id} {...file} />
))}
</Row>
</Fragment>
)}
{get(report, 'comments[1].content') && (
<Fragment>
<Spacing />
<Row left> <Row left>
{report.comments[0].files.map(file => ( <Label>Confidential Note</Label>
<FileItem compact id={file.id} key={file.id} {...file} /> </Row>
))} <Row>
<Text>{report.comments[1].content}</Text>
</Row> </Row>
</Fragment> </Fragment>
)} )}
......
...@@ -235,10 +235,7 @@ export default compose( ...@@ -235,10 +235,7 @@ export default compose(
.then(file => { .then(file => {
const files = formValues.files || [] const files = formValues.files || []
const newFiles = [...files, file] const newFiles = [...files, file]
changeForm('reviewerReport', 'files', newFiles)
setTimeout(() => {
changeForm('reviewerReport', 'files', newFiles)
}, 1000)
}) })
.catch(e => console.error(`Couldn't upload file.`, e)) .catch(e => console.error(`Couldn't upload file.`, e))
}, },
......
...@@ -69,7 +69,7 @@ export const parseSearchParams = url => { ...@@ -69,7 +69,7 @@ export const parseSearchParams = url => {
return parsedObject return parsedObject
} }
export const parseVersionOptions = fragments => export const parseVersionOptions = (fragments = []) =>
fragments.map(f => ({ fragments.map(f => ({
value: f.id, value: f.id,
label: `Version ${f.version} - updated on ${moment(f.submitted).format( label: `Version ${f.version} - updated on ${moment(f.submitted).format(
......
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