@logora/debate 0.3.12 → 0.3.13

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.
@@ -36,7 +36,7 @@ const Xe = ({
36
36
  commentsCount: ae,
37
37
  hideShowResultButton: U = !1
38
38
  }) => {
39
- const [H, p] = N(!0), [i, R] = N(void 0), [_, f] = N(!1), [u, ne] = N(
39
+ const [H, p] = N(!0), [c, R] = N(void 0), [_, f] = N(!1), [u, ne] = N(
40
40
  Number.parseFloat(S.total) || Object.values(S).reduce(
41
41
  (e, t) => e + Number.parseFloat(t),
42
42
  0
@@ -69,7 +69,7 @@ const Xe = ({
69
69
  )
70
70
  }
71
71
  ), e;
72
- }, [c, z] = N(le()), J = xe(), de = Se(), A = Be(), ue = Me(), v = Ne(), { isLoggedIn: x, isLoggingIn: K } = Ve();
72
+ }, [i, z] = N(le()), J = xe(), de = Se(), A = Be(), ue = Me(), v = Ne(), { isLoggedIn: x, isLoggingIn: K } = Ve();
73
73
  L(() => {
74
74
  K === !1 && (x ? fe(g) : p(!1));
75
75
  }, [K, x]), L(() => {
@@ -78,8 +78,8 @@ const Xe = ({
78
78
  e && (t ? X(t) : f(!0));
79
79
  }
80
80
  }, [H]), L(() => {
81
- C && C(i);
82
- }, [i]);
81
+ C && C(c);
82
+ }, [c]);
83
83
  const me = () => {
84
84
  if (b && Object.keys(b).length !== 0)
85
85
  return b.groupId === g && b.voteableType === h ? [!0, b.positionId] : (D(), [!1, !1]);
@@ -88,7 +88,7 @@ const Xe = ({
88
88
  ), t = !!e.get("initVote"), a = Number.parseInt(e.get("positionId")) || !1;
89
89
  return [t, a];
90
90
  }, fe = (e) => {
91
- p(!0), C && C(i), A.getOneWithToken("votes", `${h.toLowerCase()}/${e}`, {}).then((t) => {
91
+ p(!0), C && C(c), A.getOneWithToken("votes", `${h.toLowerCase()}/${e}`, {}).then((t) => {
92
92
  t.data.data.resource ? (R(t.data.data.resource), f(!0), p(!1)) : (p(!1), f(!1));
93
93
  }).catch((t) => {
94
94
  p(!1);
@@ -103,7 +103,7 @@ const Xe = ({
103
103
  groupId: g,
104
104
  voteableType: h,
105
105
  positionId: e
106
- }), i ? (ge(e, i.position_id), _ === !1 && y(), e !== i.position_id && A.update("votes", i.id, t).then((n) => {
106
+ }), c ? (ge(e, c.position_id), _ === !1 && y(), e !== c.position_id && A.update("votes", c.id, t).then((n) => {
107
107
  n.data.success && (R(n.data.data.resource), G(
108
108
  v.formatMessage({
109
109
  id: "header.vote_confirm_modal",
@@ -121,7 +121,7 @@ const Xe = ({
121
121
  ));
122
122
  }));
123
123
  }, he = (e) => {
124
- const t = c[e].count + 1, a = u + 1, n = {};
124
+ const t = i[e].count + 1, a = u + 1, n = {};
125
125
  r.forEach((M) => {
126
126
  if (e === M.id)
127
127
  n[M.id] = {
@@ -129,7 +129,7 @@ const Xe = ({
129
129
  percentage: B(t, a)
130
130
  };
131
131
  else {
132
- const Z = c[M.id].count;
132
+ const Z = i[M.id].count;
133
133
  n[M.id] = {
134
134
  count: Z,
135
135
  percentage: B(Z, a)
@@ -139,18 +139,18 @@ const Xe = ({
139
139
  }, ge = (e, t) => {
140
140
  if (t !== e) {
141
141
  const a = {
142
- ...c,
142
+ ...i,
143
143
  [t]: {
144
- count: c[t].count - 1,
144
+ count: i[t].count - 1,
145
145
  percentage: B(
146
- c[t].count - 1,
146
+ i[t].count - 1,
147
147
  u
148
148
  )
149
149
  },
150
150
  [e]: {
151
- count: c[e].count + 1,
151
+ count: i[e].count + 1,
152
152
  percentage: B(
153
- c[e].count + 1,
153
+ i[e].count + 1,
154
154
  u
155
155
  )
156
156
  }
@@ -164,7 +164,7 @@ const Xe = ({
164
164
  });
165
165
  return w + `?${t.toString()}`;
166
166
  }, X = (e) => {
167
- x ? Object.keys(c).includes(e.toString()) && (ve(e), D()) : (Object.keys(c).includes(e.toString()) && re({
167
+ x ? Object.keys(i).includes(e.toString()) && (ve(e), D()) : (Object.keys(i).includes(e.toString()) && re({
168
168
  groupId: g,
169
169
  voteableType: h,
170
170
  positionId: e
@@ -234,7 +234,7 @@ const Xe = ({
234
234
  children: [
235
235
  a,
236
236
  " ",
237
- i && i.position_id === e.id ? /* @__PURE__ */ s(
237
+ c && c.position_id === e.id ? /* @__PURE__ */ s(
238
238
  "span",
239
239
  {
240
240
  title: v.formatMessage({
@@ -251,12 +251,12 @@ const Xe = ({
251
251
  /* @__PURE__ */ l(
252
252
  Re,
253
253
  {
254
- progress: c[e.id].percentage / 100,
254
+ progress: i[e.id].percentage / 100,
255
255
  goal: 1,
256
256
  className: o.progress,
257
257
  innerClassName: o.progressBar,
258
258
  children: [
259
- c[e.id].percentage,
259
+ i[e.id].percentage,
260
260
  "%"
261
261
  ]
262
262
  }
@@ -272,7 +272,7 @@ const Xe = ({
272
272
  defaultMessage: "{votesCount} votes"
273
273
  }
274
274
  ) }),
275
- !V && /* @__PURE__ */ s("div", { children: i ? /* @__PURE__ */ s(
275
+ !V && /* @__PURE__ */ s("div", { children: c ? /* @__PURE__ */ s(
276
276
  "button",
277
277
  {
278
278
  "data-tid": "action_edit_vote",
@@ -368,7 +368,7 @@ const Xe = ({
368
368
  o.voteBoxShowResultContainer,
369
369
  { [I]: I }
370
370
  ),
371
- children: /* @__PURE__ */ s("div", { className: o.voteBoxShowResult, children: U ? !i && !_ && /* @__PURE__ */ s("div", { className: o.voteResultInfoText, children: v.formatMessage({
371
+ children: /* @__PURE__ */ s("div", { className: o.voteBoxShowResult, children: U ? !_ && /* @__PURE__ */ s("div", { className: o.voteResultInfoText, children: v.formatMessage({
372
372
  id: "vote.vote_box.result_after_vote",
373
373
  defaultMessage: "Le résultat s'affichera après le vote."
374
374
  }) }) : typeof window < "u" && !w ? /* @__PURE__ */ s(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",