@manuscripts/style-guide 0.30.15 → 0.30.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/cjs/components/AffiliationsEditor/AffiliationsEditor.js +3 -3
  2. package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorItem.js +7 -6
  3. package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorProfile.js +3 -3
  4. package/dist/cjs/components/AffiliationsEditor/AffiliationsEditorView.js +10 -40
  5. package/dist/cjs/components/AffiliationsEditor/styles.js +2 -1
  6. package/dist/cjs/components/AffiliationsList.js +3 -2
  7. package/dist/cjs/components/AlertMessage.js +9 -9
  8. package/dist/cjs/components/AuthorForm/AuthorForm.js +2 -1
  9. package/dist/cjs/components/AuthorForm/ContributorRolesSelect.js +6 -6
  10. package/dist/cjs/components/AuthorForm/RemoveAuthorButton.js +1 -1
  11. package/dist/cjs/components/AuthorForm/index.js +0 -1
  12. package/dist/cjs/components/AuthorName.js +2 -2
  13. package/dist/cjs/components/AuthorsContainer.js +4 -3
  14. package/dist/cjs/components/AuthorsDND/AuthorsDND.js +39 -17
  15. package/dist/cjs/components/AuthorsDND/DraggableAuthorItem.js +6 -25
  16. package/dist/cjs/components/AuthorsDND/index.js +5 -10
  17. package/dist/cjs/components/AuthorsList/Author.js +3 -2
  18. package/dist/cjs/components/AuthorsList/AuthorsList.js +3 -2
  19. package/dist/cjs/components/Avatar.js +5 -4
  20. package/dist/cjs/components/Button.js +15 -15
  21. package/dist/cjs/components/ColorField/ColorField.js +2 -1
  22. package/dist/cjs/components/ColorField/ColorSelector.js +8 -7
  23. package/dist/cjs/components/Comments/CommentActions.js +9 -12
  24. package/dist/cjs/components/Comments/CommentBody.js +5 -5
  25. package/dist/cjs/components/Comments/CommentTarget.js +1 -1
  26. package/dist/cjs/components/Comments/CommentUser.js +3 -2
  27. package/dist/cjs/components/Comments/CommentWrapper.js +18 -16
  28. package/dist/cjs/components/Comments/ResolveButton.js +3 -2
  29. package/dist/cjs/components/Dialog.js +2 -2
  30. package/dist/cjs/components/FileManager/ConfirmationPopUp.js +2 -1
  31. package/dist/cjs/components/FileManager/DragItemArea.js +2 -1
  32. package/dist/cjs/components/FileManager/FileManager.js +21 -10
  33. package/dist/cjs/components/FileManager/FileSectionItem/DesignationActions.js +5 -4
  34. package/dist/cjs/components/FileManager/FileSectionItem/DesignationActionsList.js +5 -4
  35. package/dist/cjs/components/FileManager/FileSectionItem/DragLayer.js +5 -4
  36. package/dist/cjs/components/FileManager/FileSectionItem/DraggableFileSectionItem.js +8 -7
  37. package/dist/cjs/components/FileManager/FileSectionItem/FileInfo.js +3 -2
  38. package/dist/cjs/components/FileManager/FileSectionItem/FileSectionItem.js +13 -7
  39. package/dist/cjs/components/FileManager/FileSectionItem/FileSectionUploadItem.js +4 -3
  40. package/dist/cjs/components/FileManager/FileSectionItem/FileTypeIcon.js +2 -1
  41. package/dist/cjs/components/FileManager/FileSectionItem/ItemActions.js +9 -4
  42. package/dist/cjs/components/FileManager/FileSectionItem/ProgressBarUploadItem.js +2 -1
  43. package/dist/cjs/components/FileManager/FileSectionState.js +12 -3
  44. package/dist/cjs/components/FileManager/FilesSection.js +4 -3
  45. package/dist/cjs/components/FileManager/SelectDesignationActions.js +11 -11
  46. package/dist/cjs/components/FileManager/SelectDialogDesignation.js +3 -2
  47. package/dist/cjs/components/FileManager/UploadFileArea.js +11 -10
  48. package/dist/cjs/components/FileManager/util.js +15 -8
  49. package/dist/cjs/components/Form.js +1 -1
  50. package/dist/cjs/components/Inspector.js +7 -7
  51. package/dist/cjs/components/InspectorSection.js +5 -4
  52. package/dist/cjs/components/ManuscriptNoteList.js +17 -17
  53. package/dist/cjs/components/PdfPreview.js +13 -13
  54. package/dist/cjs/components/RadioButton.js +2 -1
  55. package/dist/cjs/components/RelativeDate.js +3 -2
  56. package/dist/cjs/components/SaveStatus.js +2 -1
  57. package/dist/cjs/components/SimpleModal.js +3 -2
  58. package/dist/cjs/components/StyledModal.js +3 -2
  59. package/dist/cjs/components/SubmissionInspector/BaseInformation.js +19 -18
  60. package/dist/cjs/components/SubmissionInspector/Button.js +2 -2
  61. package/dist/cjs/components/SubmissionInspector/Progress.js +6 -5
  62. package/dist/cjs/components/SubmissionInspector/Text.js +2 -2
  63. package/dist/cjs/components/TextField.js +3 -2
  64. package/dist/cjs/components/TextFieldContainer.js +2 -1
  65. package/dist/cjs/components/TextFieldError.js +2 -1
  66. package/dist/cjs/components/TextFieldGroupContainer.js +2 -1
  67. package/dist/cjs/components/Tip.js +7 -6
  68. package/dist/cjs/components/icons/back-arrow.js +2 -1
  69. package/dist/cjs/hooks/use-dropdown.js +6 -5
  70. package/dist/cjs/lib/authors.js +24 -15
  71. package/dist/cjs/lib/capabilities.js +13 -8
  72. package/dist/cjs/lib/comments.js +9 -5
  73. package/dist/cjs/lib/lw-errors-decoder.js +51 -1
  74. package/dist/cjs/lib/name.js +2 -1
  75. package/dist/es/components/AffiliationsEditor/AffiliationsEditorView.js +6 -36
  76. package/dist/es/components/AuthorForm/ContributorRolesSelect.js +1 -2
  77. package/dist/es/components/AuthorForm/index.js +0 -1
  78. package/dist/es/components/AuthorsDND/AuthorsDND.js +20 -16
  79. package/dist/es/components/AuthorsDND/DraggableAuthorItem.js +2 -2
  80. package/dist/es/components/AuthorsDND/index.js +1 -1
  81. package/dist/es/components/Comments/CommentActions.js +1 -5
  82. package/dist/es/components/Comments/CommentWrapper.js +10 -9
  83. package/dist/es/components/FileManager/FileManager.js +13 -3
  84. package/dist/es/components/FileManager/FileSectionItem/DragLayer.js +1 -1
  85. package/dist/es/components/FileManager/FileSectionItem/FileSectionItem.js +10 -5
  86. package/dist/es/components/FileManager/FileSectionItem/FileSectionUploadItem.js +1 -1
  87. package/dist/es/components/FileManager/FileSectionItem/ItemActions.js +6 -2
  88. package/dist/es/components/FileManager/FileSectionState.js +8 -1
  89. package/dist/es/components/FileManager/SelectDesignationActions.js +7 -8
  90. package/dist/es/components/PdfPreview.js +4 -4
  91. package/dist/es/components/TextFieldContainer.js +1 -1
  92. package/dist/es/components/TextFieldGroupContainer.js +1 -1
  93. package/dist/es/lib/lw-errors-decoder.js +51 -1
  94. package/dist/types/components/AffiliationsEditor/AffiliationsEditorView.d.ts +4 -7
  95. package/dist/types/components/AffiliationsEditor/styles.d.ts +2 -2
  96. package/dist/types/components/AlertMessage.d.ts +1 -1
  97. package/dist/types/components/AuthorForm/index.d.ts +0 -1
  98. package/dist/types/components/AuthorsDND/AuthorsDND.d.ts +2 -2
  99. package/dist/types/components/AuthorsDND/DraggableAuthorItem.d.ts +15 -5
  100. package/dist/types/components/AuthorsDND/index.d.ts +1 -1
  101. package/dist/types/components/Button.d.ts +9 -9
  102. package/dist/types/components/FileManager/FileSectionItem/FileSectionItem.d.ts +1 -2
  103. package/dist/types/components/FileManager/FileSectionItem/FileSectionUploadItem.d.ts +1 -1
  104. package/dist/types/components/FileManager/FileSectionItem/ItemActions.d.ts +3 -1
  105. package/dist/types/components/FileManager/FileSectionState.d.ts +2 -0
  106. package/dist/types/components/FileManager/util.d.ts +0 -1
  107. package/dist/types/components/Form.d.ts +1 -1
  108. package/dist/types/components/InspectorSection.d.ts +1 -1
  109. package/dist/types/components/PdfPreview.d.ts +1 -1
  110. package/dist/types/components/SimpleModal.d.ts +1 -1
  111. package/dist/types/components/SubmissionInspector/Button.d.ts +1 -1
  112. package/dist/types/components/icons/add-author.d.ts +0 -1
  113. package/dist/types/components/icons/add-icon-active.d.ts +0 -1
  114. package/dist/types/components/icons/add-icon-inverted.d.ts +0 -1
  115. package/dist/types/components/icons/back-arrow.d.ts +0 -1
  116. package/dist/types/components/icons/bookmark.d.ts +0 -1
  117. package/dist/types/components/icons/google.d.ts +0 -1
  118. package/dist/types/components/icons/orcid.d.ts +0 -1
  119. package/dist/types/components/icons/project-notification.d.ts +0 -1
  120. package/dist/types/components/icons/project.d.ts +0 -1
  121. package/dist/types/components/icons/projects-list.d.ts +0 -1
  122. package/dist/types/components/icons/search.d.ts +0 -1
  123. package/dist/types/components/icons/tick-mark.d.ts +0 -1
  124. package/dist/types/components/icons/user.d.ts +0 -1
  125. package/dist/types/lib/comments.d.ts +2 -2
  126. package/package.json +5 -5
  127. package/dist/cjs/components/AuthorForm/AffiliationsSelect.js +0 -55
  128. package/dist/es/components/AuthorForm/AffiliationsSelect.js +0 -49
  129. package/dist/types/components/AuthorForm/AffiliationsSelect.d.ts +0 -29
