@manuscripts/article-editor 1.10.13 → 1.10.14
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.
- package/dist/cjs/components/projects/ManuscriptPageContainer.js +0 -2
- package/dist/cjs/components/projects/ManuscriptPageContainer.js.map +1 -1
- package/dist/cjs/hooks/use-create-editor.js +0 -2
- package/dist/cjs/hooks/use-create-editor.js.map +1 -1
- package/dist/cjs/postgres-data/buildData.js +0 -4
- package/dist/cjs/postgres-data/buildData.js.map +1 -1
- package/dist/cjs/store/Store.js.map +1 -1
- package/dist/es/components/projects/ManuscriptPageContainer.js +0 -2
- package/dist/es/components/projects/ManuscriptPageContainer.js.map +1 -1
- package/dist/es/hooks/use-create-editor.js +0 -2
- package/dist/es/hooks/use-create-editor.js.map +1 -1
- package/dist/es/postgres-data/buildData.js +0 -4
- package/dist/es/postgres-data/buildData.js.map +1 -1
- package/dist/es/store/Store.js.map +1 -1
- package/dist/types/store/Store.d.ts +1 -3
- package/package.json +3 -4
- package/dist/cjs/components/metadata/AddAuthorButton.js +0 -55
- package/dist/cjs/components/metadata/AddAuthorButton.js.map +0 -1
- package/dist/cjs/components/metadata/AddAuthorsModalContainer.js +0 -71
- package/dist/cjs/components/metadata/AddAuthorsModalContainer.js.map +0 -1
- package/dist/cjs/components/metadata/AddAuthorsSidebar.js +0 -67
- package/dist/cjs/components/metadata/AddAuthorsSidebar.js.map +0 -1
- package/dist/cjs/components/metadata/AuthorFormContainer.js +0 -24
- package/dist/cjs/components/metadata/AuthorFormContainer.js.map +0 -1
- package/dist/cjs/components/metadata/AuthorInvitationForm.js +0 -115
- package/dist/cjs/components/metadata/AuthorInvitationForm.js.map +0 -1
- package/dist/cjs/components/metadata/AuthorModalViews.js +0 -161
- package/dist/cjs/components/metadata/AuthorModalViews.js.map +0 -1
- package/dist/cjs/components/metadata/AuthorsModalContainer.js +0 -99
- package/dist/cjs/components/metadata/AuthorsModalContainer.js.map +0 -1
- package/dist/cjs/components/metadata/AuthorsModals.js +0 -37
- package/dist/cjs/components/metadata/AuthorsModals.js.map +0 -1
- package/dist/cjs/components/metadata/AuthorsPage.js +0 -100
- package/dist/cjs/components/metadata/AuthorsPage.js.map +0 -1
- package/dist/cjs/components/metadata/AuthorsSidebar.js +0 -34
- package/dist/cjs/components/metadata/AuthorsSidebar.js.map +0 -1
- package/dist/cjs/components/metadata/CreateAuthorPageContainer.js +0 -43
- package/dist/cjs/components/metadata/CreateAuthorPageContainer.js.map +0 -1
- package/dist/cjs/components/metadata/InviteAuthorButton.js +0 -62
- package/dist/cjs/components/metadata/InviteAuthorButton.js.map +0 -1
- package/dist/cjs/components/metadata/InviteAuthorPopperContainer.js +0 -62
- package/dist/cjs/components/metadata/InviteAuthorPopperContainer.js.map +0 -1
- package/dist/cjs/components/metadata/InviteAuthorsSidebar.js +0 -27
- package/dist/cjs/components/metadata/InviteAuthorsSidebar.js.map +0 -1
- package/dist/cjs/components/metadata/SearchAuthorsSidebar.js +0 -48
- package/dist/cjs/components/metadata/SearchAuthorsSidebar.js.map +0 -1
- package/dist/cjs/lib/authors.js +0 -124
- package/dist/cjs/lib/authors.js.map +0 -1
- package/dist/es/components/metadata/AddAuthorButton.js +0 -50
- package/dist/es/components/metadata/AddAuthorButton.js.map +0 -1
- package/dist/es/components/metadata/AddAuthorsModalContainer.js +0 -64
- package/dist/es/components/metadata/AddAuthorsModalContainer.js.map +0 -1
- package/dist/es/components/metadata/AddAuthorsSidebar.js +0 -62
- package/dist/es/components/metadata/AddAuthorsSidebar.js.map +0 -1
- package/dist/es/components/metadata/AuthorFormContainer.js +0 -17
- package/dist/es/components/metadata/AuthorFormContainer.js.map +0 -1
- package/dist/es/components/metadata/AuthorInvitationForm.js +0 -108
- package/dist/es/components/metadata/AuthorInvitationForm.js.map +0 -1
- package/dist/es/components/metadata/AuthorModalViews.js +0 -133
- package/dist/es/components/metadata/AuthorModalViews.js.map +0 -1
- package/dist/es/components/metadata/AuthorsModalContainer.js +0 -94
- package/dist/es/components/metadata/AuthorsModalContainer.js.map +0 -1
- package/dist/es/components/metadata/AuthorsModals.js +0 -29
- package/dist/es/components/metadata/AuthorsModals.js.map +0 -1
- package/dist/es/components/metadata/AuthorsPage.js +0 -92
- package/dist/es/components/metadata/AuthorsPage.js.map +0 -1
- package/dist/es/components/metadata/AuthorsSidebar.js +0 -29
- package/dist/es/components/metadata/AuthorsSidebar.js.map +0 -1
- package/dist/es/components/metadata/CreateAuthorPageContainer.js +0 -38
- package/dist/es/components/metadata/CreateAuthorPageContainer.js.map +0 -1
- package/dist/es/components/metadata/InviteAuthorButton.js +0 -57
- package/dist/es/components/metadata/InviteAuthorButton.js.map +0 -1
- package/dist/es/components/metadata/InviteAuthorPopperContainer.js +0 -57
- package/dist/es/components/metadata/InviteAuthorPopperContainer.js.map +0 -1
- package/dist/es/components/metadata/InviteAuthorsSidebar.js +0 -22
- package/dist/es/components/metadata/InviteAuthorsSidebar.js.map +0 -1
- package/dist/es/components/metadata/SearchAuthorsSidebar.js +0 -43
- package/dist/es/components/metadata/SearchAuthorsSidebar.js.map +0 -1
- package/dist/es/lib/authors.js +0 -112
- package/dist/es/lib/authors.js.map +0 -1
- package/dist/types/components/metadata/AddAuthorButton.d.ts +0 -29
- package/dist/types/components/metadata/AddAuthorsModalContainer.d.ts +0 -38
- package/dist/types/components/metadata/AddAuthorsSidebar.d.ts +0 -28
- package/dist/types/components/metadata/AuthorFormContainer.d.ts +0 -31
- package/dist/types/components/metadata/AuthorInvitationForm.d.ts +0 -36
- package/dist/types/components/metadata/AuthorModalViews.d.ts +0 -14
- package/dist/types/components/metadata/AuthorsModalContainer.d.ts +0 -48
- package/dist/types/components/metadata/AuthorsModals.d.ts +0 -50
- package/dist/types/components/metadata/AuthorsPage.d.ts +0 -18
- package/dist/types/components/metadata/AuthorsSidebar.d.ts +0 -24
- package/dist/types/components/metadata/CreateAuthorPageContainer.d.ts +0 -25
- package/dist/types/components/metadata/InviteAuthorButton.d.ts +0 -33
- package/dist/types/components/metadata/InviteAuthorPopperContainer.d.ts +0 -31
- package/dist/types/components/metadata/InviteAuthorsSidebar.d.ts +0 -24
- package/dist/types/components/metadata/SearchAuthorsSidebar.d.ts +0 -21
- package/dist/types/lib/authors.d.ts +0 -42
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
4
|
-
*
|
|
5
|
-
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
6
|
-
*
|
|
7
|
-
* The Original Code is manuscripts-frontend.
|
|
8
|
-
*
|
|
9
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
10
|
-
*
|
|
11
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
12
|
-
*/
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.InvitationForm = void 0;
|
|
18
|
-
const style_guide_1 = require("@manuscripts/style-guide");
|
|
19
|
-
const formik_1 = require("formik");
|
|
20
|
-
const http_status_codes_1 = require("http-status-codes");
|
|
21
|
-
const react_1 = __importDefault(require("react"));
|
|
22
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
23
|
-
const roles_1 = require("../../lib/roles");
|
|
24
|
-
const RadioButton_1 = require("../RadioButton");
|
|
25
|
-
const SendInvitationButton = (0, styled_components_1.default)(style_guide_1.PrimaryButton) `
|
|
26
|
-
width: 100%;
|
|
27
|
-
`;
|
|
28
|
-
const RadioButtonsContainer = styled_components_1.default.div `
|
|
29
|
-
padding-top: ${(props) => props.theme.grid.unit * 6}px;
|
|
30
|
-
padding-bottom: ${(props) => props.theme.grid.unit * 6}px;
|
|
31
|
-
`;
|
|
32
|
-
const AlertMessageContainer = styled_components_1.default.div `
|
|
33
|
-
margin-bottom: ${(props) => props.theme.grid.unit * 2}px;
|
|
34
|
-
`;
|
|
35
|
-
const errorResponseMessage = (status) => {
|
|
36
|
-
switch (status) {
|
|
37
|
-
case http_status_codes_1.StatusCodes.BAD_REQUEST:
|
|
38
|
-
return 'You are already a collaborator on this project.';
|
|
39
|
-
case http_status_codes_1.StatusCodes.CONFLICT:
|
|
40
|
-
return 'The invited user is already a collaborator on this project.';
|
|
41
|
-
default:
|
|
42
|
-
return 'Sending invitation failed.';
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
class InvitationForm extends react_1.default.Component {
|
|
46
|
-
constructor() {
|
|
47
|
-
super(...arguments);
|
|
48
|
-
this.state = {
|
|
49
|
-
invitationSent: false,
|
|
50
|
-
};
|
|
51
|
-
this.initialValues = {
|
|
52
|
-
email: '',
|
|
53
|
-
name: '',
|
|
54
|
-
role: 'Writer',
|
|
55
|
-
};
|
|
56
|
-
this.dismissSuccessAlert = () => {
|
|
57
|
-
this.setState({
|
|
58
|
-
invitationSent: false,
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
render() {
|
|
63
|
-
const { allowSubmit, handleSubmit, invitationValues, tokenActions } = this.props;
|
|
64
|
-
const { invitationSent } = this.state;
|
|
65
|
-
return (react_1.default.createElement(formik_1.Formik, { onSubmit: async (values, actions) => {
|
|
66
|
-
try {
|
|
67
|
-
await handleSubmit(values);
|
|
68
|
-
this.setState({ invitationSent: true });
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
const errors = {};
|
|
72
|
-
errors.submit = error.response
|
|
73
|
-
? errorResponseMessage(error.response.status)
|
|
74
|
-
: 'There was an error submitting the form.';
|
|
75
|
-
if (error.response &&
|
|
76
|
-
error.response.status === http_status_codes_1.StatusCodes.UNAUTHORIZED) {
|
|
77
|
-
tokenActions.delete();
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
actions.setErrors(errors);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
finally {
|
|
84
|
-
actions.setSubmitting(false);
|
|
85
|
-
}
|
|
86
|
-
}, initialValues: invitationValues || this.initialValues, isInitialValid: true, validateOnChange: false, validateOnBlur: false }, ({ errors, isSubmitting, values, resetForm, }) => (react_1.default.createElement(formik_1.Form, { noValidate: true },
|
|
87
|
-
errors.submit && (react_1.default.createElement(style_guide_1.AlertMessage, { type: style_guide_1.AlertMessageType.error, hideCloseButton: true },
|
|
88
|
-
errors.submit,
|
|
89
|
-
' ')),
|
|
90
|
-
!allowSubmit && (react_1.default.createElement(AlertMessageContainer, null,
|
|
91
|
-
react_1.default.createElement(style_guide_1.AlertMessage, { type: style_guide_1.AlertMessageType.info, hideCloseButton: true }, "Only project owners can invite others to the project."))),
|
|
92
|
-
invitationSent && (react_1.default.createElement(AlertMessageContainer, null,
|
|
93
|
-
react_1.default.createElement(style_guide_1.AlertMessage, { type: style_guide_1.AlertMessageType.success, hideCloseButton: true, dismissButton: {
|
|
94
|
-
text: 'OK',
|
|
95
|
-
action: () => {
|
|
96
|
-
this.dismissSuccessAlert();
|
|
97
|
-
resetForm();
|
|
98
|
-
},
|
|
99
|
-
} }, "Invitation was sent."))),
|
|
100
|
-
react_1.default.createElement(style_guide_1.TextFieldGroupContainer, { errors: {
|
|
101
|
-
name: errors.name,
|
|
102
|
-
email: errors.email,
|
|
103
|
-
} },
|
|
104
|
-
react_1.default.createElement(formik_1.Field, { name: 'name' }, ({ field }) => (react_1.default.createElement(style_guide_1.TextField, { ...field, onFocus: this.dismissSuccessAlert, type: 'text', placeholder: 'name', required: true, error: errors.name, disabled: !allowSubmit }))),
|
|
105
|
-
react_1.default.createElement(formik_1.Field, { name: 'email' }, ({ field }) => (react_1.default.createElement(style_guide_1.TextField, { ...field, onFocus: this.dismissSuccessAlert, type: 'email', placeholder: 'email', required: true, error: errors.email, disabled: !allowSubmit })))),
|
|
106
|
-
react_1.default.createElement(RadioButtonsContainer, null,
|
|
107
|
-
react_1.default.createElement(formik_1.Field, { name: 'role' }, ({ field }) => (react_1.default.createElement(RadioButton_1.RadioButton, { _id: 'owner', ...field, onFocus: this.dismissSuccessAlert, value: 'Owner', required: true, textHint: 'Can modify and delete project, invite and remove collaborators', checked: values.role === roles_1.ProjectRole.owner, disabled: !allowSubmit }, "Owner"))),
|
|
108
|
-
react_1.default.createElement(formik_1.Field, { name: 'role' }, ({ field }) => (react_1.default.createElement(RadioButton_1.RadioButton, { _id: 'writer', ...field, onFocus: this.dismissSuccessAlert, value: 'Writer', required: true, textHint: 'Can modify project contents', checked: values.role === roles_1.ProjectRole.writer, disabled: !allowSubmit }, "Writer"))),
|
|
109
|
-
react_1.default.createElement(formik_1.Field, { name: 'role' }, ({ field }) => (react_1.default.createElement(RadioButton_1.RadioButton, { _id: 'viewer', ...field, onFocus: this.dismissSuccessAlert, value: 'Viewer', required: true, textHint: 'Can only review projects without modifying it', checked: values.role === roles_1.ProjectRole.viewer, disabled: !allowSubmit }, "Viewer"))),
|
|
110
|
-
errors.role && react_1.default.createElement(style_guide_1.FormError, null, errors.role)),
|
|
111
|
-
react_1.default.createElement(SendInvitationButton, { type: "submit", disabled: isSubmitting || !allowSubmit }, "Send Invitation")))));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
exports.InvitationForm = InvitationForm;
|
|
115
|
-
//# sourceMappingURL=AuthorInvitationForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorInvitationForm.js","sourceRoot":"","sources":["../../../../src/components/metadata/Author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uBAAS,QAAE,MAAM,CAAC,IAAI,CAAa,CAC9B;YAExB,8BAAC,oBAAoB,IACnB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,YAAY,IAAI,CAAC,WAAW,sBAGjB,CAClB,CACR,CACM,CACV,CAAA;IACH,CAAC;CAOF;AArMD,wCAqMC"}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
4
|
-
*
|
|
5
|
-
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
6
|
-
*
|
|
7
|
-
* The Original Code is manuscripts-frontend.
|
|
8
|
-
*
|
|
9
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
10
|
-
*
|
|
11
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
12
|
-
*/
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
const style_guide_1 = require("@manuscripts/style-guide");
|
|
41
|
-
const transform_1 = require("@manuscripts/transform");
|
|
42
|
-
const react_1 = __importStar(require("react"));
|
|
43
|
-
const authors_1 = require("../../lib/authors");
|
|
44
|
-
const store_1 = require("../../store");
|
|
45
|
-
const AddAuthorsModalContainer_1 = require("./AddAuthorsModalContainer");
|
|
46
|
-
const AuthorsModalContainer_1 = __importDefault(require("./AuthorsModalContainer"));
|
|
47
|
-
const AuthorModalViews = () => {
|
|
48
|
-
const [store, dispatch] = (0, store_1.useStore)((store) => store);
|
|
49
|
-
const [state, setState] = (0, react_1.useState)({
|
|
50
|
-
expanded: true,
|
|
51
|
-
selectedAuthor: null,
|
|
52
|
-
addingAuthors: false,
|
|
53
|
-
nonAuthors: [],
|
|
54
|
-
numberOfAddedAuthors: 0,
|
|
55
|
-
addedAuthors: [],
|
|
56
|
-
});
|
|
57
|
-
const { saveTrackModel, collaboratorsProfiles, user, deleteTrackModel, trackModelMap, authorsPopupOn, } = store;
|
|
58
|
-
const stopEditing = () => {
|
|
59
|
-
setState((state) => ({
|
|
60
|
-
...state,
|
|
61
|
-
selectedAuthor: null,
|
|
62
|
-
addingAuthors: false,
|
|
63
|
-
isInvite: false,
|
|
64
|
-
}));
|
|
65
|
-
dispatch({ authorsPopupOn: false });
|
|
66
|
-
};
|
|
67
|
-
const createAuthor = async (priority, person, name) => {
|
|
68
|
-
if (name) {
|
|
69
|
-
const [given, ...family] = name.split(' ');
|
|
70
|
-
const bibName = (0, transform_1.buildBibliographicName)({
|
|
71
|
-
given,
|
|
72
|
-
family: family.join(' '),
|
|
73
|
-
});
|
|
74
|
-
const author = (0, transform_1.buildContributor)(bibName, 'author', priority);
|
|
75
|
-
await saveTrackModel(author);
|
|
76
|
-
setState((state) => ({
|
|
77
|
-
...state,
|
|
78
|
-
numberOfAddedAuthors: state.numberOfAddedAuthors + 1,
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
if (person) {
|
|
82
|
-
const author = (0, transform_1.buildContributor)(person.bibliographicName, 'author', priority, person.userID);
|
|
83
|
-
const createdAuthor = await saveTrackModel(author);
|
|
84
|
-
setState((state) => ({
|
|
85
|
-
...state,
|
|
86
|
-
addedAuthors: state.addedAuthors.concat(author.userID),
|
|
87
|
-
numberOfAddedAuthors: state.numberOfAddedAuthors + 1,
|
|
88
|
-
}));
|
|
89
|
-
selectAuthor(createdAuthor);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
const startEditing = (0, react_1.useCallback)(() => {
|
|
93
|
-
dispatch({ authorsPopupOn: true });
|
|
94
|
-
}, [dispatch]);
|
|
95
|
-
const selectAuthor = (0, react_1.useCallback)((author) => {
|
|
96
|
-
// TODO: make this switch without deselecting
|
|
97
|
-
setState((state) => ({
|
|
98
|
-
...state,
|
|
99
|
-
selectedAuthor: typeof author === 'string' ? author : author._id,
|
|
100
|
-
}));
|
|
101
|
-
}, []);
|
|
102
|
-
(0, react_1.useEffect)(() => {
|
|
103
|
-
dispatch({ startEditing, selectAuthor });
|
|
104
|
-
}, [dispatch, startEditing, selectAuthor]);
|
|
105
|
-
const deselectAuthor = () => {
|
|
106
|
-
setState((state) => ({ ...state, selectedAuthor: null }));
|
|
107
|
-
};
|
|
108
|
-
const removeAuthor = async (author) => {
|
|
109
|
-
await deleteTrackModel(author._id);
|
|
110
|
-
deselectAuthor();
|
|
111
|
-
if (state.addedAuthors.includes(author.userID)) {
|
|
112
|
-
const index = state.addedAuthors.indexOf(author.userID);
|
|
113
|
-
state.addedAuthors.splice(index, 1);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
const handleAddingDoneCancel = () => setState((state) => ({
|
|
117
|
-
...state,
|
|
118
|
-
numberOfAddedAuthors: 0,
|
|
119
|
-
addingAuthors: false,
|
|
120
|
-
}));
|
|
121
|
-
const handleDrop = (authors, oldIndex, newIndex) => {
|
|
122
|
-
const reorderedAuthors = (0, authors_1.reorderAuthors)(authors, oldIndex, newIndex);
|
|
123
|
-
Promise.all(reorderedAuthors.map((author, i) => {
|
|
124
|
-
author.priority = i;
|
|
125
|
-
return saveTrackModel(author);
|
|
126
|
-
}))
|
|
127
|
-
.then(() => {
|
|
128
|
-
setState((state) => ({ ...state, authorListError: '' }));
|
|
129
|
-
})
|
|
130
|
-
.catch(() => {
|
|
131
|
-
setState((state) => ({
|
|
132
|
-
...state,
|
|
133
|
-
authorListError: 'There was an error saving authors',
|
|
134
|
-
}));
|
|
135
|
-
});
|
|
136
|
-
};
|
|
137
|
-
const metaData = (0, react_1.useMemo)(() => {
|
|
138
|
-
const data = (0, authors_1.getMetaData)(trackModelMap);
|
|
139
|
-
return data;
|
|
140
|
-
}, [trackModelMap]);
|
|
141
|
-
(0, react_1.useEffect)(() => {
|
|
142
|
-
dispatch({
|
|
143
|
-
trackedAuthorsAndAffiliations: metaData?.authorsAndAffiliations,
|
|
144
|
-
});
|
|
145
|
-
}, [metaData, dispatch]);
|
|
146
|
-
const authorsAndAffiliations = metaData?.authorsAndAffiliations;
|
|
147
|
-
const contributorRoles = metaData?.contributorRoles || [];
|
|
148
|
-
if (!collaboratorsProfiles ||
|
|
149
|
-
!user ||
|
|
150
|
-
!authorsAndAffiliations ||
|
|
151
|
-
!contributorRoles) {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
return (react_1.default.createElement(style_guide_1.StyledModal, { isOpen: !!authorsPopupOn, onRequestClose: stopEditing, shouldCloseOnOverlayClick: true },
|
|
155
|
-
react_1.default.createElement(style_guide_1.ModalContainer, null,
|
|
156
|
-
react_1.default.createElement(style_guide_1.ModalHeader, null,
|
|
157
|
-
react_1.default.createElement(style_guide_1.CloseButton, { onClick: stopEditing, "data-cy": 'modal-close-button' })),
|
|
158
|
-
state.addingAuthors ? (react_1.default.createElement(AddAuthorsModalContainer_1.AddAuthorsModalContainer, { ...state, handleAddingDoneCancel: handleAddingDoneCancel, createAuthor: createAuthor, authors: authorsAndAffiliations.authors })) : (react_1.default.createElement(AuthorsModalContainer_1.default, { ...state, createAuthor: createAuthor, selectAuthor: selectAuthor, removeAuthor: removeAuthor, saveTrackModel: saveTrackModel, handleDrop: handleDrop, authors: authorsAndAffiliations.authors, authorAffiliations: authorsAndAffiliations.authorAffiliations, affiliations: authorsAndAffiliations.affiliations, contributorRoles: contributorRoles })))));
|
|
159
|
-
};
|
|
160
|
-
exports.default = AuthorModalViews;
|
|
161
|
-
//# sourceMappingURL=AuthorModalViews.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorModalViews.js","sourceRoot":"","sources":["../../../../src/components/metadata/AuthorModalViews.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,0DAKiC;AACjC,sDAG+B;AAC/B,+CAAwE;AAExE,+CAA+D;AAC/D,uCAAsC;AACtC,yEAAqE;AACrE,oFAA2D;AAY3D,MAAM,gBAAgB,GAAa,GAAG,EAAE;IACtC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,K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CAAC,OAAO,GACvC,CACH,CAAC,CAAC,CAAC,CACF,8BAAC,+BAAqB,OAChB,KAAK,EACT,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,sBAAsB,CAAC,OAAO,EACvC,kBAAkB,EAAE,sBAAsB,CAAC,kBAAkB,EAC7D,YAAY,EAAE,sBAAsB,CAAC,YAAY,EACjD,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CACc,CACL,CACf,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,gBAAgB,CAAA"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
4
|
-
*
|
|
5
|
-
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
6
|
-
*
|
|
7
|
-
* The Original Code is manuscripts-frontend.
|
|
8
|
-
*
|
|
9
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
10
|
-
*
|
|
11
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
12
|
-
*/
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const json_schema_1 = require("@manuscripts/json-schema");
|
|
18
|
-
const transform_1 = require("@manuscripts/transform");
|
|
19
|
-
const react_1 = __importDefault(require("react"));
|
|
20
|
-
const utils_1 = require("../track-changes/utils");
|
|
21
|
-
const AuthorsModals_1 = require("./AuthorsModals");
|
|
22
|
-
class AuthorsModalContainer extends react_1.default.Component {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
this.state = {
|
|
26
|
-
isRemoveAuthorOpen: false,
|
|
27
|
-
};
|
|
28
|
-
this.createContributorRole = async (name) => {
|
|
29
|
-
const contributorRole = (0, transform_1.buildContributorRole)(name);
|
|
30
|
-
return this.props.saveTrackModel(contributorRole);
|
|
31
|
-
};
|
|
32
|
-
this.handleRemoveAuthor = () => this.setState({ isRemoveAuthorOpen: !this.state.isRemoveAuthorOpen });
|
|
33
|
-
this.removeAuthor = async (author) => {
|
|
34
|
-
await this.props.removeAuthor(author);
|
|
35
|
-
this.handleRemoveAuthor();
|
|
36
|
-
};
|
|
37
|
-
this.handleSaveAuthor = async (values) => {
|
|
38
|
-
await this.props.saveTrackModel({
|
|
39
|
-
objectType: json_schema_1.ObjectTypes.Contributor,
|
|
40
|
-
...values,
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
this.addAuthorAffiliation = async (affiliation) => {
|
|
44
|
-
const selectedAuthor = this.getSelectedAuthor();
|
|
45
|
-
if (!selectedAuthor) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
let affiliationObj;
|
|
49
|
-
this.props.affiliations.forEach((aff) => {
|
|
50
|
-
if (affiliation.startsWith(aff._id)) {
|
|
51
|
-
affiliationObj = aff;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
if (!affiliationObj) {
|
|
55
|
-
affiliationObj = await this.props.saveTrackModel((0, transform_1.buildAffiliation)(affiliation));
|
|
56
|
-
}
|
|
57
|
-
const author = {
|
|
58
|
-
...selectedAuthor,
|
|
59
|
-
affiliations: (selectedAuthor.affiliations || []).concat(affiliationObj._id),
|
|
60
|
-
};
|
|
61
|
-
await this.props.saveTrackModel(author);
|
|
62
|
-
};
|
|
63
|
-
this.removeAuthorAffiliation = async (affiliation) => {
|
|
64
|
-
const selectedAuthor = this.getSelectedAuthor();
|
|
65
|
-
if (!selectedAuthor) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const nextAuthor = {
|
|
69
|
-
...selectedAuthor,
|
|
70
|
-
affiliations: (selectedAuthor.affiliations || []).filter((aff) => aff !== affiliation._id),
|
|
71
|
-
};
|
|
72
|
-
console.log(nextAuthor);
|
|
73
|
-
await this.props.saveTrackModel(nextAuthor);
|
|
74
|
-
};
|
|
75
|
-
this.updateAffiliation = async (affiliation) => {
|
|
76
|
-
await this.props.saveTrackModel(affiliation);
|
|
77
|
-
};
|
|
78
|
-
this.getSelectedAuthor = () => {
|
|
79
|
-
const sel = this.props.authors.find((author) => (0, utils_1.stripTracked)(author._id) ===
|
|
80
|
-
(0, utils_1.stripTracked)(this.props.selectedAuthor || '')) || null;
|
|
81
|
-
return sel;
|
|
82
|
-
};
|
|
83
|
-
this.handleDrop = (oldIndex, newIndex) => {
|
|
84
|
-
this.props.handleDrop(this.props.authors, oldIndex, newIndex);
|
|
85
|
-
};
|
|
86
|
-
this.createEmptyAuthor = async () => {
|
|
87
|
-
const authorInfo = (0, transform_1.buildContributor)((0, transform_1.buildBibliographicName)({ given: '', family: '' }), 'author', this.props.authors.length + 1);
|
|
88
|
-
const author = await this.props.saveTrackModel(authorInfo);
|
|
89
|
-
this.props.selectAuthor(author);
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
render() {
|
|
93
|
-
const { isRemoveAuthorOpen } = this.state;
|
|
94
|
-
const { authors, authorAffiliations, affiliations, selectAuthor, contributorRoles, } = this.props;
|
|
95
|
-
return (react_1.default.createElement(AuthorsModals_1.AuthorsModal, { "data-cy": "authors-editing-modal", authors: authors, authorAffiliations: authorAffiliations, affiliations: affiliations, selectedAuthor: this.getSelectedAuthor(), isRemoveAuthorOpen: isRemoveAuthorOpen, addAuthorAffiliation: this.addAuthorAffiliation, removeAuthorAffiliation: this.removeAuthorAffiliation, updateAffiliation: this.updateAffiliation, handleDrop: this.handleDrop, handleSaveAuthor: this.handleSaveAuthor, openAddAuthors: this.createEmptyAuthor, selectAuthor: selectAuthor, removeAuthor: this.removeAuthor, handleRemoveAuthor: this.handleRemoveAuthor, contributorRoles: contributorRoles, createContributorRole: this.createContributorRole }));
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
exports.default = AuthorsModalContainer;
|
|
99
|
-
//# sourceMappingURL=AuthorsModalContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorsModalContainer.js","sourceRoot":"","sources":["../../../../src/components/metadata/AuthorsModalContainer.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;AAEH,0DAOiC;AAEjC,sDAM+B;AAC/B,kDAAyB;AAGzB,kDAAqD;AACrD,mDAA8C;AA8B9C,MAAM,qBAAsB,SAAQ,eAAK,CAAC,SAAuB;IAAjE;;QACS,UAAK,GAAG;YACb,kBAAkB,EAAE,KAAK;SAC1B,CAAA;QAmCO,0BAAqB,GAAG,KAAK,EACnC,IAAY,EACc,EAAE;YAC5B,MAAM,eAAe,GAAG,IAAA,gCAAoB,EAAC,IAAI,CAAC,CAAA;YAElD,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,CAAA;QACnD,CAAC,CAAA;QAEO,uBAAkB,GAAG,GAAG,EAAE,CAChC,IAAI,CAAC,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAA;QAE/D,iBAAY,GAAG,KAAK,EAAE,MAAmB,EAAE,EAAE;YACnD,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;YAErC,IAAI,CAAC,kBAAkB,EAAE,C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CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;QACjC,CAAC,CAAA;IACH,CAAC;IAzIQ,MAAM;QACX,MAAM,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QACzC,MAAM,EACJ,OAAO,EACP,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,GAAG,IAAI,CAAC,KAAK,CAAA;QAEd,OAAO,CACL,8BAAC,4BAAY,eACH,uBAAuB,EAC/B,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,IAAI,CAAC,iBAAiB,EAAE,EACxC,kBAAkB,EAAE,kBAAkB,EACtC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,EAC/C,uBAAuB,EAAE,IAAI,CAAC,uBAAuB,EACrD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EACzC,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EACvC,cAAc,EAAE,IAAI,CAAC,iBAAiB,EACtC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,EAC3C,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,GACjD,CACH,CAAA;IACH,CAAC;CA0GF;AAED,kBAAe,qBAAqB,CAAA"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
4
|
-
*
|
|
5
|
-
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
6
|
-
*
|
|
7
|
-
* The Original Code is manuscripts-frontend.
|
|
8
|
-
*
|
|
9
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
10
|
-
*
|
|
11
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
12
|
-
*/
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.AddAuthorsModal = exports.AuthorsModal = exports.ScrollableModalMain = void 0;
|
|
18
|
-
const react_1 = __importDefault(require("react"));
|
|
19
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
20
|
-
const Sidebar_1 = require("../Sidebar");
|
|
21
|
-
const AddAuthorsSidebar_1 = __importDefault(require("./AddAuthorsSidebar"));
|
|
22
|
-
const AuthorFormContainer_1 = require("./AuthorFormContainer");
|
|
23
|
-
const AuthorsPage_1 = require("./AuthorsPage");
|
|
24
|
-
const AuthorsSidebar_1 = __importDefault(require("./AuthorsSidebar"));
|
|
25
|
-
exports.ScrollableModalMain = (0, styled_components_1.default)(Sidebar_1.StyledModalMain) `
|
|
26
|
-
overflow-y: auto;
|
|
27
|
-
`;
|
|
28
|
-
const AuthorsModal = ({ authors, authorAffiliations, affiliations, removeAuthor, selectAuthor, selectedAuthor, openAddAuthors, handleSaveAuthor, addAuthorAffiliation, removeAuthorAffiliation, updateAffiliation, handleDrop, isRemoveAuthorOpen, handleRemoveAuthor, contributorRoles, createContributorRole, }) => (react_1.default.createElement(Sidebar_1.ModalBody, null,
|
|
29
|
-
react_1.default.createElement(AuthorsSidebar_1.default, { authors: authors, authorAffiliations: authorAffiliations, selectAuthor: selectAuthor, selectedAuthor: selectedAuthor, openAddAuthors: openAddAuthors, handleDrop: handleDrop }),
|
|
30
|
-
react_1.default.createElement(exports.ScrollableModalMain, null, selectedAuthor ? (react_1.default.createElement(AuthorFormContainer_1.AuthorFormContainer, { author: selectedAuthor, affiliations: affiliations, authorAffiliations: authorAffiliations.get(selectedAuthor._id), handleSave: handleSaveAuthor, addAuthorAffiliation: addAuthorAffiliation, removeAuthorAffiliation: removeAuthorAffiliation, updateAffiliation: updateAffiliation, isRemoveAuthorOpen: isRemoveAuthorOpen, handleRemoveAuthor: handleRemoveAuthor, removeAuthor: removeAuthor, contributorRoles: contributorRoles, createContributorRole: createContributorRole })) : (react_1.default.createElement(AuthorsPage_1.AuthorDetailsPage, null)))));
|
|
31
|
-
exports.AuthorsModal = AuthorsModal;
|
|
32
|
-
const AddAuthorsModal = ({ nonAuthors, authors, addedAuthors, numberOfAddedAuthors, searchResults, searchText, createAuthor, handleAddingDoneCancel, handleSearchChange, isCreateAuthorOpen, handleCreateAuthor, }) => (react_1.default.createElement(Sidebar_1.ModalBody, null,
|
|
33
|
-
react_1.default.createElement(AddAuthorsSidebar_1.default, { authors: authors, nonAuthors: nonAuthors, numberOfAddedAuthors: numberOfAddedAuthors, searchText: searchText, addedAuthors: addedAuthors, handleDoneCancel: handleAddingDoneCancel, createAuthor: createAuthor, handleSearchChange: handleSearchChange, searchResults: searchResults, isCreateAuthorOpen: isCreateAuthorOpen, handleCreateAuthor: handleCreateAuthor }),
|
|
34
|
-
react_1.default.createElement(Sidebar_1.StyledModalMain, null,
|
|
35
|
-
react_1.default.createElement(AuthorsPage_1.AddAuthorsPage, { addedAuthorsCount: numberOfAddedAuthors }))));
|
|
36
|
-
exports.AddAuthorsModal = AddAuthorsModal;
|
|
37
|
-
//# sourceMappingURL=AuthorsModals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorsModals.js","sourceRoot":"","s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tB,CACmB,CACZ,CACb,CAAA;AAlDY,QAAA,YAAY,gBAkDxB;AAqBM,MAAM,eAAe,GAA6C,CAAC,EACxE,UAAU,EACV,OAAO,EACP,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,GACnB,EAAE,EAAE,CAAC,CACJ,8BAAC,mBAAS;IACR,8BAAC,2BAAiB,IAChB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,oBAAoB,EAAE,oBAAoB,EAC1C,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,sBAAsB,EACxC,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,kBAAkB,EAAE,kBAAkB,GACtC;IACF,8BAAC,yBAAe;QACd,8BAAC,4BAAc,IAAC,iBAAiB,EAAE,oBAAoB,GAAI,CAC3C,CACR,CACb,CAAA;AA/BY,QAAA,eAAe,mBA+B3B"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
4
|
-
*
|
|
5
|
-
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
6
|
-
*
|
|
7
|
-
* The Original Code is manuscripts-frontend.
|
|
8
|
-
*
|
|
9
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
10
|
-
*
|
|
11
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
12
|
-
*/
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.AuthorDetailsPage = exports.AddAuthorsPage = void 0;
|
|
18
|
-
const AddedIcon_1 = __importDefault(require("@manuscripts/assets/react/AddedIcon"));
|
|
19
|
-
const AuthorPlaceholder_1 = __importDefault(require("@manuscripts/assets/react/AuthorPlaceholder"));
|
|
20
|
-
const ContributorDetailsPlaceholder_1 = __importDefault(require("@manuscripts/assets/react/ContributorDetailsPlaceholder"));
|
|
21
|
-
const react_1 = __importDefault(require("react"));
|
|
22
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
23
|
-
const AddAuthorsMessage = () => (react_1.default.createElement("span", null, "Add authors to your author list from your collaborators, or invite new ones"));
|
|
24
|
-
const SelectAuthorMessage = () => (react_1.default.createElement("span", null, "Select an author from the list to display their details here."));
|
|
25
|
-
const AddedAuthorsMessage = ({ addedCount }) => react_1.default.createElement("span", null, "Authors added");
|
|
26
|
-
const OuterContainer = styled_components_1.default.div `
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
align-items: center;
|
|
30
|
-
justify-content: center;
|
|
31
|
-
height: 100%;
|
|
32
|
-
overflow-y: auto;
|
|
33
|
-
`;
|
|
34
|
-
const InnerContainer = styled_components_1.default.div `
|
|
35
|
-
text-align: center;
|
|
36
|
-
max-width: 480px;
|
|
37
|
-
font-size: ${(props) => props.theme.font.size.xlarge};
|
|
38
|
-
line-height: ${(props) => props.theme.font.lineHeight.large};
|
|
39
|
-
`;
|
|
40
|
-
const Placeholder = styled_components_1.default.div `
|
|
41
|
-
display: flex;
|
|
42
|
-
justify-content: center;
|
|
43
|
-
margin-bottom: ${(props) => props.theme.grid.unit * 5}px;
|
|
44
|
-
`;
|
|
45
|
-
const Action = styled_components_1.default.div `
|
|
46
|
-
display: flex;
|
|
47
|
-
align-items: center;
|
|
48
|
-
justify-content: center;
|
|
49
|
-
font-size: ${(props) => props.theme.font.size.xlarge};
|
|
50
|
-
font-weight: ${(props) => props.theme.font.weight.medium};
|
|
51
|
-
letter-spacing: -0.5px;
|
|
52
|
-
`;
|
|
53
|
-
const Message = styled_components_1.default.div `
|
|
54
|
-
max-width: 400px;
|
|
55
|
-
font-size: ${(props) => props.theme.font.size.xlarge};
|
|
56
|
-
margin-top: ${(props) => props.theme.grid.unit * 6}px;
|
|
57
|
-
font-weight: ${(props) => props.theme.font.weight.light};
|
|
58
|
-
color: ${(props) => props.theme.colors.text.secondary};
|
|
59
|
-
|
|
60
|
-
@media (max-width: 850px) {
|
|
61
|
-
margin-right: ${(props) => props.theme.grid.unit * 5}px;
|
|
62
|
-
margin-left: ${(props) => props.theme.grid.unit * 5}px;
|
|
63
|
-
max-width: 350px;
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
const AddedMessage = (0, styled_components_1.default)(Message) `
|
|
67
|
-
margin-top: 2px;
|
|
68
|
-
`;
|
|
69
|
-
const IconContainer = styled_components_1.default.div `
|
|
70
|
-
display: flex;
|
|
71
|
-
align-self: center;
|
|
72
|
-
padding-right: 5px;
|
|
73
|
-
`;
|
|
74
|
-
const MessageContainer = styled_components_1.default.div `
|
|
75
|
-
display: flex;
|
|
76
|
-
justify-content: center;
|
|
77
|
-
`;
|
|
78
|
-
const AddAuthorsPage = ({ addedAuthorsCount, }) => (react_1.default.createElement(OuterContainer, null,
|
|
79
|
-
react_1.default.createElement(InnerContainer, null,
|
|
80
|
-
react_1.default.createElement(Placeholder, null,
|
|
81
|
-
react_1.default.createElement(AuthorPlaceholder_1.default, null)),
|
|
82
|
-
addedAuthorsCount ? (react_1.default.createElement(MessageContainer, { "data-cy": 'add-author-message' },
|
|
83
|
-
react_1.default.createElement(IconContainer, null,
|
|
84
|
-
react_1.default.createElement(AddedIcon_1.default, null)),
|
|
85
|
-
react_1.default.createElement(AddedMessage, null,
|
|
86
|
-
react_1.default.createElement(AddedAuthorsMessage, { addedCount: addedAuthorsCount })))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
87
|
-
react_1.default.createElement(Action, null, "Add Author"),
|
|
88
|
-
react_1.default.createElement(Message, null,
|
|
89
|
-
react_1.default.createElement(AddAuthorsMessage, null)))))));
|
|
90
|
-
exports.AddAuthorsPage = AddAuthorsPage;
|
|
91
|
-
const AuthorDetailsPage = () => (react_1.default.createElement(OuterContainer, { "data-cy": 'author-details' },
|
|
92
|
-
react_1.default.createElement(InnerContainer, null,
|
|
93
|
-
react_1.default.createElement(Placeholder, null,
|
|
94
|
-
react_1.default.createElement(ContributorDetailsPlaceholder_1.default, null)),
|
|
95
|
-
react_1.default.createElement(react_1.default.Fragment, null,
|
|
96
|
-
react_1.default.createElement(Action, null, "Author Details"),
|
|
97
|
-
react_1.default.createElement(Message, null,
|
|
98
|
-
react_1.default.createElement(SelectAuthorMessage, null))))));
|
|
99
|
-
exports.AuthorDetailsPage = AuthorDetailsPage;
|
|
100
|
-
//# sourceMappingURL=AuthorsPage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorsPage.js","sourceRoot":"","sources":["../../../../src/components/metadata/AuthorsPage.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;AAEH,oFAA2D;AAC3D,oGAA2E;AAC3E,4HAAwF;AACxF,kDAAyB;AACzB,0EAAsC;AAEtC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,CAC9B,0HAEO,CACR,CAAA;AACD,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,CAChC,4GAA0E,CAC3E,CAAA;AAED,MAAM,mBAAmB,GAEpB,CAAC,EAAE,UAAU,EAAE,EAAE,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0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
|
4
|
-
*
|
|
5
|
-
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
|
6
|
-
*
|
|
7
|
-
* The Original Code is manuscripts-frontend.
|
|
8
|
-
*
|
|
9
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
10
|
-
*
|
|
11
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
12
|
-
*/
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const style_guide_1 = require("@manuscripts/style-guide");
|
|
18
|
-
const react_1 = __importDefault(require("react"));
|
|
19
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
20
|
-
const AddButton_1 = require("../AddButton");
|
|
21
|
-
const Sidebar_1 = require("../Sidebar");
|
|
22
|
-
const SidebarAction = styled_components_1.default.div `
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
margin-bottom: ${(props) => props.theme.grid.unit * 4}px;
|
|
26
|
-
`;
|
|
27
|
-
const AuthorsSidebar = ({ openAddAuthors, authors, selectAuthor, handleDrop, selectedAuthor, }) => (react_1.default.createElement(Sidebar_1.ModalSidebar, { "data-cy": 'authors-sidebar' },
|
|
28
|
-
react_1.default.createElement(Sidebar_1.SidebarHeader, { title: 'Authors' }),
|
|
29
|
-
react_1.default.createElement(Sidebar_1.SidebarContent, null,
|
|
30
|
-
react_1.default.createElement(SidebarAction, null,
|
|
31
|
-
react_1.default.createElement(AddButton_1.AddButton, { action: openAddAuthors, size: 'medium', title: 'New Author' })),
|
|
32
|
-
react_1.default.createElement(style_guide_1.AuthorsDND, { authors: authors, selectAuthor: selectAuthor, selectedAuthor: selectedAuthor, handleDrop: handleDrop }))));
|
|
33
|
-
exports.default = AuthorsSidebar;
|
|
34
|
-
//# sourceMappingURL=AuthorsSidebar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorsSidebar.js","sourceRoot":"","sources":["../../../../src/components/metadata/AuthorsSidebar.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;AAGH,0DAAwE;AACxE,kDAAyB;AACzB,0EAAsC;AAEtC,4CAAwC;AACxC,wCAAwE;AAExE,MAAM,aAAa,GAAG,2BAAM,CAAC,GAAG,CAAA;;;mBAGb,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;CACtD,CAAA;AAWD,MAAM,cAAc,GAAmC,CAAC,EACtD,cAAc,EACd,OAAO,EACP,YAAY,EACZ,UAAU,EACV,cAAc,GACf,EAAE,EAAE,CAAC,CACJ,8BAAC,sBAAY,eAAU,iBAAiB;IACtC,8BAAC,uBAAa,IAAC,KAAK,EAAE,SAAS,GAAI;IAEnC,8BAAC,wBAAc;QACb,8BAAC,aAAa;YACZ,8BAAC,qBAAS,IACR,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,YAAY,GACnB,CACY;QAChB,8BAAC,wBAAU,IACT,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,GACtB,CACa,CACJ,CAChB,CAAA;AAED,kBAAe,cAAc,CAAA"}
|