@manuscripts/style-guide 1.1.19 → 1.2.1
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/EditorHeader/EditorHeader.js +6 -5
- package/dist/cjs/components/EditorHeader/ProceedView.js +3 -2
- package/dist/cjs/components/SubmissionInspector/BaseInformation.js +1 -1
- package/dist/cjs/lib/capabilities.js +4 -3
- package/dist/es/components/EditorHeader/EditorHeader.js +6 -5
- package/dist/es/components/EditorHeader/ProceedView.js +3 -2
- package/dist/es/components/SubmissionInspector/BaseInformation.js +1 -1
- package/dist/es/lib/capabilities.js +4 -3
- package/dist/types/components/EditorHeader/EditorHeader.d.ts +1 -0
- package/dist/types/components/EditorHeader/ProceedView.d.ts +1 -0
- package/package.json +3 -3
|
@@ -48,15 +48,16 @@ var DialogState;
|
|
|
48
48
|
DialogState[DialogState["SUCCESS"] = 3] = "SUCCESS";
|
|
49
49
|
DialogState[DialogState["CLOSED"] = 4] = "CLOSED";
|
|
50
50
|
})(DialogState = exports.DialogState || (exports.DialogState = {}));
|
|
51
|
-
const Editing = { label: 'Editing
|
|
51
|
+
const Editing = { label: 'Editing', icon: __1.EditIcon };
|
|
52
52
|
const MapUserRole = {
|
|
53
53
|
Editor: Editing,
|
|
54
54
|
Owner: Editing,
|
|
55
55
|
Writer: Editing,
|
|
56
|
-
Annotator: { label: 'Suggesting
|
|
57
|
-
Viewer: { label: 'Reading
|
|
56
|
+
Annotator: { label: 'Suggesting', icon: __1.AnnotatorIcon },
|
|
57
|
+
Viewer: { label: 'Reading', icon: __1.ReadingIcon },
|
|
58
|
+
Proofer: { label: 'Proofing', icon: __1.AnnotatorIcon },
|
|
58
59
|
};
|
|
59
|
-
const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userRole, canCompleteTask, submitProceed, goBack, status, isAnnotator, message, exceptionDialog: ExceptionDialog, disabelProceedNote, }) => {
|
|
60
|
+
const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userRole, canCompleteTask, submitProceed, goBack, status, isAnnotator, isProofer, message, exceptionDialog: ExceptionDialog, disabelProceedNote, }) => {
|
|
60
61
|
var _a, _b, _c, _d, _e;
|
|
61
62
|
const [confirmationDialog, toggleConfirmationDialog] = (0, react_1.useState)(false);
|
|
62
63
|
const [noteValue, setNoteValue] = (0, react_1.useState)('');
|
|
@@ -104,7 +105,7 @@ const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userR
|
|
|
104
105
|
react_1.default.createElement("span", null, "Dashboard"))),
|
|
105
106
|
handleSnapshot &&
|
|
106
107
|
typeof hasPendingSuggestions == 'boolean' &&
|
|
107
|
-
submission.nextStep && (react_1.default.createElement(ProceedView_1.ProceedView, { isAnnotator: isAnnotator, disable: disable, onTransitionClick: onTransitionClick, hasPendingSuggestions: hasPendingSuggestions, dialogData: dialogData, noteValue: noteValue, currentStepTransition: currentStepTransition, currentStepType: submission.currentStep.type, previousStepType: (_e = submission.previousStep) === null || _e === void 0 ? void 0 : _e.type, nextStepType: submission.nextStep.type, confirmationDialog: confirmationDialog, onNoteChange: disabelProceedNote ? undefined : onNoteChange, continueDialogAction: continueDialogAction, onCancelClick: onCancelClick, message: message })),
|
|
108
|
+
submission.nextStep && (react_1.default.createElement(ProceedView_1.ProceedView, { isAnnotator: isAnnotator, isProofer: isProofer, disable: disable, onTransitionClick: onTransitionClick, hasPendingSuggestions: hasPendingSuggestions, dialogData: dialogData, noteValue: noteValue, currentStepTransition: currentStepTransition, currentStepType: submission.currentStep.type, previousStepType: (_e = submission.previousStep) === null || _e === void 0 ? void 0 : _e.type, nextStepType: submission.nextStep.type, confirmationDialog: confirmationDialog, onNoteChange: disabelProceedNote ? undefined : onNoteChange, continueDialogAction: continueDialogAction, onCancelClick: onCancelClick, message: message })),
|
|
108
109
|
status && (react_1.default.createElement(ChildWrapper, null,
|
|
109
110
|
react_1.default.createElement(__1.SaveStatus, { status: status }))),
|
|
110
111
|
react_1.default.createElement(Spacer, null),
|
|
@@ -46,8 +46,8 @@ const StepDetails = ({ icon, label, description, role }) => (react_1.default.cre
|
|
|
46
46
|
react_1.default.createElement(__1.SecondarySmallText, null,
|
|
47
47
|
"Actor: ",
|
|
48
48
|
role.label))));
|
|
49
|
-
const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialogData, confirmationDialog, previousStepType, currentStepType, isAnnotator, hasPendingSuggestions, onCancelClick, continueDialogAction, message: Message, }) => {
|
|
50
|
-
const dialogMessages = (0, react_1.useMemo)(() => hasPendingSuggestions && !isAnnotator
|
|
49
|
+
const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialogData, confirmationDialog, previousStepType, currentStepType, isAnnotator, isProofer, hasPendingSuggestions, onCancelClick, continueDialogAction, message: Message, }) => {
|
|
50
|
+
const dialogMessages = (0, react_1.useMemo)(() => hasPendingSuggestions && !isAnnotator && !isProofer
|
|
51
51
|
? {
|
|
52
52
|
header: 'The task can not be transitioned to the next step',
|
|
53
53
|
message: `There are still pending suggestions in the document.
|
|
@@ -90,6 +90,7 @@ const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialog
|
|
|
90
90
|
currentStepType,
|
|
91
91
|
hasPendingSuggestions,
|
|
92
92
|
isAnnotator,
|
|
93
|
+
isProofer,
|
|
93
94
|
]);
|
|
94
95
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
95
96
|
(currentStepTransition && (currentStepTransition === null || currentStepTransition === void 0 ? void 0 : currentStepTransition.length) > 1 && (react_1.default.createElement(DropdownWrapper, { button: 'Complete task', disabled: disable, primary: true },
|
|
@@ -260,7 +260,7 @@ const UpdatedDueDate = styled_components_1.default.div `
|
|
|
260
260
|
box-sizing: border-box;
|
|
261
261
|
border-radius: ${(props) => props.theme.grid.unit}px;
|
|
262
262
|
padding: ${(props) => props.theme.grid.unit}px
|
|
263
|
-
${(props) => props.theme.grid.unit * 2}px;
|
|
263
|
+
${(props) => props.theme.grid.unit * 2}px;
|
|
264
264
|
`;
|
|
265
265
|
const DueDateMessage = (0, styled_components_1.default)(Dialog_1.MessageContainer) `
|
|
266
266
|
min-height: min-content;
|
|
@@ -17,6 +17,7 @@ const getCapabilities = (project, profile, role, actions) => {
|
|
|
17
17
|
const isOwner = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.owners) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
18
18
|
const isWriter = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.writers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
19
19
|
const isAnnotator = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.annotators) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
20
|
+
const isProofer = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.proofers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
20
21
|
const isViewer = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.viewers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
21
22
|
const isProdEditor = () => role == 'pe';
|
|
22
23
|
const allowed = (action) => !!(actions === null || actions === void 0 ? void 0 : actions.includes(action));
|
|
@@ -30,7 +31,7 @@ const getCapabilities = (project, profile, role, actions) => {
|
|
|
30
31
|
handleOwnComments: !isViewer(),
|
|
31
32
|
handleOthersComments: isOwner(),
|
|
32
33
|
resolveOwnComment: !isViewer(),
|
|
33
|
-
resolveOthersComment: !(isViewer() || isAnnotator()),
|
|
34
|
+
resolveOthersComment: !(isViewer() || isAnnotator() || isProofer()),
|
|
34
35
|
createComment: !isViewer(),
|
|
35
36
|
viewNotes: true,
|
|
36
37
|
createNotes: !isViewer() && allowed(Actions.addNote),
|
|
@@ -55,8 +56,8 @@ const getCapabilities = (project, profile, role, actions) => {
|
|
|
55
56
|
accessEditor: true,
|
|
56
57
|
formatArticle: !isViewer(),
|
|
57
58
|
editArticle: !isViewer(),
|
|
58
|
-
editMetadata: !(isViewer() || isAnnotator()),
|
|
59
|
-
editCitationsAndRefs: !(isViewer() || isAnnotator()),
|
|
59
|
+
editMetadata: !(isViewer() || isAnnotator() || isProofer()),
|
|
60
|
+
editCitationsAndRefs: !(isViewer() || isAnnotator() || isProofer()),
|
|
60
61
|
shareProject: isOwner(),
|
|
61
62
|
};
|
|
62
63
|
};
|
|
@@ -19,15 +19,16 @@ export var DialogState;
|
|
|
19
19
|
DialogState[DialogState["SUCCESS"] = 3] = "SUCCESS";
|
|
20
20
|
DialogState[DialogState["CLOSED"] = 4] = "CLOSED";
|
|
21
21
|
})(DialogState || (DialogState = {}));
|
|
22
|
-
const Editing = { label: 'Editing
|
|
22
|
+
const Editing = { label: 'Editing', icon: EditIcon };
|
|
23
23
|
const MapUserRole = {
|
|
24
24
|
Editor: Editing,
|
|
25
25
|
Owner: Editing,
|
|
26
26
|
Writer: Editing,
|
|
27
|
-
Annotator: { label: 'Suggesting
|
|
28
|
-
Viewer: { label: 'Reading
|
|
27
|
+
Annotator: { label: 'Suggesting', icon: AnnotatorIcon },
|
|
28
|
+
Viewer: { label: 'Reading', icon: ReadingIcon },
|
|
29
|
+
Proofer: { label: 'Proofing', icon: AnnotatorIcon },
|
|
29
30
|
};
|
|
30
|
-
export const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userRole, canCompleteTask, submitProceed, goBack, status, isAnnotator, message, exceptionDialog: ExceptionDialog, disabelProceedNote, }) => {
|
|
31
|
+
export const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions, userRole, canCompleteTask, submitProceed, goBack, status, isAnnotator, isProofer, message, exceptionDialog: ExceptionDialog, disabelProceedNote, }) => {
|
|
31
32
|
var _a, _b, _c, _d, _e;
|
|
32
33
|
const [confirmationDialog, toggleConfirmationDialog] = useState(false);
|
|
33
34
|
const [noteValue, setNoteValue] = useState('');
|
|
@@ -75,7 +76,7 @@ export const EditorHeader = ({ handleSnapshot, submission, hasPendingSuggestions
|
|
|
75
76
|
React.createElement("span", null, "Dashboard"))),
|
|
76
77
|
handleSnapshot &&
|
|
77
78
|
typeof hasPendingSuggestions == 'boolean' &&
|
|
78
|
-
submission.nextStep && (React.createElement(ProceedView, { isAnnotator: isAnnotator, disable: disable, onTransitionClick: onTransitionClick, hasPendingSuggestions: hasPendingSuggestions, dialogData: dialogData, noteValue: noteValue, currentStepTransition: currentStepTransition, currentStepType: submission.currentStep.type, previousStepType: (_e = submission.previousStep) === null || _e === void 0 ? void 0 : _e.type, nextStepType: submission.nextStep.type, confirmationDialog: confirmationDialog, onNoteChange: disabelProceedNote ? undefined : onNoteChange, continueDialogAction: continueDialogAction, onCancelClick: onCancelClick, message: message })),
|
|
79
|
+
submission.nextStep && (React.createElement(ProceedView, { isAnnotator: isAnnotator, isProofer: isProofer, disable: disable, onTransitionClick: onTransitionClick, hasPendingSuggestions: hasPendingSuggestions, dialogData: dialogData, noteValue: noteValue, currentStepTransition: currentStepTransition, currentStepType: submission.currentStep.type, previousStepType: (_e = submission.previousStep) === null || _e === void 0 ? void 0 : _e.type, nextStepType: submission.nextStep.type, confirmationDialog: confirmationDialog, onNoteChange: disabelProceedNote ? undefined : onNoteChange, continueDialogAction: continueDialogAction, onCancelClick: onCancelClick, message: message })),
|
|
79
80
|
status && (React.createElement(ChildWrapper, null,
|
|
80
81
|
React.createElement(SaveStatus, { status: status }))),
|
|
81
82
|
React.createElement(Spacer, null),
|
|
@@ -17,8 +17,8 @@ const StepDetails = ({ icon, label, description, role }) => (React.createElement
|
|
|
17
17
|
React.createElement(SecondarySmallText, null,
|
|
18
18
|
"Actor: ",
|
|
19
19
|
role.label))));
|
|
20
|
-
export const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialogData, confirmationDialog, previousStepType, currentStepType, isAnnotator, hasPendingSuggestions, onCancelClick, continueDialogAction, message: Message, }) => {
|
|
21
|
-
const dialogMessages = useMemo(() => hasPendingSuggestions && !isAnnotator
|
|
20
|
+
export const ProceedView = ({ currentStepTransition, onTransitionClick, disable, dialogData, confirmationDialog, previousStepType, currentStepType, isAnnotator, isProofer, hasPendingSuggestions, onCancelClick, continueDialogAction, message: Message, }) => {
|
|
21
|
+
const dialogMessages = useMemo(() => hasPendingSuggestions && !isAnnotator && !isProofer
|
|
22
22
|
? {
|
|
23
23
|
header: 'The task can not be transitioned to the next step',
|
|
24
24
|
message: `There are still pending suggestions in the document.
|
|
@@ -61,6 +61,7 @@ export const ProceedView = ({ currentStepTransition, onTransitionClick, disable,
|
|
|
61
61
|
currentStepType,
|
|
62
62
|
hasPendingSuggestions,
|
|
63
63
|
isAnnotator,
|
|
64
|
+
isProofer,
|
|
64
65
|
]);
|
|
65
66
|
return (React.createElement(React.Fragment, null,
|
|
66
67
|
(currentStepTransition && (currentStepTransition === null || currentStepTransition === void 0 ? void 0 : currentStepTransition.length) > 1 && (React.createElement(DropdownWrapper, { button: 'Complete task', disabled: disable, primary: true },
|
|
@@ -230,7 +230,7 @@ const UpdatedDueDate = styled.div `
|
|
|
230
230
|
box-sizing: border-box;
|
|
231
231
|
border-radius: ${(props) => props.theme.grid.unit}px;
|
|
232
232
|
padding: ${(props) => props.theme.grid.unit}px
|
|
233
|
-
${(props) => props.theme.grid.unit * 2}px;
|
|
233
|
+
${(props) => props.theme.grid.unit * 2}px;
|
|
234
234
|
`;
|
|
235
235
|
const DueDateMessage = styled(MessageContainer) `
|
|
236
236
|
min-height: min-content;
|
|
@@ -11,6 +11,7 @@ export const getCapabilities = (project, profile, role, actions) => {
|
|
|
11
11
|
const isOwner = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.owners) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
12
12
|
const isWriter = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.writers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
13
13
|
const isAnnotator = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.annotators) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
14
|
+
const isProofer = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.proofers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
14
15
|
const isViewer = () => { var _a; return !!(profile && ((_a = project === null || project === void 0 ? void 0 : project.viewers) === null || _a === void 0 ? void 0 : _a.includes(profile.userID))); };
|
|
15
16
|
const isProdEditor = () => role == 'pe';
|
|
16
17
|
const allowed = (action) => !!(actions === null || actions === void 0 ? void 0 : actions.includes(action));
|
|
@@ -24,7 +25,7 @@ export const getCapabilities = (project, profile, role, actions) => {
|
|
|
24
25
|
handleOwnComments: !isViewer(),
|
|
25
26
|
handleOthersComments: isOwner(),
|
|
26
27
|
resolveOwnComment: !isViewer(),
|
|
27
|
-
resolveOthersComment: !(isViewer() || isAnnotator()),
|
|
28
|
+
resolveOthersComment: !(isViewer() || isAnnotator() || isProofer()),
|
|
28
29
|
createComment: !isViewer(),
|
|
29
30
|
viewNotes: true,
|
|
30
31
|
createNotes: !isViewer() && allowed(Actions.addNote),
|
|
@@ -49,8 +50,8 @@ export const getCapabilities = (project, profile, role, actions) => {
|
|
|
49
50
|
accessEditor: true,
|
|
50
51
|
formatArticle: !isViewer(),
|
|
51
52
|
editArticle: !isViewer(),
|
|
52
|
-
editMetadata: !(isViewer() || isAnnotator()),
|
|
53
|
-
editCitationsAndRefs: !(isViewer() || isAnnotator()),
|
|
53
|
+
editMetadata: !(isViewer() || isAnnotator() || isProofer()),
|
|
54
|
+
editCitationsAndRefs: !(isViewer() || isAnnotator() || isProofer()),
|
|
54
55
|
shareProject: isOwner(),
|
|
55
56
|
};
|
|
56
57
|
};
|
|
@@ -3,6 +3,7 @@ import { ProceedDialogData } from '../..';
|
|
|
3
3
|
import { SubmissionStepTransition, SubmissionStepType } from './EditorHeader';
|
|
4
4
|
export declare const ProceedView: React.FC<{
|
|
5
5
|
isAnnotator: boolean;
|
|
6
|
+
isProofer: boolean;
|
|
6
7
|
disable: boolean;
|
|
7
8
|
onTransitionClick: (event: unknown) => void;
|
|
8
9
|
onNoteChange?: (event: unknown) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/style-guide",
|
|
3
3
|
"description": "Shared components for Manuscripts applications",
|
|
4
|
-
"version": "1.1
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@formatjs/intl-relativetimeformat": "^4.5.9",
|
|
37
37
|
"@formatjs/intl-utils": "^2.2.0",
|
|
38
38
|
"@manuscripts/assets": "^0.6.2",
|
|
39
|
-
"@manuscripts/transform": "^1.3.
|
|
40
|
-
"@manuscripts/json-schema": "^2.1.
|
|
39
|
+
"@manuscripts/transform": "^1.3.11",
|
|
40
|
+
"@manuscripts/json-schema": "^2.1.1",
|
|
41
41
|
"@manuscripts/title-editor": "^1.1.0",
|
|
42
42
|
"@manuscripts/comment-editor": "^1.0.3",
|
|
43
43
|
"@reach/tabs": "^0.11.2",
|