@blocklet/discuss-kit 1.0.7 → 1.0.8

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.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const react = require("react");
3
3
  const PropTypes = require("prop-types");
4
- const styled = require("@emotion/styled");
4
+ const Theme = require("@arcblock/ux/lib/Theme");
5
5
  const IconButton = require("@mui/material/IconButton");
6
6
  const MoreVertIcon = require("@mui/icons-material/MoreVert");
7
7
  const Box = require("@mui/material/Box");
@@ -10,7 +10,6 @@ const MuiMenuItem = require("@mui/material/MenuItem");
10
10
  const jsxRuntime = require("react/jsx-runtime");
11
11
  const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
12
12
  const PropTypes__default = /* @__PURE__ */ _interopDefaultLegacy(PropTypes);
13
- const styled__default = /* @__PURE__ */ _interopDefaultLegacy(styled);
14
13
  const IconButton__default = /* @__PURE__ */ _interopDefaultLegacy(IconButton);
15
14
  const MoreVertIcon__default = /* @__PURE__ */ _interopDefaultLegacy(MoreVertIcon);
16
15
  const Box__default = /* @__PURE__ */ _interopDefaultLegacy(Box);
@@ -75,10 +74,10 @@ Menu.propTypes = {
75
74
  items: PropTypes__default.default.array.isRequired
76
75
  };
77
76
  Menu.defaultProps = {};
78
- const Root = styled__default.default("div")`
77
+ const Root = Theme.styled("div")`
79
78
  display: inline-block;
80
79
  `;
81
- const StyledMenuItem = styled__default.default(MuiMenuItem__default.default)`
80
+ const StyledMenuItem = Theme.styled(MuiMenuItem__default.default)`
82
81
  font-size: 14px;
83
82
  `;
84
83
  module.exports = Menu;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const react = require("react");
3
- const styled = require("@emotion/styled");
3
+ const Theme = require("@arcblock/ux/lib/Theme");
4
4
  const joinUrl = require("url-join");
5
5
  const PropTypes = require("prop-types");
6
6
  const useAsyncRetry = require("react-use/lib/useAsyncRetry");
@@ -19,7 +19,6 @@ const getWsClient = require("./ws");
19
19
  const api = require("./api");
20
20
  const jsxRuntime = require("react/jsx-runtime");
21
21
  const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
22
- const styled__default = /* @__PURE__ */ _interopDefaultLegacy(styled);
23
22
  const joinUrl__default = /* @__PURE__ */ _interopDefaultLegacy(joinUrl);
24
23
  const PropTypes__default = /* @__PURE__ */ _interopDefaultLegacy(PropTypes);
25
24
  const useAsyncRetry__default = /* @__PURE__ */ _interopDefaultLegacy(useAsyncRetry);
