@dhis2/analytics 23.11.1 → 23.12.0
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/CHANGELOG.md +7 -0
- package/build/cjs/components/Interpretations/InterpretationModal/Comment.js +64 -0
- package/build/cjs/components/Interpretations/InterpretationModal/CommentAddForm.js +93 -0
- package/build/cjs/components/Interpretations/InterpretationModal/CommentDeleteButton.js +62 -0
- package/build/cjs/components/Interpretations/InterpretationModal/CommentUpdateForm.js +95 -0
- package/build/cjs/components/Interpretations/InterpretationModal/InterpretationModal.js +187 -0
- package/build/cjs/components/Interpretations/InterpretationModal/InterpretationThread.js +100 -0
- package/build/cjs/components/Interpretations/InterpretationModal/index.js +13 -0
- package/build/cjs/components/Interpretations/InterpretationModal/useModalContentWidth.js +39 -0
- package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationForm.js +94 -0
- package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationList.js +94 -0
- package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +135 -0
- package/build/cjs/components/Interpretations/InterpretationsUnit/index.js +13 -0
- package/build/cjs/components/Interpretations/common/Interpretation/Interpretation.js +110 -0
- package/build/cjs/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +58 -0
- package/build/cjs/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +50 -0
- package/build/cjs/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +108 -0
- package/build/cjs/components/Interpretations/common/Interpretation/index.js +21 -0
- package/build/cjs/components/Interpretations/common/Interpretation/useLike.js +53 -0
- package/build/cjs/components/Interpretations/common/Message/Message.js +55 -0
- package/build/cjs/components/Interpretations/common/Message/MessageButtonStrip.js +33 -0
- package/build/cjs/components/Interpretations/common/Message/MessageEditorContainer.js +42 -0
- package/build/cjs/components/Interpretations/common/Message/MessageIconButton.js +67 -0
- package/build/cjs/components/Interpretations/common/Message/MessageInput.js +31 -0
- package/build/cjs/components/Interpretations/common/Message/MessageStatsBar.js +33 -0
- package/build/cjs/components/Interpretations/common/Message/index.js +53 -0
- package/build/cjs/components/Interpretations/common/RichTextEditor/RichTextEditor.js +262 -0
- package/build/cjs/components/Interpretations/common/RichTextEditor/index.js +13 -0
- package/build/cjs/components/Interpretations/common/RichTextEditor/markdownHandler.js +148 -0
- package/build/cjs/components/Interpretations/common/RichTextEditor/styles/RichTextEditor.style.js +21 -0
- package/build/cjs/components/Interpretations/common/UserMention/UserList.js +48 -0
- package/build/cjs/components/Interpretations/common/UserMention/UserMentionWrapper.js +226 -0
- package/build/cjs/components/Interpretations/common/UserMention/styles/UserMentionWrapper.style.js +30 -0
- package/build/cjs/components/Interpretations/common/UserMention/useUserSearchResults.js +78 -0
- package/build/cjs/components/Interpretations/common/index.js +44 -0
- package/build/cjs/index.js +16 -0
- package/build/cjs/locales/en/translations.json +32 -1
- package/build/es/components/Interpretations/InterpretationModal/Comment.js +45 -0
- package/build/es/components/Interpretations/InterpretationModal/CommentAddForm.js +70 -0
- package/build/es/components/Interpretations/InterpretationModal/CommentDeleteButton.js +47 -0
- package/build/es/components/Interpretations/InterpretationModal/CommentUpdateForm.js +73 -0
- package/build/es/components/Interpretations/InterpretationModal/InterpretationModal.js +165 -0
- package/build/es/components/Interpretations/InterpretationModal/InterpretationThread.js +79 -0
- package/build/es/components/Interpretations/InterpretationModal/index.js +1 -0
- package/build/es/components/Interpretations/InterpretationModal/useModalContentWidth.js +28 -0
- package/build/es/components/Interpretations/InterpretationsUnit/InterpretationForm.js +71 -0
- package/build/es/components/Interpretations/InterpretationsUnit/InterpretationList.js +78 -0
- package/build/es/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +112 -0
- package/build/es/components/Interpretations/InterpretationsUnit/index.js +1 -0
- package/build/es/components/Interpretations/common/Interpretation/Interpretation.js +87 -0
- package/build/es/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +43 -0
- package/build/es/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +33 -0
- package/build/es/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +85 -0
- package/build/es/components/Interpretations/common/Interpretation/index.js +2 -0
- package/build/es/components/Interpretations/common/Interpretation/useLike.js +45 -0
- package/build/es/components/Interpretations/common/Message/Message.js +41 -0
- package/build/es/components/Interpretations/common/Message/MessageButtonStrip.js +21 -0
- package/build/es/components/Interpretations/common/Message/MessageEditorContainer.js +30 -0
- package/build/es/components/Interpretations/common/Message/MessageIconButton.js +54 -0
- package/build/es/components/Interpretations/common/Message/MessageInput.js +16 -0
- package/build/es/components/Interpretations/common/Message/MessageStatsBar.js +21 -0
- package/build/es/components/Interpretations/common/Message/index.js +6 -0
- package/build/es/components/Interpretations/common/RichTextEditor/RichTextEditor.js +240 -0
- package/build/es/components/Interpretations/common/RichTextEditor/index.js +1 -0
- package/build/es/components/Interpretations/common/RichTextEditor/markdownHandler.js +128 -0
- package/build/es/components/Interpretations/common/RichTextEditor/styles/RichTextEditor.style.js +9 -0
- package/build/es/components/Interpretations/common/UserMention/UserList.js +33 -0
- package/build/es/components/Interpretations/common/UserMention/UserMentionWrapper.js +202 -0
- package/build/es/components/Interpretations/common/UserMention/styles/UserMentionWrapper.style.js +17 -0
- package/build/es/components/Interpretations/common/UserMention/useUserSearchResults.js +63 -0
- package/build/es/components/Interpretations/common/index.js +3 -0
- package/build/es/index.js +2 -0
- package/build/es/locales/en/translations.json +32 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [23.12.0](https://github.com/dhis2/analytics/compare/v23.11.1...v23.12.0) (2022-06-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* implement new interpretations components ([#1250](https://github.com/dhis2/analytics/issues/1250)) ([76b223b](https://github.com/dhis2/analytics/commit/76b223b9a3514e0e110cd090bc3ede42056634e8))
|
|
7
|
+
|
|
1
8
|
## [23.11.1](https://github.com/dhis2/analytics/compare/v23.11.0...v23.11.1) (2022-06-09)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Comment = void 0;
|
|
7
|
+
|
|
8
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
9
|
+
|
|
10
|
+
var _ui = require("@dhis2/ui");
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _index = require("../common/index.js");
|
|
17
|
+
|
|
18
|
+
var _CommentDeleteButton = require("./CommentDeleteButton.js");
|
|
19
|
+
|
|
20
|
+
var _CommentUpdateForm = require("./CommentUpdateForm.js");
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
const Comment = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
comment,
|
|
31
|
+
currentUser,
|
|
32
|
+
interpretationId,
|
|
33
|
+
onThreadUpdated
|
|
34
|
+
} = _ref;
|
|
35
|
+
const [isUpdateMode, setIsUpdateMode] = (0, _react.useState)(false);
|
|
36
|
+
return isUpdateMode ? /*#__PURE__*/_react.default.createElement(_CommentUpdateForm.CommentUpdateForm, {
|
|
37
|
+
close: () => setIsUpdateMode(false),
|
|
38
|
+
commentId: comment.id,
|
|
39
|
+
interpretationId: interpretationId,
|
|
40
|
+
onComplete: () => onThreadUpdated(false),
|
|
41
|
+
text: comment.text,
|
|
42
|
+
currentUser: currentUser
|
|
43
|
+
}) : /*#__PURE__*/_react.default.createElement(_index.Message, {
|
|
44
|
+
text: comment.text,
|
|
45
|
+
created: comment.created,
|
|
46
|
+
username: comment.createdBy.displayName
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement(_index.MessageStatsBar, null, comment.access.update && /*#__PURE__*/_react.default.createElement(_index.MessageIconButton, {
|
|
48
|
+
iconComponent: _ui.IconEdit16,
|
|
49
|
+
tooltipContent: _d2I18n.default.t('Edit'),
|
|
50
|
+
onClick: () => setIsUpdateMode(true)
|
|
51
|
+
}), comment.access.delete && /*#__PURE__*/_react.default.createElement(_CommentDeleteButton.CommentDeleteButton, {
|
|
52
|
+
commentId: comment.id,
|
|
53
|
+
interpretationId: interpretationId,
|
|
54
|
+
onComplete: () => onThreadUpdated(true)
|
|
55
|
+
})));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
exports.Comment = Comment;
|
|
59
|
+
Comment.propTypes = {
|
|
60
|
+
comment: _propTypes.default.object.isRequired,
|
|
61
|
+
currentUser: _propTypes.default.object.isRequired,
|
|
62
|
+
interpretationId: _propTypes.default.string.isRequired,
|
|
63
|
+
onThreadUpdated: _propTypes.default.func.isRequired
|
|
64
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CommentAddForm = void 0;
|
|
7
|
+
|
|
8
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
|
+
|
|
10
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
11
|
+
|
|
12
|
+
var _ui = require("@dhis2/ui");
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _index = require("../common/index.js");
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
const CommentAddForm = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
interpretationId,
|
|
29
|
+
currentUser,
|
|
30
|
+
onSave,
|
|
31
|
+
focusRef
|
|
32
|
+
} = _ref;
|
|
33
|
+
const [showRichTextEditor, setShowRichTextEditor] = (0, _react.useState)(false);
|
|
34
|
+
const [commentText, setCommentText] = (0, _react.useState)('');
|
|
35
|
+
const saveMutationRef = (0, _react.useRef)({
|
|
36
|
+
resource: "interpretations/".concat(interpretationId, "/comments"),
|
|
37
|
+
type: 'create',
|
|
38
|
+
data: _ref2 => {
|
|
39
|
+
let {
|
|
40
|
+
commentText
|
|
41
|
+
} = _ref2;
|
|
42
|
+
return commentText;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const [save, {
|
|
46
|
+
loading
|
|
47
|
+
}] = (0, _appRuntime.useDataMutation)(saveMutationRef.current, {
|
|
48
|
+
onComplete: () => {
|
|
49
|
+
setShowRichTextEditor(false);
|
|
50
|
+
setCommentText('');
|
|
51
|
+
onSave();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const inputPlaceholder = _d2I18n.default.t('Write a reply');
|
|
56
|
+
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement(_index.MessageEditorContainer, {
|
|
58
|
+
currentUser: currentUser
|
|
59
|
+
}, showRichTextEditor ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_index.RichTextEditor, {
|
|
60
|
+
inputPlaceholder: inputPlaceholder,
|
|
61
|
+
onChange: setCommentText,
|
|
62
|
+
value: commentText,
|
|
63
|
+
ref: focusRef,
|
|
64
|
+
disabled: loading
|
|
65
|
+
}), /*#__PURE__*/_react.default.createElement(_index.MessageButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
66
|
+
primary: true,
|
|
67
|
+
small: true,
|
|
68
|
+
onClick: () => save({
|
|
69
|
+
commentText
|
|
70
|
+
}),
|
|
71
|
+
loading: loading
|
|
72
|
+
}, _d2I18n.default.t('Post reply')), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
73
|
+
secondary: true,
|
|
74
|
+
small: true,
|
|
75
|
+
disabled: loading,
|
|
76
|
+
onClick: () => {
|
|
77
|
+
setCommentText('');
|
|
78
|
+
setShowRichTextEditor(false);
|
|
79
|
+
}
|
|
80
|
+
}, _d2I18n.default.t('Cancel')))) : /*#__PURE__*/_react.default.createElement(_index.MessageInput, {
|
|
81
|
+
onFocus: () => setShowRichTextEditor(true),
|
|
82
|
+
placeholder: inputPlaceholder,
|
|
83
|
+
ref: focusRef
|
|
84
|
+
}));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
exports.CommentAddForm = CommentAddForm;
|
|
88
|
+
CommentAddForm.propTypes = {
|
|
89
|
+
currentUser: _propTypes.default.object.isRequired,
|
|
90
|
+
focusRef: _propTypes.default.object.isRequired,
|
|
91
|
+
interpretationId: _propTypes.default.string.isRequired,
|
|
92
|
+
onSave: _propTypes.default.func
|
|
93
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CommentDeleteButton = void 0;
|
|
7
|
+
|
|
8
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
|
+
|
|
10
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
11
|
+
|
|
12
|
+
var _ui = require("@dhis2/ui");
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
|
|
18
|
+
var _index = require("../common/index.js");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
const mutation = {
|
|
23
|
+
resource: 'interpretations',
|
|
24
|
+
id: _ref => {
|
|
25
|
+
let {
|
|
26
|
+
interpretationId,
|
|
27
|
+
commentId
|
|
28
|
+
} = _ref;
|
|
29
|
+
return "".concat(interpretationId, "/comments/").concat(commentId);
|
|
30
|
+
},
|
|
31
|
+
type: 'delete'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const CommentDeleteButton = _ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
commentId,
|
|
37
|
+
interpretationId,
|
|
38
|
+
onComplete
|
|
39
|
+
} = _ref2;
|
|
40
|
+
const [remove, {
|
|
41
|
+
loading
|
|
42
|
+
}] = (0, _appRuntime.useDataMutation)(mutation, {
|
|
43
|
+
onComplete,
|
|
44
|
+
variables: {
|
|
45
|
+
commentId,
|
|
46
|
+
interpretationId
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_index.MessageIconButton, {
|
|
50
|
+
tooltipContent: _d2I18n.default.t('Delete'),
|
|
51
|
+
iconComponent: _ui.IconDelete16,
|
|
52
|
+
onClick: remove,
|
|
53
|
+
disabled: loading
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
exports.CommentDeleteButton = CommentDeleteButton;
|
|
58
|
+
CommentDeleteButton.propTypes = {
|
|
59
|
+
commentId: _propTypes.default.string.isRequired,
|
|
60
|
+
interpretationId: _propTypes.default.string.isRequired,
|
|
61
|
+
onComplete: _propTypes.default.func.isRequired
|
|
62
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CommentUpdateForm = void 0;
|
|
7
|
+
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
10
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
11
|
+
|
|
12
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
13
|
+
|
|
14
|
+
var _ui = require("@dhis2/ui");
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _index = require("../common/index.js");
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
const CommentUpdateForm = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
interpretationId,
|
|
31
|
+
commentId,
|
|
32
|
+
currentUser,
|
|
33
|
+
text,
|
|
34
|
+
close,
|
|
35
|
+
onComplete
|
|
36
|
+
} = _ref;
|
|
37
|
+
const [commentText, setCommentText] = (0, _react.useState)(text || '');
|
|
38
|
+
const updateMutationRef = (0, _react.useRef)({
|
|
39
|
+
resource: "interpretations/".concat(interpretationId, "/comments/").concat(commentId),
|
|
40
|
+
type: 'update',
|
|
41
|
+
partial: false,
|
|
42
|
+
data: _ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
commentText
|
|
45
|
+
} = _ref2;
|
|
46
|
+
return commentText;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const [update, {
|
|
50
|
+
loading,
|
|
51
|
+
error
|
|
52
|
+
}] = (0, _appRuntime.useDataMutation)(updateMutationRef.current, {
|
|
53
|
+
onComplete: () => {
|
|
54
|
+
onComplete();
|
|
55
|
+
close();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const errorText = error ? error.message || _d2I18n.default.t('Could not update comment') : '';
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
60
|
+
className: _style.default.dynamic([["2690082310", [_ui.spacers.dp8, _ui.spacers.dp8, _ui.colors.grey100]]]) + " " + "message"
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement(_index.MessageEditorContainer, {
|
|
62
|
+
currentUser: currentUser
|
|
63
|
+
}, /*#__PURE__*/_react.default.createElement(_index.RichTextEditor, {
|
|
64
|
+
inputPlaceholder: _d2I18n.default.t('Enter comment text'),
|
|
65
|
+
onChange: setCommentText,
|
|
66
|
+
value: commentText,
|
|
67
|
+
disabled: loading,
|
|
68
|
+
errorText: errorText
|
|
69
|
+
}), /*#__PURE__*/_react.default.createElement(_index.MessageButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
70
|
+
loading: loading,
|
|
71
|
+
primary: true,
|
|
72
|
+
small: true,
|
|
73
|
+
onClick: () => update({
|
|
74
|
+
commentText
|
|
75
|
+
})
|
|
76
|
+
}, _d2I18n.default.t('Update')), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
77
|
+
disabled: loading,
|
|
78
|
+
secondary: true,
|
|
79
|
+
small: true,
|
|
80
|
+
onClick: close
|
|
81
|
+
}, _d2I18n.default.t('Cancel')))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
82
|
+
id: "2690082310",
|
|
83
|
+
dynamic: [_ui.spacers.dp8, _ui.spacers.dp8, _ui.colors.grey100]
|
|
84
|
+
}, [".message.__jsx-style-dynamic-selector{padding:0 ".concat(_ui.spacers.dp8, " ").concat(_ui.spacers.dp8, ";background-color:").concat(_ui.colors.grey100, ";border-radius:5px;}")]));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
exports.CommentUpdateForm = CommentUpdateForm;
|
|
88
|
+
CommentUpdateForm.propTypes = {
|
|
89
|
+
close: _propTypes.default.func.isRequired,
|
|
90
|
+
commentId: _propTypes.default.string.isRequired,
|
|
91
|
+
currentUser: _propTypes.default.object.isRequired,
|
|
92
|
+
interpretationId: _propTypes.default.string.isRequired,
|
|
93
|
+
onComplete: _propTypes.default.func.isRequired,
|
|
94
|
+
text: _propTypes.default.string
|
|
95
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InterpretationModal = void 0;
|
|
7
|
+
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
10
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
11
|
+
|
|
12
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
13
|
+
|
|
14
|
+
var _ui = require("@dhis2/ui");
|
|
15
|
+
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
22
|
+
var _InterpretationThread = require("./InterpretationThread.js");
|
|
23
|
+
|
|
24
|
+
var _useModalContentWidth = require("./useModalContentWidth.js");
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
32
|
+
const modalCSS = {
|
|
33
|
+
styles: /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
34
|
+
id: "422732072"
|
|
35
|
+
}, ["aside.jsx-422732072{max-width:calc(100vw - 128px) !important;max-height:calc(100vh - 128px) !important;width:auto !important;height:auto !important;overflow-y:hidden;}", "aside.hidden.jsx-422732072{display:none;}", "aside.jsx-422732072>div>div{max-height:none;}"]),
|
|
36
|
+
className: "jsx-422732072"
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
function getModalContentCSS(width) {
|
|
40
|
+
return {
|
|
41
|
+
styles: /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
42
|
+
id: "1689110567",
|
|
43
|
+
dynamic: [width]
|
|
44
|
+
}, ["div.__jsx-style-dynamic-selector{width:".concat(width, "px;}")]),
|
|
45
|
+
className: _style.default.dynamic([["1689110567", [width]]])
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const query = {
|
|
50
|
+
interpretation: {
|
|
51
|
+
resource: 'interpretations',
|
|
52
|
+
id: _ref => {
|
|
53
|
+
let {
|
|
54
|
+
id
|
|
55
|
+
} = _ref;
|
|
56
|
+
return id;
|
|
57
|
+
},
|
|
58
|
+
params: {
|
|
59
|
+
fields: ['access', 'id', 'text', 'created', 'user[id,displayName]', 'likes', 'likedBy', 'comments[access,id,text,created,createdBy[id,displayName]]']
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const InterpretationModal = _ref2 => {
|
|
65
|
+
let {
|
|
66
|
+
currentUser,
|
|
67
|
+
isVisualizationLoading,
|
|
68
|
+
visualization,
|
|
69
|
+
onResponsesReceived,
|
|
70
|
+
downloadMenuComponent,
|
|
71
|
+
onClose,
|
|
72
|
+
onInterpretationUpdate,
|
|
73
|
+
interpretationId,
|
|
74
|
+
initialFocus,
|
|
75
|
+
pluginComponent: VisualizationPlugin
|
|
76
|
+
} = _ref2;
|
|
77
|
+
const modalContentWidth = (0, _useModalContentWidth.useModalContentWidth)();
|
|
78
|
+
const modalContentCSS = getModalContentCSS(modalContentWidth);
|
|
79
|
+
const [isDirty, setIsDirty] = (0, _react.useState)(false);
|
|
80
|
+
const {
|
|
81
|
+
data,
|
|
82
|
+
error,
|
|
83
|
+
loading,
|
|
84
|
+
fetching,
|
|
85
|
+
refetch
|
|
86
|
+
} = (0, _appRuntime.useDataQuery)(query, {
|
|
87
|
+
lazy: true
|
|
88
|
+
});
|
|
89
|
+
const interpretation = data === null || data === void 0 ? void 0 : data.interpretation;
|
|
90
|
+
const shouldRenderModalContent = !error && interpretation;
|
|
91
|
+
const shouldCssHideModal = loading || isVisualizationLoading;
|
|
92
|
+
|
|
93
|
+
const handleClose = () => {
|
|
94
|
+
if (isDirty) {
|
|
95
|
+
onInterpretationUpdate();
|
|
96
|
+
setIsDirty(false);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
onClose();
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const onThreadUpdated = affectsInterpretation => {
|
|
103
|
+
if (affectsInterpretation) {
|
|
104
|
+
setIsDirty(true);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
refetch({
|
|
108
|
+
id: interpretationId
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const onInterpretationDeleted = () => {
|
|
113
|
+
setIsDirty(false);
|
|
114
|
+
onInterpretationUpdate();
|
|
115
|
+
onClose();
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
(0, _react.useEffect)(() => {
|
|
119
|
+
if (interpretationId) {
|
|
120
|
+
refetch({
|
|
121
|
+
id: interpretationId
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}, [interpretationId]);
|
|
125
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shouldCssHideModal && /*#__PURE__*/_react.default.createElement(_ui.Layer, null, /*#__PURE__*/_react.default.createElement(_ui.CenteredContent, null, /*#__PURE__*/_react.default.createElement(_ui.CircularLoader, null))), /*#__PURE__*/_react.default.createElement(_ui.Modal, {
|
|
126
|
+
fluid: true,
|
|
127
|
+
onClose: handleClose,
|
|
128
|
+
className: (0, _classnames.default)(modalCSS.className, {
|
|
129
|
+
hidden: shouldCssHideModal
|
|
130
|
+
})
|
|
131
|
+
}, /*#__PURE__*/_react.default.createElement("h1", {
|
|
132
|
+
className: _style.default.dynamic([["3636222142", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "title"
|
|
133
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
134
|
+
className: _style.default.dynamic([["3636222142", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "ellipsis"
|
|
135
|
+
}, _d2I18n.default.t('Viewing interpretation: {{visualisationName}}', {
|
|
136
|
+
visualisationName: visualization.displayName,
|
|
137
|
+
nsSeparator: '^^'
|
|
138
|
+
}))), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, {
|
|
139
|
+
className: modalContentCSS.className
|
|
140
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
141
|
+
className: _style.default.dynamic([["3636222142", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "container"
|
|
142
|
+
}, error && /*#__PURE__*/_react.default.createElement(_ui.NoticeBox, {
|
|
143
|
+
error: true,
|
|
144
|
+
title: _d2I18n.default.t('Could not load interpretation')
|
|
145
|
+
}, error.message || _d2I18n.default.t('The interpretation couldn’t be displayed. Try again or contact your system administrator.')), shouldRenderModalContent && /*#__PURE__*/_react.default.createElement("div", {
|
|
146
|
+
className: _style.default.dynamic([["3636222142", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "row"
|
|
147
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
148
|
+
className: _style.default.dynamic([["3636222142", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "visualisation-wrap"
|
|
149
|
+
}, /*#__PURE__*/_react.default.createElement(VisualizationPlugin, {
|
|
150
|
+
filters: {
|
|
151
|
+
relativePeriodDate: interpretation.created
|
|
152
|
+
},
|
|
153
|
+
visualization: visualization,
|
|
154
|
+
onResponsesReceived: onResponsesReceived,
|
|
155
|
+
className: _style.default.dynamic([["3636222142", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]])
|
|
156
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
157
|
+
className: _style.default.dynamic([["3636222142", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "thread-wrap"
|
|
158
|
+
}, /*#__PURE__*/_react.default.createElement(_InterpretationThread.InterpretationThread, {
|
|
159
|
+
currentUser: currentUser,
|
|
160
|
+
fetching: fetching,
|
|
161
|
+
interpretation: interpretation,
|
|
162
|
+
onInterpretationDeleted: onInterpretationDeleted,
|
|
163
|
+
onThreadUpdated: onThreadUpdated,
|
|
164
|
+
initialFocus: initialFocus,
|
|
165
|
+
downloadMenuComponent: downloadMenuComponent
|
|
166
|
+
}))))), /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
167
|
+
disabled: fetching,
|
|
168
|
+
onClick: handleClose
|
|
169
|
+
}, _d2I18n.default.t('Hide interpretation'))), modalCSS.styles, modalContentCSS.styles, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
170
|
+
id: "3636222142",
|
|
171
|
+
dynamic: [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]
|
|
172
|
+
}, [".title.__jsx-style-dynamic-selector{color:".concat(_ui.colors.grey900, ";margin:0px;padding:").concat(_ui.spacers.dp24, " 0 ").concat(_ui.spacers.dp4, ";}"), ".ellipsis.__jsx-style-dynamic-selector{display:inline-block;font-size:20px;font-weight:500;line-height:24px;white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis;}", ".container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".row.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;gap:16px;}", ".visualisation-wrap.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".thread-wrap.__jsx-style-dynamic-selector{padding-right:".concat(_ui.spacers.dp4, ";-webkit-flex-basis:300px;-ms-flex-preferred-size:300px;flex-basis:300px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;overflow-y:auto;}")])));
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
exports.InterpretationModal = InterpretationModal;
|
|
176
|
+
InterpretationModal.propTypes = {
|
|
177
|
+
currentUser: _propTypes.default.object.isRequired,
|
|
178
|
+
downloadMenuComponent: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.func]).isRequired,
|
|
179
|
+
interpretationId: _propTypes.default.string.isRequired,
|
|
180
|
+
isVisualizationLoading: _propTypes.default.bool.isRequired,
|
|
181
|
+
pluginComponent: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.func]).isRequired,
|
|
182
|
+
visualization: _propTypes.default.object.isRequired,
|
|
183
|
+
onClose: _propTypes.default.func.isRequired,
|
|
184
|
+
onResponsesReceived: _propTypes.default.func.isRequired,
|
|
185
|
+
initialFocus: _propTypes.default.bool,
|
|
186
|
+
onInterpretationUpdate: _propTypes.default.func
|
|
187
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InterpretationThread = void 0;
|
|
7
|
+
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
10
|
+
var _ui = require("@dhis2/ui");
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _index = require("../common/index.js");
|
|
21
|
+
|
|
22
|
+
var _Comment = require("./Comment.js");
|
|
23
|
+
|
|
24
|
+
var _CommentAddForm = require("./CommentAddForm.js");
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
32
|
+
const InterpretationThread = _ref => {
|
|
33
|
+
let {
|
|
34
|
+
currentUser,
|
|
35
|
+
fetching,
|
|
36
|
+
interpretation,
|
|
37
|
+
onInterpretationDeleted,
|
|
38
|
+
initialFocus,
|
|
39
|
+
onThreadUpdated,
|
|
40
|
+
downloadMenuComponent: DownloadMenu
|
|
41
|
+
} = _ref;
|
|
42
|
+
const focusRef = (0, _react.useRef)();
|
|
43
|
+
(0, _react.useEffect)(() => {
|
|
44
|
+
if (initialFocus && focusRef.current) {
|
|
45
|
+
window.requestAnimationFrame(() => {
|
|
46
|
+
focusRef.current.focus();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, [initialFocus, focusRef.current]);
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
51
|
+
className: "jsx-2924001448" + " " + ((0, _classnames.default)('container', {
|
|
52
|
+
fetching
|
|
53
|
+
}) || "")
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
+
className: "jsx-2924001448" + " " + 'scrollbox'
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
57
|
+
className: "jsx-2924001448" + " " + 'title'
|
|
58
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.IconClock16, {
|
|
59
|
+
color: _ui.colors.grey700
|
|
60
|
+
}), (0, _moment.default)(interpretation.created).format('LLL')), /*#__PURE__*/_react.default.createElement(DownloadMenu, {
|
|
61
|
+
relativePeriodDate: interpretation.created,
|
|
62
|
+
className: "jsx-2924001448"
|
|
63
|
+
}), /*#__PURE__*/_react.default.createElement(_index.Interpretation, {
|
|
64
|
+
currentUser: currentUser,
|
|
65
|
+
interpretation: interpretation,
|
|
66
|
+
onReplyIconClick: () => {
|
|
67
|
+
var _focusRef$current;
|
|
68
|
+
|
|
69
|
+
return (_focusRef$current = focusRef.current) === null || _focusRef$current === void 0 ? void 0 : _focusRef$current.focus();
|
|
70
|
+
},
|
|
71
|
+
onUpdated: () => onThreadUpdated(true),
|
|
72
|
+
onDeleted: onInterpretationDeleted
|
|
73
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
74
|
+
className: "jsx-2924001448" + " " + 'comments'
|
|
75
|
+
}, interpretation.comments.map(comment => /*#__PURE__*/_react.default.createElement(_Comment.Comment, {
|
|
76
|
+
key: comment.id,
|
|
77
|
+
comment: comment,
|
|
78
|
+
currentUser: currentUser,
|
|
79
|
+
interpretationId: interpretation.id,
|
|
80
|
+
onThreadUpdated: onThreadUpdated
|
|
81
|
+
}))), /*#__PURE__*/_react.default.createElement(_CommentAddForm.CommentAddForm, {
|
|
82
|
+
currentUser: currentUser,
|
|
83
|
+
interpretationId: interpretation.id,
|
|
84
|
+
onSave: () => onThreadUpdated(true),
|
|
85
|
+
focusRef: focusRef
|
|
86
|
+
})), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
87
|
+
id: "2924001448"
|
|
88
|
+
}, [".container.jsx-2924001448{position:relative;overflow:hidden;max-height:calc(100vh - 285px);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".container.fetching.jsx-2924001448::before{content:'';position:absolute;inset:0px;background-color:rgba(255,255,255,0.8);}", ".container.fetching.jsx-2924001448::after{content:'';position:absolute;top:calc(50% - 12px);left:calc(50% - 12px);width:24px;height:24px;border-width:4px;border-style:solid;border-color:rgba(110,122,138,0.15) rgba(110,122,138,0.15) rgb(20,124,215);border-image:initial;border-radius:50%;-webkit-animation:1s linear 0s infinite normal none running rotation-jsx-2924001448;animation:1s linear 0s infinite normal none running rotation-jsx-2924001448;}", ".scrollbox.jsx-2924001448{overflow-y:auto;-webkit-scroll-behavior:smooth;-moz-scroll-behavior:smooth;-ms-scroll-behavior:smooth;scroll-behavior:smooth;}", ".title.jsx-2924001448{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:var(--spacers-dp8);color:var(--colors-grey900);font-size:14px;line-height:18px;}", ".comments.jsx-2924001448{padding-left:16px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;padding-top:var(--spacers-dp4);gap:var(--spacers-dp4);}", "@-webkit-keyframes rotation-jsx-2924001448{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}", "@keyframes rotation-jsx-2924001448{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}"]));
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
exports.InterpretationThread = InterpretationThread;
|
|
92
|
+
InterpretationThread.propTypes = {
|
|
93
|
+
currentUser: _propTypes.default.object.isRequired,
|
|
94
|
+
downloadMenuComponent: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.func]).isRequired,
|
|
95
|
+
fetching: _propTypes.default.bool.isRequired,
|
|
96
|
+
interpretation: _propTypes.default.object.isRequired,
|
|
97
|
+
onInterpretationDeleted: _propTypes.default.func.isRequired,
|
|
98
|
+
initialFocus: _propTypes.default.bool,
|
|
99
|
+
onThreadUpdated: _propTypes.default.func
|
|
100
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "InterpretationModal", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _InterpretationModal.InterpretationModal;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _InterpretationModal = require("./InterpretationModal.js");
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useModalContentWidth = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _utils = require("../../../modules/utils.js");
|
|
11
|
+
|
|
12
|
+
const MODAL_SIDE_PADDING = 2 * 24;
|
|
13
|
+
const MODAL_SIDE_MARGINS = 2 * 128;
|
|
14
|
+
|
|
15
|
+
const computeModalContentWidth = windowWidth => {
|
|
16
|
+
return windowWidth - MODAL_SIDE_MARGINS - MODAL_SIDE_PADDING;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const useModalContentWidth = () => {
|
|
20
|
+
const [windowWidth, setWindowWidth] = (0, _react.useState)(window.innerWidth);
|
|
21
|
+
const debouncedWindowWidth = (0, _utils.useDebounce)(windowWidth, 150);
|
|
22
|
+
const [modalContentWidth, setModalContentWidth] = (0, _react.useState)(computeModalContentWidth(windowWidth));
|
|
23
|
+
(0, _react.useEffect)(() => {
|
|
24
|
+
const onResize = () => {
|
|
25
|
+
setWindowWidth(window.innerWidth);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
window.addEventListener('resize', onResize);
|
|
29
|
+
return () => {
|
|
30
|
+
window.removeEventListener('resize', onResize);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
(0, _react.useEffect)(() => {
|
|
34
|
+
setModalContentWidth(computeModalContentWidth(debouncedWindowWidth));
|
|
35
|
+
}, [debouncedWindowWidth]);
|
|
36
|
+
return modalContentWidth;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.useModalContentWidth = useModalContentWidth;
|