Skip to content
Snippets Groups Projects
Commit ea3456a5 authored by Tania Fecheta's avatar Tania Fecheta
Browse files

fix(responseToRevisionRequest): files uploded by author on Submit revision can...

fix(responseToRevisionRequest): files uploded by author on Submit revision can be downloaded and pre
parent 3d758786
No related branches found
No related tags found
3 merge requests!160Update staging with master features,!156Develop,!151Hin 1131
import React from 'react'
import React, { Fragment } from 'react'
import { get } from 'lodash'
import { withProps } from 'recompose'
import styled from 'styled-components'
import { th } from '@pubsweet/ui-toolkit'
import { DateParser } from '@pubsweet/ui'
import { Label, Item, Row, Text } from './'
import { Label, Item, Row, Text, FileItem } from './'
const submittingAuthor = authors => {
const thisAuthor = authors.filter(e => e.isSubmitting)
return thisAuthor[0]
}
const AuthorReply = ({ reply, authorName, submittedOn }) => (
const AuthorReply = ({
authorReply,
authorName,
submittedOn,
replyContent,
replyFile,
onDownload,
onPreview,
}) => (
<Root>
<Row justify="space-between" mb={2}>
<Item justify="flex-end">
<Row mb={1}>
<Item vertical>
<Label mb={1 / 2}>Author Reply</Label>
<Text>{reply}</Text>
<Text>{replyContent}</Text>
</Item>
</Row>
<Text ml={1} mr={1} whiteSpace="nowrap">
......@@ -30,17 +38,36 @@ const AuthorReply = ({ reply, authorName, submittedOn }) => (
</DateParser>
</Item>
</Row>
{replyFile && (
<Fragment>
<Label mb={1 / 2}>File</Label>
<Row justify="flex-start" mb={2}>
<Item flex={0} mr={1}>
<FileItem
item={replyFile}
onDownload={onDownload}
onPreview={onPreview}
/>
</Item>
</Row>
</Fragment>
)}
</Root>
)
export default withProps(({ fragment: { authors, submitted } }) => ({
submittedOn: submitted,
authorName: `${get(submittingAuthor(authors), 'firstName', '')} ${get(
submittingAuthor(authors),
'lastName',
'',
)}`,
}))(AuthorReply)
export default withProps(
({ fragment: { authors, submitted }, authorReply }) => ({
submittedOn: submitted,
authorName: `${get(submittingAuthor(authors), 'firstName', '')} ${get(
submittingAuthor(authors),
'lastName',
'',
)}`,
replyContent: get(authorReply, 'content', ''),
replyFile: get(authorReply, 'file', ''),
}),
)(AuthorReply)
// #region styles
const Root = styled.div`
......
import React from 'react'
import { compose } from 'recompose'
import { ContextualBox, AuthorReply } from '../'
import {
ContextualBox,
AuthorReply,
withFilePreview,
withFileDownload,
} from '../'
const ResponseToRevisionRequest = ({
fragment,
authorReply,
toggle,
expanded,
downloadFile,
previewFile,
...rest
}) => (
<ContextualBox
expanded={expanded}
label="Response to Revision Request"
mb={2}
toggle={toggle}
{...rest}
>
<AuthorReply fragment={fragment} reply={authorReply} />
<AuthorReply
authorReply={authorReply}
fragment={fragment}
onDownload={downloadFile}
onPreview={previewFile}
/>
</ContextualBox>
)
export default ResponseToRevisionRequest
export default compose(withFilePreview, withFileDownload)(
ResponseToRevisionRequest,
)
......@@ -139,10 +139,12 @@ const ManuscriptLayout = ({
{get(currentUser, 'permissions.canViewResponseFromAuthor', false) && (
<ResponseToRevisionRequest
authorReply={get(authorResponseToRevisonRequest, 'content', '')}
authorReply={get(fragment, 'responseToReviewers', {})}
expanded={responseToRevisionRequest}
fragment={fragment}
getSignedUrl={getSignedUrl}
toggle={toggleResponseToRevisionRequest}
token={get(currentUser, 'token')}
/>
)}
......
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