@@ -286,6 +285,7 @@ function Wrapper({
286
285
  target,
287
286
  prefix,
288
287
  flatView,
288
+ autoCollapse,
289
289
  ...rest
290
290
  }) {
291
291
  if (!(target == null ? void 0 : target.id)) {
@@ -294,6 +294,13 @@ function Wrapper({
294
294
  const {
295
295
  locale
296
296
  } = context.useLocaleContext();
297
+ const [, setSettings] = discussKitUx.useCommentSettings();
298
+ react.useEffect(() => {
299
+ setSettings((prev) => ({
300
+ ...prev,
301
+ autoCollapse
302
+ }));
303
+ }, [autoCollapse, setSettings]);
297
304
  const object = react.useMemo(
298
305
  () => ({
299
306
  ...target,
@@ -344,16 +351,18 @@ Wrapper.propTypes = {
344
351
  showConnectBtn: PropTypes__default.default.bool,
345
352
  onChange: PropTypes__default.default.func,
346
353
  prefix: PropTypes__default.default.string,
347
- flatView: PropTypes__default.default.bool
354
+ flatView: PropTypes__default.default.bool,
355
+ autoCollapse: PropTypes__default.default.bool
348
356
  };
349
357
  Wrapper.defaultProps = {
350
358
  showConnectBtn: false,
351
359
  onChange: () => {
352
360
  },
353
361
  prefix: "",
354
- flatView: false
362
+ flatView: false,
363
+ autoCollapse: false
355
364
  };
356
- const Container = styled__default.default.div`
365
+ const Container = Theme.styled("div")`
357
366
  background-color: #fff;
358
367
  width: 100%;
359
368
  margin: 0 auto;
@@ -1,6 +1,6 @@
1
1
  import { useState } from "react";
2
2
  import PropTypes from "prop-types";
3
- import styled from "@emotion/styled";
3
+ import { styled } from "@arcblock/ux/lib/Theme";
4
4
  import IconButton from "@mui/material/IconButton";
5
5
  import MoreVertIcon from "@mui/icons-material/MoreVert";
6
6
  import Box from "@mui/material/Box";
@@ -1,5 +1,5 @@
1
- import { useMemo, useEffect, useContext } from "react";
2
- import styled from "@emotion/styled";
1
+ import { useEffect, useMemo, useContext } from "react";
2
+ import { styled } from "@arcblock/ux/lib/Theme";
3
3
  import joinUrl from "url-join";
4
4
  import PropTypes from "prop-types";
5
5
  import useAsyncRetry from "react-use/lib/useAsyncRetry";
@@ -11,7 +11,7 @@ import CircularProgress from "@mui/material/CircularProgress";
11
11
  import ButtonGroup from "@mui/material/ButtonGroup";
12
12
  import { useLocaleContext, LocaleProvider } from "@arcblock/ux/lib/Locale/context";
13
13
  import { ErrorBoundary } from "react-error-boundary";
14
- import { InternalThemeProvider, CommentsProvider, useCommentsContext, BinaryThumb, CommentInput, CommentList } from "@blocklet/discuss-kit-ux";
14
+ import { useCommentSettings, InternalThemeProvider, CommentsProvider, useCommentsContext, BinaryThumb, CommentInput, CommentList } from "@blocklet/discuss-kit-ux";
15
15
  import ErrorFallback from "./components/error-fallback";
16
16
  import { translations } from "./locales";
17
17
  import getWsClient, { useSubscription } from "./ws";
@@ -272,6 +272,7 @@ function Wrapper({
272
272
  target,
273
273
  prefix,
274
274
  flatView,
275
+ autoCollapse,
275
276
  ...rest
276
277
  }) {
277
278
  if (!(target == null ? void 0 : target.id)) {
@@ -280,6 +281,13 @@ function Wrapper({
280
281
  const {
281
282
  locale
282
283
  } = useLocaleContext();
284
+ const [, setSettings] = useCommentSettings();
285
+ useEffect(() => {
286
+ setSettings((prev) => ({
287
+ ...prev,
288
+ autoCollapse
289
+ }));
290
+ }, [autoCollapse, setSettings]);
283
291
  const object = useMemo(
284
292
  () => ({
285
293
  ...target,
@@ -330,16 +338,18 @@ Wrapper.propTypes = {
330
338
  showConnectBtn: PropTypes.bool,
331
339
  onChange: PropTypes.func,
332
340
  prefix: PropTypes.string,
333
- flatView: PropTypes.bool
341
+ flatView: PropTypes.bool,
342
+ autoCollapse: PropTypes.bool
334
343
  };
335
344
  Wrapper.defaultProps = {
336
345
  showConnectBtn: false,
337
346
  onChange: () => {
338
347
  },
339
348
  prefix: "",
340
- flatView: false
349
+ flatView: false,
350
+ autoCollapse: false
341
351
  };
342
- const Container = styled.div`
352
+ const Container = styled("div")`
343
353
  background-color: #fff;
344
354
  width: 100%;
345
355
  margin: 0 auto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "A react component for DID Comments blocklet.",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/es/index.js",
@@ -37,7 +37,7 @@
37
37
  "@arcblock/did-connect": "^2.4.52",
38
38
  "@arcblock/ux": "^2.4.52",
39
39
  "@arcblock/ws": "^1.18.15",
40
- "@blocklet/discuss-kit-ux": "1.0.7",
40
+ "@blocklet/discuss-kit-ux": "1.0.8",
41
41
  "@emotion/react": "^11.10.5",
42
42
  "@emotion/styled": "^11.10.5",
43
43
  "@mui/icons-material": "^5.10.9",
@@ -75,5 +75,5 @@
75
75
  "vite-plugin-build": "^0.6.0",
76
76
  "vite-plugin-svgr": "^2.2.2"
77
77
  },
78
- "gitHead": "64db5271e940f4d3a5a02444cc1dc5c391de7513"
78
+ "gitHead": "daa242497b657cf81c90e151e1cb4a51858bdca9"
79
79
  }
@@ -1,117 +0,0 @@
1
- "use strict";
2
- const react = require("react");
3
- const styled = require("@emotion/styled");
4
- const Button = require("@arcblock/ux/lib/Button");
5
- const CircularProgress = require("@mui/material/CircularProgress");
6
- const context$1 = require("@arcblock/ux/lib/Locale/context");
7
- const Dialog = require("@arcblock/ux/lib/Dialog");
8
- const Comment = require("./components/comment");
9
- const context = require("./context");
10
- const api = require("./api");
11
- const jsxRuntime = require("react/jsx-runtime");
12
- const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
13
- const styled__default = /* @__PURE__ */ _interopDefaultLegacy(styled);
14
- const Button__default = /* @__PURE__ */ _interopDefaultLegacy(Button);
15
- const CircularProgress__default = /* @__PURE__ */ _interopDefaultLegacy(CircularProgress);
16
- const Comment__default = /* @__PURE__ */ _interopDefaultLegacy(Comment);
17
- const api__default = /* @__PURE__ */ _interopDefaultLegacy(api);
18
- function CommentList() {
19
- const {
20
- comments,
21
- loadMore,
22
- hasMore,
23
- loading,
24
- removeComment
25
- } = context.useCommentsContext();
26
- const {
27
- t
28
- } = react.useContext(context$1.LocaleContext);
29
- const [waitDelRow, setWaitDelRow] = react.useState({});
30
- const handleConfirmDelete = async (comment) => {
31
- try {
32
- setWaitDelRow({});
33
- await api__default.default.delete(`/comments/${comment.id}`);
34
- removeComment(comment);
35
- } catch (e) {
36
- console.error(e);
37
- }
38
- };
39
- if (loading) {
40
- return /* @__PURE__ */ jsxRuntime.jsx(Center, {
41
- style: {
42
- width: "100%"
43
- },
44
- children: /* @__PURE__ */ jsxRuntime.jsx(CircularProgress__default.default, {})
45
- });
46
- }
47
- return /* @__PURE__ */ jsxRuntime.jsxs(Container, {
48
- children: [comments.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", {
49
- className: "empty",
50
- children: t("empty")
51
- }), comments.length > 0 && comments.map((comment, index) => {
52
- return /* @__PURE__ */ jsxRuntime.jsx(Comment__default.default, {
53
- comment,
54
- index: index + 1,
55
- onDelete: setWaitDelRow
56
- }, comment.id);
57
- }), hasMore && /* @__PURE__ */ jsxRuntime.jsx("div", {
58
- className: "load-more",
59
- children: /* @__PURE__ */ jsxRuntime.jsx(Button__default.default, {
60
- onClick: loadMore,
61
- disabled: loading,
62
- variant: "outlined",
63
- color: "primary",
64
- size: "small",
65
- children: t("loadMore")
66
- })
67
- }), /* @__PURE__ */ jsxRuntime.jsx(Dialog.Confirm, {
68
- open: !!waitDelRow.id,
69
- title: t("tip"),
70
- onConfirm: () => {
71
- handleConfirmDelete(waitDelRow);
72
- },
73
- confirmButton: {
74
- text: t("confirm"),
75
- props: {
76
- variant: "contained",
77
- color: "error"
78
- }
79
- },
80
- cancelButton: {
81
- text: t("cancel"),
82
- props: {
83
- color: "inherit"
84
- }
85
- },
86
- onCancel: () => {
87
- setWaitDelRow({});
88
- },
89
- children: /* @__PURE__ */ jsxRuntime.jsx("span", {
90
- children: t("deleteCommentDesc")
91
- })
92
- })]
93
- });
94
- }
95
- CommentList.propTypes = {};
96
- CommentList.defaultProps = {};
97
- const Center = styled__default.default.div`
98
- width: 100%;
99
- padding: 120px 0 0 0;
100
- display: flex;
101
- align-items: center;
102
- justify-content: center;
103
- `;
104
- const Container = styled__default.default.div`
105
- width: 100%;
106
- .empty {
107
- text-align: center;
108
- color: #9397a1;
109
- font-size: 16px;
110
- margin-top: 44px;
111
- }
112
- .load-more {
113
- text-align: center;
114
- margin: 24px 0;
115
- }
116
- `;
117
- module.exports = CommentList;
@@ -1,335 +0,0 @@
1
- "use strict";
2
- const React = require("react");
3
- const styled = require("@emotion/styled");
4
- const Box = require("@mui/material/Box");
5
- const Button = require("@mui/material/Button");
6
- const PropTypes = require("prop-types");
7
- const NavigateNextIcon = require("@mui/icons-material/NavigateNext");
8
- const DIDAddress = require("@arcblock/did-connect/lib/Address");
9
- const timeago_js = require("timeago.js");
10
- const context$1 = require("@arcblock/ux/lib/Locale/context");
11
- const discussKitUx = require("@blocklet/discuss-kit-ux");
12
- const rating = require("./rating");
13
- const Menu = require("./menu");
14
- const api = require("../api");
15
- const utils = require("../lib/utils");
16
- const context = require("../context");
17
- const jsxRuntime = require("react/jsx-runtime");
18
- const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
19
- function _interopNamespace(e) {
20
- if (e && e.__esModule)
21
- return e;
22
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
23
- if (e) {
24
- for (const k in e) {
25
- if (k !== "default") {
26
- const d = Object.getOwnPropertyDescriptor(e, k);
27
- Object.defineProperty(n, k, d.get ? d : {
28
- enumerable: true,
29
- get: () => e[k]
30
- });
31
- }
32
- }
33
- }
34
- n.default = e;
35
- return Object.freeze(n);
36
- }
37
- const React__namespace = /* @__PURE__ */ _interopNamespace(React);
38
- const styled__default = /* @__PURE__ */ _interopDefaultLegacy(styled);
39
- const Box__default = /* @__PURE__ */ _interopDefaultLegacy(Box);
40
- const Button__default = /* @__PURE__ */ _interopDefaultLegacy(Button);
41
- const PropTypes__default = /* @__PURE__ */ _interopDefaultLegacy(PropTypes);
42
- const NavigateNextIcon__default = /* @__PURE__ */ _interopDefaultLegacy(NavigateNextIcon);
43
- const DIDAddress__default = /* @__PURE__ */ _interopDefaultLegacy(DIDAddress);
44
- const Menu__default = /* @__PURE__ */ _interopDefaultLegacy(Menu);
45
- const api__default = /* @__PURE__ */ _interopDefaultLegacy(api);
46
- const SvgMessage = (props) => /* @__PURE__ */ React__namespace.createElement("svg", {
47
- width: 32,
48
- height: 32,
49
- viewBox: "0 0 24 24",
50
- ...props
51
- }, /* @__PURE__ */ React__namespace.createElement("path", {
52
- fill: "none",
53
- stroke: "#888888",
54
- strokeLinecap: "round",
55
- strokeLinejoin: "round",
56
- strokeWidth: 2,
57
- d: "m3 20l1.3-3.9A9 8 0 1 1 7.7 19L3 20"
58
- }));
59
- function CommentReplies({
60
- comment,
61
- onDelete,
62
- ...rest
63
- }) {
64
- const {
65
- t
66
- } = React.useContext(context$1.LocaleContext);
67
- const {
68
- loadMoreReplies
69
- } = context.useCommentsContext();
70
- const {
71
- replies,
72
- totalReplies
73
- } = comment;
74
- if (!(replies == null ? void 0 : replies.length)) {
75
- return null;
76
- }
77
- return /* @__PURE__ */ jsxRuntime.jsxs(Box__default.default, {
78
- mt: 1,
79
- ...rest,
80
- children: [replies.map((item) => {
81
- return /* @__PURE__ */ jsxRuntime.jsx("div", {
82
- children: /* @__PURE__ */ jsxRuntime.jsx(Comment, {
83
- comment: item,
84
- onDelete,
85
- rootComment: comment
86
- })
87
- }, item.id);
88
- }), totalReplies > replies.length && /* @__PURE__ */ jsxRuntime.jsx(Button__default.default, {
89
- onClick: () => loadMoreReplies(comment.id),
90
- variant: "outlined",
91
- color: "inherit",
92
- size: "small",
93
- endIcon: /* @__PURE__ */ jsxRuntime.jsx(NavigateNextIcon__default.default, {}),
94
- sx: {
95
- mt: 2,
96
- ml: 6,
97
- color: "grey.600",
98
- borderColor: "grey.400",
99
- fontSize: 12,
100
- textTransform: "none"
101
- },
102
- children: t("showMoreReplies")
103
- })]
104
- });
105
- }
106
- CommentReplies.propTypes = {
107
- comment: PropTypes__default.default.object.isRequired,
108
- onDelete: PropTypes__default.default.func.isRequired
109
- };
110
- function Comment({
111
- comment,
112
- onDelete,
113
- rootComment,
114
- ...rest
115
- }) {
116
- var _a, _b, _c, _d;
117
- const {
118
- session,
119
- addComment,
120
- updateComment,
121
- manageMode,
122
- flatMode
123
- } = context.useCommentsContext();
124
- const {
125
- t,
126
- locale
127
- } = React.useContext(context$1.LocaleContext);
128
- const [inputBoxVisible, setInputBoxVisible] = React.useState(false);
129
- const [editMode, setEditMode] = React.useState(false);
130
- const isCommenter = ((_a = session == null ? void 0 : session.user) == null ? void 0 : _a.did) === comment.commenter.did;
131
- const canEditOrDelete = !comment.deletedAt && (isCommenter || manageMode);
132
- const menuItems = [...canEditOrDelete ? [{
133
- text: /* @__PURE__ */ jsxRuntime.jsx(Box__default.default, {
134
- component: "span",
135
- sx: {
136
- color: "error.main"
137
- },
138
- children: t("delete")
139
- }),
140
- onClick: () => onDelete(comment)
141
- }, {
142
- text: /* @__PURE__ */ jsxRuntime.jsx(Box__default.default, {
143
- component: "span",
144
- children: t("edit")
145
- }),
146
- onClick: () => setEditMode(true)
147
- }] : []];
148
- const sendReply = async (content) => {
149
- const commentId = (rootComment == null ? void 0 : rootComment.id) || comment.commentId || comment.id;
150
- const data = await utils.minDelay(api.reply({
151
- commentId,
152
- parentId: comment.id,
153
- content
154
- }), 800);
155
- setInputBoxVisible(false);
156
- addComment(data);
157
- };
158
- const handleOnRate = async ({
159
- ratingType,
160
- value
161
- }) => {
162
- if (!session.user) {
163
- session.login();
164
- throw new Error("Unauthenticated.");
165
- }
166
- await api__default.default.post(`/objects/${comment.objectId}/comments/${comment.id}/ratings`, {
167
- ratingType,
168
- value
169
- });
170
- };
171
- const handleOnUnrate = async () => {
172
- if (!session.user) {
173
- session.login();
174
- throw new Error("Unauthenticated.");
175
- }
176
- await api__default.default.delete(`/objects/${comment.objectId}/comments/${comment.id}/ratings`);
177
- };
178
- const handleUpdateComment = async (content) => {
179
- await api__default.default.put(`/comments/${comment.id}`, {
180
- content
181
- });
182
- updateComment(comment.id, (current) => ({
183
- ...current,
184
- content
185
- }));
186
- };
187
- return /* @__PURE__ */ jsxRuntime.jsxs(Root, {
188
- ...rest,
189
- children: [/* @__PURE__ */ jsxRuntime.jsx(discussKitUx.Avatar, {
190
- did: comment.commenter.did,
191
- src: comment.commenter.avatar,
192
- size: 36,
193
- shape: "circle",
194
- variant: "circle"
195
- }), /* @__PURE__ */ jsxRuntime.jsxs(Box__default.default, {
196
- flex: "1",
197
- pl: 2,
198
- overflow: "hidden",
199
- children: [/* @__PURE__ */ jsxRuntime.jsxs(Box__default.default, {
200
- display: "flex",
201
- justifyContent: "space-between",
202
- alignItems: "start",
203
- children: [/* @__PURE__ */ jsxRuntime.jsxs(Box__default.default, {
204
- children: [/* @__PURE__ */ jsxRuntime.jsxs(Box__default.default, {
205
- display: "flex",
206
- alignItems: "center",
207
- gap: 1,
208
- flexWrap: "wrap",
209
- color: "#333",
210
- lineHeight: 1,
211
- children: [/* @__PURE__ */ jsxRuntime.jsx("span", {
212
- children: comment.commenter.fullName || "Unknown"
213
- }), /* @__PURE__ */ jsxRuntime.jsxs("div", {
214
- children: ["(", /* @__PURE__ */ jsxRuntime.jsx(DIDAddress__default.default, {
215
- copyable: false,
216
- responsive: false,
217
- compact: true,
218
- inline: true,
219
- children: comment.commenter.did
220
- }), ")"]
221
- }), /* @__PURE__ */ jsxRuntime.jsx(Box__default.default, {
222
- width: {
223
- xs: "100%",
224
- md: "auto"
225
- },
226
- fontSize: 13,
227
- color: "grey.500",
228
- children: /* @__PURE__ */ jsxRuntime.jsx("span", {
229
- children: timeago_js.format(comment.createdAt, locale === "zh" ? "zh_CN" : "en_US")
230
- })
231
- })]
232
- }), ((_b = comment.replyTo) == null ? void 0 : _b.did) && (flatMode || comment.parentId !== comment.commentId) && /* @__PURE__ */ jsxRuntime.jsxs(Box__default.default, {
233
- mt: 0.5,
234
- fontSize: 13,
235
- lineHeight: 1,
236
- color: "primary.light",
237
- sx: {
238
- ".did-address-text": {
239
- color: "primary.light"
240
- }
241
- },
242
- children: ["@", /* @__PURE__ */ jsxRuntime.jsx(Box__default.default, {
243
- component: "span",
244
- mr: 1,
245
- children: comment.replyTo.fullName
246
- }), "(", /* @__PURE__ */ jsxRuntime.jsx(DIDAddress__default.default, {
247
- copyable: false,
248
- responsive: false,
249
- compact: true,
250
- inline: true,
251
- children: comment.replyTo.did
252
- }), ")"]
253
- })]
254
- }), !!(menuItems == null ? void 0 : menuItems.length) && /* @__PURE__ */ jsxRuntime.jsx(Menu__default.default, {
255
- items: menuItems,
256
- style: {
257
- position: "absolute",
258
- right: 0,
259
- top: 16
260
- }
261
- })]
262
- }), /* @__PURE__ */ jsxRuntime.jsxs(Box__default.default, {
263
- mt: 1,
264
- children: [!comment.deletedAt && /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.PostContent, {
265
- content: comment.content,
266
- editing: editMode,
267
- onExitEditing: () => setEditMode(false),
268
- onSubmit: handleUpdateComment
269
- }), comment.deletedAt && /* @__PURE__ */ jsxRuntime.jsx(Box__default.default, {
270
- display: "inline-block",
271
- px: 2,
272
- py: 1,
273
- mt: 1,
274
- fontSize: 14,
275
- bgcolor: "grey.100",
276
- color: "grey.600",
277
- borderRadius: 1,
278
- children: t("deleted")
279
- })]
280
- }), !manageMode && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
281
- children: [/* @__PURE__ */ jsxRuntime.jsxs(Box__default.default, {
282
- display: "flex",
283
- alignItems: "center",
284
- mt: 1.5,
285
- children: [/* @__PURE__ */ jsxRuntime.jsx(rating.BinaryThumb, {
286
- selected: (_c = comment.rating) == null ? void 0 : _c.myRating,
287
- countPerValue: (_d = comment.rating) == null ? void 0 : _d.counts,
288
- onRate: handleOnRate,
289
- onUnrate: handleOnUnrate
290
- }), /* @__PURE__ */ jsxRuntime.jsx(Box__default.default, {
291
- onClick: () => utils.protectLogin(session, () => setInputBoxVisible(!inputBoxVisible)),
292
- sx: {
293
- lineHeight: 1,
294
- "&:hover": {
295
- cursor: "pointer"
296
- }
297
- },
298
- children: /* @__PURE__ */ jsxRuntime.jsx(SvgMessage, {
299
- style: {
300
- width: "auto",
301
- height: 16
302
- }
303
- })
304
- })]
305
- }), inputBoxVisible && /* @__PURE__ */ jsxRuntime.jsx(Box__default.default, {
306
- my: 2,
307
- children: /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.CommentInput, {
308
- send: sendReply
309
- })
310
- })]
311
- }), !comment.parentId && /* @__PURE__ */ jsxRuntime.jsx(CommentReplies, {
312
- comment,
313
- onDelete
314
- })]
315
- })]
316
- });
317
- }
318
- Comment.propTypes = {
319
- comment: PropTypes__default.default.object.isRequired,
320
- onDelete: PropTypes__default.default.func,
321
- rootComment: PropTypes__default.default.object
322
- };
323
- Comment.defaultProps = {
324
- onDelete: void 0,
325
- rootComment: void 0
326
- };
327
- const Root = styled__default.default(Box__default.default)`
328
- display: flex;
329
- position: relative;
330
- padding: 24px 0 0 0;
331
- &:first-of-type {
332
- flex-shrink: 0;
333
- }
334
- `;
335
- module.exports = Comment;