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

feat(manuscript-details): use real data

parent 9d0b91ce
No related branches found
No related tags found
1 merge request!8Sprint #10
...@@ -10,14 +10,7 @@ const TR = ({ name, email, affiliation }) => ( ...@@ -10,14 +10,7 @@ const TR = ({ name, email, affiliation }) => (
</Row> </Row>
) )
const authors = [ const Authors = ({ authors }) => (
{ name: 'Pallavi1', email: 'cocojambo1@gmail.com', affiliation: 'UTI' },
{ name: 'Pallavi2', email: 'cocojambo2@gmail.com', affiliation: 'UTI' },
{ name: 'Pallavi3', email: 'cocojambo3@gmail.com', affiliation: 'UTI' },
{ name: 'Pallavi4', email: 'cocojambo4@gmail.com', affiliation: 'UTI' },
]
const Authors = () => (
<Table> <Table>
<thead> <thead>
<tr> <tr>
...@@ -26,7 +19,18 @@ const Authors = () => ( ...@@ -26,7 +19,18 @@ const Authors = () => (
<td>Affiliation</td> <td>Affiliation</td>
</tr> </tr>
</thead> </thead>
<tbody>{authors.map(a => <TR key={a.email} {...a} />)}</tbody> <tbody>
{authors.map(
({ firstName = '', lastName = '', email = '', affiliation = '' }) => (
<TR
affiliation={affiliation}
email={email}
key={email}
name={`${firstName} ${lastName}`}
/>
),
)}
</tbody>
</Table> </Table>
) )
......
...@@ -18,7 +18,7 @@ const Expandable = ({ expanded, label, children, toggle }) => ( ...@@ -18,7 +18,7 @@ const Expandable = ({ expanded, label, children, toggle }) => (
) )
export default compose( export default compose(
withState('expanded', 'setExpanded', false), withState('expanded', 'setExpanded', ({ startExpanded }) => startExpanded),
withHandlers({ withHandlers({
toggle: ({ setExpanded }) => () => { toggle: ({ setExpanded }) => () => {
setExpanded(e => !e) setExpanded(e => !e)
...@@ -60,7 +60,6 @@ const Root = styled.div` ...@@ -60,7 +60,6 @@ const Root = styled.div`
cursor: pointer; cursor: pointer;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
/* height: ${({ expanded }) => `${expanded ? 160 : 40}px`}; */
transition: all 0.3s; transition: all 0.3s;
` `
// #endregion // #endregion
import React from 'react' import React, { Fragment } from 'react'
import styled, { css } from 'styled-components' import styled, { css } from 'styled-components'
import { th, Icon } from '@pubsweet/ui' import { th, Icon } from '@pubsweet/ui'
...@@ -17,7 +17,7 @@ const parseFileSize = (size = 0) => { ...@@ -17,7 +17,7 @@ const parseFileSize = (size = 0) => {
return `${size} bytes` return `${size} bytes`
} }
const File = ({ fileName = 'Some_awesome_stuff.pdf', fileSize }) => ( const File = ({ name = 'filename', size }) => (
<FileRoot> <FileRoot>
<IconButton> <IconButton>
<Icon primary size={3}> <Icon primary size={3}>
...@@ -29,28 +29,42 @@ const File = ({ fileName = 'Some_awesome_stuff.pdf', fileSize }) => ( ...@@ -29,28 +29,42 @@ const File = ({ fileName = 'Some_awesome_stuff.pdf', fileSize }) => (
download download
</Icon> </Icon>
</IconButton> </IconButton>
<FileName>{fileName}</FileName> <FileName>{name}</FileName>
<FileSize>{parseFileSize(fileSize)}</FileSize> <FileSize>{parseFileSize(size)}</FileSize>
</FileRoot> </FileRoot>
) )
const Files = () => ( const Files = ({
files: { manuscripts = [], coverLetter = [], supplementary = [] },
}) => (
<Root> <Root>
<Header> {manuscripts.length > 0 && (
<span>Main manuscript</span> <Fragment>
<div /> <Header>
</Header> <span>Main manuscript</span>
<File fileName="file1.png" fileSize={212312312} /> <div />
<File fileName="file2.png" fileSize={3231} /> </Header>
<File fileName="file3.png" fileSize={5521231} /> {manuscripts.map(file => <File key={file.id} {...file} />)}
<Header> </Fragment>
<span>Supplimentary files</span> )}
<div /> {supplementary.length > 0 && (
</Header> <Fragment>
<Header> <Header>
<span>Cover letter</span> <span>Supplemetary files</span>
<div /> <div />
</Header> </Header>
{supplementary.map(file => <File key={file.id} {...file} />)}
</Fragment>
)}
{coverLetter.length > 0 && (
<Fragment>
<Header>
<span>Supplemetary files</span>
<div />
</Header>
{coverLetter.map(file => <File key={file.id} {...file} />)}
</Fragment>
)}
</Root> </Root>
) )
......
import React from 'react' import React from 'react'
import { isEmpty } from 'lodash'
import { th } from '@pubsweet/ui' import { th } from '@pubsweet/ui'
import styled from 'styled-components' import styled from 'styled-components'
import { Authors, Expandable, Files } from './' import { Authors, Expandable, Files } from './'
const Conflict = () => ( const defaultConflict = `
<Text> “Prevention is better than cure.” Well said and well understood! But there
Prevention is better than cure. Well said and well understood! But there
are certain types of headaches, which are part and parcel of you; gifted to are certain types of headaches, which are part and parcel of you; gifted to
you by birth! Sinus headache is one of them, unfortunately. Many say about you by birth! Sinus headache is one of them, unfortunately. Many say about
sinus, “that which can not be cured, must be endured!’ You can control it, sinus, “that which can not be cured, must be endured!’ You can control it,
reduce its impact. Can it be ever eradicated? The answer is in the negative, reduce its impact. Can it be ever eradicated? The answer is in the negative,
as far as the present day medical research can take you! In sinus, as far as the present day medical research can take you! In sinus,
invariably you have the headache, but every headache is not sinus! Sinus and invariably you have the headache, but every headache is not sinus! Sinus and
nasal passage problems are the cause of headache, mostly! It is not that you nasal passage problems are the cause of headache, mostly! It is not that you`
</Text> const Conflict = ({ conflict = defaultConflict }) => <Text>{conflict}</Text>
const Abstract = ({ abstract }) => (
<Text dangerouslySetInnerHTML={{ __html: abstract }} />
) )
const ManuscriptDetails = () => ( const ManuscriptDetails = ({
collection,
fragment: {
conflicts,
files = {},
authors = [],
metadata: { abstract = '' },
},
}) => (
<Root> <Root>
<Expandable label="Details"> <Expandable label="Details" startExpanded>
<Expandable label="abstract">wai sebi nu fi nasol</Expandable> {!!abstract && (
<Expandable label="Conflict of interest"> <Expandable label="abstract">
<Conflict /> <Abstract abstract={abstract} />
</Expandable> </Expandable>
<Expandable label="authors"> )}
<Authors /> {conflicts.hasConflicts !== 'no' && (
</Expandable> <Expandable label="Conflict of interest">
<Expandable label="files"> <Conflict conflict={conflicts.conflict} />
<Files /> </Expandable>
</Expandable> )}
{authors.length > 0 && (
<Expandable label="authors" startExpanded>
<Authors authors={authors} />
</Expandable>
)}
{!isEmpty(files) && (
<Expandable label="files">
<Files files={files} />
</Expandable>
)}
</Expandable> </Expandable>
</Root> </Root>
) )
...@@ -44,6 +65,7 @@ const Text = styled.span` ...@@ -44,6 +65,7 @@ const Text = styled.span`
` `
const Root = styled.div` const Root = styled.div`
background-color: ${th('colorBackground')};
border: ${th('borderDefault')}; border: ${th('borderDefault')};
margin-top: calc(${th('subGridUnit')} * 2); margin-top: calc(${th('subGridUnit')} * 2);
transition: height 0.3s; transition: height 0.3s;
......
...@@ -28,7 +28,7 @@ const ManuscriptLayout = ({ ...@@ -28,7 +28,7 @@ const ManuscriptLayout = ({
<ManuscriptId>{`- ID ${project.customId}`}</ManuscriptId> <ManuscriptId>{`- ID ${project.customId}`}</ManuscriptId>
</Header> </Header>
<ManuscriptHeader journal={journal} project={project} version={version} /> <ManuscriptHeader journal={journal} project={project} version={version} />
<ManuscriptDetails /> <ManuscriptDetails collection={project} fragment={version} />
</Container> </Container>
<SideBar flex={1}>Sidebar</SideBar> <SideBar flex={1}>Sidebar</SideBar>
</Root> </Root>
......
...@@ -39,7 +39,7 @@ module.exports = { ...@@ -39,7 +39,7 @@ module.exports = {
'pubsweet-client': { 'pubsweet-client': {
API_ENDPOINT: '/api', API_ENDPOINT: '/api',
'login-redirect': '/', 'login-redirect': '/',
'redux-log': false, 'redux-log': true,
theme: process.env.PUBSWEET_THEME, theme: process.env.PUBSWEET_THEME,
}, },
'mail-transport': { 'mail-transport': {
......
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