@logora/debate 0.3.61 → 0.3.62
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,6 +1,6 @@
|
|
|
1
|
-
import { jsx as o, jsxs as l, Fragment as
|
|
1
|
+
import { jsx as o, jsxs as l, Fragment as h } from "react/jsx-runtime";
|
|
2
2
|
import B from "classnames";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as f, useEffect as ae, useCallback as le, Suspense as ne, lazy as de } from "react";
|
|
4
4
|
import { useIntl as ce } from "react-intl";
|
|
5
5
|
import s from "./Argument.module.scss.js";
|
|
6
6
|
import { ReplyFooter as pe } from "./ReplyFooter.js";
|
|
@@ -22,18 +22,18 @@ import { Button as Se } from "../../action/button/Button.js";
|
|
|
22
22
|
const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({ default: e.ArgumentInput }))), P = (e) => e?.replace(/ /g, " "), Te = ({
|
|
23
23
|
argument: e,
|
|
24
24
|
argumentReplies: n,
|
|
25
|
-
nestingLevel:
|
|
26
|
-
maxNestingLevel:
|
|
27
|
-
groupType:
|
|
28
|
-
groupName:
|
|
29
|
-
positions:
|
|
25
|
+
nestingLevel: y = 0,
|
|
26
|
+
maxNestingLevel: C = 2,
|
|
27
|
+
groupType: S,
|
|
28
|
+
groupName: R,
|
|
29
|
+
positions: _ = [],
|
|
30
30
|
disableLinks: F = !1,
|
|
31
|
-
parentArgument:
|
|
31
|
+
parentArgument: d,
|
|
32
32
|
flashParent: j,
|
|
33
33
|
expandable: G,
|
|
34
|
-
disabled:
|
|
35
|
-
hideFooter:
|
|
36
|
-
hideReplies:
|
|
34
|
+
disabled: g = !1,
|
|
35
|
+
hideFooter: T = !1,
|
|
36
|
+
hideReplies: N,
|
|
37
37
|
vote: H,
|
|
38
38
|
fixedContentHeight: V = !1,
|
|
39
39
|
enableEdition: z = !0,
|
|
@@ -44,7 +44,7 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
44
44
|
replyRedirectUrl: K,
|
|
45
45
|
hideContent: Q = !1
|
|
46
46
|
}) => {
|
|
47
|
-
const i = ce(), { isLoggedIn: W, currentUser:
|
|
47
|
+
const i = ce(), { isLoggedIn: W, currentUser: c } = ue(), w = c?.moderation_status === "banned", r = he(), [p, b] = f(!1), [X, A] = f(!1), [Z, ee] = f(!1), x = me(e), [m, M] = f(), u = D(
|
|
48
48
|
e.content,
|
|
49
49
|
e.language,
|
|
50
50
|
"content",
|
|
@@ -54,21 +54,21 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
54
54
|
e.position?.language,
|
|
55
55
|
"name",
|
|
56
56
|
e.position?.translation_entries
|
|
57
|
-
),
|
|
57
|
+
), v = `argument_${e.id}`, I = e.position && _?.map((t) => t.id).indexOf(e.position.id) + 1;
|
|
58
58
|
ae(() => {
|
|
59
59
|
n !== void 0 && ie();
|
|
60
60
|
}, [n]);
|
|
61
61
|
const oe = (t) => {
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
64
|
-
|
|
62
|
+
if (v === t) {
|
|
63
|
+
const $ = document.getElementById(t);
|
|
64
|
+
$ && $.scrollIntoView({ behavior: "smooth" }), A(!0);
|
|
65
65
|
}
|
|
66
|
-
},
|
|
66
|
+
}, L = () => {
|
|
67
67
|
ee((t) => !t);
|
|
68
68
|
}, k = () => {
|
|
69
|
-
|
|
69
|
+
b((t) => !t), M([]);
|
|
70
70
|
}, se = (t) => {
|
|
71
|
-
if (!
|
|
71
|
+
if (!m?.find((a) => a.id === t.id))
|
|
72
72
|
return t;
|
|
73
73
|
}, re = le((t, a) => /* @__PURE__ */ o(
|
|
74
74
|
fe,
|
|
@@ -84,24 +84,24 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
84
84
|
const t = n.filter(
|
|
85
85
|
(a) => a.reply_to_id === e.id
|
|
86
86
|
);
|
|
87
|
-
t.length > 0 && (
|
|
87
|
+
t.length > 0 && (M(t), b(!0));
|
|
88
88
|
}
|
|
89
|
-
},
|
|
89
|
+
}, U = (t = null) => /* @__PURE__ */ o(
|
|
90
90
|
Ne,
|
|
91
91
|
{
|
|
92
92
|
...t ? { argument: t } : {},
|
|
93
|
-
nestingLevel:
|
|
94
|
-
maxNestingLevel:
|
|
95
|
-
disabled:
|
|
96
|
-
groupName:
|
|
97
|
-
groupType:
|
|
98
|
-
positions:
|
|
93
|
+
nestingLevel: y + 1,
|
|
94
|
+
maxNestingLevel: C,
|
|
95
|
+
disabled: g,
|
|
96
|
+
groupName: R,
|
|
97
|
+
groupType: S,
|
|
98
|
+
positions: _,
|
|
99
99
|
argumentReplies: n,
|
|
100
100
|
parentArgument: e,
|
|
101
101
|
flashParent: (a) => oe(`argument_${a}`)
|
|
102
102
|
}
|
|
103
103
|
);
|
|
104
|
-
return /* @__PURE__ */ l(ye, { elementId:
|
|
104
|
+
return /* @__PURE__ */ l(ye, { elementId: v, onScroll: () => A(!0), children: [
|
|
105
105
|
/* @__PURE__ */ l(
|
|
106
106
|
"div",
|
|
107
107
|
{
|
|
@@ -111,10 +111,10 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
111
111
|
[s.flash]: X,
|
|
112
112
|
[s.argumentReply]: e.is_reply === !0
|
|
113
113
|
},
|
|
114
|
-
s[`level-${
|
|
115
|
-
s[`position-${!(e.author.role === "editor" || e.author.role === "moderator") &&
|
|
114
|
+
s[`level-${y}`],
|
|
115
|
+
s[`position-${!(e.author.role === "editor" || e.author.role === "moderator") && I}`]
|
|
116
116
|
),
|
|
117
|
-
id:
|
|
117
|
+
id: v,
|
|
118
118
|
children: [
|
|
119
119
|
/* @__PURE__ */ o(
|
|
120
120
|
_e,
|
|
@@ -123,7 +123,7 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
123
123
|
author: e.author,
|
|
124
124
|
tag: (e.author.role === "editor" || e.author.role === "moderator") && e.is_reply ? null : te.translatedContent,
|
|
125
125
|
date: e.created_at,
|
|
126
|
-
tagClassName: s[`headerPosition-${
|
|
126
|
+
tagClassName: s[`headerPosition-${I}`],
|
|
127
127
|
disableLinks: F,
|
|
128
128
|
isDeleted: e.is_deleted,
|
|
129
129
|
showModerationFeedback: q ?? (e.status === "rejected" && r.moderation?.showFeedback === !0),
|
|
@@ -138,7 +138,7 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
138
138
|
}) }) : Q ? /* @__PURE__ */ o("div", { className: s.argumentDeletedBody, children: i.formatMessage({
|
|
139
139
|
id: "argument.argument.content_deleted",
|
|
140
140
|
defaultMessage: "This content has been removed."
|
|
141
|
-
}) }) : /* @__PURE__ */ l(
|
|
141
|
+
}) }) : /* @__PURE__ */ l(h, { children: [
|
|
142
142
|
/* @__PURE__ */ l(
|
|
143
143
|
"div",
|
|
144
144
|
{
|
|
@@ -146,21 +146,21 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
146
146
|
[s.fixedHeight]: r?.layout?.showAllArgumentInEmbed !== !0 ? V : !1
|
|
147
147
|
}),
|
|
148
148
|
children: [
|
|
149
|
-
e.is_reply &&
|
|
149
|
+
e.is_reply && d && /* @__PURE__ */ l(
|
|
150
150
|
"div",
|
|
151
151
|
{
|
|
152
152
|
className: s.replyTo,
|
|
153
|
-
onClick: () => j(
|
|
153
|
+
onClick: () => j(d.id),
|
|
154
154
|
children: [
|
|
155
155
|
i.formatMessage({
|
|
156
156
|
id: "info.replying_to",
|
|
157
157
|
defaultMessage: "Replying to"
|
|
158
158
|
}),
|
|
159
159
|
/* @__PURE__ */ l("span", { className: s.replyingTo, children: [
|
|
160
|
-
|
|
160
|
+
d.is_deleted ? i.formatMessage({
|
|
161
161
|
id: "info.deleted",
|
|
162
162
|
defaultMessage: "Deleted"
|
|
163
|
-
}) :
|
|
163
|
+
}) : d.author.full_name,
|
|
164
164
|
/* @__PURE__ */ o(E, { name: "chat", height: 16 })
|
|
165
165
|
] })
|
|
166
166
|
]
|
|
@@ -169,23 +169,23 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
169
169
|
/* @__PURE__ */ o(
|
|
170
170
|
ge,
|
|
171
171
|
{
|
|
172
|
-
content: /* @__PURE__ */ l(
|
|
172
|
+
content: /* @__PURE__ */ l(h, { children: [
|
|
173
173
|
e.is_edited && /* @__PURE__ */ o("div", { className: s.edited, children: i.formatMessage({
|
|
174
174
|
id: "argument.argument.updated",
|
|
175
175
|
defaultMessage: "Updated argument"
|
|
176
176
|
}) }),
|
|
177
|
-
|
|
177
|
+
x && !u.isTranslated ? /* @__PURE__ */ o(
|
|
178
178
|
"div",
|
|
179
179
|
{
|
|
180
180
|
className: s.argumentContent,
|
|
181
|
-
dangerouslySetInnerHTML: { __html: P(
|
|
181
|
+
dangerouslySetInnerHTML: { __html: P(x) }
|
|
182
182
|
}
|
|
183
|
-
) : /* @__PURE__ */ o("div", { className: s.argumentContent, children: P(
|
|
184
|
-
|
|
183
|
+
) : /* @__PURE__ */ o("div", { className: s.argumentContent, children: P(u.translatedContent) }),
|
|
184
|
+
u.isTranslated && /* @__PURE__ */ o(
|
|
185
185
|
be,
|
|
186
186
|
{
|
|
187
187
|
language: e.language,
|
|
188
|
-
callback: () =>
|
|
188
|
+
callback: () => u.toggleContent()
|
|
189
189
|
}
|
|
190
190
|
)
|
|
191
191
|
] }),
|
|
@@ -207,17 +207,17 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
207
207
|
),
|
|
208
208
|
e.sources?.length > 0 && /* @__PURE__ */ o("div", { className: s.argumentSourcesList, children: e.sources.map(re) })
|
|
209
209
|
] }),
|
|
210
|
-
!
|
|
210
|
+
!T && !e.is_deleted && /* @__PURE__ */ o(
|
|
211
211
|
Me,
|
|
212
212
|
{
|
|
213
213
|
resource: e,
|
|
214
|
-
disabled:
|
|
214
|
+
disabled: g || e.status === "rejected" || !W && r?.actions?.disableInputForVisitor === !0 || w,
|
|
215
215
|
reportType: "Message",
|
|
216
216
|
softDelete: r.actions?.softDelete,
|
|
217
217
|
deleteType: "messages",
|
|
218
218
|
deleteListId: Y,
|
|
219
|
-
enableReply:
|
|
220
|
-
handleReplyTo:
|
|
219
|
+
enableReply: y <= C || c.role === "editor" || c.role === "moderator",
|
|
220
|
+
handleReplyTo: L,
|
|
221
221
|
replyRedirectUrl: K,
|
|
222
222
|
shareUrl: `https://app.logora.fr/share/a/${e.id}`,
|
|
223
223
|
shareTitle: i.formatMessage({
|
|
@@ -242,18 +242,18 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
242
242
|
voteableId: e.id,
|
|
243
243
|
totalUpvote: e.upvotes,
|
|
244
244
|
totalDownvote: 0,
|
|
245
|
-
activeClassName: s[`voteButtonPosition-${
|
|
246
|
-
disabled: e.status === "rejected" ||
|
|
245
|
+
activeClassName: s[`voteButtonPosition-${I}`],
|
|
246
|
+
disabled: e.status === "rejected" || c?.id === e?.author?.id || w
|
|
247
247
|
}
|
|
248
248
|
)
|
|
249
249
|
}
|
|
250
250
|
),
|
|
251
|
-
!
|
|
251
|
+
!T && !N && /* @__PURE__ */ o(
|
|
252
252
|
pe,
|
|
253
253
|
{
|
|
254
254
|
numberReplies: e.number_replies,
|
|
255
255
|
repliesAuthors: e.replies_authors,
|
|
256
|
-
expandReplies:
|
|
256
|
+
expandReplies: p,
|
|
257
257
|
onToggleReplies: k,
|
|
258
258
|
isReply: e.is_reply
|
|
259
259
|
}
|
|
@@ -261,26 +261,21 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
261
261
|
]
|
|
262
262
|
}
|
|
263
263
|
),
|
|
264
|
-
!
|
|
264
|
+
!N && /* @__PURE__ */ l(h, { children: [
|
|
265
265
|
Z && /* @__PURE__ */ o(ne, { fallback: null, children: /* @__PURE__ */ o(
|
|
266
266
|
Re,
|
|
267
267
|
{
|
|
268
268
|
groupId: e.group_id,
|
|
269
|
-
groupType:
|
|
270
|
-
groupName:
|
|
271
|
-
positions:
|
|
269
|
+
groupType: S,
|
|
270
|
+
groupName: R,
|
|
271
|
+
positions: _,
|
|
272
272
|
parentId: e.id,
|
|
273
273
|
positionId: H?.position_id,
|
|
274
|
-
disabled:
|
|
274
|
+
disabled: g,
|
|
275
275
|
hideSourceAction: r?.actions?.disableUserSources || !1,
|
|
276
276
|
argumentListId: `argument_${e.id}_reply_list`,
|
|
277
277
|
onSubmit: (t) => {
|
|
278
|
-
|
|
279
|
-
},
|
|
280
|
-
onUpdate: (t) => {
|
|
281
|
-
h(
|
|
282
|
-
(a) => a.map((d) => d.id === t.id ? t : d)
|
|
283
|
-
);
|
|
278
|
+
L(), M([t]), b(!0);
|
|
284
279
|
},
|
|
285
280
|
isReply: !0,
|
|
286
281
|
avatarSize: 40,
|
|
@@ -293,8 +288,8 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
293
288
|
},
|
|
294
289
|
`Reply${e.id}`
|
|
295
290
|
) }),
|
|
296
|
-
|
|
297
|
-
|
|
291
|
+
m?.length > 0 && p && /* @__PURE__ */ o("div", { className: s.repliesList, children: m.map((t) => U(t)) }),
|
|
292
|
+
p && /* @__PURE__ */ o("div", { className: s.repliesList, children: /* @__PURE__ */ o(
|
|
298
293
|
Ie,
|
|
299
294
|
{
|
|
300
295
|
voteableType: "Message",
|
|
@@ -310,12 +305,12 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
310
305
|
perPage: 5,
|
|
311
306
|
display: "column",
|
|
312
307
|
resourcePropName: "argument",
|
|
313
|
-
emptyListComponent: /* @__PURE__ */ o(
|
|
308
|
+
emptyListComponent: /* @__PURE__ */ o(h, {}),
|
|
314
309
|
transformData: (t) => se(t),
|
|
315
|
-
children:
|
|
310
|
+
children: U(e)
|
|
316
311
|
}
|
|
317
312
|
) }),
|
|
318
|
-
|
|
313
|
+
m?.length > 0 && !p && /* @__PURE__ */ o("div", { className: s.repliesList, children: e.number_replies > 1 && /* @__PURE__ */ o("div", { className: s.readMoreLink, children: /* @__PURE__ */ o(
|
|
319
314
|
Se,
|
|
320
315
|
{
|
|
321
316
|
role: "link",
|
|
@@ -1,138 +1,137 @@
|
|
|
1
|
-
import { jsxs as _, jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import { useLocation as
|
|
1
|
+
import { jsxs as _, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import $e from "@rooks/use-sessionstorage-state";
|
|
3
|
+
import { useRef as qe, useState as c, useEffect as M, Suspense as De, lazy as We } from "react";
|
|
4
|
+
import { useIntl as Ye, FormattedMessage as me } from "react-intl";
|
|
5
|
+
import { useLocation as ke } from "react-router";
|
|
6
6
|
import I from "classnames";
|
|
7
7
|
import n from "./ArgumentInput.module.scss.js";
|
|
8
|
-
import { useDataProvider as
|
|
9
|
-
import { useList as
|
|
10
|
-
import { useConfig as
|
|
11
|
-
import { useInput as
|
|
12
|
-
import { useAuth as
|
|
13
|
-
import { useFormValidation as
|
|
14
|
-
import { useResponsive as
|
|
15
|
-
import { useAuthRequired as
|
|
16
|
-
import { useModal as
|
|
17
|
-
import { useToast as
|
|
18
|
-
import { TogglePosition as
|
|
19
|
-
import { Avatar as
|
|
20
|
-
import { AuthorBox as
|
|
21
|
-
import { TextEditor as
|
|
22
|
-
import { Icon as
|
|
23
|
-
const ot =
|
|
8
|
+
import { useDataProvider as Re } from "../../data/data_provider/useDataProvider.js";
|
|
9
|
+
import { useList as je } from "../../list/list_provider/useList.js";
|
|
10
|
+
import { useConfig as ze } from "../../data/config_provider/useConfig.js";
|
|
11
|
+
import { useInput as Oe } from "../input_provider/useInput.js";
|
|
12
|
+
import { useAuth as Je } from "../../auth/use_auth/useAuth.js";
|
|
13
|
+
import { useFormValidation as Ke } from "../../forms/use_form_validation/useFormValidation.js";
|
|
14
|
+
import { useResponsive as Ge } from "../../hooks/use_responsive/useResponsive.js";
|
|
15
|
+
import { useAuthRequired as He } from "../../hooks/use_auth_required/useAuthRequired.js";
|
|
16
|
+
import { useModal as Qe } from "../../dialog/modal/useModal.js";
|
|
17
|
+
import { useToast as Xe } from "../../dialog/toast_provider/useToast.js";
|
|
18
|
+
import { TogglePosition as Ze } from "../toggle_position/TogglePosition.js";
|
|
19
|
+
import { Avatar as et } from "../../user/avatar/Avatar.js";
|
|
20
|
+
import { AuthorBox as tt } from "../../user/author_box/AuthorBox.js";
|
|
21
|
+
import { TextEditor as nt } from "../text_editor/TextEditor.js";
|
|
22
|
+
import { Icon as at } from "../../icons/icon/Icon.js";
|
|
23
|
+
const ot = We(() => import("../../modal/side_modal/index.js").then((v) => ({ default: v.SideModal }))), Nt = ({
|
|
24
24
|
argumentListId: v,
|
|
25
|
-
avatarSize:
|
|
25
|
+
avatarSize: ge = 48,
|
|
26
26
|
disabled: z = !1,
|
|
27
27
|
positions: a = [],
|
|
28
28
|
disabledPositions: S = [],
|
|
29
29
|
groupId: A,
|
|
30
|
-
groupName:
|
|
30
|
+
groupName: fe,
|
|
31
31
|
groupType: O,
|
|
32
|
-
hideSourceAction:
|
|
32
|
+
hideSourceAction: he = !1,
|
|
33
33
|
isReply: u = !1,
|
|
34
34
|
onSubmit: J,
|
|
35
|
-
onUpdate: K,
|
|
36
35
|
parentId: F,
|
|
37
|
-
placeholder:
|
|
36
|
+
placeholder: pe,
|
|
38
37
|
positionId: b,
|
|
39
|
-
focusOnInit:
|
|
38
|
+
focusOnInit: _e = !1,
|
|
40
39
|
activeOnInit: P = !1,
|
|
41
|
-
userGuideUrl:
|
|
42
|
-
hideUserGuideLink:
|
|
43
|
-
hideCharCount:
|
|
44
|
-
disableAutoActivate:
|
|
40
|
+
userGuideUrl: K,
|
|
41
|
+
hideUserGuideLink: Me = !1,
|
|
42
|
+
hideCharCount: ve = !1,
|
|
43
|
+
disableAutoActivate: Ae = !1
|
|
45
44
|
}) => {
|
|
46
|
-
const r =
|
|
47
|
-
focus:
|
|
45
|
+
const r = Ye(), G = Re(), x = je(), h = ze(), {
|
|
46
|
+
focus: H,
|
|
48
47
|
setFocus: N,
|
|
49
|
-
setReset:
|
|
48
|
+
setReset: be,
|
|
50
49
|
inputContent: B,
|
|
51
|
-
setInputContent:
|
|
52
|
-
setInputRichContent:
|
|
53
|
-
} =
|
|
50
|
+
setInputContent: Q,
|
|
51
|
+
setInputRichContent: Ce
|
|
52
|
+
} = Oe(), { isLoggedIn: C, currentUser: d } = Je(), { errors: E, validate: V } = Ke(), { isMobile: m } = Ge(), we = ke(), X = qe(null), [U, $] = c([]), [q, D] = c(""), [Z, W] = c(null), [l, p] = c(null), [ee, te] = c(null), [ne, ae] = c(!1), [w, oe] = c(!1), [y, ie] = c({}), [g, Ie] = $e(
|
|
54
53
|
"userSide",
|
|
55
54
|
{}
|
|
56
|
-
), [f,
|
|
55
|
+
), [f, Se] = c(
|
|
57
56
|
!C && h?.actions?.disableInputForVisitor
|
|
58
|
-
), Y =
|
|
59
|
-
typeof window < "u" ? window.location.search :
|
|
57
|
+
), Y = He(), { showModal: xe } = Qe(), { toast: k } = Xe() || {}, se = new URLSearchParams(
|
|
58
|
+
typeof window < "u" ? window.location.search : we.search
|
|
60
59
|
);
|
|
61
60
|
M(() => {
|
|
62
|
-
|
|
61
|
+
Se(
|
|
63
62
|
!C && h?.actions?.disableInputForVisitor
|
|
64
63
|
);
|
|
65
64
|
}, [C, h]);
|
|
66
|
-
const R = d?.role === "editor" || d?.role === "moderator",
|
|
65
|
+
const R = d?.role === "editor" || d?.role === "moderator", re = d?.moderation_status === "banned";
|
|
67
66
|
M(() => {
|
|
68
67
|
let e = null;
|
|
69
|
-
typeof window < "u" && (e =
|
|
68
|
+
typeof window < "u" && (e = se.get("positionId")), b && b != a[2]?.id && a?.find((t) => t.id === b) ? p(b) : e && e != a[2]?.id ? p(e) : g && g.groupId == A && g.positionId != a[2]?.id && p(g.positionId);
|
|
70
69
|
}, [b]), M(() => {
|
|
71
70
|
P && (j(), N(!0));
|
|
72
71
|
}, [P]), M(() => {
|
|
73
72
|
if (typeof window < "u") {
|
|
74
|
-
const e =
|
|
75
|
-
(e === !0 || e === "true") && (N(!0),
|
|
73
|
+
const e = _e || se.get("initArgument");
|
|
74
|
+
(e === !0 || e === "true") && (N(!0), Ee());
|
|
76
75
|
}
|
|
77
76
|
}, []), M(() => {
|
|
78
|
-
|
|
79
|
-
}, [
|
|
80
|
-
B?.id && (
|
|
77
|
+
H && (ue(), N(!1));
|
|
78
|
+
}, [H]), M(() => {
|
|
79
|
+
B?.id && (Ne(B), N(!0));
|
|
81
80
|
}, [B]);
|
|
82
|
-
const
|
|
83
|
-
|
|
81
|
+
const Ne = (e) => {
|
|
82
|
+
ie(e), oe(!0), $(e.sources), D(e.content), W(e.rich_content), te(e.id), ue(), p(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Ce(e.rich_content) : Q(e.content);
|
|
83
|
+
}, ue = () => {
|
|
84
|
+
X.current.scrollIntoView(!1);
|
|
84
85
|
}, de = () => {
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
}, Te = (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Ne(
|
|
92
|
-
/* @__PURE__ */ i(We, { fallback: null, children: /* @__PURE__ */ i(
|
|
86
|
+
D(""), W(null), ie({}), te(null), $([]), be(!0), Q(null);
|
|
87
|
+
}, ye = (e) => {
|
|
88
|
+
p(e), ce(e);
|
|
89
|
+
}, Te = () => {
|
|
90
|
+
xe(
|
|
91
|
+
/* @__PURE__ */ o(De, { fallback: null, children: /* @__PURE__ */ o(
|
|
93
92
|
ot,
|
|
94
93
|
{
|
|
95
94
|
modalTitle: r.formatMessage({
|
|
96
95
|
id: "modal.side_modal.modal_title",
|
|
97
96
|
defaultMessage: "Choose your side"
|
|
98
97
|
}),
|
|
99
|
-
onChooseSide:
|
|
98
|
+
onChooseSide: ye,
|
|
100
99
|
positions: a,
|
|
101
|
-
title:
|
|
100
|
+
title: fe,
|
|
102
101
|
disabledPositions: !u && S,
|
|
103
102
|
isNeutral: g && g.groupId == A && g.positionId === a[2]?.id
|
|
104
103
|
}
|
|
105
104
|
) })
|
|
106
105
|
);
|
|
107
|
-
},
|
|
108
|
-
C ?
|
|
109
|
-
},
|
|
110
|
-
f ? Y({ loginAction: "argument" }) : (
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
},
|
|
106
|
+
}, Le = () => {
|
|
107
|
+
C ? ee ? Be() : !a || a?.length === 0 || !S?.find((e) => e?.id === l) && l || R && u ? ce(u && R && a[0]?.id) : Te() : Y({ loginAction: "argument" });
|
|
108
|
+
}, Fe = (e, t) => {
|
|
109
|
+
f ? Y({ loginAction: "argument" }) : (D(e), W(t), V({ content: e }, [{ content: ["url", null] }]));
|
|
110
|
+
}, Pe = (e) => {
|
|
111
|
+
$(e);
|
|
112
|
+
}, le = [
|
|
114
113
|
{ content: ["length", 3] },
|
|
115
114
|
{ content: ["required", null] },
|
|
116
115
|
{ content: ["url", null] },
|
|
117
116
|
...!a || a?.length === 0 ? [] : [{ position_id: ["required", null] }]
|
|
118
|
-
],
|
|
119
|
-
const t = e || l,
|
|
120
|
-
content:
|
|
121
|
-
rich_content:
|
|
117
|
+
], ce = (e) => {
|
|
118
|
+
const t = e || l, s = {
|
|
119
|
+
content: q,
|
|
120
|
+
rich_content: Z,
|
|
122
121
|
group_id: A,
|
|
123
122
|
...O && { group_type: O },
|
|
124
123
|
...t && { position_id: t },
|
|
125
124
|
is_reply: !!F,
|
|
126
125
|
message_id: F || null,
|
|
127
|
-
source_ids:
|
|
126
|
+
source_ids: U?.map((i) => i.id)
|
|
128
127
|
};
|
|
129
|
-
V(
|
|
128
|
+
V(s, le) && (t && a && a.map((i) => i.id).includes(t) && Ie({
|
|
130
129
|
groupId: A,
|
|
131
130
|
positionId: t
|
|
132
|
-
}),
|
|
133
|
-
if (
|
|
131
|
+
}), de(), G.create("messages", s).then((i) => {
|
|
132
|
+
if (i.data.success) {
|
|
134
133
|
if (F)
|
|
135
|
-
J(
|
|
134
|
+
J(i.data.data.resource), k(
|
|
136
135
|
r.formatMessage({
|
|
137
136
|
id: "alert.argument_create",
|
|
138
137
|
defaultMessage: "Your contribution has been sent !"
|
|
@@ -146,11 +145,11 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
|
|
|
146
145
|
}
|
|
147
146
|
);
|
|
148
147
|
else {
|
|
149
|
-
const T =
|
|
148
|
+
const T = i.data.data.resource;
|
|
150
149
|
let L = v;
|
|
151
150
|
t && !m && (L = `argumentList${T.position.id}`), J?.(
|
|
152
|
-
|
|
153
|
-
a.find((
|
|
151
|
+
q,
|
|
152
|
+
a.find((Ue) => Ue.id === t) || null
|
|
154
153
|
), x.add(L, [T]), k(
|
|
155
154
|
r.formatMessage({
|
|
156
155
|
id: "alert.argument_create",
|
|
@@ -170,45 +169,45 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
|
|
|
170
169
|
typeof window < "u" && window.dispatchEvent(
|
|
171
170
|
new CustomEvent("logora:user_content:created", {
|
|
172
171
|
detail: {
|
|
173
|
-
content:
|
|
172
|
+
content: i.data.data?.resource
|
|
174
173
|
}
|
|
175
174
|
})
|
|
176
175
|
);
|
|
177
176
|
}
|
|
178
177
|
}));
|
|
179
|
-
},
|
|
178
|
+
}, Be = () => {
|
|
180
179
|
const e = {
|
|
181
|
-
content:
|
|
182
|
-
rich_content:
|
|
183
|
-
source_ids:
|
|
180
|
+
content: q,
|
|
181
|
+
rich_content: Z,
|
|
182
|
+
source_ids: U?.map((t) => t.id),
|
|
184
183
|
...l && { position_id: l }
|
|
185
184
|
};
|
|
186
|
-
V(e,
|
|
185
|
+
V(e, le) && G.update("messages", ee, e).then((t) => {
|
|
187
186
|
if (t.data.success) {
|
|
188
|
-
const
|
|
189
|
-
console.log("[updateArgument] réponse API:",
|
|
190
|
-
let
|
|
191
|
-
if (
|
|
192
|
-
const T = `argumentList${y.position.id}`, L = `argumentList${
|
|
193
|
-
x.remove(T, [
|
|
187
|
+
const s = t.data.data.resource;
|
|
188
|
+
console.log("[updateArgument] réponse API:", s), console.log("[updateArgument] editElement:", y), console.log("[updateArgument] argumentListId prop:", v);
|
|
189
|
+
let i = v;
|
|
190
|
+
if (s.is_reply ? i = `argument_${s.reply_to_id || y?.reply_to_id}_reply_list` : l && !m && (i = `argumentList${s.position?.id}`), console.log("[updateArgument] listId final:", i), y?.position?.id != s.position?.id && !m && !s.is_reply) {
|
|
191
|
+
const T = `argumentList${y.position.id}`, L = `argumentList${s.position.id}`;
|
|
192
|
+
x.remove(T, [s]), x.add(L, [s]);
|
|
194
193
|
} else
|
|
195
|
-
x.update(
|
|
194
|
+
x.update(i, [s]);
|
|
196
195
|
k(r.formatMessage({ id: "alert.argument_modify" }), {
|
|
197
196
|
type: "success"
|
|
198
|
-
}),
|
|
197
|
+
}), de();
|
|
199
198
|
}
|
|
200
199
|
});
|
|
201
|
-
},
|
|
202
|
-
if (!
|
|
203
|
-
|
|
200
|
+
}, Ee = () => {
|
|
201
|
+
if (!ne) {
|
|
202
|
+
ae(!0);
|
|
204
203
|
const e = setTimeout(() => {
|
|
205
|
-
|
|
204
|
+
ae(!1);
|
|
206
205
|
}, 2e3);
|
|
207
206
|
return () => clearTimeout(e);
|
|
208
207
|
}
|
|
209
208
|
}, j = () => {
|
|
210
209
|
f ? Y({ loginAction: "argument" }) : oe(!0);
|
|
211
|
-
},
|
|
210
|
+
}, Ve = () => {
|
|
212
211
|
const e = S.find(
|
|
213
212
|
(t) => t.id === l
|
|
214
213
|
);
|
|
@@ -222,28 +221,28 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
|
|
|
222
221
|
);
|
|
223
222
|
};
|
|
224
223
|
return /* @__PURE__ */ _("div", { className: n.inputContainer, children: [
|
|
225
|
-
z && /* @__PURE__ */
|
|
224
|
+
z && /* @__PURE__ */ o("div", { className: n.disabledInputMask, children: re ? r.formatMessage({
|
|
226
225
|
id: "input.argument_input.user_banned",
|
|
227
226
|
defaultMessage: "You are banned from the debate space."
|
|
228
227
|
}) : r.formatMessage({
|
|
229
228
|
id: "info.debate_is_inactive",
|
|
230
229
|
defaultMessage: "Debate is closed"
|
|
231
230
|
}) }),
|
|
232
|
-
/* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ o(
|
|
233
232
|
"div",
|
|
234
233
|
{
|
|
235
234
|
className: I(n.argumentInput, {
|
|
236
|
-
[n.flash]:
|
|
235
|
+
[n.flash]: ne,
|
|
237
236
|
[n.replyInputContainer]: u
|
|
238
237
|
}),
|
|
239
|
-
children: /* @__PURE__ */
|
|
238
|
+
children: /* @__PURE__ */ o("div", { "data-tid": "action_add_argument", ref: X, children: /* @__PURE__ */ _("div", { className: n.argumentInputBox, children: [
|
|
240
239
|
a.length > 0 && C && (!u || !R) && /* @__PURE__ */ _("div", { className: n.userPosition, children: [
|
|
241
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ o("div", { children: r.formatMessage({
|
|
242
241
|
id: "input.position",
|
|
243
242
|
defaultMessage: "Your position"
|
|
244
243
|
}) }),
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
-
|
|
244
|
+
/* @__PURE__ */ o(
|
|
245
|
+
Ze,
|
|
247
246
|
{
|
|
248
247
|
activeLabel: l === a[0].id ? 0 : l === a[1].id ? 1 : null,
|
|
249
248
|
firstLabel: a[0],
|
|
@@ -260,22 +259,22 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
|
|
|
260
259
|
[n.replyEditorRow]: u
|
|
261
260
|
}),
|
|
262
261
|
children: [
|
|
263
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ o(
|
|
264
263
|
"div",
|
|
265
264
|
{
|
|
266
265
|
className: I(n.argumentAuthorContainer, {
|
|
267
266
|
[n.argumentAuthorContainerMobile]: m,
|
|
268
267
|
[n.argumentAuthorContainerActivated]: !m && w || u
|
|
269
268
|
}),
|
|
270
|
-
children: !m && w || u ? /* @__PURE__ */
|
|
271
|
-
|
|
269
|
+
children: !m && w || u ? /* @__PURE__ */ o(
|
|
270
|
+
et,
|
|
272
271
|
{
|
|
273
272
|
avatarUrl: d.image_url,
|
|
274
273
|
userName: d.full_name,
|
|
275
|
-
size:
|
|
274
|
+
size: ge
|
|
276
275
|
}
|
|
277
|
-
) : /* @__PURE__ */
|
|
278
|
-
|
|
276
|
+
) : /* @__PURE__ */ o(
|
|
277
|
+
tt,
|
|
279
278
|
{
|
|
280
279
|
fullName: d?.full_name || r.formatMessage({ id: "default_author.full_name" }),
|
|
281
280
|
avatarUrl: d?.image_url,
|
|
@@ -294,38 +293,38 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
|
|
|
294
293
|
[n.replyTextEditorBox]: u
|
|
295
294
|
}),
|
|
296
295
|
children: [
|
|
297
|
-
/* @__PURE__ */
|
|
298
|
-
|
|
296
|
+
/* @__PURE__ */ o(
|
|
297
|
+
nt,
|
|
299
298
|
{
|
|
300
299
|
handleChange: (e, t) => {
|
|
301
|
-
|
|
300
|
+
Fe(e, t);
|
|
302
301
|
},
|
|
303
302
|
handleSourcesChange: (e) => {
|
|
304
|
-
|
|
303
|
+
Pe(e);
|
|
305
304
|
},
|
|
306
|
-
placeholder:
|
|
305
|
+
placeholder: pe,
|
|
307
306
|
"aria-label": r.formatMessage({
|
|
308
307
|
id: "input.argument_input.aria_label",
|
|
309
308
|
defaultMessage: "Message input field"
|
|
310
309
|
}),
|
|
311
|
-
onSubmit:
|
|
312
|
-
sources:
|
|
313
|
-
hideSourceAction:
|
|
310
|
+
onSubmit: Le,
|
|
311
|
+
sources: U,
|
|
312
|
+
hideSourceAction: he || f,
|
|
314
313
|
uid: `Argument${A}`,
|
|
315
314
|
onActivation: j,
|
|
316
315
|
showStylesControls: w,
|
|
317
|
-
disabled: z || f ||
|
|
316
|
+
disabled: z || f || re,
|
|
318
317
|
maxLength: f ? !1 : h?.actions?.argumentMaxLength,
|
|
319
318
|
disableRichText: h?.actions?.disableRichText || f,
|
|
320
319
|
shortBar: u,
|
|
321
320
|
hideSubmit: f,
|
|
322
321
|
allowedDomains: h?.allowed_sources,
|
|
323
322
|
active: P,
|
|
324
|
-
hideCharCount:
|
|
325
|
-
disableAutoActivate:
|
|
323
|
+
hideCharCount: ve,
|
|
324
|
+
disableAutoActivate: Ae
|
|
326
325
|
}
|
|
327
326
|
),
|
|
328
|
-
E?.content && /* @__PURE__ */
|
|
327
|
+
E?.content && /* @__PURE__ */ o("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ o("div", { children: e }, t)) }),
|
|
329
328
|
w && S?.find(
|
|
330
329
|
(e) => e.id === l
|
|
331
330
|
) && /* @__PURE__ */ _(
|
|
@@ -336,8 +335,8 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
|
|
|
336
335
|
n.disabledPositionWarning
|
|
337
336
|
),
|
|
338
337
|
children: [
|
|
339
|
-
/* @__PURE__ */
|
|
340
|
-
|
|
338
|
+
/* @__PURE__ */ o(
|
|
339
|
+
at,
|
|
341
340
|
{
|
|
342
341
|
name: "announcement",
|
|
343
342
|
className: n.warningIcon,
|
|
@@ -345,25 +344,25 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
|
|
|
345
344
|
width: 20
|
|
346
345
|
}
|
|
347
346
|
),
|
|
348
|
-
/* @__PURE__ */
|
|
347
|
+
/* @__PURE__ */ o("div", { className: n.argumentInputWarningText, children: Ve() })
|
|
349
348
|
]
|
|
350
349
|
}
|
|
351
350
|
),
|
|
352
|
-
w &&
|
|
353
|
-
|
|
351
|
+
w && K && !Me && /* @__PURE__ */ o("div", { className: n.guideMessage, children: /* @__PURE__ */ o(
|
|
352
|
+
me,
|
|
354
353
|
{
|
|
355
354
|
id: "alert.guide_message",
|
|
356
355
|
defaultMessage: "Contributions must comply with our {userCharter}.",
|
|
357
356
|
values: {
|
|
358
|
-
userCharter: /* @__PURE__ */
|
|
357
|
+
userCharter: /* @__PURE__ */ o(
|
|
359
358
|
"a",
|
|
360
359
|
{
|
|
361
360
|
className: n.guideMessage,
|
|
362
|
-
href:
|
|
361
|
+
href: K,
|
|
363
362
|
target: "_blank",
|
|
364
363
|
rel: "noreferrer",
|
|
365
|
-
children: /* @__PURE__ */
|
|
366
|
-
|
|
364
|
+
children: /* @__PURE__ */ o(
|
|
365
|
+
me,
|
|
367
366
|
{
|
|
368
367
|
id: "alert.user_charter",
|
|
369
368
|
defaultMessage: "user charter"
|
|
@@ -386,5 +385,5 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
|
|
|
386
385
|
] });
|
|
387
386
|
};
|
|
388
387
|
export {
|
|
389
|
-
|
|
388
|
+
Nt as ArgumentInput
|
|
390
389
|
};
|