diff --git a/app/components/component-dashboard/src/components/JournalLink.js b/app/components/component-dashboard/src/components/JournalLink.js index af569d511d6215bfe6eb3d3caed2178f204330e0..0eebff3df893cb5b0309bb629b077db72259c9d6 100644 --- a/app/components/component-dashboard/src/components/JournalLink.js +++ b/app/components/component-dashboard/src/components/JournalLink.js @@ -1,12 +1,9 @@ import React from 'react' import { Link } from '@pubsweet/ui' -const projectUrl = ({ journal, version, page, id }) => { +const projectUrl = ({ version, page, id }) => { const parts = [] - parts.push('journals') - parts.push(typeof journal === 'object' ? journal.id : journal) - if (version) { parts.push('versions') parts.push(typeof version === 'object' ? version.id : version) diff --git a/app/components/component-dashboard/src/components/sections/ReviewerItem.js b/app/components/component-dashboard/src/components/sections/ReviewerItem.js index e3be97f2967bee8245c3601dcae329324365e18e..3e5070037cce015fce261599ab798bddb6667f77 100644 --- a/app/components/component-dashboard/src/components/sections/ReviewerItem.js +++ b/app/components/component-dashboard/src/components/sections/ReviewerItem.js @@ -55,12 +55,7 @@ const ReviewerItem = ({ version, journals, currentUser, reviewerRespond }) => { {(status === 'accepted' || status === 'completed') && ( <Links> <LinkContainer> - <JournalLink - id={version.id} - journal={journals} - page="reviews" - version={version} - > + <JournalLink id={version.id} page="reviews" version={version}> {status === 'completed' ? 'Completed' : 'Do Review'} </JournalLink> </LinkContainer> diff --git a/app/components/component-review/CHANGELOG.md b/app/components/component-review/CHANGELOG.md deleted file mode 100644 index 17abd9aa6245b1bbebebd8bf292cc2312e1c131f..0000000000000000000000000000000000000000 --- a/app/components/component-review/CHANGELOG.md +++ /dev/null @@ -1,626 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [4.1.0](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@4.0.7...pubsweet-component-xpub-review@4.1.0) (2019-11-11) - - -### Features - -* **xpub:** bring back xpub components ([fb69994](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/fb69994098b4e2dbcca75b4786ebb1335af730b9)) - - - - - -## [4.0.7](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@4.0.6...pubsweet-component-xpub-review@4.0.7) (2019-01-16) - - -### Bug Fixes - -* **components:** change back teams model to previous model ([a5eeae0](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/a5eeae0)) -* **components:** fixing components after new manuscript version ([89537ff](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/89537ff)) -* **components:** graphql data model changes ([4b61093](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/4b61093)) -* **formik:** improve formik usage ([24b42ff](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/24b42ff)) -* **graphql:** review components fixes ([8094d9e](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/8094d9e)) -* **manuscript:** wax did not show ([80ae8c6](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/80ae8c6)) -* **merge:** merging to master ([8603808](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/8603808)) -* **test:** problems with eslint and test ([48f7fe2](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/48f7fe2)) -* **xpub-review:** changes tp reviews ([5ae4240](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/5ae4240)) - - - - - -## [4.0.6](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@4.0.5...pubsweet-component-xpub-review@4.0.6) (2019-01-14) - -**Note:** Version bump only for package pubsweet-component-xpub-review - - - - - -## [4.0.5](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@4.0.4...pubsweet-component-xpub-review@4.0.5) (2019-01-13) - -**Note:** Version bump only for package pubsweet-component-xpub-review - - - - - -## [4.0.4](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@4.0.3...pubsweet-component-xpub-review@4.0.4) (2019-01-09) - -**Note:** Version bump only for package pubsweet-component-xpub-review - - - - - -## [4.0.3](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@4.0.2...pubsweet-component-xpub-review@4.0.3) (2018-12-12) - -**Note:** Version bump only for package pubsweet-component-xpub-review - - - - - -## [4.0.2](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@4.0.1...pubsweet-component-xpub-review@4.0.2) (2018-12-04) - -**Note:** Version bump only for package pubsweet-component-xpub-review - - - - - -## [4.0.1](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@4.0.0...pubsweet-component-xpub-review@4.0.1) (2018-11-30) - -**Note:** Version bump only for package pubsweet-component-xpub-review - - - - - -# [4.0.0](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.2.0...pubsweet-component-xpub-review@4.0.0) (2018-11-29) - - -### Features - -* **various:** update styled-components ([5c51466](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/5c51466)) -* **various:** upgrade styled-components ([9b886f6](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/9b886f6)) - - -### BREAKING CHANGES - -* **various:** Replace all styled-components .extend with styled() -* **various:** Replace styled-components injectGlobal with new createGlobalStyle - - - - - -<a name="3.2.0"></a> -# [3.2.0](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.13...pubsweet-component-xpub-review@3.2.0) (2018-11-05) - - -### Features - -* GraphQL Xpub review component ([66b3e73](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/66b3e73)) - - - - -<a name="3.1.13"></a> -## [3.1.13](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.12...pubsweet-component-xpub-review@3.1.13) (2018-10-08) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.1.12"></a> -## [3.1.12](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.11...pubsweet-component-xpub-review@3.1.12) (2018-09-27) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.1.11"></a> -## [3.1.11](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.10...pubsweet-component-xpub-review@3.1.11) (2018-09-19) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.1.10"></a> -## [3.1.10](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.9...pubsweet-component-xpub-review@3.1.10) (2018-09-06) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.1.9"></a> -## [3.1.9](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.8...pubsweet-component-xpub-review@3.1.9) (2018-09-04) - - -### Bug Fixes - -* **editor:** replace wax with wax-prosemirror ([d7b12f4](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d7b12f4)) - - - - -<a name="3.1.8"></a> -## [3.1.8](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.7...pubsweet-component-xpub-review@3.1.8) (2018-08-22) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.1.7"></a> -## [3.1.7](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.6...pubsweet-component-xpub-review@3.1.7) (2018-08-20) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.1.6"></a> -## [3.1.6](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.5...pubsweet-component-xpub-review@3.1.6) (2018-08-17) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.1.5"></a> -## [3.1.5](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.4...pubsweet-component-xpub-review@3.1.5) (2018-08-02) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.1.4"></a> -## [3.1.4](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.3...pubsweet-component-xpub-review@3.1.4) (2018-07-27) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.1.3"></a> -## [3.1.3](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.2...pubsweet-component-xpub-review@3.1.3) (2018-07-23) - - -### Bug Fixes - -* **review:** change attachment files ([bdfa18d](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/bdfa18d)) -* **review:** change user assign editor ([eadca2b](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/eadca2b)) - - - - -<a name="3.1.2"></a> -## [3.1.2](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.1...pubsweet-component-xpub-review@3.1.2) (2018-07-19) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.1.1"></a> -## [3.1.1](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.1.0...pubsweet-component-xpub-review@3.1.1) (2018-07-12) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.1.0"></a> -# [3.1.0](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.0.1...pubsweet-component-xpub-review@3.1.0) (2018-07-09) - - -### Features - -* correct version number ([56b467a](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/56b467a)) -* update dependency versions ([51486f4](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/51486f4)) - - - - -<a name="3.0.1"></a> -## [3.0.1](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@3.0.0...pubsweet-component-xpub-review@3.0.1) (2018-07-03) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="3.0.0"></a> -# [3.0.0](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@2.0.1...pubsweet-component-xpub-review@3.0.0) (2018-07-02) - - -### Features - -* **ui:** introduce more line height variables ([85c24e2](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/85c24e2)) - - -### BREAKING CHANGES - -* **ui:** the existing fontLineHeight variable is gone and replaced by multiple new variables - - - - -<a name="2.0.1"></a> -## [2.0.1](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@2.0.0...pubsweet-component-xpub-review@2.0.1) (2018-06-28) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="2.0.0"></a> -# [2.0.0](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@1.0.1...pubsweet-component-xpub-review@2.0.0) (2018-06-28) - - -### Bug Fixes - -* **monorepo:** fix versions of ui across repo ([72ada07](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/72ada07)) -* **styleguide:** correct require path ([79a2b07](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/79a2b07)) - - -### Code Refactoring - -* **ui:** replace current gridunit variables with one small value ([cf48f29](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/cf48f29)) - - -### BREAKING CHANGES - -* **ui:** Your ui components will now be multiplying a much smaller value so they need to be -adjusted - - - - -<a name="1.0.1"></a> -## [1.0.1](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@1.0.0...pubsweet-component-xpub-review@1.0.1) (2018-06-19) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="1.0.0"></a> -# [1.0.0](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.4.2...pubsweet-component-xpub-review@1.0.0) (2018-06-01) - - -### Features - -* **ui:** start ui-toolkit module ([2083b9c](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/2083b9c)) - - -### BREAKING CHANGES - -* **ui:** th now comes from the toolkit, so all th imports from ui are now broken - - - - -<a name="0.4.2"></a> -## [0.4.2](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.4.1...pubsweet-component-xpub-review@0.4.2) (2018-05-21) - - -### Bug Fixes - -* **components:** use Tabs from pubsweet ui ([8e9fd3c](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/8e9fd3c)) - - - - -<a name="0.4.1"></a> -## [0.4.1](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.4.0...pubsweet-component-xpub-review@0.4.1) (2018-05-18) - - -### Bug Fixes - -* **components:** authors assigning problem ([50baa94](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/50baa94)) - - - - -<a name="0.4.0"></a> -# [0.4.0](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.3.2...pubsweet-component-xpub-review@0.4.0) (2018-05-10) - - -### Bug Fixes - -* **components:** decision linter ([5679ce0](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/5679ce0)) -* **components:** html parse, styled components ([8b24552](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/8b24552)) -* **components:** lint issues ([ff56878](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/ff56878)) -* **components:** redux form ([2f7f1ed](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/2f7f1ed)) -* **components:** review page layout ([4ea2cdd](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/4ea2cdd)) - - -### Features - -* **components:** add tabs to submission ([0e45892](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/0e45892)) - - - - -<a name="0.3.2"></a> -## [0.3.2](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.3.1...pubsweet-component-xpub-review@0.3.2) (2018-05-09) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="0.3.1"></a> -## [0.3.1](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.3.0...pubsweet-component-xpub-review@0.3.1) (2018-05-03) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="0.3.0"></a> -# [0.3.0](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.2.0...pubsweet-component-xpub-review@0.3.0) (2018-05-03) - - -### Bug Fixes - -* **components:** align columns cp page ([a5968b0](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/a5968b0)) -* **components:** align dropdown horizontally ([a7081e3](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/a7081e3)) -* **components:** change position and direction of assign ([7a7eeb3](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/7a7eeb3)) -* **components:** change supplymentary to attachment component ([143c452](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/143c452)) -* **components:** fix lint errors ([be173db](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/be173db)) -* **components:** fix lint errors ([c2b8e52](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/c2b8e52)) -* **components:** fix lint errors ([98046fb](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/98046fb)) -* **components:** fix lint errors ([2503ff9](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/2503ff9)) -* **components:** fix unsued lint error ([20c282c](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/20c282c)) -* **components:** load all users to control panel ([90c88e6](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/90c88e6)) -* **components:** load all users to control panel ([92dac6b](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/92dac6b)) -* **components:** load all users to control panel ([f20e44d](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/f20e44d)) -* **components:** load all users to control panel ([85fa14f](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/85fa14f)) -* **components:** loading data in the decision form ([8f499aa](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/8f499aa)) -* **components:** take care of case of zero files ([b70f728](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/b70f728)) - - -### Features - -* **components:** add assign editors to cp ([3cca44d](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/3cca44d)) -* **components:** add assign editors to cp ([987310d](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/987310d)) - - - - -<a name="0.2.0"></a> -# [0.2.0](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.1.4...pubsweet-component-xpub-review@0.2.0) (2018-04-24) - - -### Bug Fixes - -* **compoenents:** fix cases of empty objects in metadata ([7a5bfbc](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/7a5bfbc)) -* **components:** change placeholder ([d80a41a](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d80a41a)) -* **components:** change text input fields ([775a961](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/775a961)) -* **components:** change value to files at upload components ([aa2b45e](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/aa2b45e)) -* **components:** fix file name problem ([73f33c9](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/73f33c9)) -* **components:** passport through route ([fdf9dce](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/fdf9dce)) -* **components:** passport through route ([593eeda](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/593eeda)) -* **components:** remove tables - add list of metadata ([b9d57cd](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/b9d57cd)) - - -### Features - -* **component:** add make invitation request ([659eb64](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/659eb64)) -* **component:** add make invitation request ([44f1574](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/44f1574)) -* **component:** add make invitation request ([7245d35](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/7245d35)) -* **component:** add make invitation request ([bda7d95](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/bda7d95)) -* **component:** add make invitation request ([b049aa3](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/b049aa3)) -* **component:** add make invitation request ([36faf21](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/36faf21)) -* **component:** add make invitation request ([5a9b393](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/5a9b393)) -* **component:** add make invitation request ([ff3f8fb](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/ff3f8fb)) -* **component:** add make invitation request ([335d0f0](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/335d0f0)) -* **component:** add make invitation request ([d070bb1](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d070bb1)) -* **component:** add make invitation request ([f9cae33](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/f9cae33)) -* **component:** add make invitation request ([947c846](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/947c846)) -* **component:** add make invitation request ([38e5728](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/38e5728)) -* **component:** add make invitation request ([430e9e2](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/430e9e2)) -* **component:** add make invitation request ([30193b3](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/30193b3)) -* **component:** add make invitation request ([721bbaf](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/721bbaf)) -* **component:** add make invitation request ([c4317bb](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/c4317bb)) -* **component:** add make invitation request ([ae785b9](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/ae785b9)) -* **component:** add make invitation request ([9d0ad57](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/9d0ad57)) -* **component:** add make invitation request ([1412d87](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/1412d87)) -* **component:** add make invitation request ([1911bab](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/1911bab)) -* **component:** add make invitation request ([6f27a3e](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/6f27a3e)) -* **component:** add make invitation request ([3817c8a](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/3817c8a)) -* **component:** add make invitation request ([61a1f0b](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/61a1f0b)) -* **component:** add make invitation request ([4820e45](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/4820e45)) -* **component:** add make invitation request ([27e2984](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/27e2984)) -* **component:** add make invitation request ([9e00e11](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/9e00e11)) -* **component:** add make invitation request ([3d13943](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/3d13943)) -* **component:** add make invitation request ([9d731d3](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/9d731d3)) -* **component:** add make invitation request ([251381c](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/251381c)) -* **component:** add make invitation request ([dcd1f46](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/dcd1f46)) -* **component:** add make invitation request ([20628a4](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/20628a4)) -* **components:** add API endpoint invitation ([4739b84](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/4739b84)) -* **components:** add API endpoint invitation ([9276ef9](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/9276ef9)) -* **components:** add API endpoint invitation ([24810b8](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/24810b8)) -* **components:** add API endpoint invitation ([16bf6a1](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/16bf6a1)) -* **components:** add API endpoint invitation ([d19bf84](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d19bf84)) -* **components:** add API endpoint invitation ([ee82d6b](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/ee82d6b)) -* **components:** add API endpoint invitation ([17d9532](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/17d9532)) -* **components:** add API endpoint invitation ([009b693](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/009b693)) -* **components:** add API endpoint invitation ([e50383f](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/e50383f)) -* **components:** add API endpoint invitation ([19932d7](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/19932d7)) -* **components:** add API endpoint invitation ([fc40c17](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/fc40c17)) -* **components:** add API endpoint invitation ([3c5cbea](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/3c5cbea)) -* **components:** add API endpoint invitation ([d21afe6](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d21afe6)) -* **components:** add API endpoint invitation ([d06ae4b](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d06ae4b)) -* **components:** add API endpoint invitation ([2703f3e](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/2703f3e)) -* **components:** add API endpoint invitation ([d6bb84a](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d6bb84a)) -* **components:** add API endpoint invitation ([24ee6ca](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/24ee6ca)) -* **components:** add API endpoint invitation ([f963b76](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/f963b76)) -* **components:** add API endpoint invitation ([48e8e12](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/48e8e12)) -* **components:** add API endpoint invitation ([ae7d9aa](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/ae7d9aa)) -* **components:** add API endpoint invitation ([c6d0d94](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/c6d0d94)) -* **components:** add API endpoint invitation ([db805c4](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/db805c4)) -* **components:** add API endpoint invitation ([d897187](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d897187)) -* **components:** add API endpoint invitation ([daff65a](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/daff65a)) -* **components:** add API endpoint invitation ([9e9b4ce](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/9e9b4ce)) -* **components:** add API endpoint invitation ([0ca4cfa](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/0ca4cfa)) -* **components:** add API endpoint invitation ([8de6954](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/8de6954)) -* **components:** add API endpoint invitation ([abdf121](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/abdf121)) -* **components:** add API endpoint invitation ([a781136](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/a781136)) -* **components:** add API endpoint invitation ([10fb6e2](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/10fb6e2)) -* **components:** add API endpoint invitation ([3fcc322](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/3fcc322)) -* **components:** add API endpoint invitation ([98d568e](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/98d568e)) -* **components:** create invite reviewer endpoints ([fc6cad4](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/fc6cad4)) -* **components:** fix correct update of reviewer ([6a423e4](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/6a423e4)) -* **components:** fix correct update of reviewer ([4a26556](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/4a26556)) -* **components:** fix correct update of reviewer ([4c9a7d9](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/4c9a7d9)) -* **components:** fix correct update of reviewer ([5988b36](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/5988b36)) -* **components:** fix correct update of reviewer ([b937db4](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/b937db4)) -* **components:** fix correct update of reviewer ([48a70a8](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/48a70a8)) -* **components:** fix correct update of reviewer ([b22a250](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/b22a250)) -* **components:** fix correct update of reviewer ([c030cce](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/c030cce)) -* **components:** fix correct update of reviewer ([b4ac0ec](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/b4ac0ec)) -* **components:** fix correct update of reviewer ([d7553ef](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d7553ef)) -* **components:** fix correct update of reviewer ([a30f25e](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/a30f25e)) -* **components:** fix correct update of reviewer ([c1b734e](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/c1b734e)) -* **components:** fix correct update of reviewer ([ec31850](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/ec31850)) -* **components:** fix correct update of reviewer ([fe67780](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/fe67780)) -* **components:** fix correct update of reviewer ([acd3a2d](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/acd3a2d)) -* **components:** fix correct update of reviewer ([dcd2f94](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/dcd2f94)) -* **components:** fix correct update of reviewer ([ee775be](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/ee775be)) -* **components:** fix correct update of reviewer ([bc8ef13](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/bc8ef13)) -* **components:** fix correct update of reviewer ([45b7375](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/45b7375)) -* **components:** fix correct update of reviewer ([1b449ab](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/1b449ab)) -* **components:** fix correct update of reviewer ([be3ce7b](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/be3ce7b)) -* **components:** fix correct update of reviewer ([b700d30](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/b700d30)) -* **components:** fix correct update of reviewer ([30559e0](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/30559e0)) -* **components:** fix correct update of reviewer ([358a8f6](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/358a8f6)) -* **components:** fix correct update of reviewer ([3d2d412](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/3d2d412)) -* **components:** fix correct update of reviewer ([d5de1d0](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d5de1d0)) -* **components:** fix correct update of reviewer ([fb692e9](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/fb692e9)) -* **components:** fix correct update of reviewer ([11c44ae](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/11c44ae)) -* **components:** fix correct update of reviewer ([46fdc54](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/46fdc54)) -* **components:** fix correct update of reviewer ([b42550f](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/b42550f)) -* **components:** fix correct update of reviewer ([2476402](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/2476402)) -* **components:** fix correct update of reviewer ([895bc73](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/895bc73)) -* **components:** invitation email ([da5d78d](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/da5d78d)) -* **components:** invitation email ([b479847](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/b479847)) -* **components:** invitation email ([f6d93cf](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/f6d93cf)) -* **components:** invitation email ([6ee4a13](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/6ee4a13)) -* **components:** invitation email ([2c3e61d](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/2c3e61d)) -* **components:** invitation email ([b27816d](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/b27816d)) -* **components:** invitation email ([af6f384](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/af6f384)) -* **components:** invitation email ([1ca6d60](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/1ca6d60)) -* **components:** invitation email ([e55a10a](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/e55a10a)) -* **components:** invitation email ([de5f871](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/de5f871)) -* **components:** invitation email ([087d151](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/087d151)) -* **components:** invitation email ([43a53a9](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/43a53a9)) -* **components:** invitation email ([74720ee](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/74720ee)) -* **components:** invitation email ([f252b17](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/f252b17)) -* **components:** invitation email ([ae51c4c](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/ae51c4c)) -* **components:** invitation email ([1e4bc4f](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/1e4bc4f)) -* **components:** invitation email ([f557112](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/f557112)) -* **components:** invitation email ([34d3054](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/34d3054)) -* **components:** invitation email ([d0d30af](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/d0d30af)) -* **components:** invitation email ([77a0ae4](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/77a0ae4)) -* **components:** invitation email ([75d3ac1](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/75d3ac1)) -* **components:** invitation email ([3aab5d1](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/3aab5d1)) -* **components:** invitation email ([f8bea7f](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/f8bea7f)) -* **components:** invitation email ([c2ef155](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/c2ef155)) -* **components:** invitation email ([fbac60d](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/fbac60d)) -* **components:** invitation email ([8afcd9c](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/8afcd9c)) -* **components:** invitation email ([860f233](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/860f233)) -* **components:** invitation email ([5d4d10e](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/5d4d10e)) -* **components:** invitation email ([b8c9d1d](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/b8c9d1d)) -* **components:** invitation email ([3d6b89b](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/3d6b89b)) -* **components:** invitation email ([0da74f6](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/0da74f6)) -* **components:** invitation email ([c2ebb60](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/c2ebb60)) - - - - -<a name="0.1.4"></a> -## [0.1.4](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.1.3...pubsweet-component-xpub-review@0.1.4) (2018-04-11) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="0.1.3"></a> -## [0.1.3](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.1.2...pubsweet-component-xpub-review@0.1.3) (2018-04-03) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="0.1.2"></a> -## [0.1.2](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.1.1...pubsweet-component-xpub-review@0.1.2) (2018-03-30) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="0.1.1"></a> -## [0.1.1](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.1.0...pubsweet-component-xpub-review@0.1.1) (2018-03-28) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="0.1.0"></a> -# [0.1.0](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.0.5...pubsweet-component-xpub-review@0.1.0) (2018-03-27) - - -### Bug Fixes - -* **components:** use version.id as key ([0ca2f56](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/0ca2f56)) - - -### Features - -* **components:** add Link from review page back to control panel ([860b737](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/860b737)) -* **styleguide:** page per section ([0bf0836](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/0bf0836)) - - - - -<a name="0.0.5"></a> -## [0.0.5](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.0.4...pubsweet-component-xpub-review@0.0.5) (2018-03-19) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="0.0.4"></a> -## [0.0.4](https://gitlab.coko.foundation/pubsweet/pubsweet/compare/pubsweet-component-xpub-review@0.0.3...pubsweet-component-xpub-review@0.0.4) (2018-03-15) - - - - -**Note:** Version bump only for package pubsweet-component-xpub-review - -<a name="0.0.3"></a> - -## 0.0.3 (2018-03-09) - -### Bug Fixes - -* **xpub:** dubiously ignore linting errors ([a60d0ad](https://gitlab.coko.foundation/pubsweet/pubsweet/commit/a60d0ad)) diff --git a/app/components/component-review/README.md b/app/components/component-review/README.md deleted file mode 100644 index 816d2d31210b61c9d5113bc99ca19448ffec8abe..0000000000000000000000000000000000000000 --- a/app/components/component-review/README.md +++ /dev/null @@ -1,6 +0,0 @@ -## pubsweet-component-xpub-review - -A PubSweet component that provides interfaces for editors to invite reviewers, reviewers to submit their reviews, and editors to make their decisions. - -_Note: -Some of the container components for these pages are a bit complex, as they need to also connect child components that are nested deeper in the tree and pass them down as props - there may be a better solution to this._ diff --git a/app/components/component-review/src/components/ReviewPage.js b/app/components/component-review/src/components/ReviewPage.js index c70db575ee922dd872d3ab77b2716163cf0fb48c..5689389a36cf9d78af60768009ff7edf4fdf818b 100644 --- a/app/components/component-review/src/components/ReviewPage.js +++ b/app/components/component-review/src/components/ReviewPage.js @@ -1,11 +1,14 @@ -import { compose, withProps } from 'recompose' -import { graphql } from '@apollo/react-hoc' +import React from 'react' +// import { compose, withProps } from 'recompose' +import { useMutation, useQuery } from '@apollo/react-hooks' import gql from 'graphql-tag' -import { withFormik } from 'formik' -import { withLoader } from 'pubsweet-client' +import { Formik } from 'formik' +// import { withLoader } from 'pubsweet-client' import { cloneDeep } from 'lodash' import { getCommentContent } from './review/util' import ReviewLayout from '../components/review/ReviewLayout' +import { Spinner } from '../../../shared' +import useCurrentUser from '../../../../hooks/useCurrentUser' const reviewFields = ` id @@ -109,6 +112,7 @@ const fragmentFields = ` } keywords } + submission suggestions { reviewers { opposed @@ -134,11 +138,16 @@ const query = gql` manuscriptVersions { ${fragmentFields} } + channels { + id + type + topic + } } } ` -const updateTeam = gql` +const updateTeamMutation = gql` mutation($id: ID!, $input: TeamInput) { updateTeam(id: $id, input: $input) { ${teamFields} @@ -146,7 +155,7 @@ const updateTeam = gql` } ` -const updateReviewMutation = gql` +const updateReviewMutationQuery = gql` mutation($id: ID, $input: ReviewInput) { updateReview(id: $id, input: $input) { ${reviewFields} @@ -177,172 +186,354 @@ const createFileMutation = gql` } ` -export default compose( - graphql(query, { - options: ({ match }) => ({ +export default ({ match, ...props }) => { + const currentUser = useCurrentUser() + const [updateReviewMutation] = useMutation(updateReviewMutationQuery) + + // File upload + const [uploadReviewFiles] = useMutation(uploadReviewFilesMutation) + + const [updateTeam] = useMutation(updateTeamMutation) + + const [createFileM] = useMutation(createFileMutation) + const createFile = file => + createFileM({ variables: { - id: match.params.version, + file, }, - }), - }), - graphql(uploadReviewFilesMutation, { name: 'uploadReviewFilesMutation' }), - graphql(updateReviewMutation, { name: 'updateReviewMutation' }), - graphql(updateTeam, { name: 'updateTeam' }), - graphql(createFileMutation, { - props: ({ mutate, ownProps: { match } }) => ({ - createFile: file => { - mutate({ + update: (proxy, { data: { createFile } }) => { + const data = proxy.readQuery({ + query, variables: { - file, + id: match.params.version, }, - update: (proxy, { data: { createFile } }) => { - const data = proxy.readQuery({ - query, - variables: { - id: match.params.version, - }, - }) + }) - data.manuscript.reviews.map(review => { - if (review.id === file.objectId) { - review.comments.map(comment => { - if (comment.type === createFile.fileType) { - comment.files = [createFile] - } - return comment - }) + data.manuscript.reviews.map(review => { + if (review.id === file.objectId) { + review.comments.map(comment => { + if (comment.type === createFile.fileType) { + comment.files = [createFile] } - return review + return comment }) - - proxy.writeQuery({ query, data }) - }, + } + return review }) + + proxy.writeQuery({ query, data }) }, - }), - }), - withLoader(), - withProps( - ({ - manuscript, - currentUser, - match: { - params: { journal }, - }, - updateReviewMutation, - uploadReviewFilesMutation, - updateTeam, - createFile, - }) => ({ - journal: { id: journal }, - review: - manuscript.reviews.find( - review => review.user.id === currentUser.id && !review.isDecision, - ) || {}, - status: ( - ( - (manuscript.teams.find(team => team.role === 'reviewerEditor') || {}) - .status || [] - ).find(status => status.user === currentUser.id) || {} - ).status, - updateReview: (review, file) => { - ;(review.comments || []).map(comment => { - delete comment.files - delete comment.__typename - return comment - }) + }) - const reviewData = { - recommendation: review.recommendation, - comments: review.comments, - manuscriptId: manuscript.id, - } + const { loading, error, data } = useQuery(query, { + variables: { + id: match.params.version, + }, + }) - return updateReviewMutation({ - variables: { - id: review.id || undefined, - input: reviewData, - }, - update: (proxy, { data: { updateReview } }) => { - const data = JSON.parse( - JSON.stringify( - proxy.readQuery({ - query, - variables: { - id: manuscript.id, - }, - }), - ), - ) - let reviewIndex = data.manuscript.reviews.findIndex( - review => review.id === updateReview.id, - ) - reviewIndex = reviewIndex < 0 ? 0 : reviewIndex - data.manuscript.reviews[reviewIndex] = updateReview - proxy.writeQuery({ query, data }) - }, - }) + if (loading) return <Spinner /> + if (error) return `Error! ${error.message}` + + const manuscript = data.manuscript + const channelId = manuscript.channels.find(c => c.type === 'editorial').id + + const review = + (manuscript.reviews && + manuscript.reviews.find( + review => review.user.id === currentUser.id && !review.isDecision, + )) || + {} + + const status = ( + ( + (manuscript.teams.find(team => team.role === 'reviewerEditor') || {}) + .status || [] + ).find(status => status.user === currentUser.id) || {} + ).status + + const updateReview = (review, file) => { + ;(review.comments || []).map(comment => { + delete comment.files + delete comment.__typename + return comment + }) + + const reviewData = { + recommendation: review.recommendation, + comments: review.comments, + manuscriptId: manuscript.id, + } + + return updateReviewMutation({ + variables: { + id: review.id || undefined, + input: reviewData, }, - uploadFile: (file, updateReview, type) => - uploadReviewFilesMutation({ - variables: { - file, - }, - }).then(({ data }) => { - const newFile = { - url: data.upload.url, - filename: file.name, - mimeType: file.type, - size: file.size, - object: 'Review', - objectId: updateReview.id, - fileType: type, - } - createFile(newFile) - }), - completeReview: history => { - const team = cloneDeep(manuscript.teams).find( - team => team.role === 'reviewerEditor', + update: (proxy, { data: { updateReview } }) => { + const data = JSON.parse( + JSON.stringify( + proxy.readQuery({ + query, + variables: { + id: manuscript.id, + }, + }), + ), ) - team.members = team.members.map(m => { - if (m.user.id === currentUser.id) { - return { user: { id: m.user.id }, status: 'completed' } - } - return { user: { id: m.user.id }, status: m.status } - }) + let reviewIndex = data.manuscript.reviews.findIndex( + review => review.id === updateReview.id, + ) + reviewIndex = reviewIndex < 0 ? 0 : reviewIndex + data.manuscript.reviews[reviewIndex] = updateReview + proxy.writeQuery({ query, data }) + }, + }) + } - updateTeam({ - variables: { - id: team.id, - input: { - members: team.members, - }, - }, - }).then(() => { - history.push('/dashboard') - }) + const uploadFile = (file, updateReview, type) => + uploadReviewFilesMutation({ + variables: { + file, }, - }), - ), - withFormik({ - mapPropsToValues: props => - props.manuscript.reviews.find( - review => review.user.id === props.currentUser.id && !review.isDecision, - ) || { - id: null, - comments: [], - recommendation: null, + }).then(({ data }) => { + const newFile = { + url: data.upload.url, + filename: file.name, + mimeType: file.type, + size: file.size, + object: 'Review', + objectId: updateReview.id, + fileType: type, + } + createFile(newFile) + }) + + const completeReview = history => { + const team = cloneDeep(manuscript.teams).find( + team => team.role === 'reviewerEditor', + ) + team.members = team.members.map(m => { + if (m.user.id === currentUser.id) { + return { user: { id: m.user.id }, status: 'completed' } + } + return { user: { id: m.user.id }, status: m.status } + }) + + updateTeam({ + variables: { + id: team.id, + input: { + members: team.members, + }, }, - isInitialValid: ({ review }) => { - if (!review.id) return false - const hasRecommendation = review.recommendation !== null - const comment = getCommentContent(review, 'note') - const isCommented = comment !== null && comment !== '' + }).then(() => { + history.push('/dashboard') + }) + } - return isCommented && hasRecommendation - }, - displayName: 'review', - handleSubmit: (props, { props: { completeReview, history } }) => - completeReview(history), - }), -)(ReviewLayout) + return ( + <Formik + handleSubmit={(props, { props: { completeReview, history } }) => + completeReview(history) + } + // isInitialValid: ({ review }) => { + // if (!review.id) return false + // const hasRecommendation = review.recommendation !== null + // const comment = getCommentContent(review, 'note') + // const isCommented = comment !== null && comment !== '' + + // return isCommented && hasRecommendation + // }, + initialValues={ + (manuscript.reviews && + manuscript.reviews.find( + review => review.user.id === currentUser.id && !review.isDecision, + )) || { + id: null, + comments: [], + recommendation: null, + } + } + > + <ReviewLayout + currentUser={currentUser} + manuscript={manuscript} + review={review} + status={status} + updateReview={updateReview} + uploadFile={uploadFile} + channelId={channelId} + /> + </Formik> + ) +} + +// export default compose( +// graphql(query, { +// options: ({ match }) => ({ +// variables: { +// id: match.params.version, +// }, +// }), +// }), +// graphql(uploadReviewFilesMutation, { name: 'uploadReviewFilesMutation' }), +// graphql(updateReviewMutation, { name: 'updateReviewMutation' }), +// graphql(updateTeam, { name: 'updateTeam' }), +// graphql(createFileMutation, { +// props: ({ mutate, ownProps: { match } }) => ({ +// createFile: file => { +// mutate({ +// variables: { +// file, +// }, +// update: (proxy, { data: { createFile } }) => { +// const data = proxy.readQuery({ +// query, +// variables: { +// id: match.params.version, +// }, +// }) + +// data.manuscript.reviews.map(review => { +// if (review.id === file.objectId) { +// review.comments.map(comment => { +// if (comment.type === createFile.fileType) { +// comment.files = [createFile] +// } +// return comment +// }) +// } +// return review +// }) + +// proxy.writeQuery({ query, data }) +// }, +// }) +// }, +// }), +// }), +// withLoader(), +// withProps( +// ({ +// manuscript, +// currentUser, +// match: { +// params: { journal }, +// }, +// updateReviewMutation, +// uploadReviewFilesMutation, +// updateTeam, +// createFile, +// }) => ({ +// journal: { id: journal }, +// review: +// manuscript.reviews.find( +// review => review.user.id === currentUser.id && !review.isDecision, +// ) || {}, +// status: ( +// ( +// (manuscript.teams.find(team => team.role === 'reviewerEditor') || {}) +// .status || [] +// ).find(status => status.user === currentUser.id) || {} +// ).status, +// updateReview: (review, file) => { +// ;(review.comments || []).map(comment => { +// delete comment.files +// delete comment.__typename +// return comment +// }) + +// const reviewData = { +// recommendation: review.recommendation, +// comments: review.comments, +// manuscriptId: manuscript.id, +// } + +// return updateReviewMutation({ +// variables: { +// id: review.id || undefined, +// input: reviewData, +// }, +// update: (proxy, { data: { updateReview } }) => { +// const data = JSON.parse( +// JSON.stringify( +// proxy.readQuery({ +// query, +// variables: { +// id: manuscript.id, +// }, +// }), +// ), +// ) +// let reviewIndex = data.manuscript.reviews.findIndex( +// review => review.id === updateReview.id, +// ) +// reviewIndex = reviewIndex < 0 ? 0 : reviewIndex +// data.manuscript.reviews[reviewIndex] = updateReview +// proxy.writeQuery({ query, data }) +// }, +// }) +// }, +// uploadFile: (file, updateReview, type) => +// uploadReviewFilesMutation({ +// variables: { +// file, +// }, +// }).then(({ data }) => { +// const newFile = { +// url: data.upload.url, +// filename: file.name, +// mimeType: file.type, +// size: file.size, +// object: 'Review', +// objectId: updateReview.id, +// fileType: type, +// } +// createFile(newFile) +// }), +// completeReview: history => { +// const team = cloneDeep(manuscript.teams).find( +// team => team.role === 'reviewerEditor', +// ) +// team.members = team.members.map(m => { +// if (m.user.id === currentUser.id) { +// return { user: { id: m.user.id }, status: 'completed' } +// } +// return { user: { id: m.user.id }, status: m.status } +// }) + +// updateTeam({ +// variables: { +// id: team.id, +// input: { +// members: team.members, +// }, +// }, +// }).then(() => { +// history.push('/dashboard') +// }) +// }, +// }), +// ), +// withFormik({ +// mapPropsToValues: props => +// props.manuscript.reviews.find( +// review => review.user.id === props.currentUser.id && !review.isDecision, +// ) || { +// id: null, +// comments: [], +// recommendation: null, +// }, +// isInitialValid: ({ review }) => { +// if (!review.id) return false +// const hasRecommendation = review.recommendation !== null +// const comment = getCommentContent(review, 'note') +// const isCommented = comment !== null && comment !== '' + +// return isCommented && hasRecommendation +// }, +// displayName: 'review', +// handleSubmit: (props, { props: { completeReview, history } }) => +// completeReview(history), +// }), +// )(ReviewLayout) diff --git a/app/components/component-review/src/components/decision/DecisionLayout.md b/app/components/component-review/src/components/decision/DecisionLayout.md deleted file mode 100644 index 1fdf0824955bfd45f8b1216a25c6db5f85053af6..0000000000000000000000000000000000000000 --- a/app/components/component-review/src/components/decision/DecisionLayout.md +++ /dev/null @@ -1,114 +0,0 @@ -A page for an editor to make a decision on a version of a project. - -```js -const { withFormik } = require('formik') -const { JournalProvider } = require('xpub-journal') -const AssignEditor = require('../assignEditors/AssignEditor').default - -const journal = { - id: faker.random.uuid(), -} - -const manuscriptTemplate = () => ({ - id: faker.random.uuid(), - teams: [ - { - id: faker.random.uuid(), - role: 'author', - name: 'Authors', - object: { - id: faker.random.uuid(), - __typename: 'Manuscript', - }, - objectType: 'manuscript', - members: [ - { - user: {}, - }, - ], - }, - ], - meta: { - title: faker.lorem.sentence(25), - abstract: faker.lorem.sentence(100), - articleType: 'original-research', - declarations: { - openData: 'yes', - openPeerReview: 'no', - preregistered: 'yes', - previouslySubmitted: 'yes', - researchNexus: 'no', - streamlinedReview: 'no', - }, - }, - decision: { - id: faker.random.uuid(), - comments: [{ type: 'note', content: 'this needs review' }], - created: 'Thu Oct 11 2018', - open: false, - status: '<p>This is a decision</p>', - user: { identities: [] }, - }, - reviews: [ - { - comments: { content: 'this needs review' }, - created: 'Thu Oct 11 2018', - open: false, - recommendation: '', - user: { identities: [] }, - }, - ], -}) - -const manuscript = Object.assign({}, manuscriptTemplate(), { - manuscriptVersions: [manuscriptTemplate()], -}) - -const team = { - members: [], -} - -const options = [ - { - value: faker.random.uuid(), - label: faker.internet.userName(), - }, - { - value: faker.random.uuid(), - label: faker.internet.userName(), - }, - { - value: faker.random.uuid(), - label: faker.internet.userName(), - }, -] - -const AssignEditorContainer = ({ - project, - teamName, - teamTypeName, - addUserToTeam, -}) => ( - <AssignEditor - team={team} - options={options} - manuscript={manuscript} - teamName={teamName} - teamTypeName={teamTypeName} - addUserToTeam={addUserToTeam} - /> -) - -const ConnectedDecisionLayout = withFormik({ - initialValues: {}, - mapPropsToValues: ({ manuscript }) => manuscript, - displayName: 'decision', - handleSubmit: (props, { props: { onSubmit, history } }) => - onSubmit(props, { history }), -})(DecisionLayout) -;<div style={{ position: 'relative', height: 600 }}> - <JournalProvider journal={journal}> - <ConnectedDecisionLayout manuscript={manuscript} uploadFile={() => {}} /> - </JournalProvider> -</div> -``` diff --git a/app/components/component-review/src/components/review/Review.md b/app/components/component-review/src/components/review/Review.md deleted file mode 100644 index c1b178e534ab57206ce5c33c907c123df384be37..0000000000000000000000000000000000000000 --- a/app/components/component-review/src/components/review/Review.md +++ /dev/null @@ -1,12 +0,0 @@ -A review of a version of a project. - -```js -const review = { - comments: [{ content: 'this needs review' }], - created: 'Thu Oct 11 2018', - open: false, - recommendation: 'revise', - user: { id: 1 }, -} -;<Review review={review} /> -``` diff --git a/app/components/component-review/src/components/review/ReviewForm.md b/app/components/component-review/src/components/review/ReviewForm.md deleted file mode 100644 index 9650dc63eec6549bd0e3e790761aa9479126914f..0000000000000000000000000000000000000000 --- a/app/components/component-review/src/components/review/ReviewForm.md +++ /dev/null @@ -1,92 +0,0 @@ -A form for entering a review of a version of a project. - -```js -const { withFormik } = require('formik') - -const journal = { - id: faker.random.uuid(), -} - -const manuscriptTemplate = () => ({ - id: faker.random.uuid(), - teams: [ - { - id: faker.random.uuid(), - role: 'reviewerEditor', - name: 'reviewer', - object: { - id: faker.random.uuid(), - __typename: 'Manuscript', - }, - objectType: 'manuscript', - members: [ - { - user: { id: 1 }, - }, - ], - }, - ], - meta: { - title: faker.lorem.sentence(25), - abstract: faker.lorem.sentence(100), - articleType: 'original-research', - declarations: { - openData: 'yes', - openPeerReview: 'no', - preregistered: 'yes', - previouslySubmitted: 'yes', - researchNexus: 'no', - streamlinedReview: 'no', - }, - }, - decision: { - id: faker.random.uuid(), - comments: [{ type: 'note', content: 'this needs review' }], - created: 'Thu Oct 11 2018', - open: false, - status: '<p>This is a decision</p>', - user: { id: 1 }, - }, - reviews: [ - { - comments: [{ content: 'this needs review' }], - created: 'Thu Oct 11 2018', - open: false, - recommendation: '', - user: { id: 1 }, - }, - ], -}) - -const manuscript = Object.assign({}, manuscriptTemplate(), { - manuscriptVersions: [manuscriptTemplate()], -}) - -const review = { - comments: [{ content: 'this needs review' }], - created: 'Thu Oct 11 2018', - open: false, - recommendation: '', - user: { id: 1 }, -} - -const currentUser = { - id: 1, -} - -const ConnectedReviewForm = withFormik({ - initialValues: {}, - mapPropsToValues: ({ manuscript, currentUser }) => - manuscript.reviews.find(review => review.user.id === currentUser.id), - displayName: 'review', - handleSubmit: (props, { props: { onSubmit, history } }) => - onSubmit(props, { history }), -})(ReviewForm) -;<JournalProvider journal={journal}> - <ConnectedReviewForm - manuscript={manuscript} - currentUser={currentUser} - uploadFile={() => new XMLHttpRequest()} - /> -</JournalProvider> -``` diff --git a/app/components/component-review/src/components/review/ReviewLayout.js b/app/components/component-review/src/components/review/ReviewLayout.js index af44325b13295a81394b75f7de9bc4012bbc067a..df4b3d968bfdab9009f0bd07c3e9580e6034c8ba 100644 --- a/app/components/component-review/src/components/review/ReviewLayout.js +++ b/app/components/component-review/src/components/review/ReviewLayout.js @@ -7,7 +7,8 @@ import ReviewForm from './ReviewForm' import ReviewMetadata from '../metadata/ReviewMetadata' import Review from './Review' import EditorSection from '../decision/EditorSection' -import { Columns, Manuscript, AdminSection } from '../style' +import { Columns, Manuscript, Chat } from '../style' +import MessageContainer from '../../../../component-chat/src' const addEditor = (manuscript, label) => ({ content: <EditorSection manuscript={manuscript} />, @@ -25,6 +26,7 @@ const ReviewLayout = ({ status, updateReview, uploadFile, + channelId, }) => { const reviewSections = [] const editorSections = [] @@ -37,10 +39,14 @@ const ReviewLayout = ({ <div> <ReviewMetadata manuscript={manuscript} /> <Review - review={manuscript.reviews.find( - review => - (review.user.id === currentUser.id && !review.isDecision) || {}, - )} + review={ + manuscript.reviews && + manuscript.reviews.find( + review => + (review.user.id === currentUser.id && !review.isDecision) || + {}, + ) + } /> </div> ), @@ -79,20 +85,23 @@ const ReviewLayout = ({ return ( <Columns> <Manuscript> + {/* <Manuscript> <Tabs activeKey={editorSections[editorSections.length - 1].key} sections={editorSections} title="Versions" /> - </Manuscript> + </Manuscript> */} - <AdminSection> <Tabs activeKey={reviewSections[reviewSections.length - 1].key} sections={reviewSections} title="Versions" /> - </AdminSection> + </Manuscript> + <Chat> + <MessageContainer channelId={channelId} /> + </Chat> </Columns> ) } diff --git a/app/components/component-review/src/components/review/ReviewLayout.md b/app/components/component-review/src/components/review/ReviewLayout.md deleted file mode 100644 index 2ff154f99436bf6077e326c3c14c61b12c5a64aa..0000000000000000000000000000000000000000 --- a/app/components/component-review/src/components/review/ReviewLayout.md +++ /dev/null @@ -1,94 +0,0 @@ -A page for a reviewer to submit a review of a version of a project. - -```js -const { withFormik } = require('formik') - -const journal = { - id: faker.random.uuid(), -} - -const manuscriptTemplate = () => ({ - id: faker.random.uuid(), - teams: [ - { - id: faker.random.uuid(), - role: 'reviewerEditor', - name: 'reviewer', - object: { - id: faker.random.uuid(), - __typename: 'Manuscript', - }, - objectType: 'manuscript', - members: [ - { - user: { id: 1 }, - }, - ], - }, - ], - meta: { - title: faker.lorem.sentence(25), - abstract: faker.lorem.sentence(100), - articleType: 'original-research', - declarations: { - openData: 'yes', - openPeerReview: 'no', - preregistered: 'yes', - previouslySubmitted: 'yes', - researchNexus: 'no', - streamlinedReview: 'no', - }, - }, - decision: { - id: faker.random.uuid(), - comments: [{ type: 'note', content: 'this needs review' }], - created: 'Thu Oct 11 2018', - open: false, - status: '<p>This is a decision</p>', - user: { id: 1 }, - }, - reviews: [ - { - comments: [{ content: 'this needs review' }], - created: 'Thu Oct 11 2018', - open: false, - recommendation: '', - user: { id: 1 }, - }, - ], -}) - -const manuscript = Object.assign({}, manuscriptTemplate(), { - manuscriptVersions: [manuscriptTemplate()], -}) - -const review = { - comments: [{ content: 'this needs review' }], - created: 'Thu Oct 11 2018', - open: false, - recommendation: '', - user: { id: 1 }, -} - -const currentUser = { - id: 1, -} - -const ConnectedReviewLayout = withFormik({ - initialValues: {}, - mapPropsToValues: ({ manuscript, currentUser }) => - manuscript.reviews.find(review => review.user.id === currentUser.id), - displayName: 'review', - handleSubmit: (props, { props: { onSubmit, history } }) => - onSubmit(props, { history }), -})(ReviewLayout) -;<div style={{ position: 'relative', height: 600 }}> - <ConnectedReviewLayout - journal={journal} - manuscript={manuscript} - review={review} - uploadFile={() => {}} - currentUser={currentUser} - /> -</div> -```