diff --git a/packages/component-faraday-ui/src/WizardAuthors.js b/packages/component-faraday-ui/src/WizardAuthors.js index 1749fda6f68b9a10e4c83313e1daef1868248fea..ee28d0b054a48bda1f6423cb6fdaeec5a99d5c55 100644 --- a/packages/component-faraday-ui/src/WizardAuthors.js +++ b/packages/component-faraday-ui/src/WizardAuthors.js @@ -167,12 +167,12 @@ export default compose( }, deleteAuthor: ({ authors, - project, - version, + collection, + fragment, deleteAuthor, setFormAuthors, }) => author => ({ hideModal, setModalError }) => - deleteAuthor(project.id, version.id, author.id) + deleteAuthor(collection.id, fragment.id, author.id) .then(() => { const newAuthors = setCorrespondingAuthor( authors.filter(a => a.id !== author.id), @@ -185,8 +185,8 @@ export default compose( withHandlers({ authorEditorSubmit: ({ authors, - project, - version, + collection, + fragment, addAuthor, setFetching, saveNewAuthor, @@ -199,8 +199,8 @@ export default compose( ...omit(values, 'id'), isSubmitting: authors.length === 1, }, - project.id, - version.id, + collection.id, + fragment.id, ).then(saveNewAuthor) } editExistingAuthor(values) diff --git a/packages/component-faraday-ui/src/submissionRevision/DetailsAndAuthors.js b/packages/component-faraday-ui/src/submissionRevision/DetailsAndAuthors.js index 13d0a6cfa39c1c6af90c8382aacf85e6a94618f7..8dfd9a05c7867c0031e748a840ffd51c9ddfa41d 100644 --- a/packages/component-faraday-ui/src/submissionRevision/DetailsAndAuthors.js +++ b/packages/component-faraday-ui/src/submissionRevision/DetailsAndAuthors.js @@ -19,8 +19,7 @@ import { ContextualBox } from '../' const Empty = () => <div /> const DetailsAndAuthors = ({ - version, - project, + collection, journal, addAuthor, changeForm, @@ -79,15 +78,15 @@ const DetailsAndAuthors = ({ addAuthor={addAuthor} authors={get(fragment, 'authors', [])} changeForm={changeForm} + collection={collection} deleteAuthor={deleteAuthor} error={authorsError} formName="revision" + fragment={fragment} isAuthorEdit={isAuthorEdit} isAuthorsFetching={isAuthorsFetching} journal={journal} onAuthorEdit={onAuthorEdit} - project={project} - version={version} /> </Root> </ContextualBox> diff --git a/packages/component-faraday-ui/src/submissionRevision/DetailsAndAuthors.md b/packages/component-faraday-ui/src/submissionRevision/DetailsAndAuthors.md index 5f2c9dec36639d1feef56077280374139d1913f2..1ac22499492ee611bb322827d7f5ad34fae164b8 100644 --- a/packages/component-faraday-ui/src/submissionRevision/DetailsAndAuthors.md +++ b/packages/component-faraday-ui/src/submissionRevision/DetailsAndAuthors.md @@ -5,162 +5,163 @@ const { reduxForm, getFormValues, change } = require('redux-form') const Wrapper = compose( withHandlers({ - onAuthorEdit: props => () => console.log('Edit author') + onAuthorEdit: props => () => console.log('Edit author'), }), withProps({ manuscriptTypes: [ - { - label: 'Research', - value: 'research', - author: true, - peerReview: true, - abstractRequired: true, - }, - { - label: 'Review', - value: 'review', - author: true, - peerReview: true, - abstractRequired: true, - }], - fragment: { - "id": "a9dc38fe-5524-4728-b97f-9495a2eb4bee", - "type": "fragment", - "files": { - "coverLetter": [], - "manuscripts": [ - { - "id": "a9dc38fe-5524-4728-b97f-9495a2eb4bee/4a452733-e05d-485a-a0be-7c199c5eb4a1", - "name": "manuscris.pdf", - "size": 39973, - "originalName": "manuscris.pdf" - } - ], - "supplementary": [] - }, - "owners": [ { - "id": "81586d97-d2b4-4423-a1e3-efd228fc67b8", - "username": "mihail.hagiu+re@thinslices.com" + label: 'Research', + value: 'research', + author: true, + peerReview: true, + abstractRequired: true, }, { - "id": "96673581-5916-46c5-8a57-d9e69c3e713d", - "username": "admin" - } - ], - "authors": [ - { - "id": "81586d97-d2b4-4423-a1e3-efd228fc67b8", - "email": "mihail.hagiu+re@thinslices.com", - "country": "AX", - "lastName": "ihail", - "firstName": "M", - "affiliation": "TS", - "isSubmitting": true, - "isCorresponding": true - } - ], - "created": "2018-10-11T08:04:47.636Z", - "version": 1, - "metadata": { - "type": "research", - "title": "czxcxzc", - "journal": "Bioinorganic Chemistry and Applications", - "abstract": "xdzczxc" - }, - "conflicts": { - "hasFunding": "", - "hasConflicts": "no", - "hasDataAvailability": "" - }, - "submitted": 1539606240257, - "collectionId": "e69cddda-74be-47aa-8f99-c388ef5c8a77", - "declarations": { - "agree": true - }, - "fragmentType": "version", - "recommendations": [] - }, - collection: { - "id": "e69cddda-74be-47aa-8f99-c388ef5c8a77", - "type": "collection", - "owners": [ - "96673581-5916-46c5-8a57-d9e69c3e713d", - "81586d97-d2b4-4423-a1e3-efd228fc67b8" - ], - "status": "rejected", - "created": 1539245087543, - "customId": "5074586", - "fragments": [ - "a9dc38fe-5524-4728-b97f-9495a2eb4bee" + label: 'Review', + value: 'review', + author: true, + peerReview: true, + abstractRequired: true, + }, ], - "technicalChecks": {}, - "currentVersion": { - "id": "a9dc38fe-5524-4728-b97f-9495a2eb4bee", - "type": "fragment", - "files": { - "coverLetter": [], - "manuscripts": [ + fragment: { + id: 'a9dc38fe-5524-4728-b97f-9495a2eb4bee', + type: 'fragment', + files: { + coverLetter: [], + manuscripts: [ { - "id": "a9dc38fe-5524-4728-b97f-9495a2eb4bee/4a452733-e05d-485a-a0be-7c199c5eb4a1", - "name": "manuscris.pdf", - "size": 39973, - "originalName": "manuscris.pdf" - } + id: + 'a9dc38fe-5524-4728-b97f-9495a2eb4bee/4a452733-e05d-485a-a0be-7c199c5eb4a1', + name: 'manuscris.pdf', + size: 39973, + originalName: 'manuscris.pdf', + }, ], - "supplementary": [] + supplementary: [], }, - "owners": [ - "81586d97-d2b4-4423-a1e3-efd228fc67b8", - "96673581-5916-46c5-8a57-d9e69c3e713d" + owners: [ + { + id: '81586d97-d2b4-4423-a1e3-efd228fc67b8', + username: 'mihail.hagiu+re@thinslices.com', + }, + { + id: '96673581-5916-46c5-8a57-d9e69c3e713d', + username: 'admin', + }, ], - "authors": [ + authors: [ { - "id": "81586d97-d2b4-4423-a1e3-efd228fc67b8", - "email": "mihail.hagiu+re@thinslices.com", - "country": "AX", - "lastName": "ihail", - "firstName": "M", - "affiliation": "TS", - "isSubmitting": true, - "isCorresponding": true - } + id: '81586d97-d2b4-4423-a1e3-efd228fc67b8', + email: 'mihail.hagiu+re@thinslices.com', + country: 'AX', + lastName: 'ihail', + firstName: 'M', + affiliation: 'TS', + isSubmitting: true, + isCorresponding: true, + }, ], - "created": "2018-10-11T08:04:47.636Z", - "version": 1, - "metadata": { - "type": "research", - "title": "czxcxzc", - "journal": "Bioinorganic Chemistry and Applications", - "abstract": "xdzczxc" + created: '2018-10-11T08:04:47.636Z', + version: 1, + metadata: { + type: 'research', + title: 'czxcxzc', + journal: 'Bioinorganic Chemistry and Applications', + abstract: 'xdzczxc', }, - "conflicts": { - "hasFunding": "", - "hasConflicts": "no", - "hasDataAvailability": "" + conflicts: { + hasFunding: '', + hasConflicts: 'no', + hasDataAvailability: '', }, - "submitted": 1539606240257, - "collectionId": "e69cddda-74be-47aa-8f99-c388ef5c8a77", - "declarations": { - "agree": true + submitted: 1539606240257, + collectionId: 'e69cddda-74be-47aa-8f99-c388ef5c8a77', + declarations: { + agree: true, }, - "fragmentType": "version", - "recommendations": [] + fragmentType: 'version', + recommendations: [], + }, + collection: { + id: 'e69cddda-74be-47aa-8f99-c388ef5c8a77', + type: 'collection', + owners: [ + '96673581-5916-46c5-8a57-d9e69c3e713d', + '81586d97-d2b4-4423-a1e3-efd228fc67b8', + ], + status: 'rejected', + created: 1539245087543, + customId: '5074586', + fragments: ['a9dc38fe-5524-4728-b97f-9495a2eb4bee'], + technicalChecks: {}, + currentVersion: { + id: 'a9dc38fe-5524-4728-b97f-9495a2eb4bee', + type: 'fragment', + files: { + coverLetter: [], + manuscripts: [ + { + id: + 'a9dc38fe-5524-4728-b97f-9495a2eb4bee/4a452733-e05d-485a-a0be-7c199c5eb4a1', + name: 'manuscris.pdf', + size: 39973, + originalName: 'manuscris.pdf', + }, + ], + supplementary: [], + }, + owners: [ + '81586d97-d2b4-4423-a1e3-efd228fc67b8', + '96673581-5916-46c5-8a57-d9e69c3e713d', + ], + authors: [ + { + id: '81586d97-d2b4-4423-a1e3-efd228fc67b8', + email: 'mihail.hagiu+re@thinslices.com', + country: 'AX', + lastName: 'ihail', + firstName: 'M', + affiliation: 'TS', + isSubmitting: true, + isCorresponding: true, + }, + ], + created: '2018-10-11T08:04:47.636Z', + version: 1, + metadata: { + type: 'research', + title: 'czxcxzc', + journal: 'Bioinorganic Chemistry and Applications', + abstract: 'xdzczxc', + }, + conflicts: { + hasFunding: '', + hasConflicts: 'no', + hasDataAvailability: '', + }, + submitted: 1539606240257, + collectionId: 'e69cddda-74be-47aa-8f99-c388ef5c8a77', + declarations: { + agree: true, + }, + fragmentType: 'version', + recommendations: [], + }, + visibleStatus: 'Rejected', }, - "visibleStatus": "Rejected" - } - }), - connect(state => ({ - formValues: getFormValues('styleguide')(state), - }), - { - changeForm: change }), + connect( + state => ({ + formValues: getFormValues('styleguide')(state), + }), + { + changeForm: change, + }, + ), reduxForm({ form: 'styleguide', }), -)(( props ) => ( - <DetailsAndAuthors {...props}/> -)) +)(props => console.log('Padadas', props) || <DetailsAndAuthors {...props} />) ;<Wrapper /> ``` diff --git a/packages/component-faraday-ui/src/submissionRevision/SubmitRevision.js b/packages/component-faraday-ui/src/submissionRevision/SubmitRevision.js index cf663fca04a4fb5357d1ffcb510636e5b3853740..0db22674e197f4d83512a85e662af30ca206b3db 100644 --- a/packages/component-faraday-ui/src/submissionRevision/SubmitRevision.js +++ b/packages/component-faraday-ui/src/submissionRevision/SubmitRevision.js @@ -13,14 +13,18 @@ import { ContextualBox } from '../' const SubmitRevision = ({ journal, fragment, + collection, changeForm, handleSubmit, onAuthorEdit, + addAuthor = () => Promise.resolve(42), }) => ( <ContextualBox label="Submit Revision"> <Root> <DetailsAndAuthors + addAuthor={addAuthor} changeForm={changeForm} + collection={collection} fragment={fragment} manuscriptTypes={journal.manuscriptTypes} onAuthorEdit={onAuthorEdit} diff --git a/packages/component-faraday-ui/src/submissionRevision/SubmitRevision.md b/packages/component-faraday-ui/src/submissionRevision/SubmitRevision.md index 520bffd8fc8016a04b2afd442a90d3a84454a4fc..6c9a0bde8927225e69c55be3fa2ee2cf2f78938c 100644 --- a/packages/component-faraday-ui/src/submissionRevision/SubmitRevision.md +++ b/packages/component-faraday-ui/src/submissionRevision/SubmitRevision.md @@ -1,62 +1,130 @@ ```js const props = { fragment: { - "id": "a9dc38fe-5524-4728-b97f-9495a2eb4bee", - "type": "fragment", - "files": { - "coverLetter": [], - "manuscripts": [ + id: 'a9dc38fe-5524-4728-b97f-9495a2eb4bee', + type: 'fragment', + files: { + coverLetter: [], + manuscripts: [ { - "id": "a9dc38fe-5524-4728-b97f-9495a2eb4bee/4a452733-e05d-485a-a0be-7c199c5eb4a1", - "name": "manuscris.pdf", - "size": 39973, - "originalName": "manuscris.pdf" - } + id: + 'a9dc38fe-5524-4728-b97f-9495a2eb4bee/4a452733-e05d-485a-a0be-7c199c5eb4a1', + name: 'manuscris.pdf', + size: 39973, + originalName: 'manuscris.pdf', + }, ], - "supplementary": [] + supplementary: [], }, - "owners": [ + owners: [ { - "id": "81586d97-d2b4-4423-a1e3-efd228fc67b8", - "username": "mihail.hagiu+re@thinslices.com" + id: '81586d97-d2b4-4423-a1e3-efd228fc67b8', + username: 'mihail.hagiu+re@thinslices.com', }, { - "id": "96673581-5916-46c5-8a57-d9e69c3e713d", - "username": "admin" - } + id: '96673581-5916-46c5-8a57-d9e69c3e713d', + username: 'admin', + }, ], - "authors": [ + authors: [ { - "id": "81586d97-d2b4-4423-a1e3-efd228fc67b8", - "email": "mihail.hagiu+re@thinslices.com", - "country": "AX", - "lastName": "ihail", - "firstName": "M", - "affiliation": "TS", - "isSubmitting": true, - "isCorresponding": true - } + id: '81586d97-d2b4-4423-a1e3-efd228fc67b8', + email: 'mihail.hagiu+re@thinslices.com', + country: 'RO', + lastName: 'ihail', + firstName: 'M', + affiliation: 'TS', + isSubmitting: true, + isCorresponding: true, + }, ], - "created": "2018-10-11T08:04:47.636Z", - "version": 1, - "metadata": { - "type": "research", - "title": "czxcxzc", - "journal": "Bioinorganic Chemistry and Applications", - "abstract": "xdzczxc" + created: '2018-10-11T08:04:47.636Z', + version: 1, + metadata: { + type: 'research', + title: 'czxcxzc', + journal: 'Bioinorganic Chemistry and Applications', + abstract: 'xdzczxc', }, - "conflicts": { - "hasFunding": "", - "hasConflicts": "no", - "hasDataAvailability": "" + conflicts: { + hasFunding: '', + hasConflicts: 'no', + hasDataAvailability: '', }, - "submitted": 1539606240257, - "collectionId": "e69cddda-74be-47aa-8f99-c388ef5c8a77", - "declarations": { - "agree": true + submitted: 1539606240257, + collectionId: 'e69cddda-74be-47aa-8f99-c388ef5c8a77', + declarations: { + agree: true, + }, + fragmentType: 'version', + recommendations: [], + }, + collection: { + id: 'e69cddda-74be-47aa-8f99-c388ef5c8a77', + type: 'collection', + owners: [ + '96673581-5916-46c5-8a57-d9e69c3e713d', + '81586d97-d2b4-4423-a1e3-efd228fc67b8', + ], + status: 'rejected', + created: 1539245087543, + customId: '5074586', + fragments: ['a9dc38fe-5524-4728-b97f-9495a2eb4bee'], + technicalChecks: {}, + currentVersion: { + id: 'a9dc38fe-5524-4728-b97f-9495a2eb4bee', + type: 'fragment', + files: { + coverLetter: [], + manuscripts: [ + { + id: + 'a9dc38fe-5524-4728-b97f-9495a2eb4bee/4a452733-e05d-485a-a0be-7c199c5eb4a1', + name: 'manuscris.pdf', + size: 39973, + originalName: 'manuscris.pdf', + }, + ], + supplementary: [], + }, + owners: [ + '81586d97-d2b4-4423-a1e3-efd228fc67b8', + '96673581-5916-46c5-8a57-d9e69c3e713d', + ], + authors: [ + { + id: '81586d97-d2b4-4423-a1e3-efd228fc67b8', + email: 'mihail.hagiu+re@thinslices.com', + country: 'AX', + lastName: 'ihail', + firstName: 'M', + affiliation: 'TS', + isSubmitting: true, + isCorresponding: true, + }, + ], + created: '2018-10-11T08:04:47.636Z', + version: 1, + metadata: { + type: 'research', + title: 'czxcxzc', + journal: 'Bioinorganic Chemistry and Applications', + abstract: 'xdzczxc', + }, + conflicts: { + hasFunding: '', + hasConflicts: 'no', + hasDataAvailability: '', + }, + submitted: 1539606240257, + collectionId: 'e69cddda-74be-47aa-8f99-c388ef5c8a77', + declarations: { + agree: true, + }, + fragmentType: 'version', + recommendations: [], }, - "fragmentType": "version", - "recommendations": [] + visibleStatus: 'Rejected', }, journal: { manuscriptTypes: [ @@ -81,9 +149,8 @@ const props = { peerReview: false, abstractRequired: false, }, - ] - } -}; - -<SubmitRevision {...props} /> + ], + }, +} +;<SubmitRevision {...props} /> ``` diff --git a/packages/component-wizard/src/components/StepTwo.js b/packages/component-wizard/src/components/StepTwo.js index 659b4fccc156231e9deaf5baf8f9b042069b9005..79401f9696c5dfc71c2e124325dbcee1cde4f614 100644 --- a/packages/component-wizard/src/components/StepTwo.js +++ b/packages/component-wizard/src/components/StepTwo.js @@ -90,14 +90,14 @@ const StepTwo = ({ addAuthor={addAuthor} authors={get(version, 'authors', [])} changeForm={changeForm} + collection={project} deleteAuthor={deleteAuthor} error={authorsError} + fragment={version} isAuthorEdit={isAuthorEdit} isAuthorsFetching={isAuthorsFetching} journal={journal} onAuthorEdit={setAuthorEditIndex} - project={project} - version={version} /> {questions.map(q => (