@blocklet/discuss-kit 1.5.150 → 1.5.152

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.
@@ -102,7 +102,7 @@ function DiscussKitComments({
102
102
  }) {
103
103
  discussKitUx.useDefaultApiErrorHandler({ request: api });
104
104
  const { session } = react.useContext(Session.SessionContext) || {};
105
- const { state, sort, add, updateCommentState } = discussKitUx.useCommentsContext();
105
+ const { state, sort, add, updateCommentState, interactive } = discussKitUx.useCommentsContext();
106
106
  const { total, order, initialized } = state;
107
107
  const { t } = context.useLocaleContext();
108
108
  const objectRatingState = useAsyncRetry(() => api.fetchRatings(object.id));
@@ -159,7 +159,15 @@ function DiscussKitComments({
159
159
  return /* @__PURE__ */ jsxRuntime.jsxs(Container, { className: "comment-container", children: [
160
160
  /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
161
161
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "end", children: [
162
- displayReaction && objectRatingState.value && /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.GithubReaction, { data: objectRatingState.value, onRate: handleOnRate, onUnrate: handleOnUnrate }) }),
162
+ displayReaction && objectRatingState.value && /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
163
+ discussKitUx.GithubReaction,
164
+ {
165
+ data: objectRatingState.value,
166
+ onRate: handleOnRate,
167
+ onUnrate: handleOnUnrate,
168
+ interactive
169
+ }
170
+ ) }),
163
171
  displayConnectButton && (session.user ? /* @__PURE__ */ jsxRuntime.jsx(SessionManager, { style: { padding: 0 }, showText: true, showRole: true, session }) : /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "medium", variant: "contained", color: "primary", onClick: () => session.login(), children: t("connect") }))
164
172
  ] }),
165
173
  displayConnectButton && !session.user && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "input-no-connect", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "connect-tip", children: [
@@ -167,7 +175,7 @@ function DiscussKitComments({
167
175
  " ",
168
176
  /* @__PURE__ */ jsxRuntime.jsx("a", { className: "down-load-wallet", href: "https://www.didwallet.io/", target: "_blank", rel: "noreferrer", children: t("installDIDWallet") })
169
177
  ] }) }),
170
- session.user && commentInputPosition === "top" && /* @__PURE__ */ jsxRuntime.jsx(Box, { mt: 2, className: "comment-editor", children: /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.CommentInput, { send: sendComment, draftKey: `object-${object.id}`, autoFocus: false }) })
178
+ session.user && interactive && commentInputPosition === "top" && /* @__PURE__ */ jsxRuntime.jsx(Box, { mt: 2, className: "comment-editor", children: /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.CommentInput, { send: sendComment, draftKey: `object-${object.id}`, autoFocus: false }) })
171
179
  ] }),
172
180
  !!total && showTopbar && /* @__PURE__ */ jsxRuntime.jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 3, children: [
173
181
  /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
@@ -200,7 +208,7 @@ function DiscussKitComments({
200
208
  ] })
201
209
  ] }),
202
210
  /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.CommentList, { className: "comment-list" }),
203
- session.user && commentInputPosition === "bottom" && /* @__PURE__ */ jsxRuntime.jsx(Box, { mt: 6, children: /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.CommentInput, { send: sendComment, draftKey: `object-${object.id}`, autoFocus: false }) })
211
+ session.user && interactive && commentInputPosition === "bottom" && /* @__PURE__ */ jsxRuntime.jsx(Box, { mt: 6, children: /* @__PURE__ */ jsxRuntime.jsx(discussKitUx.CommentInput, { send: sendComment, draftKey: `object-${object.id}`, autoFocus: false }) })
204
212
  ] });
205
213
  }
