@bigbinary/neeto-molecules 3.15.38 → 3.15.39
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/README.md +1 -0
- package/dist/Engagements.js +292 -0
- package/dist/Engagements.js.map +1 -0
- package/dist/cjs/Engagements.js +294 -0
- package/dist/cjs/Engagements.js.map +1 -0
- package/package.json +1 -1
- package/src/translations/en.json +1 -0
- package/types/Engagements.d.ts +131 -0
package/README.md
CHANGED
|
@@ -35,6 +35,7 @@ https://neeto-molecules.neeto.com/
|
|
|
35
35
|
- [EmailPreview](./docs/components/EmailPreview.md)
|
|
36
36
|
- [EmojiPicker](./docs/components/EmojiPicker.md)
|
|
37
37
|
- [EmojiReactions](./docs/components/EmojiReactions.md)
|
|
38
|
+
- [Engagements](./docs/components/Engagements.md)
|
|
38
39
|
- [ErrorPage](./docs/components/ErrorPage.md)
|
|
39
40
|
- [FileUpload](./docs/components/FileUpload.md)
|
|
40
41
|
- [FinderModal](./docs/components/FinderModal.md)
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import React__default, { memo, forwardRef } from 'react';
|
|
3
|
+
import { isPresent, findIndexBy, noop } from '@bigbinary/neeto-cist';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import Avatar from '@bigbinary/neetoui/Avatar';
|
|
6
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
import { P as PropTypes } from './index-DAYCJu79.js';
|
|
8
|
+
import Typography from '@bigbinary/neetoui/Typography';
|
|
9
|
+
import DateFormat from './DateFormat.js';
|
|
10
|
+
import MoreDropdown from './MoreDropdown.js';
|
|
11
|
+
import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
12
|
+
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
13
|
+
import { collectBy, prop, eqProps, pluck, pathEq } from 'ramda';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import EmojiPicker from './EmojiPicker.js';
|
|
16
|
+
import { n } from './inject-css-DmrvuTKK.js';
|
|
17
|
+
import './_commonjsHelpers-BFTU3MAI.js';
|
|
18
|
+
import '@bigbinary/neeto-commons-frontend/react-utils/useTimer';
|
|
19
|
+
import '@bigbinary/neeto-commons-frontend/utils/datetime';
|
|
20
|
+
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
21
|
+
import '@bigbinary/neeto-icons/MenuHorizontal';
|
|
22
|
+
import '@bigbinary/neeto-icons/MenuVertical';
|
|
23
|
+
import '@bigbinary/neetoui/Button';
|
|
24
|
+
import '@bigbinary/neetoui/Dropdown';
|
|
25
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
26
|
+
import '@bigbinary/neeto-icons/SmileFaceGrey';
|
|
27
|
+
import 'emoji-mart';
|
|
28
|
+
import '@tanstack/react-query';
|
|
29
|
+
import 'axios';
|
|
30
|
+
|
|
31
|
+
var ActivityIcon = function ActivityIcon(_ref) {
|
|
32
|
+
var icon = _ref.icon,
|
|
33
|
+
unread = _ref.unread;
|
|
34
|
+
return /*#__PURE__*/jsx("div", {
|
|
35
|
+
className: "flex-shrink-0",
|
|
36
|
+
children: /*#__PURE__*/jsxs("span", {
|
|
37
|
+
className: classnames("neeto-ui-bg-gray-200 neeto-ui-text-gray-600 neeto-ui-rounded-full relative z-10 flex h-7 w-7 items-center justify-center p-1", {
|
|
38
|
+
"neeto-ui-text-primary-600 neeto-ui-bg-primary-100": unread
|
|
39
|
+
}),
|
|
40
|
+
children: [icon, unread && /*#__PURE__*/jsx("span", {
|
|
41
|
+
className: "neeto-ui-rounded-full neeto-ui-bg-primary-800 absolute -right-0.5 -top-0.5 h-2 w-2"
|
|
42
|
+
})]
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var Activity = function Activity(_ref) {
|
|
48
|
+
var user = _ref.user,
|
|
49
|
+
icon = _ref.icon,
|
|
50
|
+
_ref$unread = _ref.unread,
|
|
51
|
+
unread = _ref$unread === void 0 ? false : _ref$unread,
|
|
52
|
+
className = _ref.className,
|
|
53
|
+
children = _ref.children;
|
|
54
|
+
var avatar = {
|
|
55
|
+
name: user.name,
|
|
56
|
+
imageUrl: user.profileImageUrl
|
|
57
|
+
};
|
|
58
|
+
return /*#__PURE__*/jsxs("div", {
|
|
59
|
+
className: classnames("neeto-molecules-engagements-node relative -mt-4 flex items-center gap-2 py-4", className),
|
|
60
|
+
children: [/*#__PURE__*/jsx(ActivityIcon, {
|
|
61
|
+
icon: icon,
|
|
62
|
+
unread: unread
|
|
63
|
+
}), /*#__PURE__*/jsx(Avatar, {
|
|
64
|
+
size: "medium",
|
|
65
|
+
user: avatar
|
|
66
|
+
}), /*#__PURE__*/jsx("div", {
|
|
67
|
+
className: "pt-0.5",
|
|
68
|
+
children: children
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var CommentHeader = function CommentHeader(_ref) {
|
|
74
|
+
var user = _ref.user,
|
|
75
|
+
comment = _ref.comment,
|
|
76
|
+
info = _ref.info,
|
|
77
|
+
actions = _ref.actions;
|
|
78
|
+
var avatar = {
|
|
79
|
+
name: user.name,
|
|
80
|
+
imageUrl: user.profileImageUrl
|
|
81
|
+
};
|
|
82
|
+
return /*#__PURE__*/jsxs("div", {
|
|
83
|
+
className: "neeto-ui-bg-gray-100 neeto-ui-border-gray-300 flex items-center justify-between rounded-t-md border-b py-2 pl-4 pr-2",
|
|
84
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
85
|
+
className: "flex items-center gap-2",
|
|
86
|
+
children: [/*#__PURE__*/jsx(Avatar, {
|
|
87
|
+
size: "medium",
|
|
88
|
+
user: avatar
|
|
89
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
90
|
+
className: "neeto-ui-text-gray-700",
|
|
91
|
+
style: "body2",
|
|
92
|
+
weight: "semibold",
|
|
93
|
+
children: user.name
|
|
94
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
95
|
+
className: "neeto-ui-text-gray-700",
|
|
96
|
+
style: "body2",
|
|
97
|
+
children: "\u2022"
|
|
98
|
+
}), info && /*#__PURE__*/jsxs(Fragment, {
|
|
99
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
100
|
+
className: "neeto-ui-text-gray-500 lowercase",
|
|
101
|
+
style: "body2",
|
|
102
|
+
children: info
|
|
103
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
104
|
+
className: "neeto-ui-text-gray-700",
|
|
105
|
+
style: "body2",
|
|
106
|
+
children: "\u2022"
|
|
107
|
+
})]
|
|
108
|
+
}), comment.createdAt && /*#__PURE__*/jsx(DateFormat.FromNow, {
|
|
109
|
+
date: comment.createdAt,
|
|
110
|
+
typographyProps: {
|
|
111
|
+
style: "body2",
|
|
112
|
+
className: "neeto-ui-text-gray-500"
|
|
113
|
+
}
|
|
114
|
+
})]
|
|
115
|
+
}), isPresent(actions) && /*#__PURE__*/jsx(MoreDropdown, {
|
|
116
|
+
dropdownProps: {
|
|
117
|
+
position: "bottom-start"
|
|
118
|
+
},
|
|
119
|
+
menuItems: actions
|
|
120
|
+
})]
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
125
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
126
|
+
var findOwnIndex = findIndexBy({
|
|
127
|
+
userId: globalProps.user.id
|
|
128
|
+
});
|
|
129
|
+
var groupReactions = collectBy(prop("unified"));
|
|
130
|
+
var Reactions = function Reactions(_ref) {
|
|
131
|
+
var reactions = _ref.reactions,
|
|
132
|
+
onAdd = _ref.onAdd,
|
|
133
|
+
onRemove = _ref.onRemove;
|
|
134
|
+
var _useTranslation = useTranslation(),
|
|
135
|
+
t = _useTranslation.t;
|
|
136
|
+
var groups = groupReactions(reactions);
|
|
137
|
+
var onSelect = function onSelect(emoji) {
|
|
138
|
+
// Try to find group to which emoji belongs in existing reactions.
|
|
139
|
+
var group = groups.find(pathEq(emoji.unified, [0, "unified"]));
|
|
140
|
+
if (group && findOwnIndex(group) >= 0) return; // User already reacted with same emoji.
|
|
141
|
+
onAdd(_objectSpread(_objectSpread({}, emoji), {}, {
|
|
142
|
+
emoji: emoji["native"]
|
|
143
|
+
}));
|
|
144
|
+
};
|
|
145
|
+
return /*#__PURE__*/jsxs("div", {
|
|
146
|
+
className: "mt-2 flex flex-wrap gap-0.5",
|
|
147
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
148
|
+
className: "neeto-ui-rounded-full neeto-ui-bg-gray-200 mr-2",
|
|
149
|
+
children: /*#__PURE__*/jsx(EmojiPicker, {
|
|
150
|
+
onSelect: onSelect
|
|
151
|
+
})
|
|
152
|
+
}), groups.map(function (reactions) {
|
|
153
|
+
var ownIndex = findOwnIndex(reactions);
|
|
154
|
+
var selected = ownIndex >= 0;
|
|
155
|
+
var reaction = selected ? reactions[ownIndex] : reactions[0];
|
|
156
|
+
var names = pluck("reactor", reactions).join(", ");
|
|
157
|
+
return /*#__PURE__*/jsx(Tooltip, {
|
|
158
|
+
position: "top",
|
|
159
|
+
content: /*#__PURE__*/jsx("p", {
|
|
160
|
+
className: "text-center text-xs",
|
|
161
|
+
children: t("neetoMolecules.common.reacted", {
|
|
162
|
+
names: names
|
|
163
|
+
})
|
|
164
|
+
}),
|
|
165
|
+
children: /*#__PURE__*/jsx("div", {
|
|
166
|
+
className: classnames("neeto-ui-rounded-full mx-1 flex cursor-pointer items-center justify-center px-2 py-1", {
|
|
167
|
+
"neeto-ui-bg-accent-100": selected,
|
|
168
|
+
"neeto-ui-bg-gray-100": !selected
|
|
169
|
+
}),
|
|
170
|
+
onClick: function onClick() {
|
|
171
|
+
return (selected ? onRemove : onAdd)(reaction);
|
|
172
|
+
},
|
|
173
|
+
children: /*#__PURE__*/jsxs(Typography, {
|
|
174
|
+
className: "space-x-1 text-sm",
|
|
175
|
+
style: "body2",
|
|
176
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
177
|
+
className: "text-sm",
|
|
178
|
+
children: reaction.emoji
|
|
179
|
+
}), /*#__PURE__*/jsx("span", {
|
|
180
|
+
className: "text-sm",
|
|
181
|
+
children: reactions.length
|
|
182
|
+
})]
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
}, reaction.unified);
|
|
186
|
+
})]
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
var Reactions$1 = /*#__PURE__*/memo(Reactions, eqProps("reactions"));
|
|
190
|
+
|
|
191
|
+
var ENGAGEMENT_TYPES = {
|
|
192
|
+
COMMENT: "comment",
|
|
193
|
+
ACTIVITY: "activity"
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
var createCommentElementId = function createCommentElementId(comment) {
|
|
197
|
+
return "neeto-molecules-engagement-comment--".concat(comment.id);
|
|
198
|
+
};
|
|
199
|
+
var defaultMatchType = function defaultMatchType(engagement) {
|
|
200
|
+
if (engagement.commenter) return ENGAGEMENT_TYPES.COMMENT;else if (engagement.creator) return ENGAGEMENT_TYPES.ACTIVITY;
|
|
201
|
+
return null;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
var Comment = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
205
|
+
var user = _ref.user,
|
|
206
|
+
comment = _ref.comment,
|
|
207
|
+
reactions = _ref.reactions,
|
|
208
|
+
info = _ref.info,
|
|
209
|
+
actions = _ref.actions,
|
|
210
|
+
className = _ref.className,
|
|
211
|
+
children = _ref.children,
|
|
212
|
+
onAddReaction = _ref.onAddReaction,
|
|
213
|
+
onRemoveReaction = _ref.onRemoveReaction;
|
|
214
|
+
return /*#__PURE__*/jsxs("div", {
|
|
215
|
+
ref: ref,
|
|
216
|
+
id: createCommentElementId(comment),
|
|
217
|
+
className: classnames("neeto-ui-bg-white neeto-ui-rounded-md neeto-ui-border-gray-300 neeto-molecules-comments-node mb-4 w-full border", className),
|
|
218
|
+
children: [/*#__PURE__*/jsx(CommentHeader, {
|
|
219
|
+
actions: actions,
|
|
220
|
+
comment: comment,
|
|
221
|
+
info: info,
|
|
222
|
+
user: user
|
|
223
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
224
|
+
className: "neeto-molecules-comments-node__inner p-4",
|
|
225
|
+
children: [children, reactions !== false && /*#__PURE__*/jsx(Reactions$1, {
|
|
226
|
+
reactions: reactions,
|
|
227
|
+
onAdd: onAddReaction,
|
|
228
|
+
onRemove: onRemoveReaction
|
|
229
|
+
})]
|
|
230
|
+
})]
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
Comment.displayName = "Comment";
|
|
234
|
+
Comment.propTypes = {
|
|
235
|
+
/** Object representing the user information */
|
|
236
|
+
user: PropTypes.shape({
|
|
237
|
+
name: PropTypes.string.isRequired
|
|
238
|
+
}).isRequired,
|
|
239
|
+
/** Object representing the comment item. */
|
|
240
|
+
comment: PropTypes.shape({
|
|
241
|
+
id: PropTypes.string.isRequired,
|
|
242
|
+
createdAt: PropTypes.string.isRequired
|
|
243
|
+
}).isRequired,
|
|
244
|
+
/** Array of reactions. Settings this to `false` will disable reactions for the item */
|
|
245
|
+
reactions: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
|
|
246
|
+
/** Optional text label to be displayed in the header. */
|
|
247
|
+
info: PropTypes.string,
|
|
248
|
+
/** Optional action items to be passed to the menuItems prop of the actions dropdown */
|
|
249
|
+
actions: PropTypes.arrayOf(PropTypes.shape({
|
|
250
|
+
isVisible: PropTypes.bool,
|
|
251
|
+
key: PropTypes.string.isRequired,
|
|
252
|
+
label: PropTypes.string.isRequired,
|
|
253
|
+
onClick: PropTypes.func.isRequired
|
|
254
|
+
})),
|
|
255
|
+
/** Additional classes passed on to the board view. */
|
|
256
|
+
className: PropTypes.string,
|
|
257
|
+
/** Callback function triggered when a reaction (emoji) is added */
|
|
258
|
+
onAddReaction: PropTypes.func,
|
|
259
|
+
/** Callback function triggered when a reaction (emoji) is removed*/
|
|
260
|
+
onRemoveReaction: PropTypes.func
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
var css = ".neeto-molecules-comments-node{position:relative}.neeto-molecules-comments-node:before{background-color:rgb(var(--neeto-ui-gray-200));content:\"\";height:1rem;left:13px;position:absolute;top:calc(100% + 1px);transform:translateX(-50%);width:2px}.neeto-molecules-comments-node:last-child:before{display:none}.neeto-molecules-engagements-node{position:relative}.neeto-molecules-engagements-node:before{background-color:rgb(var(--neeto-ui-gray-200));content:\"\";height:100%;left:14px;position:absolute;top:0;transform:translateX(-50%);width:2px}";
|
|
264
|
+
n(css,{});
|
|
265
|
+
|
|
266
|
+
var Engagements = function Engagements(_ref) {
|
|
267
|
+
var data = _ref.data,
|
|
268
|
+
_ref$isActivitiesEnab = _ref.isActivitiesEnabled,
|
|
269
|
+
isActivitiesEnabled = _ref$isActivitiesEnab === void 0 ? false : _ref$isActivitiesEnab,
|
|
270
|
+
_ref$matchType = _ref.matchType,
|
|
271
|
+
matchType = _ref$matchType === void 0 ? defaultMatchType : _ref$matchType,
|
|
272
|
+
renderComment = _ref.renderComment,
|
|
273
|
+
renderActivity = _ref.renderActivity;
|
|
274
|
+
var rendererHashmap = _defineProperty(_defineProperty({}, ENGAGEMENT_TYPES.COMMENT, renderComment), ENGAGEMENT_TYPES.ACTIVITY, isActivitiesEnabled ? renderActivity : noop);
|
|
275
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
276
|
+
children: data.map(function (engagement, index) {
|
|
277
|
+
var type = matchType(engagement);
|
|
278
|
+
var renderer = rendererHashmap[type];
|
|
279
|
+
if (!renderer) return null;
|
|
280
|
+
return /*#__PURE__*/jsx(React__default.Fragment, {
|
|
281
|
+
children: renderer(engagement, index)
|
|
282
|
+
}, engagement.id);
|
|
283
|
+
})
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
Engagements.displayName = "Engagements";
|
|
287
|
+
Engagements.Comment = Comment;
|
|
288
|
+
Engagements.Activity = Activity;
|
|
289
|
+
Engagements.TYPES = ENGAGEMENT_TYPES;
|
|
290
|
+
|
|
291
|
+
export { Engagements as default };
|
|
292
|
+
//# sourceMappingURL=Engagements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Engagements.js","sources":["../src/components/Engagements/Activity/Icon.jsx","../src/components/Engagements/Activity/index.jsx","../src/components/Engagements/Comment/Header.jsx","../src/components/Engagements/Comment/Reactions.jsx","../src/components/Engagements/constants.js","../src/components/Engagements/utils.js","../src/components/Engagements/Comment/index.jsx","../src/components/Engagements/index.jsx"],"sourcesContent":["import classNames from \"classnames\";\n\nconst ActivityIcon = ({ icon, unread }) => (\n <div className=\"flex-shrink-0\">\n <span\n className={classNames(\n \"neeto-ui-bg-gray-200 neeto-ui-text-gray-600 neeto-ui-rounded-full relative z-10 flex h-7 w-7 items-center justify-center p-1\",\n {\n \"neeto-ui-text-primary-600 neeto-ui-bg-primary-100\": unread,\n }\n )}\n >\n {icon}\n {unread && (\n <span className=\"neeto-ui-rounded-full neeto-ui-bg-primary-800 absolute -right-0.5 -top-0.5 h-2 w-2\" />\n )}\n </span>\n </div>\n);\n\nexport default ActivityIcon;\n","import classNames from \"classnames\";\nimport { Avatar } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport ActivityIcon from \"./Icon\";\n\nconst Activity = ({ user, icon, unread = false, className, children }) => {\n const avatar = { name: user.name, imageUrl: user.profileImageUrl };\n\n return (\n <div\n className={classNames(\n \"neeto-molecules-engagements-node relative -mt-4 flex items-center gap-2 py-4\",\n className\n )}\n >\n <ActivityIcon {...{ icon, unread }} />\n <Avatar size=\"medium\" user={avatar} />\n <div className=\"pt-0.5\">{children}</div>\n </div>\n );\n};\n\nActivity.propTypes = {\n /** Object representing the user information */\n user: PropTypes.shape({ name: PropTypes.string.isRequired }).isRequired,\n\n /** Element to render as the icon */\n icon: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,\n\n /** Boolean indicating if the activity is unread to show unread badge */\n unread: PropTypes.bool,\n\n /** Additional classes passed on to the board view. */\n className: PropTypes.string,\n};\n\nexport default Activity;\n","import { isPresent } from \"neetocist\";\nimport { Avatar, Typography } from \"neetoui\";\n\nimport DateFormat from \"components/DateFormat\";\nimport MoreDropdown from \"components/MoreDropdown\";\n\nconst CommentHeader = ({ user, comment, info, actions }) => {\n const avatar = { name: user.name, imageUrl: user.profileImageUrl };\n\n return (\n <div className=\"neeto-ui-bg-gray-100 neeto-ui-border-gray-300 flex items-center justify-between rounded-t-md border-b py-2 pl-4 pr-2\">\n <div className=\"flex items-center gap-2\">\n <Avatar size=\"medium\" user={avatar} />\n <Typography\n className=\"neeto-ui-text-gray-700\"\n style=\"body2\"\n weight=\"semibold\"\n >\n {user.name}\n </Typography>\n <Typography className=\"neeto-ui-text-gray-700\" style=\"body2\">\n •\n </Typography>\n {info && (\n <>\n <Typography\n className=\"neeto-ui-text-gray-500 lowercase\"\n style=\"body2\"\n >\n {info}\n </Typography>\n <Typography className=\"neeto-ui-text-gray-700\" style=\"body2\">\n •\n </Typography>\n </>\n )}\n {comment.createdAt && (\n <DateFormat.FromNow\n date={comment.createdAt}\n typographyProps={{\n style: \"body2\",\n className: \"neeto-ui-text-gray-500\",\n }}\n />\n )}\n </div>\n {isPresent(actions) && (\n <MoreDropdown\n dropdownProps={{ position: \"bottom-start\" }}\n menuItems={actions}\n />\n )}\n </div>\n );\n};\n\nexport default CommentHeader;\n","import { memo } from \"react\";\n\nimport classNames from \"classnames\";\nimport { findIndexBy } from \"neetocist\";\nimport { globalProps } from \"neetocommons/initializers\";\nimport { Tooltip, Typography } from \"neetoui\";\nimport { collectBy, eqProps, pathEq, pluck, prop } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport EmojiPicker from \"components/EmojiPicker\";\n\nconst findOwnIndex = findIndexBy({ userId: globalProps.user.id });\nconst groupReactions = collectBy(prop(\"unified\"));\n\nconst Reactions = ({ reactions, onAdd, onRemove }) => {\n const { t } = useTranslation();\n const groups = groupReactions(reactions);\n\n const onSelect = emoji => {\n // Try to find group to which emoji belongs in existing reactions.\n const group = groups.find(pathEq(emoji.unified, [0, \"unified\"]));\n if (group && findOwnIndex(group) >= 0) return; // User already reacted with same emoji.\n onAdd({ ...emoji, emoji: emoji.native });\n };\n\n return (\n <div className=\"mt-2 flex flex-wrap gap-0.5\">\n <div className=\"neeto-ui-rounded-full neeto-ui-bg-gray-200 mr-2\">\n <EmojiPicker {...{ onSelect }} />\n </div>\n {groups.map(reactions => {\n const ownIndex = findOwnIndex(reactions);\n const selected = ownIndex >= 0;\n const reaction = selected ? reactions[ownIndex] : reactions[0];\n const names = pluck(\"reactor\", reactions).join(\", \");\n\n return (\n <Tooltip\n key={reaction.unified}\n position=\"top\"\n content={\n <p className=\"text-center text-xs\">\n {t(\"neetoMolecules.common.reacted\", { names })}\n </p>\n }\n >\n <div\n className={classNames(\n \"neeto-ui-rounded-full mx-1 flex cursor-pointer items-center justify-center px-2 py-1\",\n {\n \"neeto-ui-bg-accent-100\": selected,\n \"neeto-ui-bg-gray-100\": !selected,\n }\n )}\n onClick={() => (selected ? onRemove : onAdd)(reaction)}\n >\n <Typography className=\"space-x-1 text-sm\" style=\"body2\">\n <span className=\"text-sm\">{reaction.emoji}</span>\n <span className=\"text-sm\">{reactions.length}</span>\n </Typography>\n </div>\n </Tooltip>\n );\n })}\n </div>\n );\n};\n\nexport default memo(Reactions, eqProps(\"reactions\"));\n","export const ACTIVITY_TYPES = {\n TIMELINE: \"Timeline\",\n FIELD_VALUE: \"FieldValue\",\n TASK: \"Task\",\n ASSIGNEE: \"Assignee\",\n CHECKLIST: \"Checklist\",\n FIELD: \"Field\",\n PROJECT: \"Project\",\n COMMENT: \"Comment\",\n DOCUMENT: \"Document\",\n CHAT_MESSAGE: \"ChatMessage\",\n MESSAGE: \"Message\",\n SECTION: \"Section\",\n PROJECT_MEMBER: \"ProjectMember\",\n PULL_REQUEST: \"NeetoGithubEngine::PullRequest\",\n};\n\nexport const ENGAGEMENT_TYPES = {\n COMMENT: \"comment\",\n ACTIVITY: \"activity\",\n};\n","import { ENGAGEMENT_TYPES } from \"./constants\";\n\nexport const createCommentElementId = comment =>\n `neeto-molecules-engagement-comment--${comment.id}`;\n\nexport const defaultMatchType = engagement => {\n if (engagement.commenter) return ENGAGEMENT_TYPES.COMMENT;\n else if (engagement.creator) return ENGAGEMENT_TYPES.ACTIVITY;\n\n return null;\n};\n","import { forwardRef } from \"react\";\n\nimport classNames from \"classnames\";\nimport PropTypes from \"prop-types\";\n\nimport CommentHeader from \"./Header\";\nimport Reactions from \"./Reactions\";\n\nimport { createCommentElementId } from \"../utils\";\n\nconst Comment = forwardRef(\n (\n {\n user,\n comment,\n reactions,\n info,\n actions,\n className,\n children,\n onAddReaction,\n onRemoveReaction,\n },\n ref\n ) => (\n <div\n {...{ ref }}\n id={createCommentElementId(comment)}\n className={classNames(\n \"neeto-ui-bg-white neeto-ui-rounded-md neeto-ui-border-gray-300 neeto-molecules-comments-node mb-4 w-full border\",\n className\n )}\n >\n <CommentHeader {...{ actions, comment, info, user }} />\n <div className=\"neeto-molecules-comments-node__inner p-4\">\n {children}\n {reactions !== false && (\n <Reactions\n {...{ reactions }}\n onAdd={onAddReaction}\n onRemove={onRemoveReaction}\n />\n )}\n </div>\n </div>\n )\n);\n\nComment.displayName = \"Comment\";\nComment.propTypes = {\n /** Object representing the user information */\n user: PropTypes.shape({ name: PropTypes.string.isRequired }).isRequired,\n\n /** Object representing the comment item. */\n comment: PropTypes.shape({\n id: PropTypes.string.isRequired,\n createdAt: PropTypes.string.isRequired,\n }).isRequired,\n\n /** Array of reactions. Settings this to `false` will disable reactions for the item */\n reactions: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),\n\n /** Optional text label to be displayed in the header. */\n info: PropTypes.string,\n\n /** Optional action items to be passed to the menuItems prop of the actions dropdown */\n actions: PropTypes.arrayOf(\n PropTypes.shape({\n isVisible: PropTypes.bool,\n key: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n onClick: PropTypes.func.isRequired,\n })\n ),\n\n /** Additional classes passed on to the board view. */\n className: PropTypes.string,\n\n /** Callback function triggered when a reaction (emoji) is added */\n onAddReaction: PropTypes.func,\n\n /** Callback function triggered when a reaction (emoji) is removed*/\n onRemoveReaction: PropTypes.func,\n};\n\nexport default Comment;\n","import React from \"react\";\n\nimport { noop } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport Activity from \"./Activity\";\nimport Comment from \"./Comment\";\nimport { ENGAGEMENT_TYPES } from \"./constants\";\nimport \"./engagements.scss\";\nimport { defaultMatchType } from \"./utils\";\n\nconst Engagements = ({\n data,\n isActivitiesEnabled = false,\n matchType = defaultMatchType,\n renderComment,\n renderActivity,\n}) => {\n const rendererHashmap = {\n [ENGAGEMENT_TYPES.COMMENT]: renderComment,\n [ENGAGEMENT_TYPES.ACTIVITY]: isActivitiesEnabled ? renderActivity : noop,\n };\n\n return (\n <>\n {data.map((engagement, index) => {\n const type = matchType(engagement);\n const renderer = rendererHashmap[type];\n if (!renderer) return null;\n\n return (\n <React.Fragment key={engagement.id}>\n {renderer(engagement, index)}\n </React.Fragment>\n );\n })}\n </>\n );\n};\n\nEngagements.displayName = \"Engagements\";\nEngagements.Comment = Comment;\nEngagements.Activity = Activity;\nEngagements.TYPES = ENGAGEMENT_TYPES;\n\nEngagements.propTypes = {\n /** An array of engagement items */\n data: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string.isRequired }))\n .isRequired,\n\n /** Boolean, determines whether activities are rendered. Defaults to false */\n isActivitiesEnabled: PropTypes.bool,\n\n /** Optional function to match the item type. Receives item as argument and should return one of Engagements.TYPES.*/\n matchType: PropTypes.func,\n\n /** A function to render individual comment item. Receives comment and index as arguments */\n renderComment: PropTypes.func.isRequired,\n\n /** A function to render individual activity item. Receives comment and index as arguments */\n renderActivity: PropTypes.func.isRequired,\n};\n\nexport default Engagements;\n"],"names":["ActivityIcon","_ref","icon","unread","_jsx","className","children","_jsxs","classNames","Activity","user","_ref$unread","avatar","name","imageUrl","profileImageUrl","Avatar","size","CommentHeader","comment","info","actions","Typography","style","weight","_Fragment","createdAt","DateFormat","FromNow","date","typographyProps","isPresent","MoreDropdown","dropdownProps","position","menuItems","findOwnIndex","findIndexBy","userId","globalProps","id","groupReactions","collectBy","prop","Reactions","reactions","onAdd","onRemove","_useTranslation","useTranslation","t","groups","onSelect","emoji","group","find","pathEq","unified","_objectSpread","EmojiPicker","map","ownIndex","selected","reaction","names","pluck","join","Tooltip","content","onClick","length","memo","eqProps","ENGAGEMENT_TYPES","COMMENT","ACTIVITY","createCommentElementId","concat","defaultMatchType","engagement","commenter","creator","Comment","forwardRef","ref","onAddReaction","onRemoveReaction","displayName","propTypes","PropTypes","shape","string","isRequired","oneOfType","array","bool","arrayOf","isVisible","key","label","func","Engagements","data","_ref$isActivitiesEnab","isActivitiesEnabled","_ref$matchType","matchType","renderComment","renderActivity","rendererHashmap","_defineProperty","noop","index","type","renderer","React","Fragment","TYPES"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAEC,MAAM,GAAAF,IAAA,CAANE,MAAM,CAAA;AAAA,EAAA,oBAClCC,GAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,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,GAAGL,eAAe,CAACI,IAAI,CAAC,CAAA;AACtC,MAAA,IAAI,CAACC,QAAQ,EAAE,OAAO,IAAI,CAAA;AAE1B,MAAA,oBACE9G,GAAA,CAAC+G,cAAK,CAACC,QAAQ,EAAA;AAAA9G,QAAAA,QAAA,EACZ4G,QAAQ,CAACnC,UAAU,EAAEiC,KAAK,CAAA;OADRjC,EAAAA,UAAU,CAACvC,EAEhB,CAAC,CAAA;KAEpB,CAAA;AAAC,GACF,CAAC,CAAA;AAEP,EAAC;AAED6D,WAAW,CAACd,WAAW,GAAG,aAAa,CAAA;AACvCc,WAAW,CAACnB,OAAO,GAAGA,OAAO,CAAA;AAC7BmB,WAAW,CAAC5F,QAAQ,GAAGA,QAAQ,CAAA;AAC/B4F,WAAW,CAACgB,KAAK,GAAG5C,gBAAgB;;;;"}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
6
|
+
var classnames = require('classnames');
|
|
7
|
+
var Avatar = require('@bigbinary/neetoui/Avatar');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
var index = require('./index-JY2zVpnv.js');
|
|
10
|
+
var Typography = require('@bigbinary/neetoui/Typography');
|
|
11
|
+
var DateFormat = require('./DateFormat.js');
|
|
12
|
+
var MoreDropdown = require('./MoreDropdown.js');
|
|
13
|
+
var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
|
|
14
|
+
var Tooltip = require('@bigbinary/neetoui/Tooltip');
|
|
15
|
+
var ramda = require('ramda');
|
|
16
|
+
var reactI18next = require('react-i18next');
|
|
17
|
+
var EmojiPicker = require('./EmojiPicker.js');
|
|
18
|
+
var injectCss = require('./inject-css-vQvjPR2x.js');
|
|
19
|
+
require('./_commonjsHelpers-BJu3ubxk.js');
|
|
20
|
+
require('@bigbinary/neeto-commons-frontend/react-utils/useTimer');
|
|
21
|
+
require('@bigbinary/neeto-commons-frontend/utils/datetime');
|
|
22
|
+
require('@babel/runtime/helpers/objectWithoutProperties');
|
|
23
|
+
require('@bigbinary/neeto-icons/MenuHorizontal');
|
|
24
|
+
require('@bigbinary/neeto-icons/MenuVertical');
|
|
25
|
+
require('@bigbinary/neetoui/Button');
|
|
26
|
+
require('@bigbinary/neetoui/Dropdown');
|
|
27
|
+
require('@babel/runtime/helpers/slicedToArray');
|
|
28
|
+
require('@bigbinary/neeto-icons/SmileFaceGrey');
|
|
29
|
+
require('emoji-mart');
|
|
30
|
+
require('@tanstack/react-query');
|
|
31
|
+
require('axios');
|
|
32
|
+
|
|
33
|
+
var ActivityIcon = function ActivityIcon(_ref) {
|
|
34
|
+
var icon = _ref.icon,
|
|
35
|
+
unread = _ref.unread;
|
|
36
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
37
|
+
className: "flex-shrink-0",
|
|
38
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
39
|
+
className: classnames("neeto-ui-bg-gray-200 neeto-ui-text-gray-600 neeto-ui-rounded-full relative z-10 flex h-7 w-7 items-center justify-center p-1", {
|
|
40
|
+
"neeto-ui-text-primary-600 neeto-ui-bg-primary-100": unread
|
|
41
|
+
}),
|
|
42
|
+
children: [icon, unread && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
43
|
+
className: "neeto-ui-rounded-full neeto-ui-bg-primary-800 absolute -right-0.5 -top-0.5 h-2 w-2"
|
|
44
|
+
})]
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var Activity = function Activity(_ref) {
|
|
50
|
+
var user = _ref.user,
|
|
51
|
+
icon = _ref.icon,
|
|
52
|
+
_ref$unread = _ref.unread,
|
|
53
|
+
unread = _ref$unread === void 0 ? false : _ref$unread,
|
|
54
|
+
className = _ref.className,
|
|
55
|
+
children = _ref.children;
|
|
56
|
+
var avatar = {
|
|
57
|
+
name: user.name,
|
|
58
|
+
imageUrl: user.profileImageUrl
|
|
59
|
+
};
|
|
60
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
61
|
+
className: classnames("neeto-molecules-engagements-node relative -mt-4 flex items-center gap-2 py-4", className),
|
|
62
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ActivityIcon, {
|
|
63
|
+
icon: icon,
|
|
64
|
+
unread: unread
|
|
65
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Avatar, {
|
|
66
|
+
size: "medium",
|
|
67
|
+
user: avatar
|
|
68
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
69
|
+
className: "pt-0.5",
|
|
70
|
+
children: children
|
|
71
|
+
})]
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var CommentHeader = function CommentHeader(_ref) {
|
|
76
|
+
var user = _ref.user,
|
|
77
|
+
comment = _ref.comment,
|
|
78
|
+
info = _ref.info,
|
|
79
|
+
actions = _ref.actions;
|
|
80
|
+
var avatar = {
|
|
81
|
+
name: user.name,
|
|
82
|
+
imageUrl: user.profileImageUrl
|
|
83
|
+
};
|
|
84
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
85
|
+
className: "neeto-ui-bg-gray-100 neeto-ui-border-gray-300 flex items-center justify-between rounded-t-md border-b py-2 pl-4 pr-2",
|
|
86
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
87
|
+
className: "flex items-center gap-2",
|
|
88
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Avatar, {
|
|
89
|
+
size: "medium",
|
|
90
|
+
user: avatar
|
|
91
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
92
|
+
className: "neeto-ui-text-gray-700",
|
|
93
|
+
style: "body2",
|
|
94
|
+
weight: "semibold",
|
|
95
|
+
children: user.name
|
|
96
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
97
|
+
className: "neeto-ui-text-gray-700",
|
|
98
|
+
style: "body2",
|
|
99
|
+
children: "\u2022"
|
|
100
|
+
}), info && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
101
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
102
|
+
className: "neeto-ui-text-gray-500 lowercase",
|
|
103
|
+
style: "body2",
|
|
104
|
+
children: info
|
|
105
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
106
|
+
className: "neeto-ui-text-gray-700",
|
|
107
|
+
style: "body2",
|
|
108
|
+
children: "\u2022"
|
|
109
|
+
})]
|
|
110
|
+
}), comment.createdAt && /*#__PURE__*/jsxRuntime.jsx(DateFormat.FromNow, {
|
|
111
|
+
date: comment.createdAt,
|
|
112
|
+
typographyProps: {
|
|
113
|
+
style: "body2",
|
|
114
|
+
className: "neeto-ui-text-gray-500"
|
|
115
|
+
}
|
|
116
|
+
})]
|
|
117
|
+
}), neetoCist.isPresent(actions) && /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
|
|
118
|
+
dropdownProps: {
|
|
119
|
+
position: "bottom-start"
|
|
120
|
+
},
|
|
121
|
+
menuItems: actions
|
|
122
|
+
})]
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
127
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
128
|
+
var findOwnIndex = neetoCist.findIndexBy({
|
|
129
|
+
userId: initializers.globalProps.user.id
|
|
130
|
+
});
|
|
131
|
+
var groupReactions = ramda.collectBy(ramda.prop("unified"));
|
|
132
|
+
var Reactions = function Reactions(_ref) {
|
|
133
|
+
var reactions = _ref.reactions,
|
|
134
|
+
onAdd = _ref.onAdd,
|
|
135
|
+
onRemove = _ref.onRemove;
|
|
136
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
137
|
+
t = _useTranslation.t;
|
|
138
|
+
var groups = groupReactions(reactions);
|
|
139
|
+
var onSelect = function onSelect(emoji) {
|
|
140
|
+
// Try to find group to which emoji belongs in existing reactions.
|
|
141
|
+
var group = groups.find(ramda.pathEq(emoji.unified, [0, "unified"]));
|
|
142
|
+
if (group && findOwnIndex(group) >= 0) return; // User already reacted with same emoji.
|
|
143
|
+
onAdd(_objectSpread(_objectSpread({}, emoji), {}, {
|
|
144
|
+
emoji: emoji["native"]
|
|
145
|
+
}));
|
|
146
|
+
};
|
|
147
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
148
|
+
className: "mt-2 flex flex-wrap gap-0.5",
|
|
149
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
150
|
+
className: "neeto-ui-rounded-full neeto-ui-bg-gray-200 mr-2",
|
|
151
|
+
children: /*#__PURE__*/jsxRuntime.jsx(EmojiPicker, {
|
|
152
|
+
onSelect: onSelect
|
|
153
|
+
})
|
|
154
|
+
}), groups.map(function (reactions) {
|
|
155
|
+
var ownIndex = findOwnIndex(reactions);
|
|
156
|
+
var selected = ownIndex >= 0;
|
|
157
|
+
var reaction = selected ? reactions[ownIndex] : reactions[0];
|
|
158
|
+
var names = ramda.pluck("reactor", reactions).join(", ");
|
|
159
|
+
return /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
|
|
160
|
+
position: "top",
|
|
161
|
+
content: /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
162
|
+
className: "text-center text-xs",
|
|
163
|
+
children: t("neetoMolecules.common.reacted", {
|
|
164
|
+
names: names
|
|
165
|
+
})
|
|
166
|
+
}),
|
|
167
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
168
|
+
className: classnames("neeto-ui-rounded-full mx-1 flex cursor-pointer items-center justify-center px-2 py-1", {
|
|
169
|
+
"neeto-ui-bg-accent-100": selected,
|
|
170
|
+
"neeto-ui-bg-gray-100": !selected
|
|
171
|
+
}),
|
|
172
|
+
onClick: function onClick() {
|
|
173
|
+
return (selected ? onRemove : onAdd)(reaction);
|
|
174
|
+
},
|
|
175
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(Typography, {
|
|
176
|
+
className: "space-x-1 text-sm",
|
|
177
|
+
style: "body2",
|
|
178
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
179
|
+
className: "text-sm",
|
|
180
|
+
children: reaction.emoji
|
|
181
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
182
|
+
className: "text-sm",
|
|
183
|
+
children: reactions.length
|
|
184
|
+
})]
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
}, reaction.unified);
|
|
188
|
+
})]
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
var Reactions$1 = /*#__PURE__*/React.memo(Reactions, ramda.eqProps("reactions"));
|
|
192
|
+
|
|
193
|
+
var ENGAGEMENT_TYPES = {
|
|
194
|
+
COMMENT: "comment",
|
|
195
|
+
ACTIVITY: "activity"
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
var createCommentElementId = function createCommentElementId(comment) {
|
|
199
|
+
return "neeto-molecules-engagement-comment--".concat(comment.id);
|
|
200
|
+
};
|
|
201
|
+
var defaultMatchType = function defaultMatchType(engagement) {
|
|
202
|
+
if (engagement.commenter) return ENGAGEMENT_TYPES.COMMENT;else if (engagement.creator) return ENGAGEMENT_TYPES.ACTIVITY;
|
|
203
|
+
return null;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
var Comment = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
207
|
+
var user = _ref.user,
|
|
208
|
+
comment = _ref.comment,
|
|
209
|
+
reactions = _ref.reactions,
|
|
210
|
+
info = _ref.info,
|
|
211
|
+
actions = _ref.actions,
|
|
212
|
+
className = _ref.className,
|
|
213
|
+
children = _ref.children,
|
|
214
|
+
onAddReaction = _ref.onAddReaction,
|
|
215
|
+
onRemoveReaction = _ref.onRemoveReaction;
|
|
216
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
217
|
+
ref: ref,
|
|
218
|
+
id: createCommentElementId(comment),
|
|
219
|
+
className: classnames("neeto-ui-bg-white neeto-ui-rounded-md neeto-ui-border-gray-300 neeto-molecules-comments-node mb-4 w-full border", className),
|
|
220
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(CommentHeader, {
|
|
221
|
+
actions: actions,
|
|
222
|
+
comment: comment,
|
|
223
|
+
info: info,
|
|
224
|
+
user: user
|
|
225
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
226
|
+
className: "neeto-molecules-comments-node__inner p-4",
|
|
227
|
+
children: [children, reactions !== false && /*#__PURE__*/jsxRuntime.jsx(Reactions$1, {
|
|
228
|
+
reactions: reactions,
|
|
229
|
+
onAdd: onAddReaction,
|
|
230
|
+
onRemove: onRemoveReaction
|
|
231
|
+
})]
|
|
232
|
+
})]
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
Comment.displayName = "Comment";
|
|
236
|
+
Comment.propTypes = {
|
|
237
|
+
/** Object representing the user information */
|
|
238
|
+
user: index.PropTypes.shape({
|
|
239
|
+
name: index.PropTypes.string.isRequired
|
|
240
|
+
}).isRequired,
|
|
241
|
+
/** Object representing the comment item. */
|
|
242
|
+
comment: index.PropTypes.shape({
|
|
243
|
+
id: index.PropTypes.string.isRequired,
|
|
244
|
+
createdAt: index.PropTypes.string.isRequired
|
|
245
|
+
}).isRequired,
|
|
246
|
+
/** Array of reactions. Settings this to `false` will disable reactions for the item */
|
|
247
|
+
reactions: index.PropTypes.oneOfType([index.PropTypes.array, index.PropTypes.bool]),
|
|
248
|
+
/** Optional text label to be displayed in the header. */
|
|
249
|
+
info: index.PropTypes.string,
|
|
250
|
+
/** Optional action items to be passed to the menuItems prop of the actions dropdown */
|
|
251
|
+
actions: index.PropTypes.arrayOf(index.PropTypes.shape({
|
|
252
|
+
isVisible: index.PropTypes.bool,
|
|
253
|
+
key: index.PropTypes.string.isRequired,
|
|
254
|
+
label: index.PropTypes.string.isRequired,
|
|
255
|
+
onClick: index.PropTypes.func.isRequired
|
|
256
|
+
})),
|
|
257
|
+
/** Additional classes passed on to the board view. */
|
|
258
|
+
className: index.PropTypes.string,
|
|
259
|
+
/** Callback function triggered when a reaction (emoji) is added */
|
|
260
|
+
onAddReaction: index.PropTypes.func,
|
|
261
|
+
/** Callback function triggered when a reaction (emoji) is removed*/
|
|
262
|
+
onRemoveReaction: index.PropTypes.func
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
var css = ".neeto-molecules-comments-node{position:relative}.neeto-molecules-comments-node:before{background-color:rgb(var(--neeto-ui-gray-200));content:\"\";height:1rem;left:13px;position:absolute;top:calc(100% + 1px);transform:translateX(-50%);width:2px}.neeto-molecules-comments-node:last-child:before{display:none}.neeto-molecules-engagements-node{position:relative}.neeto-molecules-engagements-node:before{background-color:rgb(var(--neeto-ui-gray-200));content:\"\";height:100%;left:14px;position:absolute;top:0;transform:translateX(-50%);width:2px}";
|
|
266
|
+
injectCss.n(css,{});
|
|
267
|
+
|
|
268
|
+
var Engagements = function Engagements(_ref) {
|
|
269
|
+
var data = _ref.data,
|
|
270
|
+
_ref$isActivitiesEnab = _ref.isActivitiesEnabled,
|
|
271
|
+
isActivitiesEnabled = _ref$isActivitiesEnab === void 0 ? false : _ref$isActivitiesEnab,
|
|
272
|
+
_ref$matchType = _ref.matchType,
|
|
273
|
+
matchType = _ref$matchType === void 0 ? defaultMatchType : _ref$matchType,
|
|
274
|
+
renderComment = _ref.renderComment,
|
|
275
|
+
renderActivity = _ref.renderActivity;
|
|
276
|
+
var rendererHashmap = _defineProperty(_defineProperty({}, ENGAGEMENT_TYPES.COMMENT, renderComment), ENGAGEMENT_TYPES.ACTIVITY, isActivitiesEnabled ? renderActivity : neetoCist.noop);
|
|
277
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
278
|
+
children: data.map(function (engagement, index) {
|
|
279
|
+
var type = matchType(engagement);
|
|
280
|
+
var renderer = rendererHashmap[type];
|
|
281
|
+
if (!renderer) return null;
|
|
282
|
+
return /*#__PURE__*/jsxRuntime.jsx(React.Fragment, {
|
|
283
|
+
children: renderer(engagement, index)
|
|
284
|
+
}, engagement.id);
|
|
285
|
+
})
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
Engagements.displayName = "Engagements";
|
|
289
|
+
Engagements.Comment = Comment;
|
|
290
|
+
Engagements.Activity = Activity;
|
|
291
|
+
Engagements.TYPES = ENGAGEMENT_TYPES;
|
|
292
|
+
|
|
293
|
+
module.exports = Engagements;
|
|
294
|
+
//# sourceMappingURL=Engagements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Engagements.js","sources":["../../src/components/Engagements/Activity/Icon.jsx","../../src/components/Engagements/Activity/index.jsx","../../src/components/Engagements/Comment/Header.jsx","../../src/components/Engagements/Comment/Reactions.jsx","../../src/components/Engagements/constants.js","../../src/components/Engagements/utils.js","../../src/components/Engagements/Comment/index.jsx","../../src/components/Engagements/index.jsx"],"sourcesContent":["import classNames from \"classnames\";\n\nconst ActivityIcon = ({ icon, unread }) => (\n <div className=\"flex-shrink-0\">\n <span\n className={classNames(\n \"neeto-ui-bg-gray-200 neeto-ui-text-gray-600 neeto-ui-rounded-full relative z-10 flex h-7 w-7 items-center justify-center p-1\",\n {\n \"neeto-ui-text-primary-600 neeto-ui-bg-primary-100\": unread,\n }\n )}\n >\n {icon}\n {unread && (\n <span className=\"neeto-ui-rounded-full neeto-ui-bg-primary-800 absolute -right-0.5 -top-0.5 h-2 w-2\" />\n )}\n </span>\n </div>\n);\n\nexport default ActivityIcon;\n","import classNames from \"classnames\";\nimport { Avatar } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport ActivityIcon from \"./Icon\";\n\nconst Activity = ({ user, icon, unread = false, className, children }) => {\n const avatar = { name: user.name, imageUrl: user.profileImageUrl };\n\n return (\n <div\n className={classNames(\n \"neeto-molecules-engagements-node relative -mt-4 flex items-center gap-2 py-4\",\n className\n )}\n >\n <ActivityIcon {...{ icon, unread }} />\n <Avatar size=\"medium\" user={avatar} />\n <div className=\"pt-0.5\">{children}</div>\n </div>\n );\n};\n\nActivity.propTypes = {\n /** Object representing the user information */\n user: PropTypes.shape({ name: PropTypes.string.isRequired }).isRequired,\n\n /** Element to render as the icon */\n icon: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,\n\n /** Boolean indicating if the activity is unread to show unread badge */\n unread: PropTypes.bool,\n\n /** Additional classes passed on to the board view. */\n className: PropTypes.string,\n};\n\nexport default Activity;\n","import { isPresent } from \"neetocist\";\nimport { Avatar, Typography } from \"neetoui\";\n\nimport DateFormat from \"components/DateFormat\";\nimport MoreDropdown from \"components/MoreDropdown\";\n\nconst CommentHeader = ({ user, comment, info, actions }) => {\n const avatar = { name: user.name, imageUrl: user.profileImageUrl };\n\n return (\n <div className=\"neeto-ui-bg-gray-100 neeto-ui-border-gray-300 flex items-center justify-between rounded-t-md border-b py-2 pl-4 pr-2\">\n <div className=\"flex items-center gap-2\">\n <Avatar size=\"medium\" user={avatar} />\n <Typography\n className=\"neeto-ui-text-gray-700\"\n style=\"body2\"\n weight=\"semibold\"\n >\n {user.name}\n </Typography>\n <Typography className=\"neeto-ui-text-gray-700\" style=\"body2\">\n •\n </Typography>\n {info && (\n <>\n <Typography\n className=\"neeto-ui-text-gray-500 lowercase\"\n style=\"body2\"\n >\n {info}\n </Typography>\n <Typography className=\"neeto-ui-text-gray-700\" style=\"body2\">\n •\n </Typography>\n </>\n )}\n {comment.createdAt && (\n <DateFormat.FromNow\n date={comment.createdAt}\n typographyProps={{\n style: \"body2\",\n className: \"neeto-ui-text-gray-500\",\n }}\n />\n )}\n </div>\n {isPresent(actions) && (\n <MoreDropdown\n dropdownProps={{ position: \"bottom-start\" }}\n menuItems={actions}\n />\n )}\n </div>\n );\n};\n\nexport default CommentHeader;\n","import { memo } from \"react\";\n\nimport classNames from \"classnames\";\nimport { findIndexBy } from \"neetocist\";\nimport { globalProps } from \"neetocommons/initializers\";\nimport { Tooltip, Typography } from \"neetoui\";\nimport { collectBy, eqProps, pathEq, pluck, prop } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport EmojiPicker from \"components/EmojiPicker\";\n\nconst findOwnIndex = findIndexBy({ userId: globalProps.user.id });\nconst groupReactions = collectBy(prop(\"unified\"));\n\nconst Reactions = ({ reactions, onAdd, onRemove }) => {\n const { t } = useTranslation();\n const groups = groupReactions(reactions);\n\n const onSelect = emoji => {\n // Try to find group to which emoji belongs in existing reactions.\n const group = groups.find(pathEq(emoji.unified, [0, \"unified\"]));\n if (group && findOwnIndex(group) >= 0) return; // User already reacted with same emoji.\n onAdd({ ...emoji, emoji: emoji.native });\n };\n\n return (\n <div className=\"mt-2 flex flex-wrap gap-0.5\">\n <div className=\"neeto-ui-rounded-full neeto-ui-bg-gray-200 mr-2\">\n <EmojiPicker {...{ onSelect }} />\n </div>\n {groups.map(reactions => {\n const ownIndex = findOwnIndex(reactions);\n const selected = ownIndex >= 0;\n const reaction = selected ? reactions[ownIndex] : reactions[0];\n const names = pluck(\"reactor\", reactions).join(\", \");\n\n return (\n <Tooltip\n key={reaction.unified}\n position=\"top\"\n content={\n <p className=\"text-center text-xs\">\n {t(\"neetoMolecules.common.reacted\", { names })}\n </p>\n }\n >\n <div\n className={classNames(\n \"neeto-ui-rounded-full mx-1 flex cursor-pointer items-center justify-center px-2 py-1\",\n {\n \"neeto-ui-bg-accent-100\": selected,\n \"neeto-ui-bg-gray-100\": !selected,\n }\n )}\n onClick={() => (selected ? onRemove : onAdd)(reaction)}\n >\n <Typography className=\"space-x-1 text-sm\" style=\"body2\">\n <span className=\"text-sm\">{reaction.emoji}</span>\n <span className=\"text-sm\">{reactions.length}</span>\n </Typography>\n </div>\n </Tooltip>\n );\n })}\n </div>\n );\n};\n\nexport default memo(Reactions, eqProps(\"reactions\"));\n","export const ACTIVITY_TYPES = {\n TIMELINE: \"Timeline\",\n FIELD_VALUE: \"FieldValue\",\n TASK: \"Task\",\n ASSIGNEE: \"Assignee\",\n CHECKLIST: \"Checklist\",\n FIELD: \"Field\",\n PROJECT: \"Project\",\n COMMENT: \"Comment\",\n DOCUMENT: \"Document\",\n CHAT_MESSAGE: \"ChatMessage\",\n MESSAGE: \"Message\",\n SECTION: \"Section\",\n PROJECT_MEMBER: \"ProjectMember\",\n PULL_REQUEST: \"NeetoGithubEngine::PullRequest\",\n};\n\nexport const ENGAGEMENT_TYPES = {\n COMMENT: \"comment\",\n ACTIVITY: \"activity\",\n};\n","import { ENGAGEMENT_TYPES } from \"./constants\";\n\nexport const createCommentElementId = comment =>\n `neeto-molecules-engagement-comment--${comment.id}`;\n\nexport const defaultMatchType = engagement => {\n if (engagement.commenter) return ENGAGEMENT_TYPES.COMMENT;\n else if (engagement.creator) return ENGAGEMENT_TYPES.ACTIVITY;\n\n return null;\n};\n","import { forwardRef } from \"react\";\n\nimport classNames from \"classnames\";\nimport PropTypes from \"prop-types\";\n\nimport CommentHeader from \"./Header\";\nimport Reactions from \"./Reactions\";\n\nimport { createCommentElementId } from \"../utils\";\n\nconst Comment = forwardRef(\n (\n {\n user,\n comment,\n reactions,\n info,\n actions,\n className,\n children,\n onAddReaction,\n onRemoveReaction,\n },\n ref\n ) => (\n <div\n {...{ ref }}\n id={createCommentElementId(comment)}\n className={classNames(\n \"neeto-ui-bg-white neeto-ui-rounded-md neeto-ui-border-gray-300 neeto-molecules-comments-node mb-4 w-full border\",\n className\n )}\n >\n <CommentHeader {...{ actions, comment, info, user }} />\n <div className=\"neeto-molecules-comments-node__inner p-4\">\n {children}\n {reactions !== false && (\n <Reactions\n {...{ reactions }}\n onAdd={onAddReaction}\n onRemove={onRemoveReaction}\n />\n )}\n </div>\n </div>\n )\n);\n\nComment.displayName = \"Comment\";\nComment.propTypes = {\n /** Object representing the user information */\n user: PropTypes.shape({ name: PropTypes.string.isRequired }).isRequired,\n\n /** Object representing the comment item. */\n comment: PropTypes.shape({\n id: PropTypes.string.isRequired,\n createdAt: PropTypes.string.isRequired,\n }).isRequired,\n\n /** Array of reactions. Settings this to `false` will disable reactions for the item */\n reactions: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),\n\n /** Optional text label to be displayed in the header. */\n info: PropTypes.string,\n\n /** Optional action items to be passed to the menuItems prop of the actions dropdown */\n actions: PropTypes.arrayOf(\n PropTypes.shape({\n isVisible: PropTypes.bool,\n key: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n onClick: PropTypes.func.isRequired,\n })\n ),\n\n /** Additional classes passed on to the board view. */\n className: PropTypes.string,\n\n /** Callback function triggered when a reaction (emoji) is added */\n onAddReaction: PropTypes.func,\n\n /** Callback function triggered when a reaction (emoji) is removed*/\n onRemoveReaction: PropTypes.func,\n};\n\nexport default Comment;\n","import React from \"react\";\n\nimport { noop } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport Activity from \"./Activity\";\nimport Comment from \"./Comment\";\nimport { ENGAGEMENT_TYPES } from \"./constants\";\nimport \"./engagements.scss\";\nimport { defaultMatchType } from \"./utils\";\n\nconst Engagements = ({\n data,\n isActivitiesEnabled = false,\n matchType = defaultMatchType,\n renderComment,\n renderActivity,\n}) => {\n const rendererHashmap = {\n [ENGAGEMENT_TYPES.COMMENT]: renderComment,\n [ENGAGEMENT_TYPES.ACTIVITY]: isActivitiesEnabled ? renderActivity : noop,\n };\n\n return (\n <>\n {data.map((engagement, index) => {\n const type = matchType(engagement);\n const renderer = rendererHashmap[type];\n if (!renderer) return null;\n\n return (\n <React.Fragment key={engagement.id}>\n {renderer(engagement, index)}\n </React.Fragment>\n );\n })}\n </>\n );\n};\n\nEngagements.displayName = \"Engagements\";\nEngagements.Comment = Comment;\nEngagements.Activity = Activity;\nEngagements.TYPES = ENGAGEMENT_TYPES;\n\nEngagements.propTypes = {\n /** An array of engagement items */\n data: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string.isRequired }))\n .isRequired,\n\n /** Boolean, determines whether activities are rendered. Defaults to false */\n isActivitiesEnabled: PropTypes.bool,\n\n /** Optional function to match the item type. Receives item as argument and should return one of Engagements.TYPES.*/\n matchType: PropTypes.func,\n\n /** A function to render individual comment item. Receives comment and index as arguments */\n renderComment: PropTypes.func.isRequired,\n\n /** A function to render individual activity item. Receives comment and index as arguments */\n renderActivity: PropTypes.func.isRequired,\n};\n\nexport default Engagements;\n"],"names":["ActivityIcon","_ref","icon","unread","_jsx","className","children","_jsxs","classNames","Activity","user","_ref$unread","avatar","name","imageUrl","profileImageUrl","Avatar","size","CommentHeader","comment","info","actions","Typography","style","weight","_Fragment","createdAt","DateFormat","FromNow","date","typographyProps","isPresent","MoreDropdown","dropdownProps","position","menuItems","findOwnIndex","findIndexBy","userId","globalProps","id","groupReactions","collectBy","prop","Reactions","reactions","onAdd","onRemove","_useTranslation","useTranslation","t","groups","onSelect","emoji","group","find","pathEq","unified","_objectSpread","EmojiPicker","map","ownIndex","selected","reaction","names","pluck","join","Tooltip","content","onClick","length","memo","eqProps","ENGAGEMENT_TYPES","COMMENT","ACTIVITY","createCommentElementId","concat","defaultMatchType","engagement","commenter","creator","Comment","forwardRef","ref","onAddReaction","onRemoveReaction","displayName","propTypes","PropTypes","shape","string","isRequired","oneOfType","array","bool","arrayOf","isVisible","key","label","func","Engagements","data","_ref$isActivitiesEnab","isActivitiesEnabled","_ref$matchType","matchType","renderComment","renderActivity","rendererHashmap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ACxClC,EAAAA,gBAAgB,CAACE,QAAQ,EAAG6B,mBAAmB,GAAGI,cAAc,GAAGG,cAAI,CACzE,CAAA;EAED,oBACE3G,cAAA,CAAAqB,mBAAA,EAAA;IAAAnB,QAAA,EACGgG,IAAI,CAAC1C,GAAG,CAAC,UAACmB,UAAU,EAAEiC,KAAK,EAAK;AAC/B,MAAA,IAAMC,IAAI,GAAGP,SAAS,CAAC3B,UAAU,CAAC,CAAA;AAClC,MAAA,IAAMmC,QAAQ,GAAGL,eAAe,CAACI,IAAI,CAAC,CAAA;AACtC,MAAA,IAAI,CAACC,QAAQ,EAAE,OAAO,IAAI,CAAA;AAE1B,MAAA,oBACE9G,cAAA,CAAC+G,KAAK,CAACC,QAAQ,EAAA;AAAA9G,QAAAA,QAAA,EACZ4G,QAAQ,CAACnC,UAAU,EAAEiC,KAAK,CAAA;OADRjC,EAAAA,UAAU,CAACvC,EAEhB,CAAC,CAAA;KAEpB,CAAA;AAAC,GACF,CAAC,CAAA;AAEP,EAAC;AAED6D,WAAW,CAACd,WAAW,GAAG,aAAa,CAAA;AACvCc,WAAW,CAACnB,OAAO,GAAGA,OAAO,CAAA;AAC7BmB,WAAW,CAAC5F,QAAQ,GAAGA,QAAQ,CAAA;AAC/B4F,WAAW,CAACgB,KAAK,GAAG5C,gBAAgB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-molecules",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.39",
|
|
4
4
|
"description": "A package of reusable molecular components for neeto products.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-molecules.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
package/src/translations/en.json
CHANGED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { ENGAGEMENT_TYPES } from 'components/Engagements/constants';
|
|
2
|
+
|
|
3
|
+
type Emoji = {
|
|
4
|
+
native: string;
|
|
5
|
+
unified: string;
|
|
6
|
+
};
|
|
7
|
+
type MenuItems = {
|
|
8
|
+
label: string;
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
key: string;
|
|
11
|
+
isVisible?: boolean;
|
|
12
|
+
hasSubItems?: boolean;
|
|
13
|
+
dropdownProps?: DropdownProps;
|
|
14
|
+
menuItems?: MenuItems[];
|
|
15
|
+
};
|
|
16
|
+
type UserData = {
|
|
17
|
+
name: string;
|
|
18
|
+
profileImageUrl?: string;
|
|
19
|
+
};
|
|
20
|
+
type CommentData = {
|
|
21
|
+
id: string;
|
|
22
|
+
createdAt?: string;
|
|
23
|
+
commenter?: UserData;
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
type ActivityData = {
|
|
27
|
+
id: string;
|
|
28
|
+
creator?: UserData;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
};
|
|
31
|
+
type EngagementType = typeof ENGAGEMENT_TYPES[number];
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* The Engagements component renders the general layout for comments and
|
|
35
|
+
*
|
|
36
|
+
* activities to show user engagement timeline.
|
|
37
|
+
*
|
|
38
|
+
* The main container component for the Engagements components that wraps the
|
|
39
|
+
*
|
|
40
|
+
* items.
|
|
41
|
+
*
|
|
42
|
+
* A wrapper component to be used within the Engagements to render individual
|
|
43
|
+
*
|
|
44
|
+
* comment.
|
|
45
|
+
*
|
|
46
|
+
* A wrapper component to be used within the Engagements to render individual
|
|
47
|
+
*
|
|
48
|
+
* activity.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
*
|
|
52
|
+
* import { useState } from "react";
|
|
53
|
+
* import { User } from "neetoicons";
|
|
54
|
+
* import { Typography } from "neetoui";
|
|
55
|
+
*
|
|
56
|
+
* import Engagements from "neetomolecules/Engagements";
|
|
57
|
+
*
|
|
58
|
+
* const Timeline = () => {
|
|
59
|
+
* const [data] = useState([
|
|
60
|
+
* {
|
|
61
|
+
* id: "comment-1",
|
|
62
|
+
* content: "Hi world!",
|
|
63
|
+
* commenter: { name: "Oliver Smith" },
|
|
64
|
+
* createdAt: Date().toString(),
|
|
65
|
+
* },
|
|
66
|
+
* {
|
|
67
|
+
* id: "comment-2",
|
|
68
|
+
* content: "Hi Oliver!",
|
|
69
|
+
* commenter: { name: "Lily James" },
|
|
70
|
+
* createdAt: Date().toString(),
|
|
71
|
+
* },
|
|
72
|
+
* {
|
|
73
|
+
* id: "activity-1",
|
|
74
|
+
* type: "USER_EXIT",
|
|
75
|
+
* creator: { name: "Oliver Smith" },
|
|
76
|
+
* createdAt: Date().toString(),
|
|
77
|
+
* },
|
|
78
|
+
* ]);
|
|
79
|
+
*
|
|
80
|
+
* return (
|
|
81
|
+
* <Engagements
|
|
82
|
+
* {...{ data }}
|
|
83
|
+
* isActivitiesEnabled
|
|
84
|
+
* renderActivity={engagement => (
|
|
85
|
+
* <Engagements.Activity icon={<User />} user={engagement.creator}>
|
|
86
|
+
* <Typography style="body2">
|
|
87
|
+
* {engagement.type === "USER_EXIT" &&
|
|
88
|
+
* `${engagement.creator.name} left this conversation`}
|
|
89
|
+
* </Typography>
|
|
90
|
+
* </Engagements.Activity>
|
|
91
|
+
* )}
|
|
92
|
+
* renderComment={engagement => (
|
|
93
|
+
* <Engagements.Comment
|
|
94
|
+
* comment={engagement}
|
|
95
|
+
* info="messaged"
|
|
96
|
+
* user={engagement.commenter}
|
|
97
|
+
* >
|
|
98
|
+
* <Typography style="body2">{engagement.content}</Typography>
|
|
99
|
+
* </Engagements.Comment>
|
|
100
|
+
* )}
|
|
101
|
+
* />
|
|
102
|
+
* );
|
|
103
|
+
* };
|
|
104
|
+
* @endexample
|
|
105
|
+
*/
|
|
106
|
+
declare const Engagements: React.FC<{
|
|
107
|
+
data: Array<CommentData | ActivityData>;
|
|
108
|
+
isActivitiesEnabled?: boolean;
|
|
109
|
+
matchType?: (engagement: CommentData | ActivityData) => EngagementType;
|
|
110
|
+
renderComment: (engagement: CommentData, index: number) => React.ReactNode;
|
|
111
|
+
renderActivity: (engagement: ActivityData, index: number) => React.ReactNode;
|
|
112
|
+
}> & {
|
|
113
|
+
Comment: React.FC<{
|
|
114
|
+
user: UserData;
|
|
115
|
+
comment: CommentData;
|
|
116
|
+
reactions?: boolean | Emoji[];
|
|
117
|
+
info?: string;
|
|
118
|
+
actions?: MenuItems[];
|
|
119
|
+
className?: string;
|
|
120
|
+
onAddReaction: (emoji: Emoji) => void;
|
|
121
|
+
onRemoveReaction: (emoji: Emoji) => void;
|
|
122
|
+
}>;
|
|
123
|
+
Activity: React.FC<{
|
|
124
|
+
user: UserData;
|
|
125
|
+
icon: React.ReactNode;
|
|
126
|
+
unread?: boolean;
|
|
127
|
+
className?: string;
|
|
128
|
+
}>;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { Engagements as default };
|