@logora/debate 0.4.73 → 0.4.74
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
1
|
import { jsxs as C, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import We from "@rooks/use-sessionstorage-state";
|
|
3
|
-
import { useRef as Ye, useState as c, useEffect as p, Suspense as
|
|
3
|
+
import { useRef as Ye, useState as c, useEffect as p, Suspense as je, lazy as Re } from "react";
|
|
4
4
|
import { useIntl as ze, FormattedMessage as he } from "react-intl";
|
|
5
5
|
import { useLocation as Oe } from "react-router";
|
|
6
6
|
import x from "classnames";
|
|
@@ -20,7 +20,7 @@ import { Avatar as st } from "../../user/avatar/Avatar.js";
|
|
|
20
20
|
import { AuthorBox as it } from "../../user/author_box/AuthorBox.js";
|
|
21
21
|
import { TextEditor as ot } from "../text_editor/TextEditor.js";
|
|
22
22
|
import { Icon as rt } from "../../icons/icon/Icon.js";
|
|
23
|
-
const ut =
|
|
23
|
+
const ut = Re(() => import("../../modal/side_modal/index.js").then((N) => ({ default: N.SideModal }))), Ft = ({
|
|
24
24
|
argumentListId: N,
|
|
25
25
|
avatarSize: pe = 48,
|
|
26
26
|
disabled: O = !1,
|
|
@@ -30,7 +30,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
30
30
|
groupName: _e,
|
|
31
31
|
groupType: J,
|
|
32
32
|
hideSourceAction: Me = !1,
|
|
33
|
-
isReply:
|
|
33
|
+
isReply: o = !1,
|
|
34
34
|
onSubmit: K,
|
|
35
35
|
onUpdate: G,
|
|
36
36
|
parentId: M,
|
|
@@ -44,7 +44,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
44
44
|
disableAutoActivate: we = !1,
|
|
45
45
|
autoFocus: Q = !1
|
|
46
46
|
}) => {
|
|
47
|
-
const
|
|
47
|
+
const r = ze(), X = Je(), T = Ke(), v = Ge(), {
|
|
48
48
|
focus: Z,
|
|
49
49
|
setFocus: ee,
|
|
50
50
|
setReset: Se,
|
|
@@ -56,7 +56,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
56
56
|
{}
|
|
57
57
|
), [g, Te] = c(
|
|
58
58
|
!S && v?.actions?.disableInputForVisitor
|
|
59
|
-
), Y = et(), { showModal: Le } = tt(), { toast:
|
|
59
|
+
), Y = et(), { showModal: Le } = tt(), { toast: j } = nt() || {}, le = new URLSearchParams(
|
|
60
60
|
typeof window < "u" ? window.location.search : xe.search
|
|
61
61
|
);
|
|
62
62
|
p(() => {
|
|
@@ -64,7 +64,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
64
64
|
!S && v?.actions?.disableInputForVisitor
|
|
65
65
|
);
|
|
66
66
|
}, [S, v]);
|
|
67
|
-
const
|
|
67
|
+
const R = u?.role === "editor" || u?.role === "moderator", ce = u?.moderation_status === "banned";
|
|
68
68
|
p(() => {
|
|
69
69
|
let e = null;
|
|
70
70
|
typeof window < "u" && (e = le.get("positionId")), w && w != a[2]?.id && a?.find((t) => t.id === w) ? b(w) : e && e != a[2]?.id ? b(e) : f && f.groupId == _ && f.positionId != a[2]?.id && b(f.positionId);
|
|
@@ -80,7 +80,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
80
80
|
}, []), p(() => {
|
|
81
81
|
Z && (L(), ee(!1));
|
|
82
82
|
}, [Z]), p(() => {
|
|
83
|
-
B?.id && (Fe(B), ee(!0));
|
|
83
|
+
B?.id && !o && (Fe(B), ee(!0));
|
|
84
84
|
}, [B]);
|
|
85
85
|
const Fe = (e) => {
|
|
86
86
|
de(e), ue(!0), k(e.sources), D(e.content), U(e.rich_content), ie(e.id), L(), b(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Ie(e.rich_content) : te(e.content);
|
|
@@ -92,23 +92,23 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
92
92
|
b(e), ge(e);
|
|
93
93
|
}, Be = () => {
|
|
94
94
|
Le(
|
|
95
|
-
/* @__PURE__ */ s(
|
|
95
|
+
/* @__PURE__ */ s(je, { fallback: null, children: /* @__PURE__ */ s(
|
|
96
96
|
ut,
|
|
97
97
|
{
|
|
98
|
-
modalTitle:
|
|
98
|
+
modalTitle: r.formatMessage({
|
|
99
99
|
id: "modal.side_modal.modal_title",
|
|
100
100
|
defaultMessage: "Choose your side"
|
|
101
101
|
}),
|
|
102
102
|
onChooseSide: Pe,
|
|
103
103
|
positions: a,
|
|
104
104
|
title: _e,
|
|
105
|
-
disabledPositions: !
|
|
105
|
+
disabledPositions: !o && y,
|
|
106
106
|
isNeutral: f && f.groupId == _ && f.positionId === a[2]?.id
|
|
107
107
|
}
|
|
108
108
|
) })
|
|
109
109
|
);
|
|
110
110
|
}, Ee = () => {
|
|
111
|
-
S ? se ? ke() : !a || a?.length === 0 || !y?.find((e) => e?.id === d) && d ||
|
|
111
|
+
S ? se ? ke() : !a || a?.length === 0 || !y?.find((e) => e?.id === d) && d || R && o ? ge(o && R && a[0]?.id) : Be() : Y({ loginAction: "argument" });
|
|
112
112
|
}, $e = (e, t) => {
|
|
113
113
|
g ? Y({ loginAction: "argument" }) : (D(e), U(t), $({ content: e }, [{ content: ["url", null] }]));
|
|
114
114
|
}, Ve = (e) => {
|
|
@@ -135,14 +135,14 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
135
135
|
}), me(), X.create("messages", l).then((i) => {
|
|
136
136
|
if (i.data.success) {
|
|
137
137
|
if (M)
|
|
138
|
-
K(i.data.data.resource),
|
|
139
|
-
|
|
138
|
+
K(i.data.data.resource), j(
|
|
139
|
+
r.formatMessage({
|
|
140
140
|
id: "alert.argument_create",
|
|
141
141
|
defaultMessage: "Your contribution has been sent !"
|
|
142
142
|
}),
|
|
143
143
|
{
|
|
144
144
|
type: "success",
|
|
145
|
-
points:
|
|
145
|
+
points: r.formatMessage({
|
|
146
146
|
id: "alert.reply_gain",
|
|
147
147
|
defaultMessage: " "
|
|
148
148
|
})
|
|
@@ -154,14 +154,14 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
154
154
|
t && !m && (F = `argumentList${h.position.id}`), K?.(
|
|
155
155
|
q,
|
|
156
156
|
a.find((Ue) => Ue.id === t) || null
|
|
157
|
-
), T.add(F, [h]),
|
|
158
|
-
|
|
157
|
+
), T.add(F, [h]), j(
|
|
158
|
+
r.formatMessage({
|
|
159
159
|
id: "alert.argument_create",
|
|
160
160
|
defaultMessage: "Your contribution has been sent !"
|
|
161
161
|
}),
|
|
162
162
|
{
|
|
163
163
|
type: "success",
|
|
164
|
-
points:
|
|
164
|
+
points: r.formatMessage({
|
|
165
165
|
id: "alert.argument_create_gain",
|
|
166
166
|
defaultMessage: "Up to 10 eloquence points"
|
|
167
167
|
}),
|
|
@@ -190,7 +190,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
190
190
|
if (t.data.success) {
|
|
191
191
|
const l = t.data.data.resource;
|
|
192
192
|
let i = N;
|
|
193
|
-
if (A?.is_reply ||
|
|
193
|
+
if (A?.is_reply || o) {
|
|
194
194
|
const h = A?.message_id || A?.reply_to_id || M;
|
|
195
195
|
h && (i = `argument_${h}_reply_list`);
|
|
196
196
|
} else d && !m && (i = `argumentList${l.position?.id}`);
|
|
@@ -199,7 +199,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
199
199
|
T.remove(h, [l]), T.add(F, [l]);
|
|
200
200
|
} else
|
|
201
201
|
T.update(i, [l]);
|
|
202
|
-
G && G(l),
|
|
202
|
+
G && G(l), j(r.formatMessage({ id: "alert.argument_modify" }), {
|
|
203
203
|
type: "success"
|
|
204
204
|
}), me();
|
|
205
205
|
}
|
|
@@ -219,7 +219,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
219
219
|
(t) => t.id === d
|
|
220
220
|
);
|
|
221
221
|
if (e)
|
|
222
|
-
return
|
|
222
|
+
return r.formatMessage(
|
|
223
223
|
{
|
|
224
224
|
id: "info.argument_side_limit",
|
|
225
225
|
defaultMessage: "You have reached the argument limit (10) for position {position}."
|
|
@@ -228,10 +228,10 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
228
228
|
);
|
|
229
229
|
};
|
|
230
230
|
return /* @__PURE__ */ C("div", { className: n.inputContainer, children: [
|
|
231
|
-
O && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ce ?
|
|
231
|
+
O && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ce ? r.formatMessage({
|
|
232
232
|
id: "input.argument_input.user_banned",
|
|
233
233
|
defaultMessage: "You are banned from the debate space."
|
|
234
|
-
}) :
|
|
234
|
+
}) : r.formatMessage({
|
|
235
235
|
id: "info.debate_is_inactive",
|
|
236
236
|
defaultMessage: "Debate is closed"
|
|
237
237
|
}) }),
|
|
@@ -240,11 +240,11 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
240
240
|
{
|
|
241
241
|
className: x(n.argumentInput, {
|
|
242
242
|
[n.flash]: oe,
|
|
243
|
-
[n.replyInputContainer]:
|
|
243
|
+
[n.replyInputContainer]: o
|
|
244
244
|
}),
|
|
245
245
|
children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref: ne, children: /* @__PURE__ */ C("div", { className: n.argumentInputBox, children: [
|
|
246
|
-
a.length > 0 && S && (!
|
|
247
|
-
/* @__PURE__ */ s("div", { children:
|
|
246
|
+
a.length > 0 && S && (!o || !R) && /* @__PURE__ */ C("div", { className: n.userPosition, children: [
|
|
247
|
+
/* @__PURE__ */ s("div", { children: r.formatMessage({
|
|
248
248
|
id: "input.position",
|
|
249
249
|
defaultMessage: "Your position"
|
|
250
250
|
}) }),
|
|
@@ -263,7 +263,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
263
263
|
{
|
|
264
264
|
className: x(n.argumentTextInputBox, {
|
|
265
265
|
[n.argumentTextInputBoxisTablet]: !m,
|
|
266
|
-
[n.replyEditorRow]:
|
|
266
|
+
[n.replyEditorRow]: o
|
|
267
267
|
}),
|
|
268
268
|
children: [
|
|
269
269
|
/* @__PURE__ */ s(
|
|
@@ -271,9 +271,9 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
271
271
|
{
|
|
272
272
|
className: x(n.argumentAuthorContainer, {
|
|
273
273
|
[n.argumentAuthorContainerMobile]: m,
|
|
274
|
-
[n.argumentAuthorContainerActivated]: !m && I ||
|
|
274
|
+
[n.argumentAuthorContainerActivated]: !m && I || o
|
|
275
275
|
}),
|
|
276
|
-
children: !m && I ||
|
|
276
|
+
children: !m && I || o ? /* @__PURE__ */ s(
|
|
277
277
|
st,
|
|
278
278
|
{
|
|
279
279
|
avatarUrl: u.image_url,
|
|
@@ -283,7 +283,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
283
283
|
) : /* @__PURE__ */ s(
|
|
284
284
|
it,
|
|
285
285
|
{
|
|
286
|
-
fullName: u?.full_name ||
|
|
286
|
+
fullName: u?.full_name || r.formatMessage({ id: "default_author.full_name" }),
|
|
287
287
|
avatarUrl: u?.image_url,
|
|
288
288
|
points: u?.points || 0,
|
|
289
289
|
slug: u?.hash_id
|
|
@@ -297,7 +297,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
297
297
|
onClick: z,
|
|
298
298
|
"data-testid": "argument-input",
|
|
299
299
|
className: x(n.textEditorBox, {
|
|
300
|
-
[n.replyTextEditorBox]:
|
|
300
|
+
[n.replyTextEditorBox]: o
|
|
301
301
|
}),
|
|
302
302
|
children: [
|
|
303
303
|
/* @__PURE__ */ s(
|
|
@@ -310,7 +310,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
310
310
|
Ve(e);
|
|
311
311
|
},
|
|
312
312
|
placeholder: ve,
|
|
313
|
-
"aria-label":
|
|
313
|
+
"aria-label": r.formatMessage({
|
|
314
314
|
id: "input.argument_input.aria_label",
|
|
315
315
|
defaultMessage: "Message input field"
|
|
316
316
|
}),
|
|
@@ -323,7 +323,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
323
323
|
disabled: O || g || ce,
|
|
324
324
|
maxLength: g ? !1 : v?.actions?.argumentMaxLength,
|
|
325
325
|
disableRichText: v?.actions?.disableRichText || g,
|
|
326
|
-
shortBar:
|
|
326
|
+
shortBar: o,
|
|
327
327
|
hideSubmit: g,
|
|
328
328
|
allowedDomains: v?.allowed_sources,
|
|
329
329
|
active: P,
|