206
214
  DiscussKitComments.propTypes = {
@@ -227,6 +235,7 @@ function Wrapper({
227
235
  order,
228
236
  allowCopyLink,
229
237
  showProfileCard,
238
+ interactive,
230
239
  ...rest
231
240
  }) {
232
241
  if (!(target == null ? void 0 : target.id)) {
@@ -266,6 +275,7 @@ function Wrapper({
266
275
  autoCollapse,
267
276
  allowCopyLink,
268
277
  showProfileCard,
278
+ interactive,
269
279
  children: /* @__PURE__ */ jsxRuntime.jsx(DiscussKitComments, { ...rest, object })
270
280
  }
271
281
  ) }) }) }) }) }) });
@@ -285,7 +295,8 @@ Wrapper.propTypes = {
285
295
  autoCollapse: PropTypes.bool,
286
296
  allowCopyLink: PropTypes.bool,
287
297
  showProfileCard: PropTypes.bool,
288
- order: PropTypes.oneOf(["asc", "desc"])
298
+ order: PropTypes.oneOf(["asc", "desc"]),
299
+ interactive: PropTypes.bool
289
300
  };
290
301
  Wrapper.defaultProps = {
291
302
  displayConnectButton: false,
@@ -297,7 +308,8 @@ Wrapper.defaultProps = {
297
308
  autoCollapse: false,
298
309
  allowCopyLink: false,
299
310
  showProfileCard: false,
300
- order: void 0
311
+ order: void 0,
312
+ interactive: true
301
313
  };
302
314
  const Container = Theme.styled("div")`
303
315
  background-color: #fff;
@@ -101,7 +101,7 @@ function DiscussKitComments({
101
101
  }) {
102
102
  useDefaultApiErrorHandler({ request: api });
103
103
  const { session } = useContext(SessionContext) || {};
104
- const { state, sort, add, updateCommentState } = useCommentsContext();
104
+ const { state, sort, add, updateCommentState, interactive } = useCommentsContext();
105
105
  const { total, order, initialized } = state;
106
106
  const { t } = useLocaleContext();
107
107
  const objectRatingState = useAsyncRetry(() => fetchRatings(object.id));
@@ -158,7 +158,15 @@ function DiscussKitComments({
158
158
  return /* @__PURE__ */ jsxs(Container, { className: "comment-container", children: [
159
159
  /* @__PURE__ */ jsxs(Fragment, { children: [
160
160
  /* @__PURE__ */ jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "end", children: [
161
- displayReaction && objectRatingState.value && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(GithubReaction, { data: objectRatingState.value, onRate: handleOnRate, onUnrate: handleOnUnrate }) }),
161
+ displayReaction && objectRatingState.value && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
162
+ GithubReaction,
163
+ {
164
+ data: objectRatingState.value,
165
+ onRate: handleOnRate,
166
+ onUnrate: handleOnUnrate,
167
+ interactive
168
+ }
169
+ ) }),
162
170
  displayConnectButton && (session.user ? /* @__PURE__ */ jsx(SessionManager, { style: { padding: 0 }, showText: true, showRole: true, session }) : /* @__PURE__ */ jsx(Button, { size: "medium", variant: "contained", color: "primary", onClick: () => session.login(), children: t("connect") }))
163
171
  ] }),
164
172
  displayConnectButton && !session.user && /* @__PURE__ */ jsx("div", { className: "input-no-connect", children: /* @__PURE__ */ jsxs("span", { className: "connect-tip", children: [
@@ -166,7 +174,7 @@ function DiscussKitComments({
166
174
  " ",
167
175
  /* @__PURE__ */ jsx("a", { className: "down-load-wallet", href: "https://www.didwallet.io/", target: "_blank", rel: "noreferrer", children: t("installDIDWallet") })
168
176
  ] }) }),
169
- session.user && commentInputPosition === "top" && /* @__PURE__ */ jsx(Box, { mt: 2, className: "comment-editor", children: /* @__PURE__ */ jsx(CommentInput, { send: sendComment, draftKey: `object-${object.id}`, autoFocus: false }) })
177
+ session.user && interactive && commentInputPosition === "top" && /* @__PURE__ */ jsx(Box, { mt: 2, className: "comment-editor", children: /* @__PURE__ */ jsx(CommentInput, { send: sendComment, draftKey: `object-${object.id}`, autoFocus: false }) })
170
178
  ] }),
171
179
  !!total && showTopbar && /* @__PURE__ */ jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 3, children: [
172
180
  /* @__PURE__ */ jsxs("span", { children: [
@@ -199,7 +207,7 @@ function DiscussKitComments({
199
207
  ] })
200
208
  ] }),
201
209
  /* @__PURE__ */ jsx(CommentList, { className: "comment-list" }),
202
- session.user && commentInputPosition === "bottom" && /* @__PURE__ */ jsx(Box, { mt: 6, children: /* @__PURE__ */ jsx(CommentInput, { send: sendComment, draftKey: `object-${object.id}`, autoFocus: false }) })
210
+ session.user && interactive && commentInputPosition === "bottom" && /* @__PURE__ */ jsx(Box, { mt: 6, children: /* @__PURE__ */ jsx(CommentInput, { send: sendComment, draftKey: `object-${object.id}`, autoFocus: false }) })
203
211
  ] });
204
212
  }
205
213
  DiscussKitComments.propTypes = {
@@ -226,6 +234,7 @@ function Wrapper({
226
234
  order,
227
235
  allowCopyLink,
228
236
  showProfileCard,
237
+ interactive,
229
238
  ...rest
230
239
  }) {
231
240
  if (!(target == null ? void 0 : target.id)) {
@@ -265,6 +274,7 @@ function Wrapper({
265
274
  autoCollapse,
266
275
  allowCopyLink,
267
276
  showProfileCard,
277
+ interactive,
268
278
  children: /* @__PURE__ */ jsx(DiscussKitComments, { ...rest, object })
269
279
  }
270
280
  ) }) }) }) }) }) });
@@ -284,7 +294,8 @@ Wrapper.propTypes = {
284
294
  autoCollapse: PropTypes.bool,
285
295
  allowCopyLink: PropTypes.bool,
286
296
  showProfileCard: PropTypes.bool,
287
- order: PropTypes.oneOf(["asc", "desc"])
297
+ order: PropTypes.oneOf(["asc", "desc"]),
298
+ interactive: PropTypes.bool
288
299
  };
289
300
  Wrapper.defaultProps = {
290
301
  displayConnectButton: false,
@@ -296,7 +307,8 @@ Wrapper.defaultProps = {
296
307
  autoCollapse: false,
297
308
  allowCopyLink: false,
298
309
  showProfileCard: false,
299
- order: void 0
310
+ order: void 0,
311
+ interactive: true
300
312
  };
301
313
  const Container = styled("div")`
302
314
  background-color: #fff;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit",
3
- "version": "1.5.150",
3
+ "version": "1.5.152",
4
4
  "description": "A react component for Discuss Kit blocklet.",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/es/index.js",
@@ -37,8 +37,8 @@
37
37
  "@arcblock/did-connect": "2.8.2",
38
38
  "@arcblock/ux": "2.8.2",
39
39
  "@arcblock/ws": "^1.18.92",
40
- "@blocklet/discuss-kit-ux": "1.5.150",
41
- "@blocklet/editor": "1.5.150",
40
+ "@blocklet/discuss-kit-ux": "1.5.152",
41
+ "@blocklet/editor": "1.5.152",
42
42
  "@emotion/react": "^11.10.5",
43
43
  "@emotion/styled": "^11.10.5",
44
44
  "@mui/icons-material": "^5.14.9",
@@ -77,5 +77,5 @@
77
77
  "vite-plugin-build": "^0.10.0",
78
78
  "vite-plugin-svgr": "^4.1.0"
79
79
  },
80
- "gitHead": "abe673c9aea6f950da06b314957f76d6a2659dfe"
80
+ "gitHead": "cd85f290d1d617b9625997c913fc592bf671be4c"
81
81
  }