@logora/debate 0.4.17 → 0.4.18
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,321 +1,309 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import { ReplyFooter as
|
|
7
|
-
import { useRichContent as
|
|
8
|
-
import { useAuth as
|
|
9
|
-
import { useConfig as
|
|
10
|
-
import { useList as
|
|
11
|
-
import { useTranslatedContent as
|
|
12
|
-
import { SourceListItem as
|
|
13
|
-
import { HashScroll as
|
|
14
|
-
import { ContentHeader as
|
|
15
|
-
import { Icon as
|
|
16
|
-
import { ReadMore as
|
|
17
|
-
import { TranslationButton as
|
|
18
|
-
import { ContentFooter as
|
|
19
|
-
import { VoteButton as
|
|
20
|
-
import { VotePaginatedList as
|
|
21
|
-
import { UserContentSkeleton as
|
|
22
|
-
import { Button as
|
|
23
|
-
const
|
|
1
|
+
import { jsx as o, jsxs as l, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import B from "classnames";
|
|
3
|
+
import { useState as y, useEffect as le, useCallback as ne, Suspense as de, lazy as ce } from "react";
|
|
4
|
+
import { useIntl as pe } from "react-intl";
|
|
5
|
+
import s from "./Argument.module.scss.js";
|
|
6
|
+
import { ReplyFooter as me } from "./ReplyFooter.js";
|
|
7
|
+
import { useRichContent as ue } from "./useRichContent.js";
|
|
8
|
+
import { useAuth as he } from "../../auth/use_auth/useAuth.js";
|
|
9
|
+
import { useConfig as fe } from "../../data/config_provider/useConfig.js";
|
|
10
|
+
import { useList as ye } from "../../list/list_provider/useList.js";
|
|
11
|
+
import { useTranslatedContent as D } from "../../translation/translated_content/useTranslatedContent.js";
|
|
12
|
+
import { SourceListItem as _e } from "../../source/source_list_item/SourceListItem.js";
|
|
13
|
+
import { HashScroll as ge } from "../../tools/hash_scroll/HashScroll.js";
|
|
14
|
+
import { ContentHeader as be } from "../../user_content/content_header/ContentHeader.js";
|
|
15
|
+
import { Icon as E } from "../../icons/icon/Icon.js";
|
|
16
|
+
import { ReadMore as Me } from "../../text/read_more/ReadMore.js";
|
|
17
|
+
import { TranslationButton as ve } from "../../translation/translation_button/TranslationButton.js";
|
|
18
|
+
import { ContentFooter as Ie } from "../../user_content/content_footer/ContentFooter.js";
|
|
19
|
+
import { VoteButton as Ce } from "../../vote/vote_button/VoteButton.js";
|
|
20
|
+
import { VotePaginatedList as Se } from "../../list/paginated_list/VotePaginatedList.js";
|
|
21
|
+
import { UserContentSkeleton as Re } from "../../skeleton/user_content_skeleton/UserContentSkeleton.js";
|
|
22
|
+
import { Button as Te } from "../../action/button/Button.js";
|
|
23
|
+
const Ne = ce(() => import("../../input/argument_input/index.js").then((e) => ({ default: e.ArgumentInput }))), F = (e) => e?.replace(/ /g, " "), we = ({
|
|
24
24
|
argument: e,
|
|
25
|
-
argumentReplies:
|
|
26
|
-
nestingLevel:
|
|
27
|
-
maxNestingLevel:
|
|
28
|
-
groupType:
|
|
29
|
-
groupName:
|
|
30
|
-
positions:
|
|
31
|
-
disableLinks:
|
|
25
|
+
argumentReplies: n,
|
|
26
|
+
nestingLevel: _ = 0,
|
|
27
|
+
maxNestingLevel: S = 2,
|
|
28
|
+
groupType: R,
|
|
29
|
+
groupName: T,
|
|
30
|
+
positions: g = [],
|
|
31
|
+
disableLinks: P = !1,
|
|
32
32
|
parentArgument: c,
|
|
33
|
-
flashParent:
|
|
34
|
-
expandable:
|
|
35
|
-
disabled:
|
|
36
|
-
hideFooter:
|
|
37
|
-
hideReplies:
|
|
38
|
-
vote:
|
|
39
|
-
fixedContentHeight:
|
|
40
|
-
enableEdition:
|
|
41
|
-
enableDeletion:
|
|
42
|
-
deleteListId:
|
|
43
|
-
showModerationFeedback:
|
|
44
|
-
lineCount:
|
|
45
|
-
replyRedirectUrl:
|
|
46
|
-
hideContent:
|
|
33
|
+
flashParent: j,
|
|
34
|
+
expandable: G,
|
|
35
|
+
disabled: b = !1,
|
|
36
|
+
hideFooter: N = !1,
|
|
37
|
+
hideReplies: w,
|
|
38
|
+
vote: H,
|
|
39
|
+
fixedContentHeight: V = !1,
|
|
40
|
+
enableEdition: z = !0,
|
|
41
|
+
enableDeletion: O = !0,
|
|
42
|
+
deleteListId: Y,
|
|
43
|
+
showModerationFeedback: q,
|
|
44
|
+
lineCount: J = 5,
|
|
45
|
+
replyRedirectUrl: K,
|
|
46
|
+
hideContent: Q = !1
|
|
47
47
|
}) => {
|
|
48
|
-
const
|
|
48
|
+
const a = pe(), { isLoggedIn: W, currentUser: p } = he(), A = p?.moderation_status === "banned", r = fe(), X = ye(), [m, M] = y(!1), [Z, x] = y(!1), [ee, te] = y(!1), L = ue(e), [u, v] = y(), h = D(
|
|
49
49
|
e.content,
|
|
50
50
|
e.language,
|
|
51
51
|
"content",
|
|
52
52
|
e.translation_entries
|
|
53
|
-
),
|
|
53
|
+
), oe = D(
|
|
54
54
|
e.position?.name,
|
|
55
55
|
e.position?.language,
|
|
56
56
|
"name",
|
|
57
57
|
e.position?.translation_entries
|
|
58
|
-
),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
let D = !1;
|
|
67
|
-
const pe = a.map((R) => {
|
|
68
|
-
const F = r.find((ue) => ue.id === R.id);
|
|
69
|
-
return F ? (D = !0, { ...R, ...F }) : R;
|
|
70
|
-
});
|
|
71
|
-
return D ? pe : a;
|
|
72
|
-
});
|
|
73
|
-
}, [I.updateElements, e.id]);
|
|
74
|
-
const le = (t) => {
|
|
75
|
-
if (v === t) {
|
|
76
|
-
const a = document.getElementById(t);
|
|
77
|
-
a && a.scrollIntoView({ behavior: "smooth" }), U(!0);
|
|
58
|
+
), I = `argument_${e.id}`, C = e.position && g?.map((t) => t.id).indexOf(e.position.id) + 1;
|
|
59
|
+
le(() => {
|
|
60
|
+
n !== void 0 && ae();
|
|
61
|
+
}, [n]);
|
|
62
|
+
const se = (t) => {
|
|
63
|
+
if (I === t) {
|
|
64
|
+
const d = document.getElementById(t);
|
|
65
|
+
d && d.scrollIntoView({ behavior: "smooth" }), x(!0);
|
|
78
66
|
}
|
|
67
|
+
}, U = () => {
|
|
68
|
+
te((t) => !t);
|
|
79
69
|
}, k = () => {
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
}, ne = (t) => {
|
|
84
|
-
if (!m?.find((r) => r.id === t.id))
|
|
70
|
+
M((t) => !t), v([]);
|
|
71
|
+
}, re = (t) => {
|
|
72
|
+
if (!u?.find((i) => i.id === t.id))
|
|
85
73
|
return t;
|
|
86
|
-
},
|
|
87
|
-
|
|
74
|
+
}, ie = ne((t, i) => /* @__PURE__ */ o(
|
|
75
|
+
_e,
|
|
88
76
|
{
|
|
89
77
|
publisher: t.publisher,
|
|
90
78
|
url: t.source_url,
|
|
91
79
|
title: t.title,
|
|
92
|
-
index:
|
|
80
|
+
index: i
|
|
93
81
|
},
|
|
94
|
-
|
|
95
|
-
), []),
|
|
96
|
-
if (
|
|
97
|
-
const t =
|
|
98
|
-
(
|
|
82
|
+
i
|
|
83
|
+
), []), ae = () => {
|
|
84
|
+
if (n && Array.isArray(n)) {
|
|
85
|
+
const t = n.filter(
|
|
86
|
+
(i) => i.reply_to_id === e.id
|
|
99
87
|
);
|
|
100
|
-
t.length > 0 && (
|
|
88
|
+
t.length > 0 && (v(t), M(!0));
|
|
101
89
|
}
|
|
102
|
-
},
|
|
103
|
-
|
|
90
|
+
}, $ = (t = null) => /* @__PURE__ */ o(
|
|
91
|
+
Ae,
|
|
104
92
|
{
|
|
105
93
|
...t ? { argument: t } : {},
|
|
106
|
-
nestingLevel:
|
|
107
|
-
maxNestingLevel:
|
|
108
|
-
disabled:
|
|
109
|
-
groupName:
|
|
110
|
-
groupType:
|
|
111
|
-
positions:
|
|
112
|
-
argumentReplies:
|
|
94
|
+
nestingLevel: _ + 1,
|
|
95
|
+
maxNestingLevel: S,
|
|
96
|
+
disabled: b,
|
|
97
|
+
groupName: T,
|
|
98
|
+
groupType: R,
|
|
99
|
+
positions: g,
|
|
100
|
+
argumentReplies: n,
|
|
113
101
|
parentArgument: e,
|
|
114
|
-
flashParent: (
|
|
102
|
+
flashParent: (i) => se(`argument_${i}`)
|
|
115
103
|
}
|
|
116
104
|
);
|
|
117
|
-
return /* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ l(ge, { elementId: I, onScroll: () => x(!0), children: [
|
|
106
|
+
/* @__PURE__ */ l(
|
|
119
107
|
"div",
|
|
120
108
|
{
|
|
121
|
-
className:
|
|
122
|
-
|
|
109
|
+
className: B(
|
|
110
|
+
s.argument,
|
|
123
111
|
{
|
|
124
|
-
[
|
|
125
|
-
[
|
|
112
|
+
[s.flash]: Z,
|
|
113
|
+
[s.argumentReply]: e.is_reply === !0
|
|
126
114
|
},
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
s[`level-${_}`],
|
|
116
|
+
s[`position-${!(e.author.role === "editor" || e.author.role === "moderator") && C}`]
|
|
129
117
|
),
|
|
130
|
-
id:
|
|
118
|
+
id: I,
|
|
131
119
|
children: [
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
|
|
120
|
+
/* @__PURE__ */ o(
|
|
121
|
+
be,
|
|
134
122
|
{
|
|
135
123
|
selectedContent: e.is_selected,
|
|
136
124
|
author: e.author,
|
|
137
|
-
tag: (e.author.role === "editor" || e.author.role === "moderator") && e.is_reply ? null :
|
|
125
|
+
tag: (e.author.role === "editor" || e.author.role === "moderator") && e.is_reply ? null : oe.translatedContent,
|
|
138
126
|
date: e.created_at,
|
|
139
|
-
tagClassName:
|
|
140
|
-
disableLinks:
|
|
127
|
+
tagClassName: s[`headerPosition-${C}`],
|
|
128
|
+
disableLinks: P,
|
|
141
129
|
isDeleted: e.is_deleted,
|
|
142
|
-
showModerationFeedback:
|
|
130
|
+
showModerationFeedback: q ?? (e.status === "rejected" && r.moderation?.showFeedback === !0),
|
|
143
131
|
moderationReason: e.moderation_entry?.moderation_reason,
|
|
144
132
|
moderationNotes: e.moderation_entry?.moderator_notes,
|
|
145
|
-
moderationPolicyUrl:
|
|
133
|
+
moderationPolicyUrl: r.provider?.userGuideUrl
|
|
146
134
|
}
|
|
147
135
|
),
|
|
148
|
-
e.is_deleted ? /* @__PURE__ */
|
|
136
|
+
e.is_deleted ? /* @__PURE__ */ o("div", { className: s.argumentDeletedBody, children: a.formatMessage({
|
|
149
137
|
id: "info.deleted_by_user",
|
|
150
138
|
defaultMessage: "Content deleted by the user"
|
|
151
|
-
}) }) :
|
|
139
|
+
}) }) : Q ? /* @__PURE__ */ o("div", { className: s.argumentDeletedBody, children: a.formatMessage({
|
|
152
140
|
id: "argument.argument.content_deleted",
|
|
153
141
|
defaultMessage: "This content has been removed."
|
|
154
|
-
}) }) : /* @__PURE__ */
|
|
155
|
-
/* @__PURE__ */
|
|
142
|
+
}) }) : /* @__PURE__ */ l(f, { children: [
|
|
143
|
+
/* @__PURE__ */ l(
|
|
156
144
|
"div",
|
|
157
145
|
{
|
|
158
|
-
className:
|
|
159
|
-
[
|
|
146
|
+
className: B(s.argumentBody, {
|
|
147
|
+
[s.fixedHeight]: r?.layout?.showAllArgumentInEmbed !== !0 ? V : !1
|
|
160
148
|
}),
|
|
161
149
|
children: [
|
|
162
|
-
e.is_reply && c && /* @__PURE__ */
|
|
150
|
+
e.is_reply && c && /* @__PURE__ */ l(
|
|
163
151
|
"div",
|
|
164
152
|
{
|
|
165
|
-
className:
|
|
166
|
-
onClick: () =>
|
|
153
|
+
className: s.replyTo,
|
|
154
|
+
onClick: () => j(c.id),
|
|
167
155
|
children: [
|
|
168
|
-
|
|
156
|
+
a.formatMessage({
|
|
169
157
|
id: "info.replying_to",
|
|
170
158
|
defaultMessage: "Replying to"
|
|
171
159
|
}),
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
c.is_deleted ?
|
|
160
|
+
/* @__PURE__ */ l("span", { className: s.replyingTo, children: [
|
|
161
|
+
c.is_deleted ? a.formatMessage({
|
|
174
162
|
id: "info.deleted",
|
|
175
163
|
defaultMessage: "Deleted"
|
|
176
164
|
}) : c.author.full_name,
|
|
177
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ o(E, { name: "chat", height: 16 })
|
|
178
166
|
] })
|
|
179
167
|
]
|
|
180
168
|
}
|
|
181
169
|
),
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
-
|
|
170
|
+
/* @__PURE__ */ o(
|
|
171
|
+
Me,
|
|
184
172
|
{
|
|
185
|
-
content: /* @__PURE__ */
|
|
186
|
-
e.is_edited && /* @__PURE__ */
|
|
173
|
+
content: /* @__PURE__ */ l(f, { children: [
|
|
174
|
+
e.is_edited && /* @__PURE__ */ o("div", { className: s.edited, children: a.formatMessage({
|
|
187
175
|
id: "argument.argument.updated",
|
|
188
176
|
defaultMessage: "Updated argument"
|
|
189
177
|
}) }),
|
|
190
|
-
|
|
178
|
+
L && !h.isTranslated ? /* @__PURE__ */ o(
|
|
191
179
|
"div",
|
|
192
180
|
{
|
|
193
|
-
className:
|
|
194
|
-
dangerouslySetInnerHTML: { __html:
|
|
181
|
+
className: s.argumentContent,
|
|
182
|
+
dangerouslySetInnerHTML: { __html: F(L) }
|
|
195
183
|
}
|
|
196
|
-
) : /* @__PURE__ */
|
|
197
|
-
|
|
198
|
-
|
|
184
|
+
) : /* @__PURE__ */ o("div", { className: s.argumentContent, children: F(h.translatedContent) }),
|
|
185
|
+
h.isTranslated && /* @__PURE__ */ o(
|
|
186
|
+
ve,
|
|
199
187
|
{
|
|
200
188
|
language: e.language,
|
|
201
|
-
callback: () =>
|
|
189
|
+
callback: () => h.toggleContent()
|
|
202
190
|
}
|
|
203
191
|
)
|
|
204
192
|
] }),
|
|
205
|
-
lineCount:
|
|
206
|
-
readMoreText:
|
|
193
|
+
lineCount: r?.layout?.showAllArgumentInEmbed !== !0 ? J : void 0,
|
|
194
|
+
readMoreText: a.formatMessage({
|
|
207
195
|
id: "action.read_more",
|
|
208
196
|
defaultMessage: "Read more"
|
|
209
197
|
}),
|
|
210
|
-
readLessText:
|
|
198
|
+
readLessText: a.formatMessage({
|
|
211
199
|
id: "action.read_less",
|
|
212
200
|
defaultMessage: "Read less"
|
|
213
201
|
}),
|
|
214
|
-
expandable:
|
|
215
|
-
readMoreClassName: e.is_reply ?
|
|
202
|
+
expandable: r?.layout?.showAllArgumentInEmbed !== !0 ? G : !1,
|
|
203
|
+
readMoreClassName: e.is_reply ? s.replyStyle : s.argumentStyle
|
|
216
204
|
}
|
|
217
205
|
)
|
|
218
206
|
]
|
|
219
207
|
}
|
|
220
208
|
),
|
|
221
|
-
e.sources?.length > 0 && /* @__PURE__ */
|
|
209
|
+
e.sources?.length > 0 && /* @__PURE__ */ o("div", { className: s.argumentSourcesList, children: e.sources.map(ie) })
|
|
222
210
|
] }),
|
|
223
|
-
!
|
|
224
|
-
|
|
211
|
+
!N && !e.is_deleted && /* @__PURE__ */ o(
|
|
212
|
+
Ie,
|
|
225
213
|
{
|
|
226
214
|
resource: e,
|
|
227
|
-
disabled:
|
|
215
|
+
disabled: b || e.status === "rejected" || !W && r?.actions?.disableInputForVisitor === !0 || A,
|
|
228
216
|
reportType: "Message",
|
|
229
|
-
softDelete:
|
|
217
|
+
softDelete: r.actions?.softDelete,
|
|
230
218
|
deleteType: "messages",
|
|
231
|
-
deleteListId:
|
|
232
|
-
enableReply:
|
|
233
|
-
handleReplyTo:
|
|
234
|
-
replyRedirectUrl:
|
|
219
|
+
deleteListId: Y,
|
|
220
|
+
enableReply: _ <= S || p.role === "editor" || p.role === "moderator",
|
|
221
|
+
handleReplyTo: U,
|
|
222
|
+
replyRedirectUrl: K,
|
|
235
223
|
shareUrl: `https://app.logora.fr/share/a/${e.id}`,
|
|
236
|
-
shareTitle:
|
|
224
|
+
shareTitle: a.formatMessage({
|
|
237
225
|
id: "share.argument.title",
|
|
238
226
|
defaultMessage: "Share a debate"
|
|
239
227
|
}),
|
|
240
|
-
shareText:
|
|
228
|
+
shareText: a.formatMessage({
|
|
241
229
|
id: "share.argument.text",
|
|
242
230
|
defaultMessage: "This argument may interest you"
|
|
243
231
|
}),
|
|
244
|
-
shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${
|
|
245
|
-
showShareCode:
|
|
232
|
+
shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${r.shortname}&id=${e.id}&resource=argument" frameborder="0" width="100%" height="275px" scrolling="no"></iframe>`,
|
|
233
|
+
showShareCode: r?.actions?.hideCodeShare !== !0,
|
|
246
234
|
showShareText: !0,
|
|
247
|
-
showShareButton:
|
|
235
|
+
showShareButton: r?.actions?.hideShareButton !== !0,
|
|
248
236
|
enableReport: !(e.score === 100 && e.manual_score),
|
|
249
|
-
enableEdition:
|
|
250
|
-
enableDeletion:
|
|
251
|
-
children: /* @__PURE__ */
|
|
252
|
-
|
|
237
|
+
enableEdition: z,
|
|
238
|
+
enableDeletion: O,
|
|
239
|
+
children: /* @__PURE__ */ o(
|
|
240
|
+
Ce,
|
|
253
241
|
{
|
|
254
242
|
voteableType: "Message",
|
|
255
243
|
voteableId: e.id,
|
|
256
244
|
totalUpvote: e.upvotes,
|
|
257
245
|
totalDownvote: 0,
|
|
258
|
-
activeClassName:
|
|
259
|
-
disabled: e.status === "rejected" || p?.id === e?.author?.id ||
|
|
246
|
+
activeClassName: s[`voteButtonPosition-${C}`],
|
|
247
|
+
disabled: e.status === "rejected" || p?.id === e?.author?.id || A
|
|
260
248
|
}
|
|
261
249
|
)
|
|
262
250
|
}
|
|
263
251
|
),
|
|
264
|
-
!
|
|
265
|
-
|
|
252
|
+
!N && !w && /* @__PURE__ */ o(
|
|
253
|
+
me,
|
|
266
254
|
{
|
|
267
255
|
numberReplies: e.number_replies,
|
|
268
256
|
repliesAuthors: e.replies_authors,
|
|
269
|
-
expandReplies:
|
|
270
|
-
onToggleReplies:
|
|
257
|
+
expandReplies: m,
|
|
258
|
+
onToggleReplies: k,
|
|
271
259
|
isReply: e.is_reply
|
|
272
260
|
}
|
|
273
261
|
)
|
|
274
262
|
]
|
|
275
263
|
}
|
|
276
264
|
),
|
|
277
|
-
!
|
|
278
|
-
|
|
279
|
-
|
|
265
|
+
!w && /* @__PURE__ */ l(f, { children: [
|
|
266
|
+
ee && /* @__PURE__ */ o(de, { fallback: null, children: /* @__PURE__ */ o(
|
|
267
|
+
Ne,
|
|
280
268
|
{
|
|
281
269
|
groupId: e.group_id,
|
|
282
|
-
groupType:
|
|
283
|
-
groupName:
|
|
284
|
-
positions:
|
|
270
|
+
groupType: R,
|
|
271
|
+
groupName: T,
|
|
272
|
+
positions: g,
|
|
285
273
|
parentId: e.id,
|
|
286
|
-
positionId:
|
|
287
|
-
disabled:
|
|
288
|
-
hideSourceAction:
|
|
274
|
+
positionId: H?.position_id,
|
|
275
|
+
disabled: b,
|
|
276
|
+
hideSourceAction: r?.actions?.disableUserSources || !1,
|
|
289
277
|
onSubmit: (t) => {
|
|
290
|
-
const
|
|
291
|
-
|
|
278
|
+
const i = `argument_${e.id}_reply_list`;
|
|
279
|
+
X.add(i, [t]), U(), M(!0);
|
|
292
280
|
},
|
|
293
281
|
onUpdate: (t) => {
|
|
294
|
-
|
|
295
|
-
(
|
|
296
|
-
(
|
|
282
|
+
v(
|
|
283
|
+
(i) => i?.map(
|
|
284
|
+
(d) => d.id === t.id ? { ...d, ...t } : d
|
|
297
285
|
)
|
|
298
286
|
);
|
|
299
287
|
},
|
|
300
288
|
isReply: !0,
|
|
301
289
|
autoFocus: !0,
|
|
302
290
|
avatarSize: 40,
|
|
303
|
-
placeholder:
|
|
291
|
+
placeholder: a.formatMessage({
|
|
304
292
|
id: "input.reply_input.your_answer",
|
|
305
293
|
defaultMessage: "Your answer"
|
|
306
294
|
}),
|
|
307
|
-
userGuideUrl:
|
|
308
|
-
hideUserGuideLink:
|
|
295
|
+
userGuideUrl: r?.provider?.userGuideUrl,
|
|
296
|
+
hideUserGuideLink: r?.provider?.hideUserGuideLink
|
|
309
297
|
},
|
|
310
298
|
`Reply${e.id}`
|
|
311
299
|
) }),
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
300
|
+
u?.length > 0 && m && /* @__PURE__ */ o("div", { className: s.repliesList, children: u.map((t) => $(t)) }),
|
|
301
|
+
m && /* @__PURE__ */ o("div", { className: s.repliesList, children: /* @__PURE__ */ o(
|
|
302
|
+
Se,
|
|
315
303
|
{
|
|
316
304
|
voteableType: "Message",
|
|
317
305
|
currentListId: `argument_${e.id}_reply_list`,
|
|
318
|
-
loadingComponent: /* @__PURE__ */
|
|
306
|
+
loadingComponent: /* @__PURE__ */ o(Re, {}),
|
|
319
307
|
resource: "messages",
|
|
320
308
|
sort: "+created_at",
|
|
321
309
|
filters: {
|
|
@@ -326,18 +314,18 @@ const Ue = fe(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
326
314
|
perPage: 5,
|
|
327
315
|
display: "column",
|
|
328
316
|
resourcePropName: "argument",
|
|
329
|
-
emptyListComponent: /* @__PURE__ */
|
|
330
|
-
transformData: (t) =>
|
|
331
|
-
children:
|
|
317
|
+
emptyListComponent: /* @__PURE__ */ o(f, {}),
|
|
318
|
+
transformData: (t) => re(t),
|
|
319
|
+
children: $(e)
|
|
332
320
|
}
|
|
333
321
|
) }),
|
|
334
|
-
|
|
335
|
-
|
|
322
|
+
u?.length > 0 && !m && /* @__PURE__ */ o("div", { className: s.repliesList, children: e.number_replies > 1 && /* @__PURE__ */ o("div", { className: s.readMoreLink, children: /* @__PURE__ */ o(
|
|
323
|
+
Te,
|
|
336
324
|
{
|
|
337
325
|
role: "link",
|
|
338
|
-
rightIcon: /* @__PURE__ */
|
|
339
|
-
handleClick:
|
|
340
|
-
children:
|
|
326
|
+
rightIcon: /* @__PURE__ */ o(E, { name: "lightArrow", height: 10, width: 10 }),
|
|
327
|
+
handleClick: k,
|
|
328
|
+
children: a.formatMessage({
|
|
341
329
|
id: "argument.argument.see_more",
|
|
342
330
|
defaultMessage: "See more"
|
|
343
331
|
})
|
|
@@ -345,8 +333,8 @@ const Ue = fe(() => import("../../input/argument_input/index.js").then((e) => ({
|
|
|
345
333
|
) }) })
|
|
346
334
|
] })
|
|
347
335
|
] });
|
|
348
|
-
},
|
|
336
|
+
}, Ae = we;
|
|
349
337
|
export {
|
|
350
|
-
|
|
351
|
-
|
|
338
|
+
we as Argument,
|
|
339
|
+
Ae as ArgumentContainer
|
|
352
340
|
};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { lexicalToHtml as
|
|
1
|
+
import { useState as r, useEffect as i } from "react";
|
|
2
|
+
import { lexicalToHtml as s } from "../../input/text_editor/lexicalToHtml.js";
|
|
3
3
|
const f = (t) => {
|
|
4
|
-
const [
|
|
5
|
-
return
|
|
4
|
+
const [e, n] = r(null);
|
|
5
|
+
return i(() => {
|
|
6
6
|
if (t.rich_content && t.is_deleted != !0) {
|
|
7
7
|
const o = JSON.parse(t.rich_content);
|
|
8
8
|
if (o.hasOwnProperty("root")) {
|
|
9
|
-
const c =
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
e(null);
|
|
15
|
-
}, [t.rich_content, t.is_deleted]), n;
|
|
9
|
+
const c = s(o);
|
|
10
|
+
n(c);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}, [t.rich_content]), e;
|
|
16
14
|
};
|
|
17
15
|
export {
|
|
18
16
|
f as useRichContent
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as C, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import Ye from "@rooks/use-sessionstorage-state";
|
|
3
3
|
import { useRef as ke, useState as c, useEffect as p, Suspense as Re, lazy as je } from "react";
|
|
4
4
|
import { useIntl as ze, FormattedMessage as he } from "react-intl";
|
|
@@ -35,7 +35,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
35
35
|
onUpdate: G,
|
|
36
36
|
parentId: M,
|
|
37
37
|
placeholder: ve,
|
|
38
|
-
positionId:
|
|
38
|
+
positionId: w,
|
|
39
39
|
focusOnInit: be = !1,
|
|
40
40
|
activeOnInit: P = !1,
|
|
41
41
|
userGuideUrl: H,
|
|
@@ -51,24 +51,24 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
51
51
|
inputContent: B,
|
|
52
52
|
setInputContent: te,
|
|
53
53
|
setInputRichContent: Ie
|
|
54
|
-
} = He(), { isLoggedIn:
|
|
54
|
+
} = He(), { isLoggedIn: S, currentUser: u } = Qe(), { errors: E, validate: $ } = Xe(), { isMobile: m } = Ze(), xe = Oe(), ne = ke(null), [V, q] = c([]), [D, U] = c(""), [ae, W] = c(null), [d, b] = c(null), [se, ie] = c(null), [oe, re] = c(!1), [I, ue] = c(!1), [A, de] = c({}), [Ne, Y] = c(!1), [f, ye] = Ye(
|
|
55
55
|
"userSide",
|
|
56
56
|
{}
|
|
57
57
|
), [g, Te] = c(
|
|
58
|
-
!
|
|
58
|
+
!S && v?.actions?.disableInputForVisitor
|
|
59
59
|
), k = et(), { showModal: Le } = tt(), { toast: R } = nt() || {}, le = new URLSearchParams(
|
|
60
60
|
typeof window < "u" ? window.location.search : xe.search
|
|
61
61
|
);
|
|
62
62
|
p(() => {
|
|
63
63
|
Te(
|
|
64
|
-
!
|
|
64
|
+
!S && v?.actions?.disableInputForVisitor
|
|
65
65
|
);
|
|
66
|
-
}, [
|
|
66
|
+
}, [S, v]);
|
|
67
67
|
const j = u?.role === "editor" || u?.role === "moderator", ce = u?.moderation_status === "banned";
|
|
68
68
|
p(() => {
|
|
69
69
|
let e = null;
|
|
70
|
-
typeof window < "u" && (e = le.get("positionId")),
|
|
71
|
-
}, [
|
|
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);
|
|
71
|
+
}, [w]), p(() => {
|
|
72
72
|
Q && Y(!0);
|
|
73
73
|
}, [Q]), p(() => {
|
|
74
74
|
P && (z(), Y(!0), L());
|
|
@@ -108,7 +108,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
108
108
|
) })
|
|
109
109
|
);
|
|
110
110
|
}, Ee = () => {
|
|
111
|
-
|
|
111
|
+
S ? se ? qe() : !a || a?.length === 0 || !y?.find((e) => e?.id === d) && d || j && r ? ge(r && j && a[0]?.id) : Be() : k({ loginAction: "argument" });
|
|
112
112
|
}, $e = (e, t) => {
|
|
113
113
|
g ? k({ loginAction: "argument" }) : (U(e), W(t), $({ content: e }, [{ content: ["url", null] }]));
|
|
114
114
|
}, Ve = (e) => {
|
|
@@ -190,12 +190,12 @@ 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 (
|
|
194
|
-
const h =
|
|
193
|
+
if (A?.is_reply || r) {
|
|
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}`);
|
|
197
|
-
if (!
|
|
198
|
-
const h = `argumentList${
|
|
197
|
+
if (!A?.is_reply && A?.position?.id != l.position?.id && !m) {
|
|
198
|
+
const h = `argumentList${A.position.id}`, F = `argumentList${l.position.id}`;
|
|
199
199
|
T.remove(h, [l]), T.add(F, [l]);
|
|
200
200
|
} else
|
|
201
201
|
T.update(i, [l]);
|
|
@@ -227,7 +227,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
227
227
|
{ position: e.name }
|
|
228
228
|
);
|
|
229
229
|
};
|
|
230
|
-
return /* @__PURE__ */
|
|
230
|
+
return /* @__PURE__ */ C("div", { className: n.inputContainer, children: [
|
|
231
231
|
O && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ce ? o.formatMessage({
|
|
232
232
|
id: "input.argument_input.user_banned",
|
|
233
233
|
defaultMessage: "You are banned from the debate space."
|
|
@@ -242,8 +242,8 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
242
242
|
[n.flash]: oe,
|
|
243
243
|
[n.replyInputContainer]: r
|
|
244
244
|
}),
|
|
245
|
-
children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref: ne, children: /* @__PURE__ */
|
|
246
|
-
a.length > 0 &&
|
|
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 && (!r || !j) && /* @__PURE__ */ C("div", { className: n.userPosition, children: [
|
|
247
247
|
/* @__PURE__ */ s("div", { children: o.formatMessage({
|
|
248
248
|
id: "input.position",
|
|
249
249
|
defaultMessage: "Your position"
|
|
@@ -258,7 +258,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
258
258
|
}
|
|
259
259
|
)
|
|
260
260
|
] }),
|
|
261
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ C(
|
|
262
262
|
"div",
|
|
263
263
|
{
|
|
264
264
|
className: x(n.argumentTextInputBox, {
|
|
@@ -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 &&
|
|
274
|
+
[n.argumentAuthorContainerActivated]: !m && I || r
|
|
275
275
|
}),
|
|
276
|
-
children: !m &&
|
|
276
|
+
children: !m && I || r ? /* @__PURE__ */ s(
|
|
277
277
|
st,
|
|
278
278
|
{
|
|
279
279
|
avatarUrl: u.image_url,
|
|
@@ -291,7 +291,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
291
291
|
)
|
|
292
292
|
}
|
|
293
293
|
),
|
|
294
|
-
/* @__PURE__ */
|
|
294
|
+
/* @__PURE__ */ C(
|
|
295
295
|
"div",
|
|
296
296
|
{
|
|
297
297
|
onClick: z,
|
|
@@ -319,7 +319,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
319
319
|
hideSourceAction: Me || g,
|
|
320
320
|
uid: M ? `Reply${_}_${M}` : `Argument${_}`,
|
|
321
321
|
onActivation: z,
|
|
322
|
-
showStylesControls:
|
|
322
|
+
showStylesControls: I,
|
|
323
323
|
disabled: O || g || ce,
|
|
324
324
|
maxLength: g ? !1 : v?.actions?.argumentMaxLength,
|
|
325
325
|
disableRichText: v?.actions?.disableRichText || g,
|
|
@@ -333,9 +333,9 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
333
333
|
}
|
|
334
334
|
),
|
|
335
335
|
E?.content && /* @__PURE__ */ s("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ s("div", { children: e }, t)) }),
|
|
336
|
-
|
|
336
|
+
I && y?.find(
|
|
337
337
|
(e) => e.id === d
|
|
338
|
-
) && /* @__PURE__ */
|
|
338
|
+
) && /* @__PURE__ */ C(
|
|
339
339
|
"div",
|
|
340
340
|
{
|
|
341
341
|
className: x(
|
|
@@ -356,7 +356,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
356
356
|
]
|
|
357
357
|
}
|
|
358
358
|
),
|
|
359
|
-
|
|
359
|
+
I && H && !Ae && /* @__PURE__ */ s("div", { className: n.guideMessage, children: /* @__PURE__ */ s(
|
|
360
360
|
he,
|
|
361
361
|
{
|
|
362
362
|
id: "alert.guide_message",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as U, jsx as g, Fragment as Qe } from "react/jsx-runtime";
|
|
2
|
+
import Ue from "@rooks/use-previous";
|
|
3
|
+
import $e from "classnames";
|
|
4
4
|
import We, { useState as f, useEffect as p } from "react";
|
|
5
5
|
import { useIntl as ze } from "react-intl";
|
|
6
6
|
import { useLocation as Ge } from "react-router";
|
|
@@ -18,7 +18,7 @@ const ct = ({
|
|
|
18
18
|
sortOptions: o,
|
|
19
19
|
sort: M,
|
|
20
20
|
filters: m,
|
|
21
|
-
tagList:
|
|
21
|
+
tagList: ne,
|
|
22
22
|
pinnedTagList: ae,
|
|
23
23
|
currentPage: R,
|
|
24
24
|
resource: A,
|
|
@@ -31,8 +31,8 @@ const ct = ({
|
|
|
31
31
|
queryParam: de = "query",
|
|
32
32
|
tagParam: re = "tag_id",
|
|
33
33
|
totalHeaderParam: D = "total",
|
|
34
|
-
onUpdateTotal:
|
|
35
|
-
onElementsLoad:
|
|
34
|
+
onUpdateTotal: $,
|
|
35
|
+
onElementsLoad: b,
|
|
36
36
|
transformData: W,
|
|
37
37
|
uniqueIdKey: S = "id",
|
|
38
38
|
children: fe,
|
|
@@ -55,44 +55,44 @@ const ct = ({
|
|
|
55
55
|
withUrlParams: Ne = !1,
|
|
56
56
|
onLoadNewPage: Z
|
|
57
57
|
}) => {
|
|
58
|
-
const J = ze(), t = Ve(), H = Xe(), I = Ge(), { isMobile: K, isTablet: Me, isDesktop: L } = Ye(), [
|
|
58
|
+
const J = ze(), t = Ve(), H = Xe(), I = Ge(), { isMobile: K, isTablet: Me, isDesktop: L } = Ye(), [k, E] = f(!1), [Re, be] = f(!1), [d, y] = Ze(a, []), [O, ke] = f(
|
|
59
59
|
d?.length || 0
|
|
60
|
-
), [h, j] = f(R || 1), [w, B] = f(N || null), [
|
|
60
|
+
), [h, j] = f(R || 1), [w, B] = f(N || null), [C, q] = f(null), [Ce, ee] = f(null), c = new URLSearchParams(
|
|
61
61
|
typeof window < "u" ? window.location.search : I.search
|
|
62
|
-
),
|
|
62
|
+
), Te = () => o && o[0].type === "sort" && o[0].value || M || "", Fe = () => {
|
|
63
63
|
let e = {};
|
|
64
64
|
return o && o[0].type === "filter" && (e[o[0].name] = o[0].value), m && (e = Object.assign({}, e, m)), e;
|
|
65
|
-
}, [
|
|
66
|
-
R && R !== h && j(R), N !== void 0 && N !== w && B(N), M !== void 0 && M !==
|
|
65
|
+
}, [T, F] = f(Te()), [Q, _] = f(Fe()), te = Ue(m);
|
|
66
|
+
R && R !== h && j(R), N !== void 0 && N !== w && B(N), M !== void 0 && M !== T && F(M), te && JSON.stringify(m) !== JSON.stringify(te) && JSON.stringify(m) !== JSON.stringify(Q) && _(m), p(() => {
|
|
67
67
|
if (c.get("tagId") && q(Number.parseInt(c.get("tagId"))), c.get("search") && B(c.get("search")), c.get("sort")) {
|
|
68
|
-
|
|
68
|
+
F(c.get("sort"));
|
|
69
69
|
for (const e of c.values()) {
|
|
70
|
-
o?.map((
|
|
71
|
-
|
|
70
|
+
o?.map((s) => {
|
|
71
|
+
s.value === e && ee(s.name);
|
|
72
72
|
});
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
for (const e of c.keys()) {
|
|
77
|
-
o?.map((
|
|
78
|
-
|
|
77
|
+
o?.map((s) => {
|
|
78
|
+
s.name === e && (_({
|
|
79
79
|
...m,
|
|
80
|
-
[
|
|
81
|
-
}), ee(
|
|
80
|
+
[s.name]: s.value
|
|
81
|
+
}), ee(s.name));
|
|
82
82
|
});
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
85
|
}, [I.search]), p(() => {
|
|
86
|
-
A ? (j(1), y([]), E(!0),
|
|
86
|
+
A ? (j(1), y([]), E(!0), se(1)) : E(!1);
|
|
87
87
|
}, [
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
T,
|
|
89
|
+
Q,
|
|
90
90
|
w,
|
|
91
91
|
A,
|
|
92
|
-
|
|
92
|
+
C,
|
|
93
93
|
v
|
|
94
94
|
]), p(() => {
|
|
95
|
-
h > 1 && (E(!0),
|
|
95
|
+
h > 1 && (E(!0), se(h));
|
|
96
96
|
}, [h]), p(() => {
|
|
97
97
|
if (t.addElements && a in t.addElements && t.addElements[a].length > 0) {
|
|
98
98
|
Ae(t.addElements[a]);
|
|
@@ -103,15 +103,15 @@ const ct = ({
|
|
|
103
103
|
if (t.updateElements && a in t.updateElements) {
|
|
104
104
|
const e = t.updateElements[a];
|
|
105
105
|
if (e.length > 0) {
|
|
106
|
-
const
|
|
107
|
-
(i) => d.some((
|
|
106
|
+
const s = e.filter(
|
|
107
|
+
(i) => d.some((n) => n.id === i.id)
|
|
108
108
|
);
|
|
109
|
-
if (
|
|
110
|
-
De(
|
|
109
|
+
if (s.length > 0) {
|
|
110
|
+
De(s);
|
|
111
111
|
const i = e.filter(
|
|
112
112
|
(r) => !d.some((u) => u.id === r.id)
|
|
113
|
-
),
|
|
114
|
-
i.length > 0 ?
|
|
113
|
+
), n = { ...t.updateElements };
|
|
114
|
+
i.length > 0 ? n[a] = i : delete n[a], t.setUpdateElements(n);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -122,71 +122,71 @@ const ct = ({
|
|
|
122
122
|
delete e[a], t.setRemoveElements(e);
|
|
123
123
|
}
|
|
124
124
|
}, [t.removeElements, d]);
|
|
125
|
-
const
|
|
126
|
-
e.type === "filter" ? (
|
|
125
|
+
const _e = (e) => {
|
|
126
|
+
e.type === "filter" ? (F(""), _({
|
|
127
127
|
...m,
|
|
128
128
|
[e.name]: e.value
|
|
129
|
-
})) : (
|
|
129
|
+
})) : (F(e.value), _(m ? { ...m } : {}));
|
|
130
130
|
}, xe = () => {
|
|
131
131
|
typeof Z == "function" && Z() !== null || j(h + 1);
|
|
132
|
-
},
|
|
133
|
-
const
|
|
132
|
+
}, se = (e) => {
|
|
133
|
+
const s = le ? H.getListWithToken : H.getList;
|
|
134
134
|
if ((e - 1) * v <= (Y || O) || e === 1) {
|
|
135
135
|
const i = {
|
|
136
136
|
[oe]: e,
|
|
137
137
|
[ie]: v,
|
|
138
|
-
...
|
|
138
|
+
...T && !w && { [me]: T },
|
|
139
139
|
...w && { [de]: w },
|
|
140
140
|
...ye === !0 && { countless: !0 },
|
|
141
|
-
|
|
142
|
-
...
|
|
141
|
+
...Q,
|
|
142
|
+
...C && { [re]: C }
|
|
143
143
|
};
|
|
144
|
-
|
|
145
|
-
const r =
|
|
146
|
-
r && D in r && (
|
|
144
|
+
s(A, i).then((n) => {
|
|
145
|
+
const r = n.headers;
|
|
146
|
+
r && D in r && (ke(
|
|
147
147
|
Number.parseInt(r[D || "total"], 10)
|
|
148
|
-
),
|
|
149
|
-
let u =
|
|
150
|
-
|
|
151
|
-
}).catch((
|
|
152
|
-
console.error(
|
|
148
|
+
), $ && $(r[D || "total"]));
|
|
149
|
+
let u = n?.data?.data;
|
|
150
|
+
b && b(u), W && (u = u.filter(W)), t.addElements && a in t.addElements && t.addElements[a].length > 0 && (u = [...t.addElements[a], u]), Le(u), E(!1);
|
|
151
|
+
}).catch((n) => {
|
|
152
|
+
console.error(n), n?.response?.status !== 404 && be(!0), E(!1);
|
|
153
153
|
});
|
|
154
154
|
} else
|
|
155
155
|
E(!1);
|
|
156
156
|
}, Ae = (e) => {
|
|
157
157
|
y(
|
|
158
|
-
(
|
|
159
|
-
),
|
|
158
|
+
(s) => x([...e, ...s], S || "id")
|
|
159
|
+
), b && b(e);
|
|
160
160
|
}, De = (e) => {
|
|
161
|
-
y((
|
|
162
|
-
let i =
|
|
161
|
+
y((s) => {
|
|
162
|
+
let i = s;
|
|
163
163
|
return e.forEach(
|
|
164
|
-
(
|
|
165
|
-
(r) => r.id ===
|
|
164
|
+
(n) => i = i.map(
|
|
165
|
+
(r) => r.id === n.id ? n : r
|
|
166
166
|
)
|
|
167
167
|
), x(i, S || "id");
|
|
168
168
|
});
|
|
169
169
|
}, Je = (e) => {
|
|
170
|
-
const
|
|
171
|
-
(
|
|
170
|
+
const s = e.map((n) => n.id), i = d.filter(
|
|
171
|
+
(n) => s.indexOf(n.id) === -1
|
|
172
172
|
);
|
|
173
173
|
y(x(i, S || "id"));
|
|
174
174
|
}, Le = (e) => {
|
|
175
175
|
y(
|
|
176
|
-
(
|
|
176
|
+
(s) => x([...s, ...e], S || "id")
|
|
177
177
|
);
|
|
178
|
-
}, je = (e,
|
|
178
|
+
}, je = (e, s) => e !== void 0 ? /* @__PURE__ */ g(
|
|
179
179
|
"li",
|
|
180
180
|
{
|
|
181
181
|
className: l.paginatedListItem,
|
|
182
182
|
"data-testid": "list-item",
|
|
183
183
|
onClick: we,
|
|
184
184
|
children: /* @__PURE__ */ g(Ie, { hideMessage: !0, children: We.cloneElement(fe, {
|
|
185
|
-
index:
|
|
185
|
+
index: s,
|
|
186
186
|
[ce]: e
|
|
187
187
|
}) })
|
|
188
188
|
},
|
|
189
|
-
`${e[S || "id"]}_${e.updated_at ||
|
|
189
|
+
`${e[S || "id"]}_${e.updated_at || e.content}`
|
|
190
190
|
) : null, Be = (e) => z ? /* @__PURE__ */ g("li", { className: l.paginatedListItem, children: z }, e) : null;
|
|
191
191
|
if (Re)
|
|
192
192
|
throw new Error(
|
|
@@ -195,7 +195,7 @@ const ct = ({
|
|
|
195
195
|
defaultMessage: "Error when loading content."
|
|
196
196
|
})
|
|
197
197
|
);
|
|
198
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ U("div", { className: l.listContainer, children: [
|
|
199
199
|
/* @__PURE__ */ g(
|
|
200
200
|
Pe,
|
|
201
201
|
{
|
|
@@ -203,25 +203,25 @@ const ct = ({
|
|
|
203
203
|
subtitle: Ee,
|
|
204
204
|
showDebateConsultationSubtitle: he,
|
|
205
205
|
sortOptions: o,
|
|
206
|
-
defaultSelectOption:
|
|
206
|
+
defaultSelectOption: Ce,
|
|
207
207
|
searchBar: ue,
|
|
208
|
-
tagList:
|
|
208
|
+
tagList: ne,
|
|
209
209
|
pinnedTagList: ae,
|
|
210
|
-
activeTagId:
|
|
210
|
+
activeTagId: C,
|
|
211
211
|
onSearch: (e) => B(e),
|
|
212
|
-
onSortChange:
|
|
212
|
+
onSortChange: _e,
|
|
213
213
|
onTagChange: (e) => q(e),
|
|
214
214
|
withUrlParams: Ne
|
|
215
215
|
}
|
|
216
216
|
),
|
|
217
|
-
!
|
|
217
|
+
!k && d.length === 0 ? G ? /* @__PURE__ */ g("div", { className: l.emptyListElement, children: G }) : /* @__PURE__ */ g("div", { className: l.emptyList, children: P || J.formatMessage({
|
|
218
218
|
id: "info.emptyList",
|
|
219
219
|
defaultMessage: "No items for now."
|
|
220
|
-
}) }) : /* @__PURE__ */
|
|
221
|
-
/* @__PURE__ */
|
|
220
|
+
}) }) : /* @__PURE__ */ U(Qe, { children: [
|
|
221
|
+
/* @__PURE__ */ U(
|
|
222
222
|
"ul",
|
|
223
223
|
{
|
|
224
|
-
className:
|
|
224
|
+
className: $e(l.paginatedList, {
|
|
225
225
|
[l.paginatedListIsTablet]: !K && !L,
|
|
226
226
|
[l.centeredList]: V === "column",
|
|
227
227
|
[l.column]: V === "column",
|
|
@@ -235,11 +235,11 @@ const ct = ({
|
|
|
235
235
|
style: { gap: ve },
|
|
236
236
|
children: [
|
|
237
237
|
d.map(je),
|
|
238
|
-
|
|
238
|
+
k ? Array(v).fill().map((e, s) => s).map(Be) : null
|
|
239
239
|
]
|
|
240
240
|
}
|
|
241
241
|
),
|
|
242
|
-
!
|
|
242
|
+
!k && Se !== !1 && /* @__PURE__ */ g(
|
|
243
243
|
He,
|
|
244
244
|
{
|
|
245
245
|
buttonText: J.formatMessage({
|
|
@@ -250,7 +250,7 @@ const ct = ({
|
|
|
250
250
|
perPage: v,
|
|
251
251
|
totalElements: Y || O,
|
|
252
252
|
onLoad: xe,
|
|
253
|
-
isLoading:
|
|
253
|
+
isLoading: k,
|
|
254
254
|
hideLoader: !0,
|
|
255
255
|
"data-tid": "list_read_more"
|
|
256
256
|
}
|