Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Weekly chore: merge develop #29

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

**[Join our PREreview Slack Channel](https://join.slack.com/t/prereview/shared_invite/enQtMzYwMjQzMTk3ODMxLTZhOWQ5M2FmMTY5OTYzZDNhNDg2ZDdhODE2Y2Y4MTVjY2U0OWRiZTA5ZjM3MWM1ZTY0N2E1ODYyNWM1NTc2NDg)**

## Developer quick links
## [TODO] Developer quick links

- Design
- Roadmap
Expand Down
53 changes: 51 additions & 2 deletions app/components/AssignReviewers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { th } from '@pubsweet/ui-toolkit'

import ComposedAssignReviewers from './compose/AssignReviewers'
import { Select as DefaultSelect } from './ui'
import { AssignReviewersForm } from './form'
import { TextField } from './formElements'
import { AddReviewerForm, AssignReviewersForm } from './form'
import Loading from './Loading'
import { isMember } from '../helpers/teams'

Expand Down Expand Up @@ -56,6 +57,7 @@ const PageHeading = styled(H2)`
const ContentWrapper = styled.div`
cursor: default;
display: flex;
flex-direction: column;
margin-left: ${th('gridUnit')};

form {
Expand All @@ -80,6 +82,52 @@ const Tag = styled.span`
padding: calc(${th('gridUnit')} / 2);
`

const InviteSectionWrapper = styled.div`
margin: calc(${th('gridUnit')} * 3) 0;
`

const InviteSection = props => {
const { articleId } = props

return (
<InviteSectionWrapper>
<Action>Add a reviewer that is not in the system</Action>

<AddReviewerForm articleId={articleId}>
{formProps => {
const { errors, values, ...rest } = formProps

return (
<React.Fragment>
<TextField
error={errors.name}
label="Name"
name="name"
required
value={values.name}
{...rest}
/>

<TextField
error={errors.email}
label="Email"
name="email"
required
value={values.email}
{...rest}
/>

<Button primary type="submit">
OK
</Button>
</React.Fragment>
)
}}
</AddReviewerForm>
</InviteSectionWrapper>
)
}

const SuggestedReviewer = props => {
const { name } = props
return <Tag>{name}</Tag>
Expand Down Expand Up @@ -264,14 +312,15 @@ const AssignReviewers = props => {
options={userOptions}
value={values.reviewers}
/>

<Button disabled={!dirty} primary type="submit">
Save
</Button>
</React.Fragment>
)
}}
</AssignReviewersForm>

<InviteSection articleId={articleId} />
</Section>

<Section label="Status">
Expand Down
1 change: 0 additions & 1 deletion app/components/compose/pieces/manuscriptMetadataUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const MANUSCRIPT_METADATA_UPDATE = gql`

const ManuscriptMetadataUpdateMutation = props => {
const { articleId, render } = props
console.log(props)

const refetchQueries = [
{
Expand Down
36 changes: 36 additions & 0 deletions app/components/form/AddReviewerForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react'
import * as yup from 'yup'

import Form from './Form'

const initialValues = {
email: '',
name: '',
}

const validations = yup.object().shape({
email: yup
.string()
.required('Email is required')
.email('Invalid email address'),
name: yup.string().required('Name is required'),
})

const AddReviewerForm = props => {
// const { articleId } = props

const handleSubmit = (formValues, formikBag) => {
// console.log('submit me!', formValues)
}

return (
<Form
initialValues={initialValues}
onSubmit={handleSubmit}
validationSchema={validations}
{...props}
/>
)
}

export default AddReviewerForm
1 change: 1 addition & 0 deletions app/components/form/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as AddReviewerForm } from './AddReviewerForm'
export { default as AssignReviewersForm } from './AssignReviewersForm'
export { default as DecisionForm } from './DecisionForm'
export { default as DiscussForm } from './DiscussForm'
Expand Down
1 change: 1 addition & 0 deletions app/components/ui/EditorPanelMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const EditorPanelMetadata = props => {
return (
<MetadataForm
articleId={articleId}
doi={doi}
setState={setState}
updateMetadata={updateMetadata}
>
Expand Down
3 changes: 3 additions & 0 deletions config/authsome.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const isInvitedReviewer = (user, object, context) =>

const updatedProperties = (current, update) => {
const diff = Object.keys(current).filter(k => {
if (!update[k]) return false

if (typeof current[k] === 'string') {
return current[k] !== update[k]
}
Expand Down Expand Up @@ -169,6 +171,7 @@ const permissions = {
'currentlyWith',
'dataType',
'decisionLetter',
'doi',
'status',
]

Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9646,7 +9646,7 @@ prompt@^1.0.0:
utile "0.3.x"
winston "2.1.x"

"prompt@github:flatiron/prompt#1c95d1d8d333b5fbc13fa5f0619f3dcf0d514f87":
prompt@flatiron/prompt#1c95d1d8d333b5fbc13fa5f0619f3dcf0d514f87:
version "1.0.0"
resolved "https://codeload.github.com/flatiron/prompt/tar.gz/1c95d1d8d333b5fbc13fa5f0619f3dcf0d514f87"
dependencies:
Expand Down