@logora/debate 0.3.101 → 0.3.103

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.
@@ -0,0 +1 @@
1
+ ._proposalBoxContainer_ru1rh_3{display:flex!important;flex-direction:column!important;justify-content:space-between!important;position:relative;box-shadow:var(--box-shadow, 0px 2px 5px rgba(7, 42, 68, .1));border:var(--box-border, 1px solid rgba(7, 42, 68, .1));color:var(--text-primary, #222222);border-radius:var(--box-border-radius, 6px);background-color:var(--background-color-primary, white);scroll-margin-top:150px;padding:var(--box-spacing, var(--space-unit, 1em));gap:var(--box-spacing, var(--space-unit, 1em))}._proposalBoxContainer_ru1rh_3._flash_ru1rh_17{-webkit-transition:box-shadow .8s ease-in-out;-moz-transition:box-shadow .8s ease-in-out;-o-transition:box-shadow .8s ease-in-out;transition:box-shadow .8s ease-in-out;box-shadow:0 0 15px var(--call-primary-color, #434343)}._edited_ru1rh_25{font-size:var(--font-size-extra-small, 14px);color:var(--text-secondary, #5F5F5F);line-height:var(--line-height-loose, 1.38em);margin-bottom:var(--spacer-xs, calc(var(--space-unit, 1em) * .325))!important}._proposalBoxContent_ru1rh_32{flex:1;text-align:left;white-space:pre-line;line-height:var(--line-height-loose, 1.38em);font-size:var(--font-size-small, 16px)}@container (min-width: 768px){._proposalBoxContent_ru1rh_32._withMinHeight_ru1rh_41{min-height:185px}}._proposalBoxContent_ru1rh_32 ._proposalTitle_ru1rh_45{font-size:var(--font-size-normal, 16px);font-weight:var(--font-weight-bold, 700);padding-bottom:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._proposalBoxContent_ru1rh_32 ._proposalTitle_ru1rh_45:first-letter{text-transform:uppercase}._proposalBoxContent_ru1rh_32 ._proposalContent_ru1rh_53 *{font-size:var(--font-size-small, 16px)}._proposalSourcesList_ru1rh_57{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;font-size:var(--font-size-extra-small, 14px);font-weight:var(--font-weight-normal, 400)}._proposalSourcesList_ru1rh_57 a{text-decoration:none}._fixedHeight_ru1rh_69{height:200px;overflow:hidden;position:relative}._fixedHeight_ru1rh_69:after{content:"";position:absolute;z-index:1;bottom:0;left:0;right:0;pointer-events:none;background-image:linear-gradient(to bottom,#fff0,#fff 90%);width:100%;height:5em}._proposalContent_ru1rh_53 ol{list-style-type:decimal!important;margin-left:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;padding-left:var(--spacer-xl, calc(var(--space-unit, 1em) * 3))!important}._proposalContent_ru1rh_53 ul{list-style-type:disc!important;margin-left:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;padding-left:var(--spacer-xl, calc(var(--space-unit, 1em) * 3))!important}._proposalContent_ru1rh_53 ol li::marker,._proposalContent_ru1rh_53 ul li::marker{content:normal!important}
@@ -1,163 +1,157 @@
1
1
  import { jsx as o, jsxs as l, Fragment as f } from "react/jsx-runtime";
2
- import F from "classnames";
3
- import { useState as y, useEffect as P, useCallback as pe, Suspense as ue, lazy as me } from "react";
4
- import { useIntl as he } from "react-intl";
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
5
  import s from "./Argument.module.scss.js";
6
- import { ReplyFooter as fe } from "./ReplyFooter.js";
7
- import { useRichContent as ye } from "./useRichContent.js";
8
- import { useAuth as _e } from "../../auth/use_auth/useAuth.js";
9
- import { useConfig as ge } from "../../data/config_provider/useConfig.js";
10
- import { useList as be } from "../../list/list_provider/useList.js";
11
- import { useTranslatedContent as j } from "../../translation/translated_content/useTranslatedContent.js";
12
- import { SourceListItem as Me } from "../../source/source_list_item/SourceListItem.js";
13
- import { HashScroll as Ie } from "../../tools/hash_scroll/HashScroll.js";
14
- import { ContentHeader as Ce } from "../../user_content/content_header/ContentHeader.js";
15
- import { Icon as G } from "../../icons/icon/Icon.js";
16
- import { ReadMore as ve } from "../../text/read_more/ReadMore.js";
17
- import { TranslationButton as Se } from "../../translation/translation_button/TranslationButton.js";
18
- import { ContentFooter as Re } from "../../user_content/content_footer/ContentFooter.js";
19
- import { VoteButton as Te } from "../../vote/vote_button/VoteButton.js";
20
- import { VotePaginatedList as Ne } from "../../list/paginated_list/VotePaginatedList.js";
21
- import { UserContentSkeleton as we } from "../../skeleton/user_content_skeleton/UserContentSkeleton.js";
22
- import { Button as Ae } from "../../action/button/Button.js";
23
- const xe = me(() => import("../../input/argument_input/index.js").then((e) => ({ default: e.ArgumentInput }))), H = (e) => e?.replace(/ /g, " "), Le = ({
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
25
  argumentReplies: n,
26
26
  nestingLevel: _ = 0,
27
- maxNestingLevel: T = 2,
28
- groupType: N,
29
- groupName: w,
27
+ maxNestingLevel: S = 2,
28
+ groupType: R,
29
+ groupName: T,
30
30
  positions: g = [],
31
- disableLinks: V = !1,
31
+ disableLinks: P = !1,
32
32
  parentArgument: c,
33
- flashParent: z,
34
- expandable: O,
33
+ flashParent: j,
34
+ expandable: G,
35
35
  disabled: b = !1,
36
- hideFooter: A = !1,
37
- hideReplies: x,
38
- vote: Y,
39
- fixedContentHeight: q = !1,
40
- enableEdition: J = !0,
41
- enableDeletion: K = !0,
42
- deleteListId: Q,
43
- showModerationFeedback: W,
44
- lineCount: X = 5,
45
- replyRedirectUrl: Z,
46
- hideContent: ee = !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 a = he(), { isLoggedIn: te, currentUser: p } = _e(), L = p?.moderation_status === "banned", i = ge(), M = be(), [u, I] = y(!1), [oe, $] = y(!1), [se, re] = y(!1), k = ye(e), [m, C] = y(), h = j(
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
- ), ie = j(
53
+ ), oe = D(
54
54
  e.position?.name,
55
55
  e.position?.language,
56
56
  "name",
57
57
  e.position?.translation_entries
58
- ), v = `argument_${e.id}`, S = e.position && g?.map((t) => t.id).indexOf(e.position.id) + 1;
59
- P(() => {
60
- n !== void 0 && de();
61
- }, [n]), P(() => {
62
- const t = `argument_${e.id}_reply_list`, r = M.updateElements?.[t];
63
- r?.length && C((d) => d?.length ? d.map((R) => {
64
- const D = r.find((ce) => ce.id === R.id);
65
- return D ? { ...R, ...D } : R;
66
- }) : d);
67
- }, [M.updateElements, e.id]);
68
- const ae = (t) => {
69
- if (v === t) {
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) {
70
64
  const d = document.getElementById(t);
71
- d && d.scrollIntoView({ behavior: "smooth" }), $(!0);
65
+ d && d.scrollIntoView({ behavior: "smooth" }), x(!0);
72
66
  }
73
67
  }, U = () => {
74
- re((t) => !t);
75
- }, B = () => {
76
- I((t) => !t), C([]);
77
- }, le = (t) => {
78
- if (!m?.find((r) => r.id === t.id))
68
+ te((t) => !t);
69
+ }, k = () => {
70
+ M((t) => !t), v([]);
71
+ }, re = (t) => {
72
+ if (!u?.find((i) => i.id === t.id))
79
73
  return t;
80
- }, ne = pe((t, r) => /* @__PURE__ */ o(
81
- Me,
74
+ }, ie = ne((t, i) => /* @__PURE__ */ o(
75
+ _e,
82
76
  {
83
77
  publisher: t.publisher,
84
78
  url: t.source_url,
85
79
  title: t.title,
86
- index: r
80
+ index: i
87
81
  },
88
- r
89
- ), []), de = () => {
82
+ i
83
+ ), []), ae = () => {
90
84
  if (n && Array.isArray(n)) {
91
85
  const t = n.filter(
92
- (r) => r.reply_to_id === e.id
86
+ (i) => i.reply_to_id === e.id
93
87
  );
94
- t.length > 0 && (C(t), I(!0));
88
+ t.length > 0 && (v(t), M(!0));
95
89
  }
96
- }, E = (t = null) => /* @__PURE__ */ o(
97
- $e,
90
+ }, $ = (t = null) => /* @__PURE__ */ o(
91
+ Ae,
98
92
  {
99
93
  ...t ? { argument: t } : {},
100
94
  nestingLevel: _ + 1,
101
- maxNestingLevel: T,
95
+ maxNestingLevel: S,
102
96
  disabled: b,
103
- groupName: w,
104
- groupType: N,
97
+ groupName: T,
98
+ groupType: R,
105
99
  positions: g,
106
100
  argumentReplies: n,
107
101
  parentArgument: e,
108
- flashParent: (r) => ae(`argument_${r}`)
102
+ flashParent: (i) => se(`argument_${i}`)
109
103
  }
110
104
  );
111
- return /* @__PURE__ */ l(Ie, { elementId: v, onScroll: () => $(!0), children: [
105
+ return /* @__PURE__ */ l(ge, { elementId: I, onScroll: () => x(!0), children: [
112
106
  /* @__PURE__ */ l(
113
107
  "div",
114
108
  {
115
- className: F(
109
+ className: B(
116
110
  s.argument,
117
111
  {
118
- [s.flash]: oe,
112
+ [s.flash]: Z,
119
113
  [s.argumentReply]: e.is_reply === !0
120
114
  },
121
115
  s[`level-${_}`],
122
- s[`position-${!(e.author.role === "editor" || e.author.role === "moderator") && S}`]
116
+ s[`position-${!(e.author.role === "editor" || e.author.role === "moderator") && C}`]
123
117
  ),
124
- id: v,
118
+ id: I,
125
119
  children: [
126
120
  /* @__PURE__ */ o(
127
- Ce,
121
+ be,
128
122
  {
129
123
  selectedContent: e.is_selected,
130
124
  author: e.author,
131
- tag: (e.author.role === "editor" || e.author.role === "moderator") && e.is_reply ? null : ie.translatedContent,
125
+ tag: (e.author.role === "editor" || e.author.role === "moderator") && e.is_reply ? null : oe.translatedContent,
132
126
  date: e.created_at,
133
- tagClassName: s[`headerPosition-${S}`],
134
- disableLinks: V,
127
+ tagClassName: s[`headerPosition-${C}`],
128
+ disableLinks: P,
135
129
  isDeleted: e.is_deleted,
136
- showModerationFeedback: W ?? (e.status === "rejected" && i.moderation?.showFeedback === !0),
130
+ showModerationFeedback: q ?? (e.status === "rejected" && r.moderation?.showFeedback === !0),
137
131
  moderationReason: e.moderation_entry?.moderation_reason,
138
132
  moderationNotes: e.moderation_entry?.moderator_notes,
139
- moderationPolicyUrl: i.provider?.userGuideUrl
133
+ moderationPolicyUrl: r.provider?.userGuideUrl
140
134
  }
141
135
  ),
142
136
  e.is_deleted ? /* @__PURE__ */ o("div", { className: s.argumentDeletedBody, children: a.formatMessage({
143
137
  id: "info.deleted_by_user",
144
138
  defaultMessage: "Content deleted by the user"
145
- }) }) : ee ? /* @__PURE__ */ o("div", { className: s.argumentDeletedBody, children: a.formatMessage({
139
+ }) }) : Q ? /* @__PURE__ */ o("div", { className: s.argumentDeletedBody, children: a.formatMessage({
146
140
  id: "argument.argument.content_deleted",
147
141
  defaultMessage: "This content has been removed."
148
142
  }) }) : /* @__PURE__ */ l(f, { children: [
149
143
  /* @__PURE__ */ l(
150
144
  "div",
151
145
  {
152
- className: F(s.argumentBody, {
153
- [s.fixedHeight]: i?.layout?.showAllArgumentInEmbed !== !0 ? q : !1
146
+ className: B(s.argumentBody, {
147
+ [s.fixedHeight]: r?.layout?.showAllArgumentInEmbed !== !0 ? V : !1
154
148
  }),
155
149
  children: [
156
150
  e.is_reply && c && /* @__PURE__ */ l(
157
151
  "div",
158
152
  {
159
153
  className: s.replyTo,
160
- onClick: () => z(c.id),
154
+ onClick: () => j(c.id),
161
155
  children: [
162
156
  a.formatMessage({
163
157
  id: "info.replying_to",
@@ -168,35 +162,35 @@ const xe = me(() => import("../../input/argument_input/index.js").then((e) => ({
168
162
  id: "info.deleted",
169
163
  defaultMessage: "Deleted"
170
164
  }) : c.author.full_name,
171
- /* @__PURE__ */ o(G, { name: "chat", height: 16 })
165
+ /* @__PURE__ */ o(E, { name: "chat", height: 16 })
172
166
  ] })
173
167
  ]
174
168
  }
175
169
  ),
176
170
  /* @__PURE__ */ o(
177
- ve,
171
+ Me,
178
172
  {
179
173
  content: /* @__PURE__ */ l(f, { children: [
180
174
  e.is_edited && /* @__PURE__ */ o("div", { className: s.edited, children: a.formatMessage({
181
175
  id: "argument.argument.updated",
182
176
  defaultMessage: "Updated argument"
183
177
  }) }),
184
- k && !h.isTranslated ? /* @__PURE__ */ o(
178
+ L && !h.isTranslated ? /* @__PURE__ */ o(
185
179
  "div",
186
180
  {
187
181
  className: s.argumentContent,
188
- dangerouslySetInnerHTML: { __html: H(k) }
182
+ dangerouslySetInnerHTML: { __html: F(L) }
189
183
  }
190
- ) : /* @__PURE__ */ o("div", { className: s.argumentContent, children: H(h.translatedContent) }),
184
+ ) : /* @__PURE__ */ o("div", { className: s.argumentContent, children: F(h.translatedContent) }),
191
185
  h.isTranslated && /* @__PURE__ */ o(
192
- Se,
186
+ ve,
193
187
  {
194
188
  language: e.language,
195
189
  callback: () => h.toggleContent()
196
190
  }
197
191
  )
198
192
  ] }),
199
- lineCount: i?.layout?.showAllArgumentInEmbed !== !0 ? X : void 0,
193
+ lineCount: r?.layout?.showAllArgumentInEmbed !== !0 ? J : void 0,
200
194
  readMoreText: a.formatMessage({
201
195
  id: "action.read_more",
202
196
  defaultMessage: "Read more"
@@ -205,27 +199,27 @@ const xe = me(() => import("../../input/argument_input/index.js").then((e) => ({
205
199
  id: "action.read_less",
206
200
  defaultMessage: "Read less"
207
201
  }),
208
- expandable: i?.layout?.showAllArgumentInEmbed !== !0 ? O : !1,
202
+ expandable: r?.layout?.showAllArgumentInEmbed !== !0 ? G : !1,
209
203
  readMoreClassName: e.is_reply ? s.replyStyle : s.argumentStyle
210
204
  }
211
205
  )
212
206
  ]
213
207
  }
214
208
  ),
215
- e.sources?.length > 0 && /* @__PURE__ */ o("div", { className: s.argumentSourcesList, children: e.sources.map(ne) })
209
+ e.sources?.length > 0 && /* @__PURE__ */ o("div", { className: s.argumentSourcesList, children: e.sources.map(ie) })
216
210
  ] }),
217
- !A && !e.is_deleted && /* @__PURE__ */ o(
218
- Re,
211
+ !N && !e.is_deleted && /* @__PURE__ */ o(
212
+ Ie,
219
213
  {
220
214
  resource: e,
221
- disabled: b || e.status === "rejected" || !te && i?.actions?.disableInputForVisitor === !0 || L,
215
+ disabled: b || e.status === "rejected" || !W && r?.actions?.disableInputForVisitor === !0 || A,
222
216
  reportType: "Message",
223
- softDelete: i.actions?.softDelete,
217
+ softDelete: r.actions?.softDelete,
224
218
  deleteType: "messages",
225
- deleteListId: Q,
226
- enableReply: _ <= T || p.role === "editor" || p.role === "moderator",
219
+ deleteListId: Y,
220
+ enableReply: _ <= S || p.role === "editor" || p.role === "moderator",
227
221
  handleReplyTo: U,
228
- replyRedirectUrl: Z,
222
+ replyRedirectUrl: K,
229
223
  shareUrl: `https://app.logora.fr/share/a/${e.id}`,
230
224
  shareTitle: a.formatMessage({
231
225
  id: "share.argument.title",
@@ -235,54 +229,61 @@ const xe = me(() => import("../../input/argument_input/index.js").then((e) => ({
235
229
  id: "share.argument.text",
236
230
  defaultMessage: "This argument may interest you"
237
231
  }),
238
- shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${i.shortname}&id=${e.id}&resource=argument" frameborder="0" width="100%" height="275px" scrolling="no"></iframe>`,
239
- showShareCode: i?.actions?.hideCodeShare !== !0,
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,
240
234
  showShareText: !0,
241
- showShareButton: i?.actions?.hideShareButton !== !0,
235
+ showShareButton: r?.actions?.hideShareButton !== !0,
242
236
  enableReport: !(e.score === 100 && e.manual_score),
243
- enableEdition: J,
244
- enableDeletion: K,
237
+ enableEdition: z,
238
+ enableDeletion: O,
245
239
  children: /* @__PURE__ */ o(
246
- Te,
240
+ Ce,
247
241
  {
248
242
  voteableType: "Message",
249
243
  voteableId: e.id,
250
244
  totalUpvote: e.upvotes,
251
245
  totalDownvote: 0,
252
- activeClassName: s[`voteButtonPosition-${S}`],
253
- disabled: e.status === "rejected" || p?.id === e?.author?.id || L
246
+ activeClassName: s[`voteButtonPosition-${C}`],
247
+ disabled: e.status === "rejected" || p?.id === e?.author?.id || A
254
248
  }
255
249
  )
256
250
  }
257
251
  ),
258
- !A && !x && /* @__PURE__ */ o(
259
- fe,
252
+ !N && !w && /* @__PURE__ */ o(
253
+ me,
260
254
  {
261
255
  numberReplies: e.number_replies,
262
256
  repliesAuthors: e.replies_authors,
263
- expandReplies: u,
264
- onToggleReplies: B,
257
+ expandReplies: m,
258
+ onToggleReplies: k,
265
259
  isReply: e.is_reply
266
260
  }
267
261
  )
268
262
  ]
269
263
  }
270
264
  ),
271
- !x && /* @__PURE__ */ l(f, { children: [
272
- se && /* @__PURE__ */ o(ue, { fallback: null, children: /* @__PURE__ */ o(
273
- xe,
265
+ !w && /* @__PURE__ */ l(f, { children: [
266
+ ee && /* @__PURE__ */ o(de, { fallback: null, children: /* @__PURE__ */ o(
267
+ Ne,
274
268
  {
275
269
  groupId: e.group_id,
276
- groupType: N,
277
- groupName: w,
270
+ groupType: R,
271
+ groupName: T,
278
272
  positions: g,
279
273
  parentId: e.id,
280
- positionId: Y?.position_id,
274
+ positionId: H?.position_id,
281
275
  disabled: b,
282
- hideSourceAction: i?.actions?.disableUserSources || !1,
276
+ hideSourceAction: r?.actions?.disableUserSources || !1,
283
277
  onSubmit: (t) => {
284
- const r = `argument_${e.id}_reply_list`;
285
- M.add(r, [t]), U(), I(!0);
278
+ const i = `argument_${e.id}_reply_list`;
279
+ X.add(i, [t]), U(), M(!0);
280
+ },
281
+ onUpdate: (t) => {
282
+ v(
283
+ (i) => i?.map(
284
+ (d) => d.id === t.id ? { ...d, ...t } : d
285
+ )
286
+ );
286
287
  },
287
288
  isReply: !0,
288
289
  autoFocus: !0,
@@ -291,18 +292,18 @@ const xe = me(() => import("../../input/argument_input/index.js").then((e) => ({
291
292
  id: "input.reply_input.your_answer",
292
293
  defaultMessage: "Your answer"
293
294
  }),
294
- userGuideUrl: i?.provider?.userGuideUrl,
295
- hideUserGuideLink: i?.provider?.hideUserGuideLink
295
+ userGuideUrl: r?.provider?.userGuideUrl,
296
+ hideUserGuideLink: r?.provider?.hideUserGuideLink
296
297
  },
297
298
  `Reply${e.id}`
298
299
  ) }),
299
- m?.length > 0 && u && /* @__PURE__ */ o("div", { className: s.repliesList, children: m.map((t) => E(t)) }),
300
- u && /* @__PURE__ */ o("div", { className: s.repliesList, children: /* @__PURE__ */ o(
301
- Ne,
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,
302
303
  {
303
304
  voteableType: "Message",
304
305
  currentListId: `argument_${e.id}_reply_list`,
305
- loadingComponent: /* @__PURE__ */ o(we, {}),
306
+ loadingComponent: /* @__PURE__ */ o(Re, {}),
306
307
  resource: "messages",
307
308
  sort: "+created_at",
308
309
  filters: {
@@ -314,16 +315,16 @@ const xe = me(() => import("../../input/argument_input/index.js").then((e) => ({
314
315
  display: "column",
315
316
  resourcePropName: "argument",
316
317
  emptyListComponent: /* @__PURE__ */ o(f, {}),
317
- transformData: (t) => le(t),
318
- children: E(e)
318
+ transformData: (t) => re(t),
319
+ children: $(e)
319
320
  }
320
321
  ) }),
321
- m?.length > 0 && !u && /* @__PURE__ */ o("div", { className: s.repliesList, children: e.number_replies > 1 && /* @__PURE__ */ o("div", { className: s.readMoreLink, children: /* @__PURE__ */ o(
322
- Ae,
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,
323
324
  {
324
325
  role: "link",
325
- rightIcon: /* @__PURE__ */ o(G, { name: "lightArrow", height: 10, width: 10 }),
326
- handleClick: B,
326
+ rightIcon: /* @__PURE__ */ o(E, { name: "lightArrow", height: 10, width: 10 }),
327
+ handleClick: k,
327
328
  children: a.formatMessage({
328
329
  id: "argument.argument.see_more",
329
330
  defaultMessage: "See more"
@@ -332,8 +333,8 @@ const xe = me(() => import("../../input/argument_input/index.js").then((e) => ({
332
333
  ) }) })
333
334
  ] })
334
335
  ] });
335
- }, $e = Le;
336
+ }, Ae = we;
336
337
  export {
337
- Le as Argument,
338
- $e as ArgumentContainer
338
+ we as Argument,
339
+ Ae as ArgumentContainer
339
340
  };
@@ -1,137 +1,138 @@
1
1
  import { jsxs as v, jsx as s } from "react/jsx-runtime";
2
- import We from "@rooks/use-sessionstorage-state";
3
- import { useRef as Ye, useState as l, useEffect as p, Suspense as ke, lazy as je } from "react";
4
- import { useIntl as Re, FormattedMessage as ge } from "react-intl";
5
- import { useLocation as ze } from "react-router";
2
+ import Ye from "@rooks/use-sessionstorage-state";
3
+ import { useRef as ke, useState as c, useEffect as p, Suspense as je, lazy as Re } from "react";
4
+ import { useIntl as ze, FormattedMessage as he } from "react-intl";
5
+ import { useLocation as Oe } from "react-router";
6
6
  import S from "classnames";
7
7
  import n from "./ArgumentInput.module.scss.js";
8
- import { useDataProvider as Oe } from "../../data/data_provider/useDataProvider.js";
9
- import { useList as Je } from "../../list/list_provider/useList.js";
10
- import { useConfig as Ke } from "../../data/config_provider/useConfig.js";
11
- import { useInput as Ge } from "../input_provider/useInput.js";
12
- import { useAuth as He } from "../../auth/use_auth/useAuth.js";
13
- import { useFormValidation as Qe } from "../../forms/use_form_validation/useFormValidation.js";
14
- import { useResponsive as Xe } from "../../hooks/use_responsive/useResponsive.js";
15
- import { useAuthRequired as Ze } from "../../hooks/use_auth_required/useAuthRequired.js";
16
- import { useModal as et } from "../../dialog/modal/useModal.js";
17
- import { useToast as tt } from "../../dialog/toast_provider/useToast.js";
18
- import { TogglePosition as nt } from "../toggle_position/TogglePosition.js";
19
- import { Avatar as at } from "../../user/avatar/Avatar.js";
20
- import { AuthorBox as st } from "../../user/author_box/AuthorBox.js";
21
- import { TextEditor as it } from "../text_editor/TextEditor.js";
22
- import { Icon as ot } from "../../icons/icon/Icon.js";
23
- const rt = je(() => import("../../modal/side_modal/index.js").then((x) => ({ default: x.SideModal }))), Lt = ({
8
+ import { useDataProvider as Je } from "../../data/data_provider/useDataProvider.js";
9
+ import { useList as Ke } from "../../list/list_provider/useList.js";
10
+ import { useConfig as Ge } from "../../data/config_provider/useConfig.js";
11
+ import { useInput as He } from "../input_provider/useInput.js";
12
+ import { useAuth as Qe } from "../../auth/use_auth/useAuth.js";
13
+ import { useFormValidation as Xe } from "../../forms/use_form_validation/useFormValidation.js";
14
+ import { useResponsive as Ze } from "../../hooks/use_responsive/useResponsive.js";
15
+ import { useAuthRequired as et } from "../../hooks/use_auth_required/useAuthRequired.js";
16
+ import { useModal as tt } from "../../dialog/modal/useModal.js";
17
+ import { useToast as nt } from "../../dialog/toast_provider/useToast.js";
18
+ import { TogglePosition as at } from "../toggle_position/TogglePosition.js";
19
+ import { Avatar as st } from "../../user/avatar/Avatar.js";
20
+ import { AuthorBox as it } from "../../user/author_box/AuthorBox.js";
21
+ import { TextEditor as ot } from "../text_editor/TextEditor.js";
22
+ import { Icon as rt } from "../../icons/icon/Icon.js";
23
+ const ut = Re(() => import("../../modal/side_modal/index.js").then((x) => ({ default: x.SideModal }))), Ft = ({
24
24
  argumentListId: x,
25
- avatarSize: he = 48,
25
+ avatarSize: pe = 48,
26
26
  disabled: O = !1,
27
27
  positions: a = [],
28
28
  disabledPositions: N = [],
29
29
  groupId: b,
30
- groupName: pe,
30
+ groupName: _e,
31
31
  groupType: J,
32
- hideSourceAction: _e = !1,
32
+ hideSourceAction: Me = !1,
33
33
  isReply: r = !1,
34
34
  onSubmit: K,
35
+ onUpdate: G,
35
36
  parentId: T,
36
- placeholder: Me,
37
+ placeholder: ve,
37
38
  positionId: A,
38
- focusOnInit: ve = !1,
39
+ focusOnInit: be = !1,
39
40
  activeOnInit: P = !1,
40
- userGuideUrl: G,
41
- hideUserGuideLink: be = !1,
42
- hideCharCount: Ae = !1,
43
- disableAutoActivate: Ce = !1,
44
- autoFocus: H = !1
41
+ userGuideUrl: H,
42
+ hideUserGuideLink: Ae = !1,
43
+ hideCharCount: Ce = !1,
44
+ disableAutoActivate: we = !1,
45
+ autoFocus: Q = !1
45
46
  }) => {
46
- const o = Re(), Q = Oe(), y = Je(), _ = Ke(), {
47
- focus: X,
48
- setFocus: Z,
49
- setReset: we,
47
+ const o = ze(), X = Je(), y = Ke(), _ = Ge(), {
48
+ focus: Z,
49
+ setFocus: ee,
50
+ setReset: Ie,
50
51
  inputContent: B,
51
- setInputContent: ee,
52
- setInputRichContent: Ie
53
- } = Ge(), { isLoggedIn: C, currentUser: u } = He(), { errors: E, validate: V } = Qe(), { isMobile: m } = Xe(), Se = ze(), te = Ye(null), [U, $] = l([]), [q, D] = l(""), [ne, W] = l(null), [d, M] = l(null), [ae, se] = l(null), [ie, oe] = l(!1), [w, re] = l(!1), [I, ue] = l({}), [xe, Y] = l(!1), [f, Ne] = We(
52
+ setInputContent: te,
53
+ setInputRichContent: Se
54
+ } = He(), { isLoggedIn: C, currentUser: u } = Qe(), { errors: E, validate: V } = Xe(), { isMobile: m } = Ze(), xe = Oe(), ne = ke(null), [$, q] = c([]), [D, U] = c(""), [ae, W] = c(null), [d, M] = c(null), [se, ie] = c(null), [oe, re] = c(!1), [w, ue] = c(!1), [I, de] = c({}), [Ne, Y] = c(!1), [f, Te] = Ye(
54
55
  "userSide",
55
56
  {}
56
- ), [g, Te] = l(
57
+ ), [g, ye] = c(
57
58
  !C && _?.actions?.disableInputForVisitor
58
- ), k = Ze(), { showModal: ye } = et(), { toast: j } = tt() || {}, de = new URLSearchParams(
59
- typeof window < "u" ? window.location.search : Se.search
59
+ ), k = et(), { showModal: Le } = tt(), { toast: j } = nt() || {}, le = new URLSearchParams(
60
+ typeof window < "u" ? window.location.search : xe.search
60
61
  );
61
62
  p(() => {
62
- Te(
63
+ ye(
63
64
  !C && _?.actions?.disableInputForVisitor
64
65
  );
65
66
  }, [C, _]);
66
- const R = u?.role === "editor" || u?.role === "moderator", le = u?.moderation_status === "banned";
67
+ const R = u?.role === "editor" || u?.role === "moderator", ce = u?.moderation_status === "banned";
67
68
  p(() => {
68
69
  let e = null;
69
- typeof window < "u" && (e = de.get("positionId")), A && A != a[2]?.id && a?.find((t) => t.id === A) ? M(A) : e && e != a[2]?.id ? M(e) : f && f.groupId == b && f.positionId != a[2]?.id && M(f.positionId);
70
+ typeof window < "u" && (e = le.get("positionId")), A && A != a[2]?.id && a?.find((t) => t.id === A) ? M(A) : e && e != a[2]?.id ? M(e) : f && f.groupId == b && f.positionId != a[2]?.id && M(f.positionId);
70
71
  }, [A]), p(() => {
71
- H && Y(!0);
72
- }, [H]), p(() => {
72
+ Q && Y(!0);
73
+ }, [Q]), p(() => {
73
74
  P && (z(), Y(!0), L());
74
75
  }, [P]), p(() => {
75
76
  if (typeof window < "u") {
76
- const e = ve || de.get("initArgument");
77
- (e === !0 || e === "true") && (Y(!0), L(), $e());
77
+ const e = be || le.get("initArgument");
78
+ (e === !0 || e === "true") && (Y(!0), L(), De());
78
79
  }
79
80
  }, []), p(() => {
80
- X && (L(), Z(!1));
81
- }, [X]), p(() => {
82
- B?.id && (Le(B), Z(!0));
81
+ Z && (L(), ee(!1));
82
+ }, [Z]), p(() => {
83
+ B?.id && (Fe(B), ee(!0));
83
84
  }, [B]);
84
- const Le = (e) => {
85
- ue(e), re(!0), $(e.sources), D(e.content), W(e.rich_content), se(e.id), L(), M(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Ie(e.rich_content) : ee(e.content);
85
+ const Fe = (e) => {
86
+ de(e), ue(!0), q(e.sources), U(e.content), W(e.rich_content), ie(e.id), L(), M(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Se(e.rich_content) : te(e.content);
86
87
  }, L = () => {
87
- te.current.scrollIntoView(!1);
88
- }, ce = () => {
89
- D(""), W(null), ue({}), se(null), $([]), we(!0), ee(null);
90
- }, Fe = (e) => {
91
- M(e), fe(e);
92
- }, Pe = () => {
93
- ye(
94
- /* @__PURE__ */ s(ke, { fallback: null, children: /* @__PURE__ */ s(
95
- rt,
88
+ ne.current.scrollIntoView(!1);
89
+ }, me = () => {
90
+ U(""), W(null), de({}), ie(null), q([]), Ie(!0), te(null);
91
+ }, Pe = (e) => {
92
+ M(e), ge(e);
93
+ }, Be = () => {
94
+ Le(
95
+ /* @__PURE__ */ s(je, { fallback: null, children: /* @__PURE__ */ s(
96
+ ut,
96
97
  {
97
98
  modalTitle: o.formatMessage({
98
99
  id: "modal.side_modal.modal_title",
99
100
  defaultMessage: "Choose your side"
100
101
  }),
101
- onChooseSide: Fe,
102
+ onChooseSide: Pe,
102
103
  positions: a,
103
- title: pe,
104
+ title: _e,
104
105
  disabledPositions: !r && N,
105
106
  isNeutral: f && f.groupId == b && f.positionId === a[2]?.id
106
107
  }
107
108
  ) })
108
109
  );
109
- }, Be = () => {
110
- C ? ae ? Ue() : !a || a?.length === 0 || !N?.find((e) => e?.id === d) && d || R && r ? fe(r && R && a[0]?.id) : Pe() : k({ loginAction: "argument" });
111
- }, Ee = (e, t) => {
112
- g ? k({ loginAction: "argument" }) : (D(e), W(t), V({ content: e }, [{ content: ["url", null] }]));
113
- }, Ve = (e) => {
114
- $(e);
115
- }, me = [
110
+ }, Ee = () => {
111
+ C ? se ? qe() : !a || a?.length === 0 || !N?.find((e) => e?.id === d) && d || R && r ? ge(r && R && a[0]?.id) : Be() : k({ loginAction: "argument" });
112
+ }, Ve = (e, t) => {
113
+ g ? k({ loginAction: "argument" }) : (U(e), W(t), V({ content: e }, [{ content: ["url", null] }]));
114
+ }, $e = (e) => {
115
+ q(e);
116
+ }, fe = [
116
117
  { content: ["length", 3] },
117
118
  { content: ["required", null] },
118
119
  { content: ["url", null] },
119
120
  ...!a || a?.length === 0 ? [] : [{ position_id: ["required", null] }]
120
- ], fe = (e) => {
121
- const t = e || d, c = {
122
- content: q,
123
- rich_content: ne,
121
+ ], ge = (e) => {
122
+ const t = e || d, l = {
123
+ content: D,
124
+ rich_content: ae,
124
125
  group_id: b,
125
126
  ...J && { group_type: J },
126
127
  ...t && { position_id: t },
127
128
  is_reply: !!T,
128
129
  message_id: T || null,
129
- source_ids: U?.map((i) => i.id)
130
+ source_ids: $?.map((i) => i.id)
130
131
  };
131
- V(c, me) && (t && a && a.map((i) => i.id).includes(t) && Ne({
132
+ V(l, fe) && (t && a && a.map((i) => i.id).includes(t) && Te({
132
133
  groupId: b,
133
134
  positionId: t
134
- }), ce(), Q.create("messages", c).then((i) => {
135
+ }), me(), X.create("messages", l).then((i) => {
135
136
  if (i.data.success) {
136
137
  if (T)
137
138
  K(i.data.data.resource), j(
@@ -151,8 +152,8 @@ const rt = je(() => import("../../modal/side_modal/index.js").then((x) => ({ def
151
152
  const h = i.data.data.resource;
152
153
  let F = x;
153
154
  t && !m && (F = `argumentList${h.position.id}`), K?.(
154
- q,
155
- a.find((De) => De.id === t) || null
155
+ D,
156
+ a.find((We) => We.id === t) || null
156
157
  ), y.add(F, [h]), j(
157
158
  o.formatMessage({
158
159
  id: "alert.argument_create",
@@ -178,42 +179,42 @@ const rt = je(() => import("../../modal/side_modal/index.js").then((x) => ({ def
178
179
  );
179
180
  }
180
181
  }));
181
- }, Ue = () => {
182
+ }, qe = () => {
182
183
  const e = {
183
- content: q,
184
- rich_content: ne,
185
- source_ids: U?.map((t) => t.id),
184
+ content: D,
185
+ rich_content: ae,
186
+ source_ids: $?.map((t) => t.id),
186
187
  ...d && { position_id: d }
187
188
  };
188
- V(e, me) && Q.update("messages", ae, e).then((t) => {
189
+ V(e, fe) && X.update("messages", se, e).then((t) => {
189
190
  if (t.data.success) {
190
- const c = t.data.data.resource;
191
+ const l = t.data.data.resource;
191
192
  let i = x;
192
193
  if (I?.is_reply || r) {
193
194
  const h = I?.message_id || T;
194
195
  h && (i = `argument_${h}_reply_list`);
195
- } else d && !m && (i = `argumentList${c.position?.id}`);
196
- if (!I?.is_reply && I?.position?.id != c.position?.id && !m) {
197
- const h = `argumentList${I.position.id}`, F = `argumentList${c.position.id}`;
198
- y.remove(h, [c]), y.add(F, [c]);
196
+ } else d && !m && (i = `argumentList${l.position?.id}`);
197
+ if (!I?.is_reply && I?.position?.id != l.position?.id && !m) {
198
+ const h = `argumentList${I.position.id}`, F = `argumentList${l.position.id}`;
199
+ y.remove(h, [l]), y.add(F, [l]);
199
200
  } else
200
- y.update(i, [c]);
201
- j(o.formatMessage({ id: "alert.argument_modify" }), {
201
+ y.update(i, [l]);
202
+ G && G(l), j(o.formatMessage({ id: "alert.argument_modify" }), {
202
203
  type: "success"
203
- }), ce();
204
+ }), me();
204
205
  }
205
206
  });
206
- }, $e = () => {
207
- if (!ie) {
208
- oe(!0);
207
+ }, De = () => {
208
+ if (!oe) {
209
+ re(!0);
209
210
  const e = setTimeout(() => {
210
- oe(!1);
211
+ re(!1);
211
212
  }, 2e3);
212
213
  return () => clearTimeout(e);
213
214
  }
214
215
  }, z = () => {
215
- g ? k({ loginAction: "argument" }) : re(!0);
216
- }, qe = () => {
216
+ g ? k({ loginAction: "argument" }) : ue(!0);
217
+ }, Ue = () => {
217
218
  const e = N.find(
218
219
  (t) => t.id === d
219
220
  );
@@ -227,7 +228,7 @@ const rt = je(() => import("../../modal/side_modal/index.js").then((x) => ({ def
227
228
  );
228
229
  };
229
230
  return /* @__PURE__ */ v("div", { className: n.inputContainer, children: [
230
- O && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: le ? o.formatMessage({
231
+ O && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ce ? o.formatMessage({
231
232
  id: "input.argument_input.user_banned",
232
233
  defaultMessage: "You are banned from the debate space."
233
234
  }) : o.formatMessage({
@@ -238,17 +239,17 @@ const rt = je(() => import("../../modal/side_modal/index.js").then((x) => ({ def
238
239
  "div",
239
240
  {
240
241
  className: S(n.argumentInput, {
241
- [n.flash]: ie,
242
+ [n.flash]: oe,
242
243
  [n.replyInputContainer]: r
243
244
  }),
244
- children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref: te, children: /* @__PURE__ */ v("div", { className: n.argumentInputBox, children: [
245
+ children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref: ne, children: /* @__PURE__ */ v("div", { className: n.argumentInputBox, children: [
245
246
  a.length > 0 && C && (!r || !R) && /* @__PURE__ */ v("div", { className: n.userPosition, children: [
246
247
  /* @__PURE__ */ s("div", { children: o.formatMessage({
247
248
  id: "input.position",
248
249
  defaultMessage: "Your position"
249
250
  }) }),
250
251
  /* @__PURE__ */ s(
251
- nt,
252
+ at,
252
253
  {
253
254
  activeLabel: d === a[0].id ? 0 : d === a[1].id ? 1 : null,
254
255
  firstLabel: a[0],
@@ -273,14 +274,14 @@ const rt = je(() => import("../../modal/side_modal/index.js").then((x) => ({ def
273
274
  [n.argumentAuthorContainerActivated]: !m && w || r
274
275
  }),
275
276
  children: !m && w || r ? /* @__PURE__ */ s(
276
- at,
277
+ st,
277
278
  {
278
279
  avatarUrl: u.image_url,
279
280
  userName: u.full_name,
280
- size: he
281
+ size: pe
281
282
  }
282
283
  ) : /* @__PURE__ */ s(
283
- st,
284
+ it,
284
285
  {
285
286
  fullName: u?.full_name || o.formatMessage({ id: "default_author.full_name" }),
286
287
  avatarUrl: u?.image_url,
@@ -300,35 +301,35 @@ const rt = je(() => import("../../modal/side_modal/index.js").then((x) => ({ def
300
301
  }),
301
302
  children: [
302
303
  /* @__PURE__ */ s(
303
- it,
304
+ ot,
304
305
  {
305
306
  handleChange: (e, t) => {
306
- Ee(e, t);
307
+ Ve(e, t);
307
308
  },
308
309
  handleSourcesChange: (e) => {
309
- Ve(e);
310
+ $e(e);
310
311
  },
311
- placeholder: Me,
312
+ placeholder: ve,
312
313
  "aria-label": o.formatMessage({
313
314
  id: "input.argument_input.aria_label",
314
315
  defaultMessage: "Message input field"
315
316
  }),
316
- onSubmit: Be,
317
- sources: U,
318
- hideSourceAction: _e || g,
317
+ onSubmit: Ee,
318
+ sources: $,
319
+ hideSourceAction: Me || g,
319
320
  uid: `Argument${b}`,
320
321
  onActivation: z,
321
322
  showStylesControls: w,
322
- disabled: O || g || le,
323
+ disabled: O || g || ce,
323
324
  maxLength: g ? !1 : _?.actions?.argumentMaxLength,
324
325
  disableRichText: _?.actions?.disableRichText || g,
325
326
  shortBar: r,
326
327
  hideSubmit: g,
327
328
  allowedDomains: _?.allowed_sources,
328
329
  active: P,
329
- autoFocus: xe,
330
- hideCharCount: Ae,
331
- disableAutoActivate: Ce
330
+ autoFocus: Ne,
331
+ hideCharCount: Ce,
332
+ disableAutoActivate: we
332
333
  }
333
334
  ),
334
335
  E?.content && /* @__PURE__ */ s("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ s("div", { children: e }, t)) }),
@@ -343,7 +344,7 @@ const rt = je(() => import("../../modal/side_modal/index.js").then((x) => ({ def
343
344
  ),
344
345
  children: [
345
346
  /* @__PURE__ */ s(
346
- ot,
347
+ rt,
347
348
  {
348
349
  name: "announcement",
349
350
  className: n.warningIcon,
@@ -351,12 +352,12 @@ const rt = je(() => import("../../modal/side_modal/index.js").then((x) => ({ def
351
352
  width: 20
352
353
  }
353
354
  ),
354
- /* @__PURE__ */ s("div", { className: n.argumentInputWarningText, children: qe() })
355
+ /* @__PURE__ */ s("div", { className: n.argumentInputWarningText, children: Ue() })
355
356
  ]
356
357
  }
357
358
  ),
358
- w && G && !be && /* @__PURE__ */ s("div", { className: n.guideMessage, children: /* @__PURE__ */ s(
359
- ge,
359
+ w && H && !Ae && /* @__PURE__ */ s("div", { className: n.guideMessage, children: /* @__PURE__ */ s(
360
+ he,
360
361
  {
361
362
  id: "alert.guide_message",
362
363
  defaultMessage: "Contributions must comply with our {userCharter}.",
@@ -365,11 +366,11 @@ const rt = je(() => import("../../modal/side_modal/index.js").then((x) => ({ def
365
366
  "a",
366
367
  {
367
368
  className: n.guideMessage,
368
- href: G,
369
+ href: H,
369
370
  target: "_blank",
370
371
  rel: "noreferrer",
371
372
  children: /* @__PURE__ */ s(
372
- ge,
373
+ he,
373
374
  {
374
375
  id: "alert.user_charter",
375
376
  defaultMessage: "user charter"
@@ -392,5 +393,5 @@ const rt = je(() => import("../../modal/side_modal/index.js").then((x) => ({ def
392
393
  ] });
393
394
  };
394
395
  export {
395
- Lt as ArgumentInput
396
+ Ft as ArgumentInput
396
397
  };
@@ -1,4 +1,4 @@
1
- import { jsx as t, jsxs as g, Fragment as I } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as d, Fragment as I } from "react/jsx-runtime";
2
2
  import { useState as p, useEffect as N } from "react";
3
3
  import C from "classnames";
4
4
  import { useIntl as y } from "react-intl";
@@ -16,13 +16,13 @@ import { ContentFooter as F } from "../../user_content/content_footer/ContentFoo
16
16
  import { UpDownVoteBox as j } from "../../vote/up_down_vote_box/UpDownVoteBox.js";
17
17
  const te = ({
18
18
  proposal: e,
19
- disabled: d = !1,
20
- fixedContentHeight: c,
19
+ disabled: c = !1,
20
+ fixedContentHeight: m,
21
21
  fitContent: T = !1,
22
22
  enableEdition: v = !0,
23
23
  hideFooter: x = !1
24
24
  }) => {
25
- const [m, M] = p(null), [w, b] = p(!1), r = y(), n = L(), { currentUser: h } = B(), f = h?.moderation_status === "banned", u = `proposal_${e.id}`, i = _(
25
+ const [h, M] = p(null), [w, b] = p(!1), r = y(), n = L(), { currentUser: f } = B(), u = f?.moderation_status === "banned", g = `proposal_${e.id}`, i = _(
26
26
  e.title,
27
27
  e.language,
28
28
  "title",
@@ -45,11 +45,11 @@ const te = ({
45
45
  const S = () => {
46
46
  i.toggleContent(), a.toggleContent();
47
47
  };
48
- return /* @__PURE__ */ t(U, { elementId: u, onScroll: () => b(!0), children: /* @__PURE__ */ g(
48
+ return /* @__PURE__ */ t(U, { elementId: g, onScroll: () => b(!0), children: /* @__PURE__ */ d(
49
49
  "div",
50
50
  {
51
51
  className: C(o.proposalBoxContainer, { [o.flash]: w }),
52
- id: u,
52
+ id: g,
53
53
  children: [
54
54
  /* @__PURE__ */ t(
55
55
  D,
@@ -60,65 +60,67 @@ const te = ({
60
60
  oneLine: !1
61
61
  }
62
62
  ),
63
- /* @__PURE__ */ t(
63
+ /* @__PURE__ */ d(
64
64
  "div",
65
65
  {
66
66
  className: C(o.proposalBoxContent, {
67
- [o.fixedHeight]: c,
68
- [o.withMinHeight]: !T && !c
67
+ [o.fixedHeight]: m,
68
+ [o.withMinHeight]: !T && !m
69
69
  }),
70
- children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
71
- P,
72
- {
73
- content: /* @__PURE__ */ g(I, { children: [
74
- e.is_edited && /* @__PURE__ */ t("div", { className: o.edited, children: r.formatMessage({
75
- id: "proposal.updated",
76
- defaultMessage: "Updated proposal"
77
- }) }),
78
- /* @__PURE__ */ t("div", { className: o.proposalTitle, children: i.translatedContent }),
79
- m && !a.isTranslated ? /* @__PURE__ */ t(
80
- "div",
81
- {
82
- className: o.proposalContent,
83
- dangerouslySetInnerHTML: { __html: m }
84
- }
85
- ) : /* @__PURE__ */ t("div", { className: o.proposalContent, children: a.translatedContent }),
86
- (a.isTranslated || i.isTranslated) && /* @__PURE__ */ t(
87
- R,
88
- {
89
- language: e.language,
90
- callback: () => S()
91
- }
92
- )
93
- ] }),
94
- lineCount: 7,
95
- readMoreText: r.formatMessage({
96
- id: "action.read_more",
97
- defaultMessage: "Read more"
98
- }),
99
- readLessText: r.formatMessage({
100
- id: "action.read_less",
101
- defaultMessage: "Read less"
102
- })
103
- }
104
- ) })
70
+ children: [
71
+ /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
72
+ P,
73
+ {
74
+ content: /* @__PURE__ */ d(I, { children: [
75
+ e.is_edited && /* @__PURE__ */ t("div", { className: o.edited, children: r.formatMessage({
76
+ id: "proposal.updated",
77
+ defaultMessage: "Updated proposal"
78
+ }) }),
79
+ /* @__PURE__ */ t("div", { className: o.proposalTitle, children: i.translatedContent }),
80
+ h && !a.isTranslated ? /* @__PURE__ */ t(
81
+ "div",
82
+ {
83
+ className: o.proposalContent,
84
+ dangerouslySetInnerHTML: { __html: h }
85
+ }
86
+ ) : /* @__PURE__ */ t("div", { className: o.proposalContent, children: a.translatedContent }),
87
+ (a.isTranslated || i.isTranslated) && /* @__PURE__ */ t(
88
+ R,
89
+ {
90
+ language: e.language,
91
+ callback: () => S()
92
+ }
93
+ )
94
+ ] }),
95
+ lineCount: 7,
96
+ readMoreText: r.formatMessage({
97
+ id: "action.read_more",
98
+ defaultMessage: "Read more"
99
+ }),
100
+ readLessText: r.formatMessage({
101
+ id: "action.read_less",
102
+ defaultMessage: "Read less"
103
+ })
104
+ }
105
+ ) }),
106
+ e.sources?.length > 0 && /* @__PURE__ */ t("div", { className: o.proposalSourcesList, children: e.sources.map((s, l) => /* @__PURE__ */ t(
107
+ $,
108
+ {
109
+ publisher: s.publisher,
110
+ url: s.source_url,
111
+ title: s.title,
112
+ index: l
113
+ },
114
+ s.id
115
+ )) })
116
+ ]
105
117
  }
106
118
  ),
107
- e.sources?.length > 0 && /* @__PURE__ */ t("div", { className: o.proposalSourcesList, children: e.sources.map((s, l) => /* @__PURE__ */ t(
108
- $,
109
- {
110
- publisher: s.publisher,
111
- url: s.source_url,
112
- title: s.title,
113
- index: l
114
- },
115
- s.id
116
- )) }),
117
119
  !x && /* @__PURE__ */ t(
118
120
  F,
119
121
  {
120
122
  resource: e,
121
- disabled: d || f,
123
+ disabled: c || u,
122
124
  reportType: "Proposal",
123
125
  deleteType: "proposals",
124
126
  deleteListId: "proposalsList",
@@ -137,7 +139,7 @@ const te = ({
137
139
  voteableId: e.id,
138
140
  totalUpvote: e.total_upvotes,
139
141
  totalDownvote: e.total_downvotes,
140
- disabled: d || h?.id === e?.author?.id || f,
142
+ disabled: c || f?.id === e?.author?.id || u,
141
143
  hideDownvotes: n?.actions?.hideDownvotes
142
144
  }
143
145
  )
@@ -1,23 +1,23 @@
1
- import '../../../assets/components/proposal/proposal_box/ProposalBox.module-Dm8XDnr1.css';const o = "_proposalBoxContainer_5x1d0_3", t = "_flash_5x1d0_17", s = "_edited_5x1d0_25", e = "_proposalBoxContent_5x1d0_32", n = "_withMinHeight_5x1d0_40", p = "_proposalTitle_5x1d0_44", i = "_proposalContent_5x1d0_52", _ = "_proposalSourcesList_5x1d0_56", a = "_fixedHeight_5x1d0_68", l = {
1
+ import '../../../assets/components/proposal/proposal_box/ProposalBox.module-VwIuUE7q.css';const o = "_proposalBoxContainer_ru1rh_3", t = "_flash_ru1rh_17", r = "_edited_ru1rh_25", s = "_proposalBoxContent_ru1rh_32", e = "_withMinHeight_ru1rh_41", n = "_proposalTitle_ru1rh_45", p = "_proposalContent_ru1rh_53", i = "_proposalSourcesList_ru1rh_57", _ = "_fixedHeight_ru1rh_69", a = {
2
2
  proposalBoxContainer: o,
3
3
  flash: t,
4
- edited: s,
5
- proposalBoxContent: e,
6
- withMinHeight: n,
7
- proposalTitle: p,
8
- proposalContent: i,
9
- proposalSourcesList: _,
10
- fixedHeight: a
4
+ edited: r,
5
+ proposalBoxContent: s,
6
+ withMinHeight: e,
7
+ proposalTitle: n,
8
+ proposalContent: p,
9
+ proposalSourcesList: i,
10
+ fixedHeight: _
11
11
  };
12
12
  export {
13
- l as default,
14
- s as edited,
15
- a as fixedHeight,
13
+ a as default,
14
+ r as edited,
15
+ _ as fixedHeight,
16
16
  t as flash,
17
17
  o as proposalBoxContainer,
18
- e as proposalBoxContent,
19
- i as proposalContent,
20
- _ as proposalSourcesList,
21
- p as proposalTitle,
22
- n as withMinHeight
18
+ s as proposalBoxContent,
19
+ p as proposalContent,
20
+ i as proposalSourcesList,
21
+ n as proposalTitle,
22
+ e as withMinHeight
23
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.101",
3
+ "version": "0.3.103",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",
@@ -1 +0,0 @@
1
- ._proposalBoxContainer_5x1d0_3{display:flex!important;flex-direction:column!important;justify-content:space-between!important;position:relative;box-shadow:var(--box-shadow, 0px 2px 5px rgba(7, 42, 68, .1));border:var(--box-border, 1px solid rgba(7, 42, 68, .1));color:var(--text-primary, #222222);border-radius:var(--box-border-radius, 6px);background-color:var(--background-color-primary, white);scroll-margin-top:150px;padding:var(--box-spacing, var(--space-unit, 1em));gap:var(--box-spacing, var(--space-unit, 1em))}._proposalBoxContainer_5x1d0_3._flash_5x1d0_17{-webkit-transition:box-shadow .8s ease-in-out;-moz-transition:box-shadow .8s ease-in-out;-o-transition:box-shadow .8s ease-in-out;transition:box-shadow .8s ease-in-out;box-shadow:0 0 15px var(--call-primary-color, #434343)}._edited_5x1d0_25{font-size:var(--font-size-extra-small, 14px);color:var(--text-secondary, #5F5F5F);line-height:var(--line-height-loose, 1.38em);margin-bottom:var(--spacer-xs, calc(var(--space-unit, 1em) * .325))!important}._proposalBoxContent_5x1d0_32{text-align:left;white-space:pre-line;line-height:var(--line-height-loose, 1.38em);font-size:var(--font-size-small, 16px)}@container (min-width: 768px){._proposalBoxContent_5x1d0_32._withMinHeight_5x1d0_40{min-height:185px}}._proposalBoxContent_5x1d0_32 ._proposalTitle_5x1d0_44{font-size:var(--font-size-normal, 16px);font-weight:var(--font-weight-bold, 700);padding-bottom:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._proposalBoxContent_5x1d0_32 ._proposalTitle_5x1d0_44:first-letter{text-transform:uppercase}._proposalBoxContent_5x1d0_32 ._proposalContent_5x1d0_52 *{font-size:var(--font-size-small, 16px)}._proposalSourcesList_5x1d0_56{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;font-size:var(--font-size-extra-small, 14px);font-weight:var(--font-weight-normal, 400)}._proposalSourcesList_5x1d0_56 a{text-decoration:none}._fixedHeight_5x1d0_68{height:200px;overflow:hidden;position:relative}._fixedHeight_5x1d0_68:after{content:"";position:absolute;z-index:1;bottom:0;left:0;right:0;pointer-events:none;background-image:linear-gradient(to bottom,#fff0,#fff 90%);width:100%;height:5em}