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