@logora/debate 0.4.46 → 0.4.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { jsx as s, Fragment as pe, jsxs as d } from "react/jsx-runtime";
2
2
  import P from "@rooks/use-sessionstorage-state";
3
- import l from "classnames";
3
+ import c from "classnames";
4
4
  import { useState as b, useEffect as k } from "react";
5
5
  import { useIntl as _e, FormattedMessage as m } from "react-intl";
6
6
  import { useLocation as be } from "react-router";
@@ -34,7 +34,7 @@ const We = ({
34
34
  commentsCount: se,
35
35
  hideShowResultButton: H = !1
36
36
  }) => {
37
- const [$, g] = b(!0), [c, y] = b(void 0), [p, f] = b(!1), [u, ae] = b(
37
+ const [$, g] = b(!0), [l, R] = b(void 0), [p, f] = b(!1), [u, ae] = b(
38
38
  Number.parseFloat(N.total) || Object.values(N).reduce(
39
39
  (e, t) => e + Number.parseFloat(t),
40
40
  0
@@ -57,7 +57,7 @@ const We = ({
57
57
  ), [_, ne, G] = P(
58
58
  "storedUserVote",
59
59
  {}
60
- ), [ye, re, ie] = P("userSide", {}), { toast: W } = Ne() || {}, ce = () => {
60
+ ), [Re, re, ie] = P("userSide", {}), { toast: W } = Ne() || {}, le = () => {
61
61
  const e = {};
62
62
  return r?.forEach(
63
63
  (t) => e[t.id] = {
@@ -67,7 +67,7 @@ const We = ({
67
67
  )
68
68
  }
69
69
  ), e;
70
- }, [i, z] = b(ce()), J = Se(), le = be(), A = we(), R = Be(), B = _e(), { isLoggedIn: C, isLoggingIn: K } = Ce();
70
+ }, [i, z] = b(le()), J = Se(), ce = be(), y = we(), A = Be(), B = _e(), { isLoggedIn: C, isLoggingIn: K } = Ce();
71
71
  k(() => {
72
72
  K === !1 && (C ? ue(h) : g(!1));
73
73
  }, [K, C]), k(() => {
@@ -76,18 +76,18 @@ const We = ({
76
76
  e && (t ? X(t) : f(!0));
77
77
  }
78
78
  }, [$]), k(() => {
79
- w && w(c);
80
- }, [c]);
79
+ w && w(l);
80
+ }, [l]);
81
81
  const de = () => {
82
82
  if (_ && Object.keys(_).length !== 0)
83
83
  return _.groupId === h && _.voteableType === v ? [!0, _.positionId] : (G(), [!1, !1]);
84
84
  const e = new URLSearchParams(
85
- typeof window < "u" ? window.location.search : le.search
85
+ typeof window < "u" ? window.location.search : ce.search
86
86
  ), t = !!e.get("initVote"), a = Number.parseInt(e.get("positionId")) || !1;
87
87
  return [t, a];
88
88
  }, ue = (e) => {
89
- g(!0), w && w(c), A.getOneWithToken("votes", `${v.toLowerCase()}/${e}`, {}).then((t) => {
90
- t.data.data.resource ? (y(t.data.data.resource), f(!0), g(!1)) : (g(!1), f(!1));
89
+ g(!0), w && w(l), y.getOneWithToken("votes", `${v.toLowerCase()}/${e}`, {}).then((t) => {
90
+ t.data.data.resource ? (R(t.data.data.resource), f(!0), g(!1)) : (g(!1), f(!1));
91
91
  }).catch((t) => {
92
92
  g(!1);
93
93
  });
@@ -101,16 +101,16 @@ const We = ({
101
101
  groupId: h,
102
102
  voteableType: v,
103
103
  positionId: e
104
- }), c ? (ve(e, c.position_id), p === !1 && L(), e !== c.position_id && A.update("votes", c.id, t).then((n) => {
105
- n.data.success && (y(n.data.data.resource), W(
104
+ }), l ? (ve(e, l.position_id), p === !1 && L(), e !== l.position_id && y.update("votes", l.id, t).then((n) => {
105
+ n.data.success && (R(n.data.data.resource), W(
106
106
  B.formatMessage({
107
107
  id: "header.vote_confirm_modal",
108
108
  defaultMessage: "Your vote has been saved !"
109
109
  }),
110
110
  { type: "success" }
111
111
  ));
112
- })) : (fe(e), L(), A.create("votes", t).then((n) => {
113
- n.data.success && (y(n.data.data.resource), W(
112
+ })) : (fe(e), L(), y.create("votes", t).then((n) => {
113
+ n.data.success && (R(n.data.data.resource), W(
114
114
  B.formatMessage({
115
115
  id: "header.vote_confirm_modal",
116
116
  defaultMessage: "Your vote has been saved !"
@@ -176,7 +176,7 @@ const We = ({
176
176
  return /* @__PURE__ */ s(
177
177
  "div",
178
178
  {
179
- className: l(o.voteAction, {
179
+ className: c(o.voteAction, {
180
180
  [o.buttonAlignLeft]: o.buttonAlignLeft
181
181
  }),
182
182
  children: /* @__PURE__ */ s(
@@ -185,7 +185,7 @@ const We = ({
185
185
  "data-tid": "action_vote",
186
186
  type: "button",
187
187
  title: a,
188
- className: l(o.voteButton, {
188
+ className: c(o.voteButton, {
189
189
  [o.textAlignLeft]: ee,
190
190
  [I]: I
191
191
  }),
@@ -200,7 +200,7 @@ const We = ({
200
200
  "div",
201
201
  {
202
202
  "data-tid": "action_vote",
203
- className: l(o.voteButtonThesis, {
203
+ className: c(o.voteButtonThesis, {
204
204
  [o.voteButtonThesisSynthesisMobile]: !j
205
205
  }),
206
206
  children: a
@@ -212,18 +212,18 @@ const We = ({
212
212
  t
213
213
  );
214
214
  }, ge = () => {
215
- C || R.actions?.unloggedVoteResults === !0 ? f(!0) : J({ loginAction: "vote" });
215
+ C || A.actions?.unloggedVoteResults === !0 ? f(!0) : J({ loginAction: "vote" });
216
216
  };
217
217
  return /* @__PURE__ */ s(
218
218
  "div",
219
219
  {
220
- className: l(o.voteBox, { [F]: F }),
220
+ className: c(o.voteBox, { [F]: F }),
221
221
  children: /* @__PURE__ */ s(pe, { children: p || M ? /* @__PURE__ */ d("div", { className: o.voteResultsBox, "data-testid": "voteResultsBox", children: [
222
222
  /* @__PURE__ */ s(
223
223
  "div",
224
224
  {
225
- className: l(o.voteResults, {
226
- [o.voteResultsOutlined]: R.layout?.outlinedVoteButtons
225
+ className: c(o.voteResults, {
226
+ [o.voteResultsOutlined]: A.layout?.outlinedVoteResults
227
227
  }),
228
228
  children: r.map((e, t) => {
229
229
  let a;
@@ -231,14 +231,14 @@ const We = ({
231
231
  /* @__PURE__ */ d(
232
232
  "div",
233
233
  {
234
- className: t > 0 ? l(
234
+ className: t > 0 ? c(
235
235
  o.voteProgressHeader,
236
236
  o.voteProgressHeaderAgainst
237
237
  ) : o.voteProgressHeader,
238
238
  children: [
239
239
  a,
240
240
  " ",
241
- c && c.position_id === e.id ? /* @__PURE__ */ s(
241
+ l && l.position_id === e.id ? /* @__PURE__ */ s(
242
242
  "span",
243
243
  {
244
244
  title: B.formatMessage({
@@ -278,7 +278,7 @@ const We = ({
278
278
  defaultMessage: "{votesCount} votes"
279
279
  }
280
280
  ) }),
281
- !M && /* @__PURE__ */ s("div", { children: c ? /* @__PURE__ */ s(
281
+ !M && /* @__PURE__ */ s("div", { children: l ? /* @__PURE__ */ s(
282
282
  "button",
283
283
  {
284
284
  "data-tid": "action_edit_vote",
@@ -313,9 +313,9 @@ const We = ({
313
313
  /* @__PURE__ */ s(
314
314
  "div",
315
315
  {
316
- className: l(o.voteBoxActionsBody, {
316
+ className: c(o.voteBoxActionsBody, {
317
317
  [o.voteBoxActionsBodyColumn]: j,
318
- [o.voteBoxActionsBodyOutlined]: R.layout?.outlinedVoteButtons,
318
+ [o.voteBoxActionsBodyOutlined]: A.layout?.outlinedVoteButtons,
319
319
  [E]: E
320
320
  }),
321
321
  children: r.map(
@@ -350,7 +350,7 @@ const We = ({
350
350
  /* @__PURE__ */ s(
351
351
  "div",
352
352
  {
353
- className: l(
353
+ className: c(
354
354
  o.voteBoxActions,
355
355
  o.voteBoxShowResultContainer,
356
356
  { [U]: U }
@@ -366,7 +366,7 @@ const We = ({
366
366
  "data-tid": "show_vote_result",
367
367
  "data-testid": "show-result",
368
368
  className: o.showResultButton,
369
- children: /* @__PURE__ */ s("span", { className: l(o.boldShowResult, o.outlined), children: /* @__PURE__ */ s(
369
+ children: /* @__PURE__ */ s("span", { className: c(o.boldShowResult, o.outlined), children: /* @__PURE__ */ s(
370
370
  m,
371
371
  {
372
372
  id: "vote.vote_box.show_result",
@@ -383,7 +383,7 @@ const We = ({
383
383
  target: "_top",
384
384
  external: !0,
385
385
  "data-testid": "show-result",
386
- children: /* @__PURE__ */ s("span", { className: l(o.boldShowResult, o.outlined), children: /* @__PURE__ */ s(
386
+ children: /* @__PURE__ */ s("span", { className: c(o.boldShowResult, o.outlined), children: /* @__PURE__ */ s(
387
387
  m,
388
388
  {
389
389
  id: "vote.vote_box.show_result",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.4.46",
3
+ "version": "0.4.47",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",