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

refactor(details): move manuscript components

parent 14053ba3
No related branches found
No related tags found
1 merge request!43Sprint #19
Showing
with 22 additions and 13 deletions
......@@ -82,7 +82,7 @@ export default compose(
})
},
downloadFile: ({ downloadFile, token }) => file => {
downloadFile({ fileId: file.id, token, fileName: file.name })
downloadFile(file)
},
deleteFile: ({ deleteFile, files, setFormFiles }) => type => file => {
deleteFile(file.id, type).then(() => {
......
......@@ -25,9 +25,9 @@ const removeAnchorElement = (a, url) => {
}
export const withFileDownload = withHandlers({
downloadFile: () => ({ fileId, token, fileName = 'file' }) => {
downloadFile: ({ token }) => file => {
if (!token) return
const { id: fileId, name: fileName } = file
const fileURL = `${
window.location.origin
}/api/files/${fileId}?${qs.stringify({
......
......@@ -23,10 +23,6 @@ export { default as WizardAuthors } from './WizardAuthors'
export { default as WizardFiles } from './WizardFiles'
export { default as PreviewFile } from './PreviewFile'
export { default as DownloadZipFiles } from './DownloadZipFiles'
export { default as ManuscriptVersion } from './ManuscriptVersion'
export { default as ManuscriptHeader } from './ManuscriptHeader'
export { default as ManuscriptMetadata } from './ManuscriptMetadata'
export { default as ManuscriptFileList } from './ManuscriptFileList'
// Manuscript Details
export * from './manuscriptDetails'
......
import React, { Fragment } from 'react'
import { Text, FileItem, Item, Row } from 'pubsweet-component-faraday-ui'
import { withFilePreview, withFileDownload } from './helpers'
import { withFilePreview, withFileDownload } from '../helpers'
const ManuscriptFileList = ({
files: { manuscripts = [], coverLetter = [], supplementary = [] },
......
......@@ -10,6 +10,7 @@ import {
const ManuscriptMetadata = ({
getSignedUrl,
currentUser: { token },
fragment: {
files = {},
authors = [],
......@@ -20,7 +21,7 @@ const ManuscriptMetadata = ({
<Fragment>
{!!abstract && (
<Item mb={1}>
<ContextualBox label="Abstract" transparent>
<ContextualBox label="Abstract" startExpanded transparent>
<Text dangerouslySetInnerHTML={{ __html: abstract }} mb={1} mt={1} />
</ContextualBox>
</Item>
......@@ -44,7 +45,11 @@ const ManuscriptMetadata = ({
files.supplementary.length})`}
transparent
>
<ManuscriptFileList files={files} getSignedUrl={getSignedUrl} />
<ManuscriptFileList
files={files}
getSignedUrl={getSignedUrl}
token={token}
/>
</ContextualBox>
</Item>
)}
......
......@@ -33,5 +33,5 @@ const fragment = {
supplementary: [],
},
}
;<ManuscriptMetadata fragment={fragment} />
;<ManuscriptMetadata fragment={fragment} currentUser={{}}/>
```
export { default as ManuscriptDetailsTop } from './ManuscriptDetailsTop'
export { default as ManuscriptVersion } from './ManuscriptVersion'
export { default as ManuscriptHeader } from './ManuscriptHeader'
export { default as ManuscriptMetadata } from './ManuscriptMetadata'
export { default as ManuscriptFileList } from './ManuscriptFileList'
......@@ -38,7 +38,11 @@ const ManuscriptLayout = ({
fragment={fragment}
journal={journal}
/>
<ManuscriptMetadata fragment={fragment} getSignedUrl={getSignedUrl} />
<ManuscriptMetadata
currentUser={currentUser}
fragment={fragment}
getSignedUrl={getSignedUrl}
/>
</Fragment>
) : (
<Text>Loading...</Text>
......
......@@ -63,7 +63,7 @@ const MainContainer = styled.div`
display: flex;
flex-direction: column;
overflow-y: auto;
padding: 0 calc(${th('gridUnit')} * 10);
padding: 0 calc(${th('gridUnit')} * 12);
padding-top: calc(${th('appBar.height')} + ${th('gridUnit')} * 3 )};
`
// #endregion
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