Newer
Older
import React, { Fragment } from 'react'
import { H2, Button } from '@pubsweet/ui'
import { Table } from '../ui'
import { obtainEventDescription } from './helpers'
import Mailer from '../mailer'
const TdDate = styled.td`
vertical-align: top;
`
const TdPerson = TdDate
manuscript.audits
.reduce((reversed, audit) => {
reversed.unshift(audit)
return reversed
}, [])
.map(audit => (
<tr key={audit.id}>
<TdDate>{moment(audit.created).format('DD/MM/YYYY HH:mm:ss')}</TdDate>
<TdPerson>{`${audit.user.givenNames} ${audit.user.surname}`}</TdPerson>
<td>{obtainEventDescription(audit, manuscript)}</td>
</tr>
))
`
const DetailsHeading = styled.div`
display: flex;
align-items: baseline;
justify-content: space-between;
`
render() {
return (
<Fragment>
<DetailsHeading>
<div>
<H2>Details</H2>
</div>
<div>
<NewMsgBtn
onClick={() => this.setState({ sendingMail: true })}
primary
>
New message
</NewMsgBtn>
</div>
{this.state.sendingMail && (
<Mailer
close={() => this.setState({ sendingMail: false })}
currentUser={this.props.currentUser}
manuscript={this.props.manuscript}
/>
<DetailsTable>
<tbody>
<tr>
<DataColumn>Date</DataColumn>
<PersonColumn>Person</PersonColumn>
<th>Event</th>
</tr>
<ActivityList manuscript={this.props.manuscript} />
</tbody>
</DetailsTable>
</Fragment>
)
}
}