Commit a4ce7655 authored by Audrey Hamelers's avatar Audrey Hamelers
parent 903230e7
Pipeline #12987 passed with stages
in 5 minutes and 49 seconds
......@@ -20,26 +20,6 @@ const ManuscriptHead = styled(FlexBar)`
font-weight: 600;
}
`
const Deleted = styled(Notification)`
margin: 0 auto;
justify-content: center;
& > span {
padding-left: calc(${th('gridUnit')} * 2);
flex: 0 0 30px;
}
& > div {
flex: 0 1 1470px;
}
@media screen and (max-width: 1500px) {
& > span {
padding-left: ${th('gridUnit')};
flex: 0 0 15px;
}
& > div {
flex: 0 1 1485px;
}
}
`
const Left = styled.div`
white-space: nowrap;
overflow: hidden;
......@@ -161,7 +141,9 @@ const SubmissionHeader = BaseComponent => ({
</RightSide>
</ManuscriptHead>
{manuscript.deleted && (
<Deleted type="error">This submission has been deleted.</Deleted>
<Notification fullscreen type="error">
This submission has been deleted.
</Notification>
)}
<BaseComponent
currentUser={currentUser}
......
import React from 'react'
import { Mutation } from 'react-apollo'
import styled from 'styled-components'
import styled, { createGlobalStyle } from 'styled-components'
import ReactHtmlParser from 'react-html-parser'
import { th, lighten } from '@pubsweet/ui-toolkit'
import { Action, Button, H1, H2, H3, H4, Icon } from '@pubsweet/ui'
......@@ -34,6 +34,12 @@ import ReviewFooter from './ReviewFooter'
import Annotator from './Annotator'
import { CONVERT_XML } from './operations'
const NoClick = createGlobalStyle`
body {
pointer-events: none;
}
`
const PreviewPageDiv = styled(PreviewPage)`
.show-mobile {
display: none;
......@@ -125,6 +131,7 @@ class Review extends React.Component {
showManuscript: false,
showAll: false,
startProcessing: false,
success: false,
}
componentDidMount() {
if (this.page && this.props.manuscript) {
......@@ -142,6 +149,15 @@ class Review extends React.Component {
}
}
}
showSuccess = () =>
new Promise((resolve, reject) => {
if (this.page) {
this.setState({ success: true })
setTimeout(() => {
this.setState({ success: false }, resolve())
}, 3000)
}
})
setRef = page => {
this.page = page
}
......@@ -194,6 +210,14 @@ class Review extends React.Component {
}
return (
<React.Fragment>
{this.state.success && (
<React.Fragment>
<NoClick />
<Notification fullscreen type="success">
{`Submission status change was successful`}
</Notification>
</React.Fragment>
)}
<PreviewPageDiv ref={this.setRef}>
<PreviewPanel
style={{
......@@ -489,6 +513,7 @@ class Review extends React.Component {
manuscript={manuscript}
previews={!!html && !!pdf}
review={review}
showSuccess={this.showSuccess}
/>
</React.Fragment>
)
......
......@@ -17,7 +17,14 @@ class ReviewFooter extends React.Component {
radio: '',
}
render() {
const { currentUser, manuscript, previews, review, history } = this.props
const {
currentUser,
manuscript,
previews,
review,
history,
showSuccess,
} = this.props
const { report, approve, cancel, radio } = this.state
const { annotations } = review || []
const { status, teams } = manuscript
......@@ -40,6 +47,7 @@ class ReviewFooter extends React.Component {
>
{(reviewManuscript, { data }) => {
const setStatus = async newStatus => {
await showSuccess()
await reviewManuscript({
variables: { data: { id: manuscript.id, status: newStatus } },
})
......@@ -167,6 +175,7 @@ class ReviewFooter extends React.Component {
<Buttons right>
<Button
onClick={async () => {
this.setState({ approve: false })
await setStatus(
status === 'xml-review'
? 'xml-complete'
......@@ -198,6 +207,7 @@ class ReviewFooter extends React.Component {
<Buttons right>
<Button
onClick={async () => {
this.setState({ report: false })
await setStatus('xml-triage')
history.push('/')
}}
......
import React from 'react'
import styled, { withTheme } from 'styled-components'
import styled, { withTheme, createGlobalStyle } from 'styled-components'
import { th } from '@pubsweet/ui-toolkit'
import { Button, Action, CheckboxGroup, H1, H2, H3, Icon } from '@pubsweet/ui'
import {
......@@ -37,6 +37,11 @@ const Alert = withTheme(({ children, theme }) => (
</Icon>
))
const NoClick = createGlobalStyle`
body {
pointer-events: none;
}
`
const ErrorReport = styled.p`
white-space: pre-wrap;
overflow-wrap: break-word;
......@@ -59,6 +64,7 @@ class Submit extends React.Component {
reject: false,
mailer: false,
message: '',
success: false,
}
async componentDidMount() {
const { currentUser, manuscript } = this.props
......@@ -87,14 +93,30 @@ class Submit extends React.Component {
}
}
}
componentDidUpdate() {
const { id, status } = this.props.manuscript
if (this.state.success && this.refnote) {
setTimeout(() => {
if (status === 'tagging') {
this.props.history.push(`/submission/${id}/review`)
} else {
this.setState({ success: false })
}
}, 3000)
}
}
setRef = refdiv => {
this.refdiv = refdiv
}
setSuccessRef = refnote => {
this.refnote = refnote
}
changeCitation = citation => {
this.props.changeCitation(citation)
this.setState({ editing: null })
}
pruneDupes = () => this.setState({ prune: true })
showSuccess = () => this.setState({ success: true })
render() {
const { currentUser, manuscript, duplicates: checkDupes = [] } = this.props
const {
......@@ -118,6 +140,7 @@ class Submit extends React.Component {
reject,
message,
mailer,
success,
} = this.state
const sections = submitSections(
manuscript,
......@@ -182,7 +205,19 @@ class Submit extends React.Component {
submitter.user.id === currentUser.id &&
['INITIAL', 'READY', 'submission-error'].includes(status)
return (
<React.Fragment>
<div ref={this.setSuccessRef}>
{success && (
<React.Fragment>
<NoClick />
<Notification fullscreen type="success">
{`Submission was successfully ${
['tagging', 'in-review'].includes(status)
? `sent for ${status === 'tagging' ? 'tagging' : 'review'}`
: 'submitted'
}`}
</Notification>
</React.Fragment>
)}
{(() => {
if (
!currentUser.admin &&
......@@ -335,6 +370,7 @@ class Submit extends React.Component {
adminButton={reviewerNote ? 'review' : 'tagging'}
disabled={sections.some(sec => sec.error)}
manuscriptId={manuscript.id}
showSuccess={this.showSuccess}
/>
) : (
<Button
......@@ -387,6 +423,7 @@ class Submit extends React.Component {
manuscriptId={manuscript.id}
releaseDelay={releaseDelay}
setChecked={c => this.setState({ checkedBoxes: c })}
showSuccess={this.showSuccess}
xml={xml}
/>
)}
......@@ -453,7 +490,7 @@ class Submit extends React.Component {
recipients={[submitter.user.id]}
/>
)}
</React.Fragment>
</div>
)
}
return null
......
......@@ -7,6 +7,7 @@ import { ALERT_PIS } from '../operations'
import { SUBMIT_MANUSCRIPT } from './operations'
const SubmitApprove = ({
showSuccess,
adminButton,
disabled,
xml,
......@@ -48,9 +49,8 @@ const SubmitApprove = ({
variables.data.status = 'xml-triage'
}
await submitManuscript({ variables })
if (adminButton === 'tagging') {
history.push(`/submission/${manuscriptId}/review`)
} else {
await showSuccess()
if (close) {
close()
}
}
......
import React from 'react'
import styled from 'styled-components'
import styled, { css } from 'styled-components'
import { th, darken } from '@pubsweet/ui-toolkit'
import { Icon } from '@pubsweet/ui'
const fullscreen = css`
margin: 0 auto;
justify-content: center;
& > span {
padding-left: calc(${th('gridUnit')} * 2);
flex: 0 0 30px;
}
& > div {
flex: 0 1 1470px;
}
@media screen and (max-width: 1500px) {
& > span {
padding-left: ${th('gridUnit')};
flex: 0 0 15px;
}
& > div {
flex: 0 1 1485px;
}
}
`
const Container = styled.div`
padding: ${th('gridUnit')};
margin: ${th('gridUnit')} 0;
......@@ -46,6 +66,7 @@ const Container = styled.div`
& > div * {
font-size: ${th('fontSizeBaseSmall')};
}
${props => props.fullscreen && fullscreen};
`
const NotifIcon = {
warning: 'alert-triangle',
......@@ -54,8 +75,8 @@ const NotifIcon = {
success: 'check-circle',
}
const Notification = ({ children, type, ...props }) => (
<Container className={`${props.className ? props.className : ''} ${type}`}>
const Notification = ({ children, type, className, ...props }) => (
<Container className={`${className || ''} ${type}`} {...props}>
<Icon color="currentColor" size={2}>
{NotifIcon[type]}
</Icon>
......
Markdown is supported
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