@manuscripts/article-editor 1.10.5 → 1.10.6-LEAN-3301-2
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/postgres-data/buildUtilities.js +0 -1
- package/dist/cjs/postgres-data/buildUtilities.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/postgres-data/buildUtilities.js +0 -1
- package/dist/es/postgres-data/buildUtilities.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,64 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* 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.
|
|
3
|
-
*
|
|
4
|
-
* 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.
|
|
5
|
-
*
|
|
6
|
-
* The Original Code is manuscripts-frontend.
|
|
7
|
-
*
|
|
8
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
-
*
|
|
10
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { AddAuthorsModal } from './AuthorsModals';
|
|
14
|
-
export class AddAuthorsModalContainer extends React.Component {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments);
|
|
17
|
-
this.state = {
|
|
18
|
-
isCreateAuthorOpen: false,
|
|
19
|
-
searchText: '',
|
|
20
|
-
searchResults: [],
|
|
21
|
-
};
|
|
22
|
-
this.handleCreateAuthor = () => {
|
|
23
|
-
if (this.state.isCreateAuthorOpen) {
|
|
24
|
-
this.setState({
|
|
25
|
-
searchText: '',
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
this.setState({
|
|
29
|
-
isCreateAuthorOpen: !this.state.isCreateAuthorOpen,
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
this.handleSearchChange = (event) => {
|
|
33
|
-
this.setState({ searchText: event.currentTarget.value });
|
|
34
|
-
this.search(event.currentTarget.value);
|
|
35
|
-
};
|
|
36
|
-
this.search = (searchText) => {
|
|
37
|
-
const { nonAuthors } = this.props;
|
|
38
|
-
if (!nonAuthors || !searchText) {
|
|
39
|
-
return this.setState({ searchResults: [] });
|
|
40
|
-
}
|
|
41
|
-
searchText = searchText.toLowerCase();
|
|
42
|
-
const searchResults = nonAuthors.filter((person) => {
|
|
43
|
-
if (searchText.includes('@')) {
|
|
44
|
-
return person.email && person.email.toLowerCase().includes(searchText);
|
|
45
|
-
}
|
|
46
|
-
const personName = [
|
|
47
|
-
person.bibliographicName.given,
|
|
48
|
-
person.bibliographicName.family,
|
|
49
|
-
]
|
|
50
|
-
.filter((part) => part)
|
|
51
|
-
.join(' ')
|
|
52
|
-
.toLowerCase();
|
|
53
|
-
return personName && personName.includes(searchText);
|
|
54
|
-
});
|
|
55
|
-
this.setState({ searchResults });
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
render() {
|
|
59
|
-
const { isCreateAuthorOpen, searchResults, searchText } = this.state;
|
|
60
|
-
const { numberOfAddedAuthors, createAuthor, addedAuthors, authors, handleAddingDoneCancel, nonAuthors, } = this.props;
|
|
61
|
-
return (React.createElement(AddAuthorsModal, { authors: authors, nonAuthors: nonAuthors, addedAuthors: addedAuthors, numberOfAddedAuthors: numberOfAddedAuthors, isCreateAuthorOpen: isCreateAuthorOpen, searchResults: searchResults, searchText: searchText, createAuthor: createAuthor, handleAddingDoneCancel: handleAddingDoneCancel, handleSearchChange: this.handleSearchChange, handleCreateAuthor: this.handleCreateAuthor }));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=AddAuthorsModalContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AddAuthorsModalContainer.js","sourceRoot":"","sources":["../../../../src/components/metadata/AddAuthorsModalContainer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAsBjD,MAAM,OAAO,wBAAyB,SAAQ,KAAK,CAAC,SAAuB;IAA3E;;QACS,UAAK,GAAG;YACb,kBAAkB,EAAE,KAAK;YACzB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE;SAClB,CAAA;QA+BO,uBAAkB,GAAG,GAAG,EAAE;YAChC,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE;gBACjC,IAAI,CAAC,QAAQ,CAAC;oBACZ,UAAU,EAAE,EAAE;iBACf,CAAC,CAAA;aACH;YACD,IAAI,CAAC,QAAQ,CAAC;gBACZ,kBAAkB,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB;aACnD,CAAC,CAAA;QACJ,CAAC,CAAA;QAEO,uBAAkB,GAAG,CAAC,KAAwC,EAAE,EAAE;YACxE,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,CAAA;YAExD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QACxC,CAAC,CAAA;QAEO,WAAM,GAAG,CAAC,UAAkB,EAAE,EAAE;YACtC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;YAEjC,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,EAAE;gBAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC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IAAI,CAAC,kBAAkB,EAC3C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,GAC3C,CACH,CAAA;IACH,CAAC;CA8CF"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* 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.
|
|
3
|
-
*
|
|
4
|
-
* 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.
|
|
5
|
-
*
|
|
6
|
-
* The Original Code is manuscripts-frontend.
|
|
7
|
-
*
|
|
8
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
-
*
|
|
10
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import { Avatar } from '@manuscripts/style-guide';
|
|
13
|
-
import React from 'react';
|
|
14
|
-
import styled from 'styled-components';
|
|
15
|
-
import { ModalSidebar, SidebarContent, SidebarHeader, SidebarPersonContainer, SidebarSearch, } from '../Sidebar';
|
|
16
|
-
import AddAuthorButton from './AddAuthorButton';
|
|
17
|
-
import CreateAuthorPageContainer from './CreateAuthorPageContainer';
|
|
18
|
-
import SearchAuthorsSidebar from './SearchAuthorsSidebar';
|
|
19
|
-
const PersonInitial = styled.span `
|
|
20
|
-
margin-right: ${(props) => props.theme.grid.unit}px;
|
|
21
|
-
font-weight: ${(props) => props.theme.font.weight.light};
|
|
22
|
-
`;
|
|
23
|
-
const PersonName = styled.div `
|
|
24
|
-
box-sizing: border-box;
|
|
25
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
26
|
-
font-size: ${(props) => props.theme.font.size.xlarge};
|
|
27
|
-
font-weight: ${(props) => props.theme.font.weight.medium};
|
|
28
|
-
max-width: 138px;
|
|
29
|
-
overflow: hidden;
|
|
30
|
-
text-overflow: ellipsis;
|
|
31
|
-
white-space: nowrap;
|
|
32
|
-
width: 100%;
|
|
33
|
-
`;
|
|
34
|
-
const PersonData = styled.div `
|
|
35
|
-
margin-left: ${(props) => props.theme.grid.unit * 2}px;
|
|
36
|
-
`;
|
|
37
|
-
const UserDataContainer = styled.div `
|
|
38
|
-
align-items: center;
|
|
39
|
-
display: flex;
|
|
40
|
-
flex: 1;
|
|
41
|
-
margin-right: 16px;
|
|
42
|
-
overflow: hidden;
|
|
43
|
-
`;
|
|
44
|
-
const SearchContainer = styled.div `
|
|
45
|
-
margin-bottom: ${(props) => props.theme.grid.unit * 2}px;
|
|
46
|
-
`;
|
|
47
|
-
const AddAuthorsSidebar = ({ nonAuthors, numberOfAddedAuthors, searchText, addedAuthors, handleDoneCancel, createAuthor, handleSearchChange, searchResults, authors, isCreateAuthorOpen, handleCreateAuthor, }) => {
|
|
48
|
-
return (React.createElement(ModalSidebar, { "data-cy": 'add-author-sidebar' },
|
|
49
|
-
React.createElement(SidebarHeader, { action: handleDoneCancel, isCancel: !numberOfAddedAuthors, title: 'Add Author' }),
|
|
50
|
-
React.createElement(SearchContainer, null,
|
|
51
|
-
React.createElement(SidebarSearch, { autoFocus: true, handleSearchChange: handleSearchChange, maxLength: 100, placeholder: 'Search name/email', value: searchText })),
|
|
52
|
-
searchText === '' ? (React.createElement(SidebarContent, { "data-cy": "non-authors-list" }, nonAuthors.map((person) => (React.createElement(SidebarPersonContainer, { key: person._id },
|
|
53
|
-
React.createElement(UserDataContainer, null,
|
|
54
|
-
React.createElement(Avatar, { src: person.avatar, size: 45 }),
|
|
55
|
-
React.createElement(PersonData, null,
|
|
56
|
-
React.createElement(PersonName, null,
|
|
57
|
-
React.createElement(PersonInitial, null, person.bibliographicName.given),
|
|
58
|
-
person.bibliographicName.family))),
|
|
59
|
-
React.createElement(AddAuthorButton, { person: person, isSelected: addedAuthors.includes(person.userID), createAuthor: createAuthor, authors: authors })))))) : isCreateAuthorOpen ? (React.createElement(CreateAuthorPageContainer, { "data-cy": "create-author-dialog", authors: authors, createAuthor: createAuthor, isOpen: isCreateAuthorOpen, handleCancel: handleCreateAuthor, searchText: searchText })) : (React.createElement(SearchAuthorsSidebar, { "data-cy": "search-authors-sidebar", addedAuthors: addedAuthors, createAuthor: createAuthor, searchResults: searchResults, authors: authors }))));
|
|
60
|
-
};
|
|
61
|
-
export default AddAuthorsSidebar;
|
|
62
|
-
//# sourceMappingURL=AddAuthorsSidebar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AddAuthorsSidebar.js","sourceRoot":"","sources":["../../../../src/components/metadata/AddAuthorsSidebar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAEjD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,aAAa,GACd,MAAM,YAAY,CAAA;AACnB,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAC/C,OAAO,yBAAyB,MAAM,6BAA6B,CAAA;AACnE,OAAO,oBAAoB,MAAM,wBAAwB,CAAA;AAEzD,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAA;kBACf,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI;iBACjC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;CACxD,CAAA;AAED,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;;WAElB,CAAC,KAAK,E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AkB,IACvC,UAAU,CAAC,GAAG,CAAC,CAAC,MAA6B,EAAE,EAAE,CAAC,CACjD,oBAAC,sBAAsB,IAAC,GAAG,EAAE,MAAM,CAAC,GAAG;YACrC,oBAAC,iBAAiB;gBAChB,oBAAC,MAAM,IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,GAAI;gBACxC,oBAAC,UAAU;oBACT,oBAAC,UAAU;wBACT,oBAAC,aAAa,QACX,MAAM,CAAC,iBAAiB,CAAC,KAAK,CACjB;wBACf,MAAM,CAAC,iBAAiB,CAAC,MAAM,CACrB,CACF,CACK;YACpB,oBAAC,eAAe,IACd,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAChD,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,GAChB,CACqB,CAC1B,CAAC,CACa,CAClB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CACvB,oBAAC,yBAAyB,eAChB,sBAAsB,EAC9B,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,YAAY,EAAE,kBAAkB,EAChC,UAAU,EAAE,UAAU,GACtB,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,oBAAoB,eACX,wBAAwB,EAChC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,GAChB,CACH,CACY,CAChB,CAAA;AACH,CAAC,CAAA;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* 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.
|
|
3
|
-
*
|
|
4
|
-
* 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.
|
|
5
|
-
*
|
|
6
|
-
* The Original Code is manuscripts-frontend.
|
|
7
|
-
*
|
|
8
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
-
*
|
|
10
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import { AffiliationsEditor, AuthorForm, } from '@manuscripts/style-guide';
|
|
13
|
-
import React from 'react';
|
|
14
|
-
export const AuthorFormContainer = ({ author, affiliations, authorAffiliations, handleSave, addAuthorAffiliation, removeAuthorAffiliation, updateAffiliation, removeAuthor, isRemoveAuthorOpen, handleRemoveAuthor, contributorRoles, createContributorRole, }) => (React.createElement(React.Fragment, null,
|
|
15
|
-
React.createElement(AuthorForm, { author: author, handleSave: handleSave, isRemoveAuthorOpen: isRemoveAuthorOpen, removeAuthor: removeAuthor, handleRemoveAuthor: handleRemoveAuthor, contributorRoles: contributorRoles, createContributorRole: createContributorRole }),
|
|
16
|
-
React.createElement(AffiliationsEditor, { affiliations: affiliations, authorAffiliations: authorAffiliations, addAuthorAffiliation: addAuthorAffiliation, removeAuthorAffiliation: removeAuthorAffiliation, updateAffiliation: updateAffiliation })));
|
|
17
|
-
//# sourceMappingURL=AuthorFormContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorFormContainer.js","sourceRoot":"","sources":["../../../../src/components/metadata/AuthorFormContainer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,OAAO,EACL,kBAAkB,EAElB,UAAU,GAEX,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AAmBzB,MAAM,CAAC,MAAM,mBAAmB,GAAyC,CAAC,EACxE,MAAM,EACN,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GACtB,EAAE,EAAE,CAAC,CACJ,oBAAC,KAAK,CAAC,QAAQ;IACb,oBAAC,UAAU,IACT,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,kBAAkB,EACtC,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,qBAAqB,GAC5C;IACF,oBAAC,kBAAkB,IACjB,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,kBAAkB,EACtC,oBAAoB,EAAE,oBAAoB,EAC1C,uBAAuB,EAAE,uBAAuB,EAChD,iBAAiB,EAAE,iBAAiB,GACpC,CACa,CAClB,CAAA"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* 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.
|
|
3
|
-
*
|
|
4
|
-
* 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.
|
|
5
|
-
*
|
|
6
|
-
* The Original Code is manuscripts-frontend.
|
|
7
|
-
*
|
|
8
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
-
*
|
|
10
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import { AlertMessage, AlertMessageType, FormError, PrimaryButton, TextField, TextFieldGroupContainer, } from '@manuscripts/style-guide';
|
|
13
|
-
import { Field, Form, Formik, } from 'formik';
|
|
14
|
-
import { StatusCodes } from 'http-status-codes';
|
|
15
|
-
import React from 'react';
|
|
16
|
-
import styled from 'styled-components';
|
|
17
|
-
import { ProjectRole } from '../../lib/roles';
|
|
18
|
-
import { RadioButton } from '../RadioButton';
|
|
19
|
-
const SendInvitationButton = styled(PrimaryButton) `
|
|
20
|
-
width: 100%;
|
|
21
|
-
`;
|
|
22
|
-
const RadioButtonsContainer = styled.div `
|
|
23
|
-
padding-top: ${(props) => props.theme.grid.unit * 6}px;
|
|
24
|
-
padding-bottom: ${(props) => props.theme.grid.unit * 6}px;
|
|
25
|
-
`;
|
|
26
|
-
const AlertMessageContainer = styled.div `
|
|
27
|
-
margin-bottom: ${(props) => props.theme.grid.unit * 2}px;
|
|
28
|
-
`;
|
|
29
|
-
const errorResponseMessage = (status) => {
|
|
30
|
-
switch (status) {
|
|
31
|
-
case StatusCodes.BAD_REQUEST:
|
|
32
|
-
return 'You are already a collaborator on this project.';
|
|
33
|
-
case StatusCodes.CONFLICT:
|
|
34
|
-
return 'The invited user is already a collaborator on this project.';
|
|
35
|
-
default:
|
|
36
|
-
return 'Sending invitation failed.';
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export class InvitationForm extends React.Component {
|
|
40
|
-
constructor() {
|
|
41
|
-
super(...arguments);
|
|
42
|
-
this.state = {
|
|
43
|
-
invitationSent: false,
|
|
44
|
-
};
|
|
45
|
-
this.initialValues = {
|
|
46
|
-
email: '',
|
|
47
|
-
name: '',
|
|
48
|
-
role: 'Writer',
|
|
49
|
-
};
|
|
50
|
-
this.dismissSuccessAlert = () => {
|
|
51
|
-
this.setState({
|
|
52
|
-
invitationSent: false,
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
render() {
|
|
57
|
-
const { allowSubmit, handleSubmit, invitationValues, tokenActions } = this.props;
|
|
58
|
-
const { invitationSent } = this.state;
|
|
59
|
-
return (React.createElement(Formik, { onSubmit: async (values, actions) => {
|
|
60
|
-
try {
|
|
61
|
-
await handleSubmit(values);
|
|
62
|
-
this.setState({ invitationSent: true });
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
const errors = {};
|
|
66
|
-
errors.submit = error.response
|
|
67
|
-
? errorResponseMessage(error.response.status)
|
|
68
|
-
: 'There was an error submitting the form.';
|
|
69
|
-
if (error.response &&
|
|
70
|
-
error.response.status === StatusCodes.UNAUTHORIZED) {
|
|
71
|
-
tokenActions.delete();
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
actions.setErrors(errors);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
finally {
|
|
78
|
-
actions.setSubmitting(false);
|
|
79
|
-
}
|
|
80
|
-
}, initialValues: invitationValues || this.initialValues, isInitialValid: true, validateOnChange: false, validateOnBlur: false }, ({ errors, isSubmitting, values, resetForm, }) => (React.createElement(Form, { noValidate: true },
|
|
81
|
-
errors.submit && (React.createElement(AlertMessage, { type: AlertMessageType.error, hideCloseButton: true },
|
|
82
|
-
errors.submit,
|
|
83
|
-
' ')),
|
|
84
|
-
!allowSubmit && (React.createElement(AlertMessageContainer, null,
|
|
85
|
-
React.createElement(AlertMessage, { type: AlertMessageType.info, hideCloseButton: true }, "Only project owners can invite others to the project."))),
|
|
86
|
-
invitationSent && (React.createElement(AlertMessageContainer, null,
|
|
87
|
-
React.createElement(AlertMessage, { type: AlertMessageType.success, hideCloseButton: true, dismissButton: {
|
|
88
|
-
text: 'OK',
|
|
89
|
-
action: () => {
|
|
90
|
-
this.dismissSuccessAlert();
|
|
91
|
-
resetForm();
|
|
92
|
-
},
|
|
93
|
-
} }, "Invitation was sent."))),
|
|
94
|
-
React.createElement(TextFieldGroupContainer, { errors: {
|
|
95
|
-
name: errors.name,
|
|
96
|
-
email: errors.email,
|
|
97
|
-
} },
|
|
98
|
-
React.createElement(Field, { name: 'name' }, ({ field }) => (React.createElement(TextField, { ...field, onFocus: this.dismissSuccessAlert, type: 'text', placeholder: 'name', required: true, error: errors.name, disabled: !allowSubmit }))),
|
|
99
|
-
React.createElement(Field, { name: 'email' }, ({ field }) => (React.createElement(TextField, { ...field, onFocus: this.dismissSuccessAlert, type: 'email', placeholder: 'email', required: true, error: errors.email, disabled: !allowSubmit })))),
|
|
100
|
-
React.createElement(RadioButtonsContainer, null,
|
|
101
|
-
React.createElement(Field, { name: 'role' }, ({ field }) => (React.createElement(RadioButton, { _id: 'owner', ...field, onFocus: this.dismissSuccessAlert, value: 'Owner', required: true, textHint: 'Can modify and delete project, invite and remove collaborators', checked: values.role === ProjectRole.owner, disabled: !allowSubmit }, "Owner"))),
|
|
102
|
-
React.createElement(Field, { name: 'role' }, ({ field }) => (React.createElement(RadioButton, { _id: 'writer', ...field, onFocus: this.dismissSuccessAlert, value: 'Writer', required: true, textHint: 'Can modify project contents', checked: values.role === ProjectRole.writer, disabled: !allowSubmit }, "Writer"))),
|
|
103
|
-
React.createElement(Field, { name: 'role' }, ({ field }) => (React.createElement(RadioButton, { _id: 'viewer', ...field, onFocus: this.dismissSuccessAlert, value: 'Viewer', required: true, textHint: 'Can only review projects without modifying it', checked: values.role === ProjectRole.viewer, disabled: !allowSubmit }, "Viewer"))),
|
|
104
|
-
errors.role && React.createElement(FormError, null, errors.role)),
|
|
105
|
-
React.createElement(SendInvitationButton, { type: "submit", disabled: isSubmitting || !allowSubmit }, "Send Invitation")))));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=AuthorInvitationForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorInvitationForm.js","sourceRoot":"","sources":["../../../../src/components/metadata/AuthorInvitationForm.tsx"],"names":[],"mappings":"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AAO,EAAE,IAAI,CAAC,mBAAmB,EACjC,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAE,+CAA+C,EACzD,OAAO,EAAE,MAAM,CAAC,IAAI,KAAK,WAAW,CAAC,MAAM,EAC3C,QAAQ,EAAE,CAAC,WAAW,aAGV,CACf,CACK;gBAEP,MAAM,CAAC,IAAI,IAAI,oBAAC,SAAS,QAAE,MAAM,CAAC,IAAI,CAAa,CAC9B;YAExB,oBAAC,oBAAoB,IACnB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,YAAY,IAAI,CAAC,WAAW,sBAGjB,CAClB,CACR,CACM,CACV,CAAA;IACH,CAAC;CAOF"}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* 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.
|
|
3
|
-
*
|
|
4
|
-
* 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.
|
|
5
|
-
*
|
|
6
|
-
* The Original Code is manuscripts-frontend.
|
|
7
|
-
*
|
|
8
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
-
*
|
|
10
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import { CloseButton, ModalContainer, ModalHeader, StyledModal, } from '@manuscripts/style-guide';
|
|
13
|
-
import { buildBibliographicName, buildContributor, } from '@manuscripts/transform';
|
|
14
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
15
|
-
import { getMetaData, reorderAuthors } from '../../lib/authors';
|
|
16
|
-
import { useStore } from '../../store';
|
|
17
|
-
import { AddAuthorsModalContainer } from './AddAuthorsModalContainer';
|
|
18
|
-
import AuthorsModalContainer from './AuthorsModalContainer';
|
|
19
|
-
const AuthorModalViews = () => {
|
|
20
|
-
const [store, dispatch] = useStore((store) => store);
|
|
21
|
-
const [state, setState] = useState({
|
|
22
|
-
expanded: true,
|
|
23
|
-
selectedAuthor: null,
|
|
24
|
-
addingAuthors: false,
|
|
25
|
-
nonAuthors: [],
|
|
26
|
-
numberOfAddedAuthors: 0,
|
|
27
|
-
addedAuthors: [],
|
|
28
|
-
});
|
|
29
|
-
const { saveTrackModel, collaboratorsProfiles, user, deleteTrackModel, trackModelMap, authorsPopupOn, } = store;
|
|
30
|
-
const stopEditing = () => {
|
|
31
|
-
setState((state) => ({
|
|
32
|
-
...state,
|
|
33
|
-
selectedAuthor: null,
|
|
34
|
-
addingAuthors: false,
|
|
35
|
-
isInvite: false,
|
|
36
|
-
}));
|
|
37
|
-
dispatch({ authorsPopupOn: false });
|
|
38
|
-
};
|
|
39
|
-
const createAuthor = async (priority, person, name) => {
|
|
40
|
-
if (name) {
|
|
41
|
-
const [given, ...family] = name.split(' ');
|
|
42
|
-
const bibName = buildBibliographicName({
|
|
43
|
-
given,
|
|
44
|
-
family: family.join(' '),
|
|
45
|
-
});
|
|
46
|
-
const author = buildContributor(bibName, 'author', priority);
|
|
47
|
-
await saveTrackModel(author);
|
|
48
|
-
setState((state) => ({
|
|
49
|
-
...state,
|
|
50
|
-
numberOfAddedAuthors: state.numberOfAddedAuthors + 1,
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
if (person) {
|
|
54
|
-
const author = buildContributor(person.bibliographicName, 'author', priority, person.userID);
|
|
55
|
-
const createdAuthor = await saveTrackModel(author);
|
|
56
|
-
setState((state) => ({
|
|
57
|
-
...state,
|
|
58
|
-
addedAuthors: state.addedAuthors.concat(author.userID),
|
|
59
|
-
numberOfAddedAuthors: state.numberOfAddedAuthors + 1,
|
|
60
|
-
}));
|
|
61
|
-
selectAuthor(createdAuthor);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const startEditing = useCallback(() => {
|
|
65
|
-
dispatch({ authorsPopupOn: true });
|
|
66
|
-
}, [dispatch]);
|
|
67
|
-
const selectAuthor = useCallback((author) => {
|
|
68
|
-
// TODO: make this switch without deselecting
|
|
69
|
-
setState((state) => ({
|
|
70
|
-
...state,
|
|
71
|
-
selectedAuthor: typeof author === 'string' ? author : author._id,
|
|
72
|
-
}));
|
|
73
|
-
}, []);
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
dispatch({ startEditing, selectAuthor });
|
|
76
|
-
}, [dispatch, startEditing, selectAuthor]);
|
|
77
|
-
const deselectAuthor = () => {
|
|
78
|
-
setState((state) => ({ ...state, selectedAuthor: null }));
|
|
79
|
-
};
|
|
80
|
-
const removeAuthor = async (author) => {
|
|
81
|
-
await deleteTrackModel(author._id);
|
|
82
|
-
deselectAuthor();
|
|
83
|
-
if (state.addedAuthors.includes(author.userID)) {
|
|
84
|
-
const index = state.addedAuthors.indexOf(author.userID);
|
|
85
|
-
state.addedAuthors.splice(index, 1);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
const handleAddingDoneCancel = () => setState((state) => ({
|
|
89
|
-
...state,
|
|
90
|
-
numberOfAddedAuthors: 0,
|
|
91
|
-
addingAuthors: false,
|
|
92
|
-
}));
|
|
93
|
-
const handleDrop = (authors, oldIndex, newIndex) => {
|
|
94
|
-
const reorderedAuthors = reorderAuthors(authors, oldIndex, newIndex);
|
|
95
|
-
Promise.all(reorderedAuthors.map((author, i) => {
|
|
96
|
-
author.priority = i;
|
|
97
|
-
return saveTrackModel(author);
|
|
98
|
-
}))
|
|
99
|
-
.then(() => {
|
|
100
|
-
setState((state) => ({ ...state, authorListError: '' }));
|
|
101
|
-
})
|
|
102
|
-
.catch(() => {
|
|
103
|
-
setState((state) => ({
|
|
104
|
-
...state,
|
|
105
|
-
authorListError: 'There was an error saving authors',
|
|
106
|
-
}));
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
const metaData = useMemo(() => {
|
|
110
|
-
const data = getMetaData(trackModelMap);
|
|
111
|
-
return data;
|
|
112
|
-
}, [trackModelMap]);
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
dispatch({
|
|
115
|
-
trackedAuthorsAndAffiliations: metaData?.authorsAndAffiliations,
|
|
116
|
-
});
|
|
117
|
-
}, [metaData, dispatch]);
|
|
118
|
-
const authorsAndAffiliations = metaData?.authorsAndAffiliations;
|
|
119
|
-
const contributorRoles = metaData?.contributorRoles || [];
|
|
120
|
-
if (!collaboratorsProfiles ||
|
|
121
|
-
!user ||
|
|
122
|
-
!authorsAndAffiliations ||
|
|
123
|
-
!contributorRoles) {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
return (React.createElement(StyledModal, { isOpen: !!authorsPopupOn, onRequestClose: stopEditing, shouldCloseOnOverlayClick: true },
|
|
127
|
-
React.createElement(ModalContainer, null,
|
|
128
|
-
React.createElement(ModalHeader, null,
|
|
129
|
-
React.createElement(CloseButton, { onClick: stopEditing, "data-cy": 'modal-close-button' })),
|
|
130
|
-
state.addingAuthors ? (React.createElement(AddAuthorsModalContainer, { ...state, handleAddingDoneCancel: handleAddingDoneCancel, createAuthor: createAuthor, authors: authorsAndAffiliations.authors })) : (React.createElement(AuthorsModalContainer, { ...state, createAuthor: createAuthor, selectAuthor: selectAuthor, removeAuthor: removeAuthor, saveTrackModel: saveTrackModel, handleDrop: handleDrop, authors: authorsAndAffiliations.authors, authorAffiliations: authorsAndAffiliations.authorAffiliations, affiliations: authorsAndAffiliations.affiliations, contributorRoles: contributorRoles })))));
|
|
131
|
-
};
|
|
132
|
-
export default AuthorModalViews;
|
|
133
|
-
//# sourceMappingURL=AuthorModalViews.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorModalVi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CAAA;IAC/D,MAAM,gBAAgB,GAAG,QAAQ,EAAE,gBAAgB,IAAI,EAAE,CAAA;IAEzD,IACE,CAAC,qBAAqB;QACtB,CAAC,IAAI;QACL,CAAC,sBAAsB;QACvB,CAAC,gBAAgB,EACjB;QACA,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,CACL,oBAAC,WAAW,IACV,MAAM,EAAE,CAAC,CAAC,cAAc,EACxB,cAAc,EAAE,WAAW,EAC3B,yBAAyB,EAAE,IAAI;QAE/B,oBAAC,cAAc;YACb,oBAAC,WAAW;gBACV,oBAAC,WAAW,IAAC,OAAO,EAAE,WAAW,aAAW,oBAAoB,GAAI,CACxD;YACb,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CACrB,oBAAC,wBAAwB,OACnB,KAAK,EACT,sBAAsB,EAAE,sBAAsB,EAC9C,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,sBAAsB,CAAC,OAAO,GACvC,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,qBAAqB,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,eAAe,gBAAgB,CAAA"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* 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.
|
|
3
|
-
*
|
|
4
|
-
* 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.
|
|
5
|
-
*
|
|
6
|
-
* The Original Code is manuscripts-frontend.
|
|
7
|
-
*
|
|
8
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
-
*
|
|
10
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
13
|
-
import { buildAffiliation, buildBibliographicName, buildContributor, buildContributorRole, } from '@manuscripts/transform';
|
|
14
|
-
import React from 'react';
|
|
15
|
-
import { stripTracked } from '../track-changes/utils';
|
|
16
|
-
import { AuthorsModal } from './AuthorsModals';
|
|
17
|
-
class AuthorsModalContainer extends React.Component {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.state = {
|
|
21
|
-
isRemoveAuthorOpen: false,
|
|
22
|
-
};
|
|
23
|
-
this.createContributorRole = async (name) => {
|
|
24
|
-
const contributorRole = buildContributorRole(name);
|
|
25
|
-
return this.props.saveTrackModel(contributorRole);
|
|
26
|
-
};
|
|
27
|
-
this.handleRemoveAuthor = () => this.setState({ isRemoveAuthorOpen: !this.state.isRemoveAuthorOpen });
|
|
28
|
-
this.removeAuthor = async (author) => {
|
|
29
|
-
await this.props.removeAuthor(author);
|
|
30
|
-
this.handleRemoveAuthor();
|
|
31
|
-
};
|
|
32
|
-
this.handleSaveAuthor = async (values) => {
|
|
33
|
-
await this.props.saveTrackModel({
|
|
34
|
-
objectType: ObjectTypes.Contributor,
|
|
35
|
-
...values,
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
this.addAuthorAffiliation = async (affiliation) => {
|
|
39
|
-
const selectedAuthor = this.getSelectedAuthor();
|
|
40
|
-
if (!selectedAuthor) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
let affiliationObj;
|
|
44
|
-
this.props.affiliations.forEach((aff) => {
|
|
45
|
-
if (affiliation.startsWith(aff._id)) {
|
|
46
|
-
affiliationObj = aff;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
if (!affiliationObj) {
|
|
50
|
-
affiliationObj = await this.props.saveTrackModel(buildAffiliation(affiliation));
|
|
51
|
-
}
|
|
52
|
-
const author = {
|
|
53
|
-
...selectedAuthor,
|
|
54
|
-
affiliations: (selectedAuthor.affiliations || []).concat(affiliationObj._id),
|
|
55
|
-
};
|
|
56
|
-
await this.props.saveTrackModel(author);
|
|
57
|
-
};
|
|
58
|
-
this.removeAuthorAffiliation = async (affiliation) => {
|
|
59
|
-
const selectedAuthor = this.getSelectedAuthor();
|
|
60
|
-
if (!selectedAuthor) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const nextAuthor = {
|
|
64
|
-
...selectedAuthor,
|
|
65
|
-
affiliations: (selectedAuthor.affiliations || []).filter((aff) => aff !== affiliation._id),
|
|
66
|
-
};
|
|
67
|
-
console.log(nextAuthor);
|
|
68
|
-
await this.props.saveTrackModel(nextAuthor);
|
|
69
|
-
};
|
|
70
|
-
this.updateAffiliation = async (affiliation) => {
|
|
71
|
-
await this.props.saveTrackModel(affiliation);
|
|
72
|
-
};
|
|
73
|
-
this.getSelectedAuthor = () => {
|
|
74
|
-
const sel = this.props.authors.find((author) => stripTracked(author._id) ===
|
|
75
|
-
stripTracked(this.props.selectedAuthor || '')) || null;
|
|
76
|
-
return sel;
|
|
77
|
-
};
|
|
78
|
-
this.handleDrop = (oldIndex, newIndex) => {
|
|
79
|
-
this.props.handleDrop(this.props.authors, oldIndex, newIndex);
|
|
80
|
-
};
|
|
81
|
-
this.createEmptyAuthor = async () => {
|
|
82
|
-
const authorInfo = buildContributor(buildBibliographicName({ given: '', family: '' }), 'author', this.props.authors.length + 1);
|
|
83
|
-
const author = await this.props.saveTrackModel(authorInfo);
|
|
84
|
-
this.props.selectAuthor(author);
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
render() {
|
|
88
|
-
const { isRemoveAuthorOpen } = this.state;
|
|
89
|
-
const { authors, authorAffiliations, affiliations, selectAuthor, contributorRoles, } = this.props;
|
|
90
|
-
return (React.createElement(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 }));
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
export default AuthorsModalContainer;
|
|
94
|
-
//# 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,OAAO,EAKL,WAAW,GAEZ,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAEL,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AA8B9C,MAAM,qBAAsB,SAAQ,KAAK,CAAC,SAAuB;IAAjE;;QACS,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B,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,eAAe,qBAAqB,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* 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.
|
|
3
|
-
*
|
|
4
|
-
* 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.
|
|
5
|
-
*
|
|
6
|
-
* The Original Code is manuscripts-frontend.
|
|
7
|
-
*
|
|
8
|
-
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
|
9
|
-
*
|
|
10
|
-
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
|
11
|
-
*/
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import styled from 'styled-components';
|
|
14
|
-
import { ModalBody, StyledModalMain } from '../Sidebar';
|
|
15
|
-
import AddAuthorsSidebar from './AddAuthorsSidebar';
|
|
16
|
-
import { AuthorFormContainer } from './AuthorFormContainer';
|
|
17
|
-
import { AddAuthorsPage, AuthorDetailsPage } from './AuthorsPage';
|
|
18
|
-
import AuthorsSidebar from './AuthorsSidebar';
|
|
19
|
-
export const ScrollableModalMain = styled(StyledModalMain) `
|
|
20
|
-
overflow-y: auto;
|
|
21
|
-
`;
|
|
22
|
-
export const AuthorsModal = ({ authors, authorAffiliations, affiliations, removeAuthor, selectAuthor, selectedAuthor, openAddAuthors, handleSaveAuthor, addAuthorAffiliation, removeAuthorAffiliation, updateAffiliation, handleDrop, isRemoveAuthorOpen, handleRemoveAuthor, contributorRoles, createContributorRole, }) => (React.createElement(ModalBody, null,
|
|
23
|
-
React.createElement(AuthorsSidebar, { authors: authors, authorAffiliations: authorAffiliations, selectAuthor: selectAuthor, selectedAuthor: selectedAuthor, openAddAuthors: openAddAuthors, handleDrop: handleDrop }),
|
|
24
|
-
React.createElement(ScrollableModalMain, null, selectedAuthor ? (React.createElement(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.createElement(AuthorDetailsPage, null)))));
|
|
25
|
-
export const AddAuthorsModal = ({ nonAuthors, authors, addedAuthors, numberOfAddedAuthors, searchResults, searchText, createAuthor, handleAddingDoneCancel, handleSearchChange, isCreateAuthorOpen, handleCreateAuthor, }) => (React.createElement(ModalBody, null,
|
|
26
|
-
React.createElement(AddAuthorsSidebar, { authors: authors, nonAuthors: nonAuthors, numberOfAddedAuthors: numberOfAddedAuthors, searchText: searchText, addedAuthors: addedAuthors, handleDoneCancel: handleAddingDoneCancel, createAuthor: createAuthor, handleSearchChange: handleSearchChange, searchResults: searchResults, isCreateAuthorOpen: isCreateAuthorOpen, handleCreateAuthor: handleCreateAuthor }),
|
|
27
|
-
React.createElement(StyledModalMain, null,
|
|
28
|
-
React.createElement(AddAuthorsPage, { addedAuthorsCount: numberOfAddedAuthors }))));
|
|
29
|
-
//# sourceMappingURL=AuthorsModals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorsModals.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