@dhis2/analytics 23.10.4 → 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 +21 -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/components/LegendKey/styles/LegendKey.style.js +2 -2
- package/build/cjs/index.js +22 -0
- package/build/cjs/locales/en/translations.json +32 -1
- package/build/cjs/locales/ro/translations.json +6 -6
- package/build/cjs/modules/legends.js +6 -2
- 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/components/LegendKey/styles/LegendKey.style.js +2 -2
- package/build/es/index.js +3 -1
- package/build/es/locales/en/translations.json +32 -1
- package/build/es/locales/ro/translations.json +6 -6
- package/build/es/modules/legends.js +6 -2
- package/package.json +3 -2
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import i18n from '@dhis2/d2-i18n';
|
|
2
|
+
import { Button, SharingDialog, IconReply16, IconShare16, IconThumbUp16, IconEdit16 } from '@dhis2/ui';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { Message, MessageStatsBar, MessageIconButton } from '../index.js';
|
|
6
|
+
import { InterpretationDeleteButton } from './InterpretationDeleteButton.js';
|
|
7
|
+
import { InterpretationUpdateForm } from './InterpretationUpdateForm.js';
|
|
8
|
+
import { useLike } from './useLike.js';
|
|
9
|
+
export const Interpretation = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
interpretation,
|
|
12
|
+
currentUser,
|
|
13
|
+
onClick,
|
|
14
|
+
onUpdated,
|
|
15
|
+
onDeleted,
|
|
16
|
+
disabled,
|
|
17
|
+
onReplyIconClick
|
|
18
|
+
} = _ref;
|
|
19
|
+
const [isUpdateMode, setIsUpdateMode] = useState(false);
|
|
20
|
+
const [showSharingDialog, setShowSharingDialog] = useState(false);
|
|
21
|
+
const {
|
|
22
|
+
toggleLike,
|
|
23
|
+
isLikedByCurrentUser,
|
|
24
|
+
toggleLikeInProgress
|
|
25
|
+
} = useLike({
|
|
26
|
+
interpretation,
|
|
27
|
+
currentUser,
|
|
28
|
+
onComplete: onUpdated
|
|
29
|
+
});
|
|
30
|
+
const shouldShowButton = !!onClick && !disabled;
|
|
31
|
+
return isUpdateMode ? /*#__PURE__*/React.createElement(InterpretationUpdateForm, {
|
|
32
|
+
close: () => setIsUpdateMode(false),
|
|
33
|
+
id: interpretation.id,
|
|
34
|
+
showSharingLink: interpretation.access.manage,
|
|
35
|
+
onComplete: onUpdated,
|
|
36
|
+
text: interpretation.text,
|
|
37
|
+
currentUser: currentUser
|
|
38
|
+
}) : /*#__PURE__*/React.createElement(Message, {
|
|
39
|
+
text: interpretation.text,
|
|
40
|
+
created: interpretation.created,
|
|
41
|
+
username: interpretation.user.displayName
|
|
42
|
+
}, !disabled && /*#__PURE__*/React.createElement(MessageStatsBar, null, /*#__PURE__*/React.createElement(MessageIconButton, {
|
|
43
|
+
tooltipContent: isLikedByCurrentUser ? i18n.t('Unlike') : i18n.t('Like'),
|
|
44
|
+
iconComponent: IconThumbUp16,
|
|
45
|
+
onClick: toggleLike,
|
|
46
|
+
selected: isLikedByCurrentUser,
|
|
47
|
+
count: interpretation.likes,
|
|
48
|
+
disabled: toggleLikeInProgress
|
|
49
|
+
}), /*#__PURE__*/React.createElement(MessageIconButton, {
|
|
50
|
+
tooltipContent: i18n.t('Reply'),
|
|
51
|
+
iconComponent: IconReply16,
|
|
52
|
+
onClick: () => onReplyIconClick(interpretation.id),
|
|
53
|
+
count: interpretation.comments.length
|
|
54
|
+
}), interpretation.access.manage && /*#__PURE__*/React.createElement(MessageIconButton, {
|
|
55
|
+
iconComponent: IconShare16,
|
|
56
|
+
tooltipContent: i18n.t('Share'),
|
|
57
|
+
onClick: () => setShowSharingDialog(true)
|
|
58
|
+
}), showSharingDialog && /*#__PURE__*/React.createElement(SharingDialog, {
|
|
59
|
+
open: true,
|
|
60
|
+
type: 'interpretation',
|
|
61
|
+
id: interpretation.id,
|
|
62
|
+
onClose: () => setShowSharingDialog(false)
|
|
63
|
+
}), interpretation.access.update && /*#__PURE__*/React.createElement(MessageIconButton, {
|
|
64
|
+
iconComponent: IconEdit16,
|
|
65
|
+
tooltipContent: i18n.t('Edit'),
|
|
66
|
+
onClick: () => setIsUpdateMode(true)
|
|
67
|
+
}), interpretation.access.delete && /*#__PURE__*/React.createElement(InterpretationDeleteButton, {
|
|
68
|
+
id: interpretation.id,
|
|
69
|
+
onComplete: onDeleted
|
|
70
|
+
})), shouldShowButton && /*#__PURE__*/React.createElement(Button, {
|
|
71
|
+
secondary: true,
|
|
72
|
+
small: true,
|
|
73
|
+
onClick: (_, event) => {
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
onClick(interpretation.id);
|
|
76
|
+
}
|
|
77
|
+
}, i18n.t('See interpretation')));
|
|
78
|
+
};
|
|
79
|
+
Interpretation.propTypes = {
|
|
80
|
+
currentUser: PropTypes.object.isRequired,
|
|
81
|
+
interpretation: PropTypes.object.isRequired,
|
|
82
|
+
onDeleted: PropTypes.func.isRequired,
|
|
83
|
+
onReplyIconClick: PropTypes.func.isRequired,
|
|
84
|
+
onUpdated: PropTypes.func.isRequired,
|
|
85
|
+
disabled: PropTypes.bool,
|
|
86
|
+
onClick: PropTypes.func
|
|
87
|
+
};
|
package/build/es/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useDataMutation } from '@dhis2/app-runtime';
|
|
2
|
+
import i18n from '@dhis2/d2-i18n';
|
|
3
|
+
import { IconDelete16 } from '@dhis2/ui';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { MessageIconButton } from '../index.js';
|
|
7
|
+
const mutation = {
|
|
8
|
+
resource: 'interpretations',
|
|
9
|
+
id: _ref => {
|
|
10
|
+
let {
|
|
11
|
+
id
|
|
12
|
+
} = _ref;
|
|
13
|
+
return id;
|
|
14
|
+
},
|
|
15
|
+
type: 'delete'
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const InterpretationDeleteButton = _ref2 => {
|
|
19
|
+
let {
|
|
20
|
+
id,
|
|
21
|
+
onComplete
|
|
22
|
+
} = _ref2;
|
|
23
|
+
const [remove, {
|
|
24
|
+
loading
|
|
25
|
+
}] = useDataMutation(mutation, {
|
|
26
|
+
onComplete,
|
|
27
|
+
variables: {
|
|
28
|
+
id
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return /*#__PURE__*/React.createElement(MessageIconButton, {
|
|
32
|
+
tooltipContent: i18n.t('Delete'),
|
|
33
|
+
iconComponent: IconDelete16,
|
|
34
|
+
onClick: remove,
|
|
35
|
+
disabled: loading
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
InterpretationDeleteButton.propTypes = {
|
|
40
|
+
id: PropTypes.string.isRequired,
|
|
41
|
+
onComplete: PropTypes.func.isRequired
|
|
42
|
+
};
|
|
43
|
+
export { InterpretationDeleteButton };
|
package/build/es/components/Interpretations/common/Interpretation/InterpretationSharingLink.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import i18n from '@dhis2/d2-i18n';
|
|
3
|
+
import { SharingDialog, colors, spacers } from '@dhis2/ui';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
const InterpretationSharingLink = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
type,
|
|
10
|
+
id
|
|
11
|
+
} = _ref;
|
|
12
|
+
const [showSharingDialog, setShowSharingDialog] = useState(false);
|
|
13
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: _JSXStyle.dynamic([["3990725326", [spacers.dp4, spacers.dp8, colors.grey800]]]) + " " + "container"
|
|
15
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
16
|
+
onClick: () => setShowSharingDialog(true),
|
|
17
|
+
className: _JSXStyle.dynamic([["3990725326", [spacers.dp4, spacers.dp8, colors.grey800]]]) + " " + "link"
|
|
18
|
+
}, i18n.t('Manage sharing'))), showSharingDialog && /*#__PURE__*/React.createElement(SharingDialog, {
|
|
19
|
+
open: true,
|
|
20
|
+
type: type,
|
|
21
|
+
id: id,
|
|
22
|
+
onClose: () => setShowSharingDialog(false)
|
|
23
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
24
|
+
id: "3990725326",
|
|
25
|
+
dynamic: [spacers.dp4, spacers.dp8, colors.grey800]
|
|
26
|
+
}, [".container.__jsx-style-dynamic-selector{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;-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;gap:".concat(spacers.dp4, ";margin-top:").concat(spacers.dp8, ";font-size:13px;color:").concat(colors.grey800, ";cursor:pointer;}"), ".link.__jsx-style-dynamic-selector{-webkit-text-decoration:underline;text-decoration:underline;}"]));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
InterpretationSharingLink.propTypes = {
|
|
30
|
+
id: PropTypes.string,
|
|
31
|
+
type: PropTypes.string
|
|
32
|
+
};
|
|
33
|
+
export { InterpretationSharingLink };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { useDataMutation } from '@dhis2/app-runtime';
|
|
3
|
+
import i18n from '@dhis2/d2-i18n';
|
|
4
|
+
import { Button, spacers, colors } from '@dhis2/ui';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
import { MessageEditorContainer, RichTextEditor, MessageButtonStrip, InterpretationSharingLink } from '../index.js';
|
|
8
|
+
const mutation = {
|
|
9
|
+
resource: 'interpretations',
|
|
10
|
+
type: 'update',
|
|
11
|
+
partial: false,
|
|
12
|
+
id: _ref => {
|
|
13
|
+
let {
|
|
14
|
+
id
|
|
15
|
+
} = _ref;
|
|
16
|
+
return id;
|
|
17
|
+
},
|
|
18
|
+
data: _ref2 => {
|
|
19
|
+
let {
|
|
20
|
+
interpretationText
|
|
21
|
+
} = _ref2;
|
|
22
|
+
return interpretationText;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export const InterpretationUpdateForm = _ref3 => {
|
|
26
|
+
let {
|
|
27
|
+
close,
|
|
28
|
+
currentUser,
|
|
29
|
+
id,
|
|
30
|
+
onComplete,
|
|
31
|
+
showSharingLink,
|
|
32
|
+
text
|
|
33
|
+
} = _ref3;
|
|
34
|
+
const [interpretationText, setInterpretationText] = useState(text || '');
|
|
35
|
+
const [update, {
|
|
36
|
+
loading,
|
|
37
|
+
error
|
|
38
|
+
}] = useDataMutation(mutation, {
|
|
39
|
+
onComplete: () => {
|
|
40
|
+
onComplete();
|
|
41
|
+
close();
|
|
42
|
+
},
|
|
43
|
+
variables: {
|
|
44
|
+
id
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const errorText = error ? error.message || i18n.t('Could not update interpretation') : '';
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: _JSXStyle.dynamic([["2690082310", [spacers.dp8, spacers.dp8, colors.grey100]]]) + " " + "message"
|
|
50
|
+
}, /*#__PURE__*/React.createElement(MessageEditorContainer, {
|
|
51
|
+
currentUser: currentUser
|
|
52
|
+
}, /*#__PURE__*/React.createElement(RichTextEditor, {
|
|
53
|
+
inputPlaceholder: i18n.t('Enter interpretation text'),
|
|
54
|
+
onChange: setInterpretationText,
|
|
55
|
+
value: interpretationText,
|
|
56
|
+
disabled: loading,
|
|
57
|
+
errorText: errorText
|
|
58
|
+
}), showSharingLink && /*#__PURE__*/React.createElement(InterpretationSharingLink, {
|
|
59
|
+
id: id,
|
|
60
|
+
type: "interpretation"
|
|
61
|
+
}), /*#__PURE__*/React.createElement(MessageButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
|
|
62
|
+
loading: loading,
|
|
63
|
+
primary: true,
|
|
64
|
+
small: true,
|
|
65
|
+
onClick: () => update({
|
|
66
|
+
interpretationText
|
|
67
|
+
})
|
|
68
|
+
}, i18n.t('Update')), /*#__PURE__*/React.createElement(Button, {
|
|
69
|
+
disabled: loading,
|
|
70
|
+
secondary: true,
|
|
71
|
+
small: true,
|
|
72
|
+
onClick: close
|
|
73
|
+
}, i18n.t('Cancel')))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
74
|
+
id: "2690082310",
|
|
75
|
+
dynamic: [spacers.dp8, spacers.dp8, colors.grey100]
|
|
76
|
+
}, [".message.__jsx-style-dynamic-selector{padding:0 ".concat(spacers.dp8, " ").concat(spacers.dp8, ";background-color:").concat(colors.grey100, ";border-radius:5px;}")]));
|
|
77
|
+
};
|
|
78
|
+
InterpretationUpdateForm.propTypes = {
|
|
79
|
+
close: PropTypes.func.isRequired,
|
|
80
|
+
currentUser: PropTypes.object.isRequired,
|
|
81
|
+
id: PropTypes.string.isRequired,
|
|
82
|
+
onComplete: PropTypes.func.isRequired,
|
|
83
|
+
showSharingLink: PropTypes.bool,
|
|
84
|
+
text: PropTypes.string
|
|
85
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useDataMutation } from '@dhis2/app-runtime';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
const useLike = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
interpretation,
|
|
7
|
+
currentUser,
|
|
8
|
+
onComplete
|
|
9
|
+
} = _ref;
|
|
10
|
+
const resource = "interpretations/".concat(interpretation.id, "/like");
|
|
11
|
+
const likeMutationRef = useRef({
|
|
12
|
+
resource,
|
|
13
|
+
type: 'create'
|
|
14
|
+
});
|
|
15
|
+
const unlikeMutationRef = useRef({
|
|
16
|
+
resource,
|
|
17
|
+
type: 'delete'
|
|
18
|
+
});
|
|
19
|
+
const [like, {
|
|
20
|
+
loading: likeLoading
|
|
21
|
+
}] = useDataMutation(likeMutationRef.current, {
|
|
22
|
+
onComplete
|
|
23
|
+
});
|
|
24
|
+
const [unlike, {
|
|
25
|
+
loading: unlikeLoading
|
|
26
|
+
}] = useDataMutation(unlikeMutationRef.current, {
|
|
27
|
+
onComplete
|
|
28
|
+
});
|
|
29
|
+
const [isLikedByCurrentUser, setIsLikedByCurrentUser] = useState(false);
|
|
30
|
+
|
|
31
|
+
const toggleLike = () => {
|
|
32
|
+
isLikedByCurrentUser ? unlike() : like();
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setIsLikedByCurrentUser(interpretation.likedBy.some(likedBy => likedBy.id === currentUser.id));
|
|
37
|
+
}, [currentUser, interpretation]);
|
|
38
|
+
return {
|
|
39
|
+
isLikedByCurrentUser,
|
|
40
|
+
toggleLike,
|
|
41
|
+
toggleLikeInProgress: likeLoading || unlikeLoading
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { useLike };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { Parser as RichTextParser } from '@dhis2/d2-ui-rich-text';
|
|
3
|
+
import { UserAvatar, spacers, colors } from '@dhis2/ui';
|
|
4
|
+
import moment from 'moment';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
const Message = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
children,
|
|
11
|
+
text,
|
|
12
|
+
created,
|
|
13
|
+
username
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
16
|
+
className: _JSXStyle.dynamic([["2436588813", [spacers.dp8, colors.grey100, spacers.dp8, colors.grey900, colors.grey600, colors.grey900, spacers.dp8]]]) + " " + "container"
|
|
17
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
className: _JSXStyle.dynamic([["2436588813", [spacers.dp8, colors.grey100, spacers.dp8, colors.grey900, colors.grey600, colors.grey900, spacers.dp8]]]) + " " + "header"
|
|
19
|
+
}, /*#__PURE__*/React.createElement(UserAvatar, {
|
|
20
|
+
name: username,
|
|
21
|
+
extrasmall: true
|
|
22
|
+
}), username, /*#__PURE__*/React.createElement("time", {
|
|
23
|
+
dateTime: created,
|
|
24
|
+
className: _JSXStyle.dynamic([["2436588813", [spacers.dp8, colors.grey100, spacers.dp8, colors.grey900, colors.grey600, colors.grey900, spacers.dp8]]])
|
|
25
|
+
}, moment(created).format('lll'))), /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: _JSXStyle.dynamic([["2436588813", [spacers.dp8, colors.grey100, spacers.dp8, colors.grey900, colors.grey600, colors.grey900, spacers.dp8]]]) + " " + "content"
|
|
27
|
+
}, /*#__PURE__*/React.createElement(RichTextParser, null, text)), /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: _JSXStyle.dynamic([["2436588813", [spacers.dp8, colors.grey100, spacers.dp8, colors.grey900, colors.grey600, colors.grey900, spacers.dp8]]]) + " " + "footer"
|
|
29
|
+
}, children), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
30
|
+
id: "2436588813",
|
|
31
|
+
dynamic: [spacers.dp8, colors.grey100, spacers.dp8, colors.grey900, colors.grey600, colors.grey900, spacers.dp8]
|
|
32
|
+
}, [".container.__jsx-style-dynamic-selector{padding:".concat(spacers.dp8, ";background-color:").concat(colors.grey100, ";border-radius:5px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:").concat(spacers.dp8, ";}"), ".header.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:6px;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-size:13px;line-height:16px;color:".concat(colors.grey900, ";}"), ".header.__jsx-style-dynamic-selector time.__jsx-style-dynamic-selector{font-size:12px;color:".concat(colors.grey600, ";}"), ".content.__jsx-style-dynamic-selector{font-size:14px;line-height:19px;color:".concat(colors.grey900, ";}"), ".content.__jsx-style-dynamic-selector p:first-child{margin:0;}", ".footer.__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;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;gap:".concat(spacers.dp8, ";}")]));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
Message.propTypes = {
|
|
36
|
+
children: PropTypes.node.isRequired,
|
|
37
|
+
created: PropTypes.string.isRequired,
|
|
38
|
+
text: PropTypes.string.isRequired,
|
|
39
|
+
username: PropTypes.string.isRequired
|
|
40
|
+
};
|
|
41
|
+
export { Message };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { spacers } from '@dhis2/ui';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
const MessageButtonStrip = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
children
|
|
9
|
+
} = _ref;
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: _JSXStyle.dynamic([["1819118406", [spacers.dp8, spacers.dp8]]]) + " " + "container"
|
|
12
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
13
|
+
id: "1819118406",
|
|
14
|
+
dynamic: [spacers.dp8, spacers.dp8]
|
|
15
|
+
}, [".container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:".concat(spacers.dp8, ";margin-top:").concat(spacers.dp8, ";}")]));
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
MessageButtonStrip.propTypes = {
|
|
19
|
+
children: PropTypes.node.isRequired
|
|
20
|
+
};
|
|
21
|
+
export { MessageButtonStrip };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { UserAvatar, spacers } from '@dhis2/ui';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
const MessageEditorContainer = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
children,
|
|
9
|
+
currentUser
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: _JSXStyle.dynamic([["3807884305", [spacers.dp8, spacers.dp12]]]) + " " + "container"
|
|
13
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: _JSXStyle.dynamic([["3807884305", [spacers.dp8, spacers.dp12]]]) + " " + "avatar"
|
|
15
|
+
}, /*#__PURE__*/React.createElement(UserAvatar, {
|
|
16
|
+
name: currentUser.name,
|
|
17
|
+
medium: true
|
|
18
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: _JSXStyle.dynamic([["3807884305", [spacers.dp8, spacers.dp12]]]) + " " + "editor"
|
|
20
|
+
}, children), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
21
|
+
id: "3807884305",
|
|
22
|
+
dynamic: [spacers.dp8, spacers.dp12]
|
|
23
|
+
}, [".container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:".concat(spacers.dp8, ";margin-top:").concat(spacers.dp12, ";}"), ".avatar.__jsx-style-dynamic-selector{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;}", ".editor.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}"]));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
MessageEditorContainer.propTypes = {
|
|
27
|
+
currentUser: PropTypes.object.isRequired,
|
|
28
|
+
children: PropTypes.node
|
|
29
|
+
};
|
|
30
|
+
export { MessageEditorContainer };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { Tooltip, colors, spacers } from '@dhis2/ui';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
const MessageIconButton = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
tooltipContent,
|
|
10
|
+
disabled,
|
|
11
|
+
onClick,
|
|
12
|
+
selected,
|
|
13
|
+
count,
|
|
14
|
+
iconComponent: Icon
|
|
15
|
+
} = _ref;
|
|
16
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
17
|
+
closeDelay: 200,
|
|
18
|
+
content: tooltipContent
|
|
19
|
+
}, _ref2 => {
|
|
20
|
+
let {
|
|
21
|
+
ref,
|
|
22
|
+
onMouseOver,
|
|
23
|
+
onMouseOut
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
26
|
+
ref: ref,
|
|
27
|
+
onMouseOver: onMouseOver,
|
|
28
|
+
onMouseOut: onMouseOut,
|
|
29
|
+
className: _JSXStyle.dynamic([["3807261824", [spacers.dp4, colors.grey700, colors.teal600, colors.grey900, colors.teal800, colors.teal500, colors.teal700]]]) + " " + "wrapper"
|
|
30
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
31
|
+
onClick: event => {
|
|
32
|
+
event.stopPropagation();
|
|
33
|
+
onClick();
|
|
34
|
+
},
|
|
35
|
+
disabled: disabled,
|
|
36
|
+
className: _JSXStyle.dynamic([["3807261824", [spacers.dp4, colors.grey700, colors.teal600, colors.grey900, colors.teal800, colors.teal500, colors.teal700]]]) + " " + (cx('button', {
|
|
37
|
+
selected
|
|
38
|
+
}) || "")
|
|
39
|
+
}, count && count, /*#__PURE__*/React.createElement(Icon, null)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
40
|
+
id: "3807261824",
|
|
41
|
+
dynamic: [spacers.dp4, colors.grey700, colors.teal600, colors.grey900, colors.teal800, colors.teal500, colors.teal700]
|
|
42
|
+
}, [".wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".button.__jsx-style-dynamic-selector{all:unset;cursor:pointer;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;gap:".concat(spacers.dp4, ";-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-size:12px;line-height:14px;color:").concat(colors.grey700, ";}"), ".button.selected.__jsx-style-dynamic-selector{color:".concat(colors.teal600, ";font-weight:500;}"), ".button.__jsx-style-dynamic-selector:hover{color:".concat(colors.grey900, ";}"), ".button.selected.__jsx-style-dynamic-selector:hover{color:".concat(colors.teal800, ";}"), ".button.selected.__jsx-style-dynamic-selector svg{color:".concat(colors.teal500, ";}"), ".button.selected.__jsx-style-dynamic-selector:hover svg{color:".concat(colors.teal700, ";}")]));
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
MessageIconButton.propTypes = {
|
|
47
|
+
iconComponent: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired,
|
|
48
|
+
tooltipContent: PropTypes.string.isRequired,
|
|
49
|
+
count: PropTypes.number,
|
|
50
|
+
disabled: PropTypes.bool,
|
|
51
|
+
selected: PropTypes.bool,
|
|
52
|
+
onClick: PropTypes.func
|
|
53
|
+
};
|
|
54
|
+
export { MessageIconButton };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
import { theme, colors } from '@dhis2/ui';
|
|
6
|
+
import React, { forwardRef } from 'react';
|
|
7
|
+
const MessageInput = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({
|
|
8
|
+
ref: ref
|
|
9
|
+
}, props, {
|
|
10
|
+
className: _JSXStyle.dynamic([["2769305849", [colors.grey900, colors.grey500, theme.focus, colors.grey100, colors.grey500, theme.disabled]]]) + " " + (props && props.className != null && props.className || "input")
|
|
11
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
12
|
+
id: "2769305849",
|
|
13
|
+
dynamic: [colors.grey900, colors.grey500, theme.focus, colors.grey100, colors.grey500, theme.disabled]
|
|
14
|
+
}, [".input.__jsx-style-dynamic-selector{width:100%;box-sizing:border-box;font-size:14px;line-height:16px;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;color:".concat(colors.grey900, ";background-color:white;padding:12px 11px 10px;outline:0;border:1px solid ").concat(colors.grey500, ";border-radius:3px;box-shadow:inset 0 1px 2px 0 rgba(48,54,60,0.1);text-overflow:ellipsis;}"), "input.__jsx-style-dynamic-selector:focus{outline:none;box-shadow:0 0 0 3px ".concat(theme.focus, ";}"), "input.disabled.__jsx-style-dynamic-selector{background-color:".concat(colors.grey100, ";border-color:").concat(colors.grey500, ";color:").concat(theme.disabled, ";cursor:not-allowed;}")])));
|
|
15
|
+
MessageInput.displayName = 'MessageInput';
|
|
16
|
+
export { MessageInput };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { spacers } from '@dhis2/ui';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
const MessageStatsBar = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
children
|
|
9
|
+
} = _ref;
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: _JSXStyle.dynamic([["2534339265", [spacers.dp12]]]) + " " + "container"
|
|
12
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
13
|
+
id: "2534339265",
|
|
14
|
+
dynamic: [spacers.dp12]
|
|
15
|
+
}, [".container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:".concat(spacers.dp12, ";}")]));
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
MessageStatsBar.propTypes = {
|
|
19
|
+
children: PropTypes.node.isRequired
|
|
20
|
+
};
|
|
21
|
+
export { MessageStatsBar };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Message } from './Message.js';
|
|
2
|
+
export { MessageButtonStrip } from './MessageButtonStrip.js';
|
|
3
|
+
export { MessageIconButton } from './MessageIconButton.js';
|
|
4
|
+
export { MessageInput } from './MessageInput.js';
|
|
5
|
+
export { MessageEditorContainer } from './MessageEditorContainer.js';
|
|
6
|
+
export { MessageStatsBar } from './MessageStatsBar.js';
|