@@ -26,19 +26,21 @@ const getModelsByType = (modelMap, objectType) => {
26
26
  }
27
27
  return output;
28
28
  };
29
- exports.buildSortedAuthors = (modelMap) => {
29
+ const buildSortedAuthors = (modelMap) => {
30
30
  return getModelsByType(modelMap, manuscripts_json_schema_1.ObjectTypes.Contributor)
31
31
  .filter((item) => item.role === 'author')
32
32
  .sort((a, b) => Number(a.priority) - Number(b.priority));
33
33
  };
34
- exports.buildAuthorPriority = (authors) => {
34
+ exports.buildSortedAuthors = buildSortedAuthors;
35
+ const buildAuthorPriority = (authors) => {
35
36
  if (!authors.length) {
36
37
  return 0;
37
38
  }
38
39
  const priorities = authors.map((author) => Number(author.priority));
39
40
  return Math.max(...priorities) + 1;
40
41
  };
41
- exports.buildAffiliationIDs = (authors) => {
42
+ exports.buildAuthorPriority = buildAuthorPriority;
43
+ const buildAffiliationIDs = (authors) => {
42
44
  const ids = [];
43
45
  authors.forEach((author) => {
44
46
  if (author.affiliations) {
@@ -49,7 +51,8 @@ exports.buildAffiliationIDs = (authors) => {
49
51
  });
50
52
  return ids.filter((value, index) => ids.indexOf(value) === index);
51
53
  };
52
- exports.buildAuthorAffiliations = (authors, affiliations, uniqueAffiliationIDs) => {
54
+ exports.buildAffiliationIDs = buildAffiliationIDs;
55
+ const buildAuthorAffiliations = (authors, affiliations, uniqueAffiliationIDs) => {
53
56
  const items = new Map();
54
57
  authors.forEach((author) => {
55
58
  items.set(author._id, (author.affiliations || []).map((id) => {
@@ -61,41 +64,47 @@ exports.buildAuthorAffiliations = (authors, affiliations, uniqueAffiliationIDs)
61
64
  });
62
65
  return items;
63
66
  };
64
- exports.buildAffiliationsMap = (affiliationIDs, modelMap) => new Map(affiliationIDs.map((id) => [
67
+ exports.buildAuthorAffiliations = buildAuthorAffiliations;
68
+ const buildAffiliationsMap = (affiliationIDs, modelMap) => new Map(affiliationIDs.map((id) => [
65
69
  id,
66
70
  modelMap.get(id),
67
71
  ]));
68
- exports.buildAuthorsAndAffiliations = (modelMap) => {
69
- const authors = exports.buildSortedAuthors(modelMap);
70
- const affiliationIDs = exports.buildAffiliationIDs(authors);
71
- const affiliations = exports.buildAffiliationsMap(affiliationIDs, modelMap);
72
- const authorAffiliations = exports.buildAuthorAffiliations(authors, affiliations, affiliationIDs);
72
+ exports.buildAffiliationsMap = buildAffiliationsMap;
73
+ const buildAuthorsAndAffiliations = (modelMap) => {
74
+ const authors = (0, exports.buildSortedAuthors)(modelMap);
75
+ const affiliationIDs = (0, exports.buildAffiliationIDs)(authors);
76
+ const affiliations = (0, exports.buildAffiliationsMap)(affiliationIDs, modelMap);
77
+ const authorAffiliations = (0, exports.buildAuthorAffiliations)(authors, affiliations, affiliationIDs);
73
78
  return {
74
79
  affiliations,
75
80
  authors,
76
81
  authorAffiliations,
77
82
  };
78
83
  };
79
- exports.isJointFirstAuthor = (authors, index) => {
84
+ exports.buildAuthorsAndAffiliations = buildAuthorsAndAffiliations;
85
+ const isJointFirstAuthor = (authors, index) => {
80
86
  const author = index === 0 ? authors[index] : authors[index - 1];
81
87
  return Boolean(author.isJointContributor);
82
88
  };
83
- exports.affiliationLabel = (affiliation) => {
89
+ exports.isJointFirstAuthor = isJointFirstAuthor;
90
+ const affiliationLabel = (affiliation) => {
84
91
  const { department, institution = '' } = affiliation;
85
92
  if (!institution) {
86
93
  return '(unknown institution)';
87
94
  }
88
95
  return department ? `${institution} (${department})`.trim() : institution;
89
96
  };
90
- exports.affiliationsOptions = (affiliations, authorAffiliations) => {
97
+ exports.affiliationLabel = affiliationLabel;
98
+ const affiliationsOptions = (affiliations, authorAffiliations) => {
91
99
  if (!authorAffiliations) {
92
- return exports.affiliationsOptions(affiliations, []);
100
+ return (0, exports.affiliationsOptions)(affiliations, []);
93
101
  }
94
102
  const authorAffiliationsIds = new Set(authorAffiliations.map((authorAffiliation) => authorAffiliation.data._id));
95
103
  return Array.from(affiliations.values())
96
104
  .filter((affiliation) => !authorAffiliationsIds.has(affiliation._id))
97
105
  .map((affiliation) => ({
98
106
  value: affiliation._id,
99
- label: exports.affiliationLabel(affiliation) || '',
107
+ label: (0, exports.affiliationLabel)(affiliation) || '',
100
108
  }));
101
109
  };
110
+ exports.affiliationsOptions = affiliationsOptions;
@@ -13,7 +13,7 @@ var A;
13
13
  A["addNote"] = "add-note";
14
14
  A["setMainManuscript"] = "set-main-manuscript";
15
15
  })(A || (A = {}));
16
- exports.getLWCapabilities = (project, profile, lwRole, actions) => {
16
+ const getLWCapabilities = (project, profile, lwRole, actions) => {
17
17
  const isEditor = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.editors) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
18
18
  const isOwner = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.owners) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
19
19
  const isWriter = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.writers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
@@ -54,23 +54,28 @@ exports.getLWCapabilities = (project, profile, lwRole, actions) => {
54
54
  accessEditor: true,
55
55
  };
56
56
  };
57
- exports.getAllPermitted = () => {
58
- const capabilities = exports.getLWCapabilities();
57
+ exports.getLWCapabilities = getLWCapabilities;
58
+ const getAllPermitted = () => {
59
+ const capabilities = (0, exports.getLWCapabilities)();
59
60
  const allAllowed = Object.keys(capabilities).reduce((caps, item) => {
60
61
  caps[item] = true;
61
62
  return caps;
62
63
  }, {});
63
64
  return allAllowed;
64
65
  };
65
- const CapabilitiesContext = react_1.default.createContext(exports.getLWCapabilities());
66
+ exports.getAllPermitted = getAllPermitted;
67
+ const CapabilitiesContext = react_1.default.createContext((0, exports.getLWCapabilities)());
66
68
  CapabilitiesContext.displayName = 'CapabilitiesContext';
67
- exports.usePermissions = () => {
69
+ const usePermissions = () => {
68
70
  return react_1.default.useContext(CapabilitiesContext);
69
71
  };
70
- exports.useCalcPermission = ({ project, profile, lwRole, permittedActions, }) => {
71
- return exports.getLWCapabilities(project, profile, lwRole, permittedActions);
72
+ exports.usePermissions = usePermissions;
73
+ const useCalcPermission = ({ project, profile, lwRole, permittedActions, }) => {
74
+ return (0, exports.getLWCapabilities)(project, profile, lwRole, permittedActions);
72
75
  };
73
- exports.CapabilitiesProvider = (props) => {
76
+ exports.useCalcPermission = useCalcPermission;
77
+ const CapabilitiesProvider = (props) => {
74
78
  const { can } = props;
75
79
  return (react_1.default.createElement(CapabilitiesContext.Provider, { value: can }, props === null || props === void 0 ? void 0 : props.children));
76
80
  };
81
+ exports.CapabilitiesProvider = CapabilitiesProvider;
@@ -16,9 +16,10 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.buildName = exports.buildNoteTree = exports.buildCommentTree = exports.isSavedComment = void 0;
19
- exports.isSavedComment = (comment) => {
19
+ const isSavedComment = (comment) => {
20
20
  return !!comment.createdAt;
21
21
  };
22
+ exports.isSavedComment = isSavedComment;
22
23
  const oldestFirst = (a, b) => Number(a.createdAt) - Number(b.createdAt);
23
24
  const buildCommentsMap = (comments) => {
24
25
  const map = new Map();
@@ -84,17 +85,20 @@ const buildNotesTreeMap = (targetsMap) => {
84
85
  }
85
86
  return map;
86
87
  };
87
- exports.buildCommentTree = (doc, comments, newComment) => {
88
+ const buildCommentTree = (doc, comments, newComment) => {
88
89
  if (newComment) {
89
- return exports.buildCommentTree(doc, [...comments, newComment]);
90
+ return (0, exports.buildCommentTree)(doc, [...comments, newComment]);
90
91
  }
91
92
  const commentsMap = buildCommentsMap(comments);
92
93
  const targetsMap = buildTargetsMap(commentsMap);
93
94
  return buildCommentsTreeMap(doc, targetsMap);
94
95
  };
95
- exports.buildNoteTree = (comments) => {
96
+ exports.buildCommentTree = buildCommentTree;
97
+ const buildNoteTree = (comments) => {
96
98
  const commentsMap = buildCommentsMap(comments);
97
99
  const targetsMap = buildTargetsMap(commentsMap);
98
100
  return buildNotesTreeMap(targetsMap);
99
101
  };
100
- exports.buildName = (name) => [name.given, name.family].filter((item) => item).join(' ');
102
+ exports.buildNoteTree = buildNoteTree;
103
+ const buildName = (name) => [name.given, name.family].filter((item) => item).join(' ');
104
+ exports.buildName = buildName;
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const errorsExplanations = {
19
19
  ANY_ERR_AUTHORIZATION: {
20
20
  title: 'Authorization issue',
21
- description: "It seems you don't have access to this page. If you think...",
21
+ description: "It seems you don't have access to this resource. If you think you should have access, please contact the support team.",
22
22
  type: 'System',
23
23
  },
24
24
  PREVIEW_HTML_GENERATION_FAILED: {
@@ -211,6 +211,26 @@ const errorsExplanations = {
211
211
  description: 'The input package is of invalid format. Please contact the source where the submitted article comes from.',
212
212
  type: 'Workflow',
213
213
  },
214
+ CI_IMAGES_EXTRACTED: {
215
+ title: 'Images extracted',
216
+ description: 'There are images extracted from the Word document file. Please check the quality of these images.',
217
+ type: 'Workflow',
218
+ },
219
+ CP_IMAGES_INCOMPLETE: {
220
+ title: 'Missing images',
221
+ description: 'Some images of the article are either missing, incomplete or corrupted.',
222
+ type: 'Workflow',
223
+ },
224
+ CP_IMAGES_UNSUPPORTED_FORMAT: {
225
+ title: 'Images of unsupported format',
226
+ description: 'There are images in the document of unsupported format.',
227
+ type: 'Workflow',
228
+ },
229
+ CP_FIGURES_MULTIPLE_IMAGES: {
230
+ title: 'Figures with multiple images',
231
+ description: 'There are figures in the docment containing multiple images.',
232
+ type: 'Workflow',
233
+ },
214
234
  FC_FAIL_QA_CHECKLIST: {
215
235
  title: 'Quality report checks outstanding',
216
236
  description: 'The Quality report still contains outstanding critical checks that have to be resolved in order to proceed.',
@@ -221,6 +241,36 @@ const errorsExplanations = {
221
241
  description: 'The package does not contain any main manuscript file.',
222
242
  type: 'Workflow',
223
243
  },
244
+ CI_ADDITIONAL_WORD_FILES: {
245
+ title: 'Multiple word files',
246
+ description: 'The package contains multiple word files. Please have the content of the package adjusted.',
247
+ type: 'Workflow',
248
+ },
249
+ CI_XML_AMENDMENT_FAILED: {
250
+ title: 'External file references error',
251
+ description: 'The XML document could not be amended with the external file references.',
252
+ type: 'Workflow',
253
+ },
254
+ CI_IMAGES_NOT_MATCHED: {
255
+ title: 'Images not found',
256
+ description: 'The package does not contain all the images refenenced in the document. Please have the content of the package adjusted.',
257
+ type: 'Workflow',
258
+ },
259
+ CI_METADATA_MISSING: {
260
+ title: 'Metadata missing',
261
+ description: 'Not all the required metadata could be foundin the content of the package. Please have the content of the package adjusted.',
262
+ type: 'Workflow',
263
+ },
264
+ CI_INVALID_DTD: {
265
+ title: 'Invalid DTD',
266
+ description: 'The DTD file is invalid. Please have the content of the package adjusted.',
267
+ type: 'Workflow',
268
+ },
269
+ CI_INVALID_FORMAT: {
270
+ title: 'Invalid Word file',
271
+ description: 'The format or version of the Word file is not correct or supported. Please have the content of the package adjusted.',
272
+ type: 'Workflow',
273
+ },
224
274
  CI_UNSUPPORTED_FORMAT: {
225
275
  title: 'Unsupported file format',
226
276
  description: 'The package contains a main document file that is not of the word document formats (DOCX/DOC) supported.',
@@ -16,10 +16,11 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.initials = void 0;
19
- exports.initials = (name) => name.given
19
+ const initials = (name) => name.given
20
20
  ? name.given
21
21
  .trim()
22
22
  .split(' ')
23
23
  .map((part) => part.substr(0, 1).toUpperCase() + '.')
24
24
  .join('')
25
25
  : '';
26
+ exports.initials = initials;
@@ -13,52 +13,22 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import AddAuthor from '@manuscripts/assets/react/AddAuthor';
17
- import React, { useState } from 'react';
16
+ import React, { useContext, useState } from 'react';
18
17
  import CreatableSelect from 'react-select/creatable';
19
- import styled, { withTheme } from 'styled-components';
18
+ import { ThemeContext } from 'styled-components';
20
19
  import { defaultAuthorFormComponents, } from '../AuthorForm/AuthorFormComponents';
21
20
  import { AffiliationsEditorItem } from './AffiliationsEditorItem';
22
- const Container = styled.div `
23
- margin: 0 1.89rem 1rem;
24
- `;
25
- const Field = styled.div `
26
- margin: 1rem 0;
27
- `;
28
- const List = styled.div `
29
- margin-bottom: 0.5rem;
30
- `;
31
- const AddAffiliationContainer = styled.div `
32
- padding-right: 0.71rem;
33
- display: flex;
34
- flex-direction: column;
35
- justify-content: space-around;
36
-
37
- svg {
38
- width: 1.5rem;
39
- height: 1.5rem;
40
- }
41
-
42
- circle,
43
- use {
44
- fill: ${(props) => props.theme.colors.brand.default};
45
- }
46
-
47
- path {
48
- mask: none;
49
- }
50
- `;
51
- const AddAffiliationIndicator = () => (React.createElement(AddAffiliationContainer, null,
52
- React.createElement(AddAuthor, null)));
21
+ import { AddAffiliationIndicator, Container, Field, List } from './styles';
53
22
  const reactSelectComponents = {
54
23
  IndicatorsContainer: AddAffiliationIndicator,
55
24
  };
56
- const AffiliationsEditorView = ({ options, selected, updateAffiliation, removeAuthorAffiliation, handleChoose, handleInputChange, inputValue, theme, components, styleOverrides, }) => {
25
+ const AffiliationsEditorView = ({ options, selected, updateAffiliation, removeAuthorAffiliation, handleChoose, handleInputChange, inputValue, components, styleOverrides, }) => {
57
26
  const { Legend } = Object.assign(Object.assign({}, defaultAuthorFormComponents), components);
58
27
  const [currentSection, setCurrentSection] = useState('');
59
28
  const requestOpen = (id) => {
60
29
  setCurrentSection(id === currentSection ? '' : id);
61
30
  };
31
+ const theme = useContext(ThemeContext);
62
32
  return (React.createElement(Container, null,
63
33
  React.createElement(Legend, null, "Affiliations"),
64
34
  React.createElement(Field, null,
@@ -79,4 +49,4 @@ const AffiliationsEditorView = ({ options, selected, updateAffiliation, removeAu
79
49
  provided.zIndex })),
80
50
  } }))));
81
51
  };
82
- export default withTheme(AffiliationsEditorView);
52
+ export default AffiliationsEditorView;
@@ -65,7 +65,6 @@ export const ContributorRolesSelect = ({ contributorRoles, createContributorRole
65
65
  setSaving(false);
66
66
  setFieldValue([...value, contribution._id]);
67
67
  }), getOptionValue: (option) => option._id, getOptionLabel: (option) => option.name, onChange: (value) => {
68
- const items = value;
69
- setFieldValue(items.map((item) => item._id));
68
+ setFieldValue(value.map((item) => item._id));
70
69
  } }));
71
70
  };
@@ -14,4 +14,3 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export * from './AuthorForm';
17
- export * from './AffiliationsSelect';
@@ -13,24 +13,28 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import React from 'react';
17
- import styled from 'styled-components';
16
+ import React, { useContext } from 'react';
17
+ import styled, { ThemeContext } from 'styled-components';
18
18
  import DraggableAuthorItem from './DraggableAuthorItem';
19
19
  const SidebarList = styled.div `
20
20
  flex: 1;
21
21
  overflow-y: visible;
22
22
  `;
23
- export const AuthorsDND = ({ authors, selectAuthor, selectedAuthor, handleDrop, getSidebarItemDecorator, components, }) => (React.createElement(SidebarList, null, authors.map((author, index) => {
24
- const user = {
25
- _id: author.userID,
26
- };
27
- const authorItem = {
28
- _id: author._id,
29
- priority: author.priority || null,
30
- index,
31
- };
32
- const decorator = getSidebarItemDecorator
33
- ? getSidebarItemDecorator(author._id)
34
- : null;
35
- return (React.createElement(DraggableAuthorItem, { key: author._id, authorItem: authorItem, onDrop: handleDrop, author: author, authors: authors, user: user, selectedAuthor: selectedAuthor, selectAuthor: selectAuthor, sidebarItemDecorator: decorator, components: components }));
36
- })));
23
+ const AuthorsDND = ({ authors, selectAuthor, selectedAuthor, handleDrop, getSidebarItemDecorator, components, }) => {
24
+ const theme = useContext(ThemeContext);
25
+ return (React.createElement(SidebarList, null, authors.map((author, index) => {
26
+ const user = {
27
+ _id: author.userID,
28
+ };
29
+ const authorItem = {
30
+ _id: author._id,
31
+ priority: author.priority || null,
32
+ index,
33
+ };
34
+ const decorator = getSidebarItemDecorator
35
+ ? getSidebarItemDecorator(author._id)
36
+ : null;
37
+ return (React.createElement(DraggableAuthorItem, { key: author._id, authorItem: authorItem, onDrop: handleDrop, author: author, authors: authors, user: user, selectedAuthor: selectedAuthor, selectAuthor: selectAuthor, sidebarItemDecorator: decorator, components: components, theme: theme }));
38
+ })));
39
+ };
40
+ export default AuthorsDND;
@@ -19,7 +19,7 @@ import VerticalEllipsis from '@manuscripts/assets/react/VerticalEllipsis';
19
19
  import React from 'react';
20
20
  import { DragSource, DropTarget, } from 'react-dnd';
21
21
  import { findDOMNode } from 'react-dom';
22
- import styled, { withTheme } from 'styled-components';
22
+ import styled from 'styled-components';
23
23
  import { isJointFirstAuthor } from '../../lib/authors';
24
24
  import { Avatar } from '../Avatar';
25
25
  import { defaultAuthorItemComponents, } from './AuthorItemComponents';
@@ -189,4 +189,4 @@ const dragType = 'authorItem';
189
189
  const dragSource = DragSource(dragType, dragSourceSpec, dragSourceCollector);
190
190
  const dropTarget = DropTarget(dragType, dropTargetSpec, dropTargetCollector);
191
191
  const DraggableAuthorItem = dragSource(dropTarget(AuthorComponent));
192
- export default withTheme(DraggableAuthorItem);
192
+ export default DraggableAuthorItem;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export * from './AuthorsDND';
16
+ export { default as AuthorsDND } from './AuthorsDND';
@@ -25,11 +25,7 @@ export const CommentActions = ({ id, target, can, isResolved, handleSetResolved,
25
25
  const handleRequestEdit = useCallback(() => {
26
26
  setIsEditing(true);
27
27
  }, [setIsEditing]);
28
- const handleRequestDelete = useCallback(() => deleteComment(id, target), [
29
- deleteComment,
30
- id,
31
- target,
32
- ]);
28
+ const handleRequestDelete = useCallback(() => deleteComment(id, target), [deleteComment, id, target]);
33
29
  const canResolve = useMemo(() => {
34
30
  if (!isProdNote) {
35
31
  return ((isOwnComment && (can === null || can === void 0 ? void 0 : can.resolveOwnComment)) || (can === null || can === void 0 ? void 0 : can.resolveOthersComment));
@@ -22,7 +22,8 @@ import { CommentUser } from './CommentUser';
22
22
  const isOwn = (comment, userId) => {
23
23
  var _a;
24
24
  return comment.contributions
25
- ? (_a = comment.contributions) === null || _a === void 0 ? void 0 : _a.some((c) => c.profileID === userId) : false;
25
+ ? (_a = comment.contributions) === null || _a === void 0 ? void 0 : _a.some((c) => c.profileID === userId)
26
+ : false;
26
27
  };
27
28
  export const CommentWrapper = ({ createKeyword, comment, can, currentUserId, getCollaborator, getKeyword, listCollaborators, listKeywords, saveComment, deleteComment, isReply, isNew, handleCreateReply, handleSetResolved, isProdNote, isSelected, handleRequestSelect, scrollIntoHighlight, children, }) => {
28
29
  const [isEditing, setIsEditing] = useState();
@@ -31,10 +32,13 @@ export const CommentWrapper = ({ createKeyword, comment, can, currentUserId, get
31
32
  if (isNew) {
32
33
  setIsEditing(true);
33
34
  if (threadRef.current) {
34
- setTimeout(() => { var _a; return (_a = threadRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
35
- block: 'nearest',
36
- inline: 'nearest',
37
- }); }, 100);
35
+ setTimeout(() => {
36
+ var _a;
37
+ return (_a = threadRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
38
+ block: 'nearest',
39
+ inline: 'nearest',
40
+ });
41
+ }, 100);
38
42
  }
39
43
  }
40
44
  }, [isNew]);
@@ -48,10 +52,7 @@ export const CommentWrapper = ({ createKeyword, comment, can, currentUserId, get
48
52
  handleRequestSelect && handleRequestSelect();
49
53
  }
50
54
  }, [handleRequestSelect]);
51
- const isOwnComment = useMemo(() => isOwn(comment, currentUserId), [
52
- comment,
53
- currentUserId,
54
- ]);
55
+ const isOwnComment = useMemo(() => isOwn(comment, currentUserId), [comment, currentUserId]);
55
56
  return (React.createElement(Note, { ref: threadRef, isSelected: isSelected },
56
57
  React.createElement(NoteHeader, null,
57
58
  React.createElement(NoteTitle, { type: "button", onMouseDown: onTitleMouseDown, onKeyDown: onTitleKeyDown }, comment.contributions && (React.createElement(CommentUser, { contributions: comment.contributions, getCollaboratorById: getCollaborator, displayName: comment.displayName, createdAt: isSavedComment(comment) ? comment.createdAt * 1000 : undefined }))),
@@ -22,9 +22,16 @@ import { Designation, designationWithFileSectionsMap, FileSectionType, generateE
22
22
  export const PermissionsContext = createContext(null);
23
23
  export const FileManager = ({ submissionId, externalFiles, enableDragAndDrop, can, handleUpload, handleDownload, handleReplace, handleChangeDesignation, }) => {
24
24
  const [state, dispatch] = useReducer(reducer, getInitialState());
25
- const handleReplaceFile = useCallback((submissionId, name, file, typeId) => {
26
- return handleReplace(submissionId, name, file, typeId);
27
- }, [handleReplace]);
25
+ const handleReplaceFile = useCallback((submissionId, name, file, typeId) => __awaiter(void 0, void 0, void 0, function* () {
26
+ dispatch(actions.HANDLE_UPLOAD_ACTION());
27
+ dispatch(actions.SELECT_DESIGNATION(namesWithDesignationMap.get(typeId) || Designation.Document));
28
+ const res = yield handleReplace(submissionId, name, file, typeId);
29
+ if (res) {
30
+ dispatch(actions.SHOW_FILE_UPLOADED_ALERT());
31
+ }
32
+ dispatch(actions.HANDLE_FINISH_UPLOAD());
33
+ return res;
34
+ }), [handleReplace]);
28
35
  const handleUploadFile = useCallback((submissionId, file, designation) => __awaiter(void 0, void 0, void 0, function* () {
29
36
  try {
30
37
  dispatch(actions.HANDLE_UPLOAD_ACTION());
@@ -32,6 +39,9 @@ export const FileManager = ({ submissionId, externalFiles, enableDragAndDrop, ca
32
39
  dispatch(actions.SELECT_DESIGNATION(Designation.Supplementary));
33
40
  }
34
41
  const res = yield handleUpload(submissionId, file, designation);
42
+ if (res) {
43
+ dispatch(actions.SHOW_FILE_UPLOADED_ALERT());
44
+ }
35
45
  dispatch(actions.HANDLE_FINISH_UPLOAD());
36
46
  return res;
37
47
  }
@@ -16,7 +16,7 @@ function getItemStyles(initialOffset, currentOffset) {
16
16
  };
17
17
  }
18
18
  export const DragLayer = () => {
19
- const { itemType, isDragging, item, initialOffset, currentOffset, } = useDragLayer((monitor) => ({
19
+ const { itemType, isDragging, item, initialOffset, currentOffset } = useDragLayer((monitor) => ({
20
20
  item: monitor.getItem(),
21
21
  itemType: monitor.getItemType(),
22
22
  initialOffset: monitor.getInitialSourceClientOffset(),
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { Link } from 'react-router-dom';
3
2
  import styled from 'styled-components';
4
3
  import { useDropdown } from '../../../hooks/use-dropdown';
5
4
  import { DropdownContainer } from '../../Dropdown';
@@ -14,8 +13,15 @@ export const FileSectionItem = ({ submissionId, externalFile, title, showAttachm
14
13
  const fileExtension = externalFile.filename.substring(externalFile.filename.lastIndexOf('.') + 1);
15
14
  const designation = namesWithDesignationMap.get(externalFile.designation);
16
15
  const isMainManuscript = designation === Designation.MainManuscript;
16
+ const isSelected = externalFile._id == window.location.hash.substr(1);
17
17
  return (React.createElement(Item, { ref: dragRef, className: className, style: style },
18
- React.createElement(ItemContainer, { to: isEditor ? `#${externalFile._id}` : '#' },
18
+ React.createElement(ItemContainer, { onClick: () => {
19
+ window.location.hash =
20
+ isEditor && !isSelected ? `#${externalFile._id}` : '#';
21
+ if (isSelected) {
22
+ window.location.hash = `#${externalFile._id}`;
23
+ }
24
+ } },
19
25
  React.createElement(FileTypeIcon, { withDot: isMainManuscript, fileExtension: fileExtension, alt: externalFile.filename }),
20
26
  React.createElement(FileInfo, { fileExtension: fileExtension, showAttachmentName: showAttachmentName, showDesignationActions: showDesignationActions, submissionAttachmentName: externalFile.filename, title: title, designation: designation, description: externalFile.description, handleChangeDesignation: handleChangeDesignation, submissionId: submissionId, dispatch: dispatch })),
21
27
  onClose && (React.createElement(IconCloseButton, { onClick: (e) => {
@@ -26,7 +32,7 @@ export const FileSectionItem = ({ submissionId, externalFile, title, showAttachm
26
32
  handleDownload && handleReplace && submissionId && (React.createElement(DropdownContainer, { ref: wrapperRef },
27
33
  React.createElement(ActionsIcon, { onClick: toggleOpen, type: "button", "aria-label": "Download or Replace", "aria-pressed": isOpen },
28
34
  React.createElement(DotsIcon, null)),
29
- isOpen && (React.createElement(ItemActions, { replaceAttachmentHandler: handleReplace, downloadAttachmentHandler: handleDownload, submissionId: submissionId, fileName: externalFile.filename, designation: externalFile.designation, publicUrl: externalFile.publicUrl, hideActionList: toggleOpen }))))));
35
+ isOpen && (React.createElement(ItemActions, { replaceAttachmentHandler: handleReplace, downloadAttachmentHandler: handleDownload, submissionId: submissionId, fileName: externalFile.filename, designation: externalFile.designation, publicUrl: externalFile.publicUrl, hideActionList: toggleOpen, dispatch: dispatch }))))));
30
36
  };
31
37
  const IconCloseButton = styled.button `
32
38
  border: none;
@@ -76,10 +82,9 @@ export const Item = styled.div `
76
82
  margin-right: 8px;
77
83
  }
78
84
  `;
79
- export const ItemContainer = styled(Link) `
85
+ export const ItemContainer = styled.div `
80
86
  display: flex;
81
87
  min-width: calc(100% - 8px);
82
88
  padding-right: 4px;
83
89
  box-sizing: border-box;
84
- text-decoration: none;
85
90
  `;
@@ -8,7 +8,7 @@ export const FileSectionUploadItem = ({ fileName, isLoading, submissionId, dragR
8
8
  const fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1);
9
9
  fileName = fileName.substring(0, fileName.lastIndexOf('.'));
10
10
  return (React.createElement(Item, { ref: dragRef, className: className, style: style },
11
- React.createElement(UploadItemContainer, { to: '#' },
11
+ React.createElement(UploadItemContainer, null,
12
12
  React.createElement(FileTypeIcon, { withDot: false }),
13
13
  React.createElement(FileInfoContainer, null,
14
14
  React.createElement(FileNameContainer, null,
@@ -1,8 +1,9 @@
1
- import React, { useContext, useRef, useState } from 'react';
1
+ import React, { useContext, useRef, useState, } from 'react';
2
2
  import { DropdownList } from '../../Dropdown';
3
3
  import { PermissionsContext } from '../FileManager';
4
+ import { actions } from '../FileSectionState';
4
5
  import { ActionsItem } from '../ItemsAction';
5
- export const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandler, submissionId, fileName, designation, publicUrl, hideActionList, }) => {
6
+ export const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandler, submissionId, fileName, designation, publicUrl, hideActionList, dispatch, }) => {
6
7
  const attachmentDesignation = designation == undefined ? 'undefined' : designation;
7
8
  const fileInputRef = useRef(null);
8
9
  const [selectedFile, setSelectedFile] = useState();
@@ -11,6 +12,9 @@ export const ItemActions = ({ downloadAttachmentHandler, replaceAttachmentHandle
11
12
  if (event && event.target && event.target.files) {
12
13
  const file = event.target.files[0];
13
14
  setSelectedFile(file);
15
+ if (dispatch) {
16
+ dispatch(actions.UPLOAD_FILE(file));
17
+ }
14
18
  replaceAttachmentHandler(submissionId, fileName, file, attachmentDesignation);
15
19
  hideActionList();
16
20
  }
@@ -17,6 +17,7 @@ var ActionTypes;
17
17
  ActionTypes["HANDLE_UPLOAD_ACTION"] = "handleUpload";
18
18
  ActionTypes["HANDLE_FINISH_UPLOAD"] = "handleFinishUpload";
19
19
  ActionTypes["HANDLE_SUCCESS_MESSAGE"] = "handleSuccessMessage";
20
+ ActionTypes["SHOW_FILE_UPLOADED_ALERT"] = "showFileUploadedAlert";
20
21
  ActionTypes["CLOSE_FILE_UPLOADED_ALERT"] = "closeFileUploadedAlert";
21
22
  })(ActionTypes || (ActionTypes = {}));
22
23
  export const reducer = (state, action) => {
@@ -41,7 +42,10 @@ export const reducer = (state, action) => {
41
42
  return Object.assign(Object.assign({}, state), { isOpenSelectDesignationPopup: false });
42
43
  }
43
44
  case ActionTypes.HANDLE_FINISH_UPLOAD: {
44
- return Object.assign(Object.assign({}, state), { isUploadFile: false, isFileUploaded: true, uploadedFile: undefined, selectDesignation: undefined });
45
+ return Object.assign(Object.assign({}, state), { isUploadFile: false, uploadedFile: undefined, selectDesignation: undefined });
46
+ }
47
+ case ActionTypes.SHOW_FILE_UPLOADED_ALERT: {
48
+ return Object.assign(Object.assign({}, state), { isFileUploaded: true });
45
49
  }
46
50
  case ActionTypes.HANDLE_SUCCESS_MESSAGE: {
47
51
  return Object.assign(Object.assign({}, state), { isShowSuccessMessage: true });
@@ -77,6 +81,9 @@ export const actions = {
77
81
  HANDLE_FINISH_UPLOAD: () => ({
78
82
  type: ActionTypes.HANDLE_FINISH_UPLOAD,
79
83
  }),
84
+ SHOW_FILE_UPLOADED_ALERT: () => ({
85
+ type: ActionTypes.SHOW_FILE_UPLOADED_ALERT,
86
+ }),
80
87
  CLOSE_FILE_UPLOADED_ALERT: () => ({
81
88
  type: ActionTypes.CLOSE_FILE_UPLOADED_ALERT,
82
89
  }),
@@ -5,16 +5,15 @@ import BottomArrowIcon from '../icons/BottomArrowIcon';
5
5
  import { PermissionsContext } from './FileManager';
6
6
  import { actions } from './FileSectionState';
7
7
  import { getUploadFileDesignationList, } from './util';
8
+ const DropdownIndicator = () => (React.createElement(SelectDesignationContainer, null,
9
+ React.createElement(BottomArrowIcon, null)));
10
+ const reactSelectComponents = {
11
+ IndicatorsContainer: DropdownIndicator,
12
+ };
8
13
  export const SelectDesignationActions = ({ fileExtension, fileSection, dispatch }) => {
9
- const DropdownIndicator = () => (React.createElement(SelectDesignationContainer, null,
10
- React.createElement(BottomArrowIcon, null)));
11
- const reactSelectComponents = {
12
- IndicatorsContainer: DropdownIndicator,
13
- };
14
14
  const can = useContext(PermissionsContext);
15
- const handleInputChange = (value) => {
16
- if (value) {
17
- const selectedDesignation = value;
15
+ const handleInputChange = (selectedDesignation) => {
16
+ if (selectedDesignation) {
18
17
  if (selectedDesignation && 'value' in selectedDesignation) {
19
18
  dispatch(actions.SELECT_DESIGNATION(selectedDesignation.value));
20
19
  }