@logora/debate 0.3.46 → 0.3.47
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,5 +1,5 @@
|
|
|
1
1
|
import { jsx as o, jsxs as l, Fragment as h } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import $ from "classnames";
|
|
3
3
|
import { useState as f, useEffect as ie, useCallback as ae, Suspense as le, lazy as ne } from "react";
|
|
4
4
|
import { useIntl as de } from "react-intl";
|
|
5
5
|
import s from "./Argument.module.scss.js";
|
|
@@ -7,30 +7,30 @@ import { ReplyFooter as ce } from "./ReplyFooter.js";
|
|
|
7
7
|
import { useRichContent as pe } from "./useRichContent.js";
|
|
8
8
|
import { useAuth as me } from "../../auth/use_auth/useAuth.js";
|
|
9
9
|
import { useConfig as ue } from "../../data/config_provider/useConfig.js";
|
|
10
|
-
import { useTranslatedContent as
|
|
10
|
+
import { useTranslatedContent as B } from "../../translation/translated_content/useTranslatedContent.js";
|
|
11
11
|
import { SourceListItem as he } from "../../source/source_list_item/SourceListItem.js";
|
|
12
12
|
import { HashScroll as fe } from "../../tools/hash_scroll/HashScroll.js";
|
|
13
13
|
import { ContentHeader as ye } from "../../user_content/content_header/ContentHeader.js";
|
|
14
14
|
import { Icon as D } from "../../icons/icon/Icon.js";
|
|
15
|
-
import { ReadMore as
|
|
16
|
-
import { TranslationButton as
|
|
15
|
+
import { ReadMore as _e } from "../../text/read_more/ReadMore.js";
|
|
16
|
+
import { TranslationButton as ge } from "../../translation/translation_button/TranslationButton.js";
|
|
17
17
|
import { ContentFooter as be } from "../../user_content/content_footer/ContentFooter.js";
|
|
18
18
|
import { VoteButton as Me } from "../../vote/vote_button/VoteButton.js";
|
|
19
19
|
import { VotePaginatedList as ve } from "../../list/paginated_list/VotePaginatedList.js";
|
|
20
|
-
import { UserContentSkeleton as
|
|
21
|
-
import { Button as
|
|
20
|
+
import { UserContentSkeleton as Ie } from "../../skeleton/user_content_skeleton/UserContentSkeleton.js";
|
|
21
|
+
import { Button as Ce } from "../../action/button/Button.js";
|
|
22
22
|
const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({ default: e.ArgumentInput }))), E = (e) => e?.replace(/ /g, " "), Re = ({
|
|
23
23
|
argument: e,
|
|
24
24
|
argumentReplies: n,
|
|
25
25
|
nestingLevel: y = 0,
|
|
26
|
-
groupType:
|
|
26
|
+
groupType: C,
|
|
27
27
|
groupName: S,
|
|
28
|
-
positions:
|
|
28
|
+
positions: _ = [],
|
|
29
29
|
disableLinks: P = !1,
|
|
30
30
|
parentArgument: d,
|
|
31
31
|
flashParent: F,
|
|
32
32
|
expandable: j,
|
|
33
|
-
disabled:
|
|
33
|
+
disabled: g = !1,
|
|
34
34
|
hideFooter: R = !1,
|
|
35
35
|
hideReplies: T,
|
|
36
36
|
vote: G,
|
|
@@ -43,17 +43,17 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
43
43
|
replyRedirectUrl: J,
|
|
44
44
|
hideContent: K = !1
|
|
45
45
|
}) => {
|
|
46
|
-
const i = de(), { isLoggedIn: Q, currentUser: c } = me(), N = c?.moderation_status === "banned", r = ue(), [p, b] = f(!1), [W, w] = f(!1), [X, Z] = f(!1), x = pe(e), [m, M] = f(), u =
|
|
46
|
+
const i = de(), { isLoggedIn: Q, currentUser: c } = me(), N = c?.moderation_status === "banned", r = ue(), [p, b] = f(!1), [W, w] = f(!1), [X, Z] = f(!1), x = pe(e), [m, M] = f(), u = B(
|
|
47
47
|
e.content,
|
|
48
48
|
e.language,
|
|
49
49
|
"content",
|
|
50
50
|
e.translation_entries
|
|
51
|
-
), ee =
|
|
51
|
+
), ee = B(
|
|
52
52
|
e.position?.name,
|
|
53
53
|
e.position?.language,
|
|
54
54
|
"name",
|
|
55
55
|
e.position?.translation_entries
|
|
56
|
-
), v = `argument_${e.id}`,
|
|
56
|
+
), v = `argument_${e.id}`, I = e.position && _?.map((t) => t.id).indexOf(e.position.id) + 1;
|
|
57
57
|
ie(() => {
|
|
58
58
|
n !== void 0 && re();
|
|
59
59
|
}, [n]);
|
|
@@ -90,10 +90,10 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
90
90
|
{
|
|
91
91
|
...t ? { argument: t } : {},
|
|
92
92
|
nestingLevel: y + 1,
|
|
93
|
-
disabled:
|
|
93
|
+
disabled: g,
|
|
94
94
|
groupName: S,
|
|
95
|
-
groupType:
|
|
96
|
-
positions:
|
|
95
|
+
groupType: C,
|
|
96
|
+
positions: _,
|
|
97
97
|
argumentReplies: n,
|
|
98
98
|
parentArgument: e,
|
|
99
99
|
flashParent: (a) => te(`argument_${a}`)
|
|
@@ -103,14 +103,14 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
103
103
|
/* @__PURE__ */ l(
|
|
104
104
|
"div",
|
|
105
105
|
{
|
|
106
|
-
className:
|
|
106
|
+
className: $(
|
|
107
107
|
s.argument,
|
|
108
108
|
{
|
|
109
109
|
[s.flash]: W,
|
|
110
110
|
[s.argumentReply]: e.is_reply === !0
|
|
111
111
|
},
|
|
112
112
|
s[`level-${y}`],
|
|
113
|
-
s[`position-${!(e.author.role === "editor" || e.author.role === "moderator") &&
|
|
113
|
+
s[`position-${!(e.author.role === "editor" || e.author.role === "moderator") && I}`]
|
|
114
114
|
),
|
|
115
115
|
id: v,
|
|
116
116
|
children: [
|
|
@@ -121,7 +121,7 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
121
121
|
author: e.author,
|
|
122
122
|
tag: (e.author.role === "editor" || e.author.role === "moderator") && e.is_reply ? null : ee.translatedContent,
|
|
123
123
|
date: e.created_at,
|
|
124
|
-
tagClassName: s[`headerPosition-${
|
|
124
|
+
tagClassName: s[`headerPosition-${I}`],
|
|
125
125
|
disableLinks: P,
|
|
126
126
|
isDeleted: e.is_deleted,
|
|
127
127
|
showModerationFeedback: Y ?? (e.status === "rejected" && r.moderation?.showFeedback === !0),
|
|
@@ -140,7 +140,7 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
140
140
|
/* @__PURE__ */ l(
|
|
141
141
|
"div",
|
|
142
142
|
{
|
|
143
|
-
className:
|
|
143
|
+
className: $(s.argumentBody, {
|
|
144
144
|
[s.fixedHeight]: r?.layout?.showAllArgumentInEmbed !== !0 ? H : !1
|
|
145
145
|
}),
|
|
146
146
|
children: [
|
|
@@ -165,7 +165,7 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
165
165
|
}
|
|
166
166
|
),
|
|
167
167
|
/* @__PURE__ */ o(
|
|
168
|
-
|
|
168
|
+
_e,
|
|
169
169
|
{
|
|
170
170
|
content: /* @__PURE__ */ l(h, { children: [
|
|
171
171
|
e.is_edited && /* @__PURE__ */ o("div", { className: s.edited, children: i.formatMessage({
|
|
@@ -180,7 +180,7 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
180
180
|
}
|
|
181
181
|
) : /* @__PURE__ */ o("div", { className: s.argumentContent, children: E(u.translatedContent) }),
|
|
182
182
|
u.isTranslated && /* @__PURE__ */ o(
|
|
183
|
-
|
|
183
|
+
ge,
|
|
184
184
|
{
|
|
185
185
|
language: e.language,
|
|
186
186
|
callback: () => u.toggleContent()
|
|
@@ -209,7 +209,7 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
209
209
|
be,
|
|
210
210
|
{
|
|
211
211
|
resource: e,
|
|
212
|
-
disabled:
|
|
212
|
+
disabled: g || e.status === "rejected" || !Q && r?.actions?.disableInputForVisitor === !0 || N,
|
|
213
213
|
reportType: "Message",
|
|
214
214
|
softDelete: r.actions?.softDelete,
|
|
215
215
|
deleteType: "messages",
|
|
@@ -240,7 +240,7 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
240
240
|
voteableId: e.id,
|
|
241
241
|
totalUpvote: e.upvotes,
|
|
242
242
|
totalDownvote: 0,
|
|
243
|
-
activeClassName: s[`voteButtonPosition-${
|
|
243
|
+
activeClassName: s[`voteButtonPosition-${I}`],
|
|
244
244
|
disabled: e.status === "rejected" || c?.id === e?.author?.id || N
|
|
245
245
|
}
|
|
246
246
|
)
|
|
@@ -264,13 +264,14 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
264
264
|
Se,
|
|
265
265
|
{
|
|
266
266
|
groupId: e.group_id,
|
|
267
|
-
groupType:
|
|
267
|
+
groupType: C,
|
|
268
268
|
groupName: S,
|
|
269
|
-
positions:
|
|
269
|
+
positions: _,
|
|
270
270
|
parentId: e.id,
|
|
271
271
|
positionId: G?.position_id,
|
|
272
|
-
disabled:
|
|
272
|
+
disabled: g,
|
|
273
273
|
hideSourceAction: r?.actions?.disableUserSources || !1,
|
|
274
|
+
argumentListId: `argument_${e.id}_reply_list`,
|
|
274
275
|
onSubmit: (t) => {
|
|
275
276
|
A(), M([t]), b(!0);
|
|
276
277
|
},
|
|
@@ -291,7 +292,7 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
291
292
|
{
|
|
292
293
|
voteableType: "Message",
|
|
293
294
|
currentListId: `argument_${e.id}_reply_list`,
|
|
294
|
-
loadingComponent: /* @__PURE__ */ o(
|
|
295
|
+
loadingComponent: /* @__PURE__ */ o(Ie, {}),
|
|
295
296
|
resource: "messages",
|
|
296
297
|
sort: "+created_at",
|
|
297
298
|
filters: {
|
|
@@ -308,7 +309,7 @@ const Se = ne(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
308
309
|
}
|
|
309
310
|
) }),
|
|
310
311
|
m?.length > 0 && !p && /* @__PURE__ */ o("div", { className: s.repliesList, children: e.number_replies > 1 && /* @__PURE__ */ o("div", { className: s.readMoreLink, children: /* @__PURE__ */ o(
|
|
311
|
-
|
|
312
|
+
Ce,
|
|
312
313
|
{
|
|
313
314
|
role: "link",
|
|
314
315
|
rightIcon: /* @__PURE__ */ o(D, { name: "lightArrow", height: 10, width: 10 }),
|