@logora/debate 0.4.93 → 0.4.95
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.
- package/dist/assets/components/embed/embed_header/EmbedHeader.module-BiboXUr0.css +1 -0
- package/dist/components/embed/embed_header/EmbedHeader.js +34 -32
- package/dist/components/embed/embed_header/EmbedHeader.module.scss.js +8 -8
- package/dist/components/vote/vote_box/VoteBox.js +193 -190
- package/package.json +1 -1
- package/dist/assets/components/embed/embed_header/EmbedHeader.module-C8RPiVBp.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._headerBox_p2vn2_3{display:flex!important;flex-direction:column!important;padding:0!important}._headerBoxLabel_p2vn2_9{display:flex!important;justify-content:flex-start!important;align-items:center!important;flex-wrap:wrap!important;gap:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))}._headerBoxLabel_p2vn2_9>._titleRedirectUrl_p2vn2_16{background:var(--background-color-primary, white)!important}._headerBoxLabel_p2vn2_9>._titleRedirectUrl_p2vn2_16:hover{background:var(--background-color-primary, white)!important}._headerBoxLabel_p2vn2_9 a{text-decoration:none!important}._headerLiveStat_p2vn2_27{margin-left:auto!important;margin-right:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;display:flex!important;align-items:center!important;justify-content:flex-end!important;color:var(--call-primary-color, #434343);font-size:var(--font-size-small, 16px);margin-left:30px}._headerLiveStat_p2vn2_27 span{margin-left:10px;margin-bottom:0!important}@media(prefers-color-scheme:dark){.logoraDarkMode ._headerLiveStat_p2vn2_27{color:#fff!important}.logoraDarkMode ._headerLiveNow_p2vn2_46{background-color:#fff!important}.logoraDarkMode ._headerLiveNow_p2vn2_46:before{background-color:#fff!important}}._headerLiveNow_p2vn2_46{min-width:8px;width:8px;height:8px;border-radius:50%;background-color:var(--call-primary-color, #434343);position:relative}._headerLiveNow_p2vn2_46:before{content:"";position:absolute;width:100%;height:100%;border-radius:50%;background-color:var(--call-primary-color, #434343);opacity:.4;animation-name:_livePin_p2vn2_1;animation-duration:1.6s;animation-iteration-count:infinite}@container (min-width: 576px){._headerLivePin_p2vn2_75{display:block!important}}._headerLivePin_p2vn2_75{display:none!important}@container (min-width: 576px){._headerLivePinMobile_p2vn2_84{display:none!important}}._headerLivePinMobile_p2vn2_84{display:block!important}@keyframes _livePin_p2vn2_1{0%{transform:scale(2.3)}50%{transform:scale(0)}to{transform:scale(2.3)}}._headerLabelText_p2vn2_103{background-color:var(--call-primary-color, #434343);color:var(--text-light, white);border-bottom:1px solid;border-color:var(--call-primary-color, #434343);border-radius:var(--box-border-radius, 6px) 0 var(--box-border-radius, 6px) 0;font-size:var(--font-size-normal, 16px);flex-wrap:nowrap;white-space:nowrap;padding-right:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;padding-left:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;padding-top:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;padding-bottom:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._debateName_p2vn2_118{color:var(--text-primary, #222222);font-weight:var(--font-weight-bold, 700);font-variation-settings:var(--font-variation-bold, normal);text-align:center;width:100%;display:flex!important;align-items:center!important;justify-content:center!important;padding-bottom:0!important;padding-top:var(--space-unit, 1em)!important;padding-right:var(--space-unit, 1em)!important;padding-left:var(--space-unit, 1em)!important}@container (min-width: 576px){._debateName_p2vn2_118{padding-right:0!important}}@container (min-width: 576px){._debateName_p2vn2_118{padding-left:0!important}}._debateName_p2vn2_118 a._debateLink_p2vn2_142{color:var(--text-primary, #222222)!important}._debateLink_p2vn2_142{font-size:var(--font-size-large, 20px);line-height:var(--line-height-normal, 1.26em);background:var(--background-color-primary, white)!important;text-decoration:none!important;color:var(--text-primary, #222222);font-weight:var(--font-weight-bold, 700);font-variation-settings:var(--font-variation-bold, normal)}._debateLink_p2vn2_142:hover{background:var(--background-color-primary, white)!important;text-decoration:underline!important}._left_p2vn2_160{justify-content:flex-start!important;padding-right:var(--space-unit, 1em)!important;padding-left:var(--space-unit, 1em)!important;padding-top:var(--space-unit, 1em)!important;padding-bottom:0!important;text-align:left}._headerLogo_p2vn2_169{width:100px!important;height:40px!important;object-fit:contain;object-position:left}._debateNameWithLogo_p2vn2_176{padding-right:0!important;padding-left:0!important}
|
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import o from "classnames";
|
|
3
3
|
import "react";
|
|
4
|
-
import { FormattedMessage as
|
|
4
|
+
import { FormattedMessage as r } from "react-intl";
|
|
5
5
|
import e from "./EmbedHeader.module.scss.js";
|
|
6
|
-
import { Link as
|
|
7
|
-
const
|
|
8
|
-
title:
|
|
9
|
-
titleRedirectUrl:
|
|
10
|
-
headerLabel:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
import { Link as m } from "../../action/link/Link.js";
|
|
7
|
+
const g = ({
|
|
8
|
+
title: c,
|
|
9
|
+
titleRedirectUrl: n,
|
|
10
|
+
headerLabel: t,
|
|
11
|
+
headerExtra: d,
|
|
12
|
+
onlineUsersCount: i,
|
|
13
|
+
textLeft: h,
|
|
14
|
+
className: u,
|
|
15
|
+
logoUrl: s,
|
|
15
16
|
logoAlt: b
|
|
16
|
-
}) => /* @__PURE__ */
|
|
17
|
-
|
|
18
|
-
/* @__PURE__ */ a(
|
|
19
|
-
|
|
17
|
+
}) => /* @__PURE__ */ l("div", { className: o(e.headerBox, u), children: [
|
|
18
|
+
(t || d) && /* @__PURE__ */ l("div", { className: e.headerBoxLabel, children: [
|
|
19
|
+
t && /* @__PURE__ */ a(
|
|
20
|
+
m,
|
|
20
21
|
{
|
|
21
|
-
to:
|
|
22
|
+
to: n,
|
|
22
23
|
target: "_top",
|
|
23
24
|
external: !0,
|
|
24
25
|
"data-tid": "link_debate_index_embed",
|
|
25
26
|
rel: "nofollow",
|
|
26
|
-
children:
|
|
27
|
+
children: s ? /* @__PURE__ */ a(
|
|
27
28
|
"img",
|
|
28
29
|
{
|
|
29
30
|
loading: "lazy",
|
|
30
31
|
className: e.headerLogo,
|
|
31
|
-
src:
|
|
32
|
+
src: s,
|
|
32
33
|
width: 100,
|
|
33
34
|
height: 40,
|
|
34
35
|
alt: b
|
|
35
36
|
}
|
|
36
|
-
) : /* @__PURE__ */ a("div", { className: e.headerLabelText, children:
|
|
37
|
+
) : /* @__PURE__ */ a("div", { className: e.headerLabelText, children: t })
|
|
37
38
|
}
|
|
38
39
|
),
|
|
39
|
-
|
|
40
|
+
d && /* @__PURE__ */ a("div", { className: e.headerLabelText, children: d }),
|
|
41
|
+
t && i ? /* @__PURE__ */ l("div", { className: e.headerLiveStat, children: [
|
|
40
42
|
/* @__PURE__ */ a("div", { className: e.headerLiveNow }),
|
|
41
43
|
/* @__PURE__ */ a(
|
|
42
44
|
"span",
|
|
@@ -44,10 +46,10 @@ const x = ({
|
|
|
44
46
|
className: e.headerLivePin,
|
|
45
47
|
"data-testid": "online-users-count",
|
|
46
48
|
children: /* @__PURE__ */ a(
|
|
47
|
-
|
|
49
|
+
r,
|
|
48
50
|
{
|
|
49
51
|
id: "embed.embed_header.online_users",
|
|
50
|
-
values: { count:
|
|
52
|
+
values: { count: i },
|
|
51
53
|
defaultMessage: "{count} online users"
|
|
52
54
|
}
|
|
53
55
|
)
|
|
@@ -59,10 +61,10 @@ const x = ({
|
|
|
59
61
|
className: e.headerLivePinMobile,
|
|
60
62
|
"data-testid": "online-users-count-mobile",
|
|
61
63
|
children: /* @__PURE__ */ a(
|
|
62
|
-
|
|
64
|
+
r,
|
|
63
65
|
{
|
|
64
66
|
id: "embed.embed_header.online",
|
|
65
|
-
values: { count:
|
|
67
|
+
values: { count: i },
|
|
66
68
|
defaultMessage: "{count} online"
|
|
67
69
|
}
|
|
68
70
|
)
|
|
@@ -73,26 +75,26 @@ const x = ({
|
|
|
73
75
|
/* @__PURE__ */ a(
|
|
74
76
|
"div",
|
|
75
77
|
{
|
|
76
|
-
className:
|
|
77
|
-
[e.left]:
|
|
78
|
-
[e.debateNameWithLogo]:
|
|
78
|
+
className: o(e.debateName, {
|
|
79
|
+
[e.left]: h,
|
|
80
|
+
[e.debateNameWithLogo]: s
|
|
79
81
|
}),
|
|
80
82
|
"data-testid": "debate-name",
|
|
81
83
|
children: /* @__PURE__ */ a(
|
|
82
|
-
|
|
84
|
+
m,
|
|
83
85
|
{
|
|
84
86
|
className: e.debateLink,
|
|
85
|
-
to:
|
|
87
|
+
to: n,
|
|
86
88
|
target: "_top",
|
|
87
89
|
external: !0,
|
|
88
90
|
"data-tid": "link_debate_title_embed",
|
|
89
91
|
rel: "nofollow",
|
|
90
|
-
children:
|
|
92
|
+
children: c
|
|
91
93
|
}
|
|
92
94
|
)
|
|
93
95
|
}
|
|
94
96
|
)
|
|
95
97
|
] });
|
|
96
98
|
export {
|
|
97
|
-
|
|
99
|
+
g as EmbedHeader
|
|
98
100
|
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import '../../../assets/components/embed/embed_header/EmbedHeader.module-
|
|
1
|
+
import '../../../assets/components/embed/embed_header/EmbedHeader.module-BiboXUr0.css';const e = "_headerBox_p2vn2_3", a = "_headerBoxLabel_p2vn2_9", t = "_headerLiveStat_p2vn2_27", o = "_headerLiveNow_p2vn2_46", _ = "_headerLivePin_p2vn2_75", d = "_headerLivePinMobile_p2vn2_84", n = "_headerLabelText_p2vn2_103", h = "_debateName_p2vn2_118", i = "_debateLink_p2vn2_142", L = "_left_p2vn2_160", r = "_headerLogo_p2vn2_169", v = "_debateNameWithLogo_p2vn2_176", b = {
|
|
2
2
|
headerBox: e,
|
|
3
3
|
headerBoxLabel: a,
|
|
4
4
|
headerLiveStat: t,
|
|
5
5
|
headerLiveNow: o,
|
|
6
6
|
headerLivePin: _,
|
|
7
7
|
headerLivePinMobile: d,
|
|
8
|
-
headerLabelText:
|
|
8
|
+
headerLabelText: n,
|
|
9
9
|
debateName: h,
|
|
10
10
|
debateLink: i,
|
|
11
11
|
left: L,
|
|
12
|
-
headerLogo:
|
|
13
|
-
debateNameWithLogo:
|
|
12
|
+
headerLogo: r,
|
|
13
|
+
debateNameWithLogo: v
|
|
14
14
|
};
|
|
15
15
|
export {
|
|
16
16
|
i as debateLink,
|
|
17
17
|
h as debateName,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
v as debateNameWithLogo,
|
|
19
|
+
b as default,
|
|
20
20
|
e as headerBox,
|
|
21
21
|
a as headerBoxLabel,
|
|
22
|
-
|
|
22
|
+
n as headerLabelText,
|
|
23
23
|
o as headerLiveNow,
|
|
24
24
|
_ as headerLivePin,
|
|
25
25
|
d as headerLivePinMobile,
|
|
26
26
|
t as headerLiveStat,
|
|
27
|
-
|
|
27
|
+
r as headerLogo,
|
|
28
28
|
L as left
|
|
29
29
|
};
|
|
@@ -1,207 +1,210 @@
|
|
|
1
|
-
import { jsx as s, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import { useLocation as
|
|
1
|
+
import { jsx as s, Fragment as be, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import u from "classnames";
|
|
3
|
+
import { useState as S, useEffect as y } from "react";
|
|
4
|
+
import { useIntl as Se, FormattedMessage as m } from "react-intl";
|
|
5
|
+
import { useLocation as we } from "react-router";
|
|
6
6
|
import o from "./VoteBox.module.scss.js";
|
|
7
|
-
import { useTranslatedContent as
|
|
8
|
-
import { useSessionStorageState as
|
|
9
|
-
import { useToast as
|
|
10
|
-
import { useAuthRequired as
|
|
11
|
-
import { useDataProvider as
|
|
12
|
-
import { useConfig as
|
|
13
|
-
import { useAuth as
|
|
14
|
-
import { Icon as
|
|
15
|
-
import { ProgressBar as
|
|
16
|
-
import { Link as
|
|
17
|
-
import { Button as
|
|
18
|
-
const
|
|
19
|
-
numberVotes:
|
|
20
|
-
votePositions:
|
|
21
|
-
voteableType:
|
|
22
|
-
voteableId:
|
|
23
|
-
redirectUrl:
|
|
24
|
-
displayColumn:
|
|
25
|
-
textAlignLeft:
|
|
26
|
-
showTotal:
|
|
27
|
-
voteBoxClassName:
|
|
28
|
-
buttonContainerClassName:
|
|
29
|
-
buttonClassName:
|
|
30
|
-
showResultClassName:
|
|
31
|
-
onVote:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
7
|
+
import { useTranslatedContent as O } from "../../translation/translated_content/useTranslatedContent.js";
|
|
8
|
+
import { useSessionStorageState as te } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
|
|
9
|
+
import { useToast as Be } from "../../dialog/toast_provider/useToast.js";
|
|
10
|
+
import { useAuthRequired as Ve } from "../../hooks/use_auth_required/useAuthRequired.js";
|
|
11
|
+
import { useDataProvider as Ce } from "../../data/data_provider/useDataProvider.js";
|
|
12
|
+
import { useConfig as xe } from "../../data/config_provider/useConfig.js";
|
|
13
|
+
import { useAuth as Ae } from "../../auth/use_auth/useAuth.js";
|
|
14
|
+
import { Icon as E } from "../../icons/icon/Icon.js";
|
|
15
|
+
import { ProgressBar as ye } from "../../progress/progress_bar/ProgressBar.js";
|
|
16
|
+
import { Link as Me } from "../../action/link/Link.js";
|
|
17
|
+
import { Button as Re } from "../../action/button/Button.js";
|
|
18
|
+
const Ke = ({
|
|
19
|
+
numberVotes: w,
|
|
20
|
+
votePositions: i,
|
|
21
|
+
voteableType: h,
|
|
22
|
+
voteableId: g,
|
|
23
|
+
redirectUrl: B,
|
|
24
|
+
displayColumn: I,
|
|
25
|
+
textAlignLeft: oe,
|
|
26
|
+
showTotal: se = !0,
|
|
27
|
+
voteBoxClassName: U,
|
|
28
|
+
buttonContainerClassName: H,
|
|
29
|
+
buttonClassName: $,
|
|
30
|
+
showResultClassName: q,
|
|
31
|
+
onVote: V,
|
|
32
|
+
onVoteCountsChange: ae,
|
|
33
|
+
disabled: M = !1,
|
|
34
|
+
showVotesCommentsNumber: ne = !1,
|
|
35
|
+
commentsCount: re,
|
|
36
|
+
hideShowResultButton: D = !1
|
|
36
37
|
}) => {
|
|
37
|
-
const [
|
|
38
|
-
Number.parseFloat(
|
|
38
|
+
const [C, p] = S(!0), [l, R] = S(void 0), [N, v] = S(!1), [c, G] = S(
|
|
39
|
+
Number.parseFloat(w.total) || Object.values(w).reduce(
|
|
39
40
|
(e, t) => e + Number.parseFloat(t),
|
|
40
41
|
0
|
|
41
42
|
) || 0
|
|
42
|
-
),
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
), W = O(
|
|
44
|
+
i[0]?.name,
|
|
45
|
+
i[0]?.language,
|
|
45
46
|
"name",
|
|
46
|
-
|
|
47
|
-
), Y =
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
i[0]?.translation_entries
|
|
48
|
+
), Y = O(
|
|
49
|
+
i[1]?.name,
|
|
50
|
+
i[1]?.language,
|
|
50
51
|
"name",
|
|
51
|
-
|
|
52
|
-
),
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
i[1]?.translation_entries
|
|
53
|
+
), z = O(
|
|
54
|
+
i[2]?.name,
|
|
55
|
+
i[2]?.language,
|
|
55
56
|
"name",
|
|
56
|
-
|
|
57
|
-
), [_,
|
|
57
|
+
i[2]?.translation_entries
|
|
58
|
+
), [_, ie, J] = te(
|
|
58
59
|
"storedUserVote",
|
|
59
60
|
{}
|
|
60
|
-
), [
|
|
61
|
+
), [Le, le, ce] = te("userSide", {}), { toast: de } = Be() || {}, ue = () => {
|
|
61
62
|
const e = {};
|
|
62
|
-
return
|
|
63
|
+
return i?.forEach(
|
|
63
64
|
(t) => e[t.id] = {
|
|
64
|
-
count: Number.parseFloat(
|
|
65
|
-
percentage:
|
|
66
|
-
100 * ((
|
|
65
|
+
count: Number.parseFloat(w[t.id]) || 0,
|
|
66
|
+
percentage: c === 0 ? 0 : Math.round(
|
|
67
|
+
100 * ((w[t.id] || 0) / c)
|
|
67
68
|
)
|
|
68
69
|
}
|
|
69
70
|
), e;
|
|
70
|
-
}, [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}, [
|
|
74
|
-
if (
|
|
75
|
-
const [e, t] =
|
|
76
|
-
e && (t ?
|
|
71
|
+
}, [n, L] = S(ue()), K = Ve(), fe = we(), k = Ce(), T = xe(), j = Se(), { isLoggedIn: x, isLoggingIn: Q } = Ae();
|
|
72
|
+
y(() => {
|
|
73
|
+
Q === !1 && (x ? ve(g) : p(!1));
|
|
74
|
+
}, [Q, x]), y(() => {
|
|
75
|
+
if (C === !1 && !B) {
|
|
76
|
+
const [e, t] = me();
|
|
77
|
+
e && (t ? P(t) : v(!0));
|
|
77
78
|
}
|
|
78
|
-
}, [
|
|
79
|
-
|
|
80
|
-
}, [l])
|
|
81
|
-
|
|
79
|
+
}, [C]), y(() => {
|
|
80
|
+
V && V(l);
|
|
81
|
+
}, [l]), y(() => {
|
|
82
|
+
ae?.({ total: c, counts: n });
|
|
83
|
+
}, [c, n]);
|
|
84
|
+
const me = () => {
|
|
82
85
|
if (_ && Object.keys(_).length !== 0)
|
|
83
|
-
return _.groupId ===
|
|
86
|
+
return _.groupId === g && _.voteableType === h ? [!0, _.positionId] : (J(), [!1, !1]);
|
|
84
87
|
const e = new URLSearchParams(
|
|
85
|
-
typeof window < "u" ? window.location.search :
|
|
88
|
+
typeof window < "u" ? window.location.search : fe.search
|
|
86
89
|
), t = !!e.get("initVote"), a = Number.parseInt(e.get("positionId")) || !1;
|
|
87
90
|
return [t, a];
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
t.data.data.resource ? (
|
|
91
|
+
}, ve = (e) => {
|
|
92
|
+
p(!0), V && V(l), k.getOneWithToken("votes", `${h.toLowerCase()}/${e}`, {}).then((t) => {
|
|
93
|
+
t.data.data.resource ? (R(t.data.data.resource), v(!0), p(!1)) : (p(!1), v(!1));
|
|
91
94
|
}).catch((t) => {
|
|
92
|
-
|
|
95
|
+
p(!1);
|
|
93
96
|
});
|
|
94
|
-
},
|
|
97
|
+
}, A = (e, t) => t === 0 ? 0 : Math.round(100 * (e / t)), X = ({ counts: e, total: t, vote: a }) => {
|
|
98
|
+
L(e), G(t), R(a);
|
|
99
|
+
}, he = (e) => {
|
|
95
100
|
const t = {
|
|
96
|
-
voteable_id:
|
|
97
|
-
voteable_type:
|
|
101
|
+
voteable_id: g,
|
|
102
|
+
voteable_type: h || "Group",
|
|
98
103
|
position_id: e
|
|
99
104
|
};
|
|
100
|
-
|
|
101
|
-
groupId:
|
|
102
|
-
voteableType:
|
|
105
|
+
le({
|
|
106
|
+
groupId: g,
|
|
107
|
+
voteableType: h,
|
|
103
108
|
positionId: e
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
})) : (me(e), k(), R.create("votes", t).then((n) => {
|
|
113
|
-
n.data.success && (M(n.data.data.resource), W(
|
|
114
|
-
C.formatMessage({
|
|
109
|
+
});
|
|
110
|
+
const r = {
|
|
111
|
+
counts: n,
|
|
112
|
+
total: c,
|
|
113
|
+
vote: l
|
|
114
|
+
}, f = (ee) => {
|
|
115
|
+
ee.data.success ? (R(ee.data.data.resource), de(
|
|
116
|
+
j.formatMessage({
|
|
115
117
|
id: "header.vote_confirm_modal",
|
|
116
118
|
defaultMessage: "Your vote has been saved !"
|
|
117
119
|
}),
|
|
118
120
|
{ type: "success" }
|
|
119
|
-
));
|
|
120
|
-
}));
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
)) : X(r);
|
|
122
|
+
}, b = () => X(r);
|
|
123
|
+
l ? (pe(e, l.position_id), N === !1 && F(), e !== l.position_id && k.update("votes", l.id, t).then(f, b)) : (ge(e), F(), k.create("votes", t).then(f, b));
|
|
124
|
+
}, ge = (e) => {
|
|
125
|
+
const t = n[e].count + 1, a = c + 1, r = {};
|
|
126
|
+
i.forEach((f) => {
|
|
127
|
+
if (e === f.id)
|
|
128
|
+
r[f.id] = {
|
|
126
129
|
count: t,
|
|
127
|
-
percentage:
|
|
130
|
+
percentage: A(t, a)
|
|
128
131
|
};
|
|
129
132
|
else {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
count:
|
|
133
|
-
percentage:
|
|
133
|
+
const b = n[f.id].count;
|
|
134
|
+
r[f.id] = {
|
|
135
|
+
count: b,
|
|
136
|
+
percentage: A(b, a)
|
|
134
137
|
};
|
|
135
138
|
}
|
|
136
|
-
}),
|
|
137
|
-
},
|
|
139
|
+
}), L(r), G(a);
|
|
140
|
+
}, pe = (e, t) => {
|
|
138
141
|
if (t !== e) {
|
|
139
142
|
const a = {
|
|
140
|
-
...
|
|
143
|
+
...n,
|
|
141
144
|
[t]: {
|
|
142
|
-
count:
|
|
143
|
-
percentage:
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
count: n[t].count - 1,
|
|
146
|
+
percentage: A(
|
|
147
|
+
n[t].count - 1,
|
|
148
|
+
c
|
|
146
149
|
)
|
|
147
150
|
},
|
|
148
151
|
[e]: {
|
|
149
|
-
count:
|
|
150
|
-
percentage:
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
count: n[e].count + 1,
|
|
153
|
+
percentage: A(
|
|
154
|
+
n[e].count + 1,
|
|
155
|
+
c
|
|
153
156
|
)
|
|
154
157
|
}
|
|
155
158
|
};
|
|
156
|
-
|
|
159
|
+
L(a);
|
|
157
160
|
}
|
|
158
|
-
},
|
|
161
|
+
}, Z = (e) => {
|
|
159
162
|
const t = new URLSearchParams({
|
|
160
163
|
initVote: "true",
|
|
161
164
|
...e && { positionId: e }
|
|
162
165
|
});
|
|
163
|
-
return
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
groupId:
|
|
167
|
-
voteableType:
|
|
166
|
+
return B + `?${t.toString()}`;
|
|
167
|
+
}, P = (e) => {
|
|
168
|
+
C || (x ? Object.keys(n).includes(e.toString()) && (he(e), J()) : (Object.keys(n).includes(e.toString()) && ie({
|
|
169
|
+
groupId: g,
|
|
170
|
+
voteableType: h,
|
|
168
171
|
positionId: e
|
|
169
|
-
}),
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
},
|
|
172
|
+
}), K({ loginAction: "vote" })));
|
|
173
|
+
}, F = () => {
|
|
174
|
+
N && ce(), v(!N);
|
|
175
|
+
}, Ne = (e, t) => {
|
|
173
176
|
let a;
|
|
174
|
-
t === 0 ? a =
|
|
175
|
-
const
|
|
177
|
+
t === 0 ? a = W.translatedContent : t === 1 ? a = Y.translatedContent : t === 2 && (a = z.translatedContent);
|
|
178
|
+
const r = typeof window < "u" && !B;
|
|
176
179
|
return /* @__PURE__ */ s(
|
|
177
180
|
"div",
|
|
178
181
|
{
|
|
179
|
-
className:
|
|
182
|
+
className: u(o.voteAction, {
|
|
180
183
|
[o.buttonAlignLeft]: o.buttonAlignLeft
|
|
181
184
|
}),
|
|
182
185
|
children: /* @__PURE__ */ s(
|
|
183
|
-
|
|
186
|
+
Re,
|
|
184
187
|
{
|
|
185
188
|
"data-tid": "action_vote",
|
|
186
189
|
type: "button",
|
|
187
190
|
title: a,
|
|
188
|
-
className:
|
|
189
|
-
[o.textAlignLeft]:
|
|
190
|
-
[
|
|
191
|
+
className: u(o.voteButton, {
|
|
192
|
+
[o.textAlignLeft]: oe,
|
|
193
|
+
[$]: $
|
|
191
194
|
}),
|
|
192
|
-
onClick:
|
|
193
|
-
disabled:
|
|
195
|
+
onClick: r ? () => P(e.id) : null,
|
|
196
|
+
disabled: M || r && C,
|
|
194
197
|
"data-testid": "voteButton",
|
|
195
|
-
to:
|
|
196
|
-
target:
|
|
197
|
-
rel:
|
|
198
|
-
external:
|
|
198
|
+
to: r ? null : Z(e.id),
|
|
199
|
+
target: r ? null : "_top",
|
|
200
|
+
rel: r ? null : "nofollow",
|
|
201
|
+
external: r ? null : !0,
|
|
199
202
|
children: /* @__PURE__ */ s(
|
|
200
203
|
"div",
|
|
201
204
|
{
|
|
202
205
|
"data-tid": "action_vote",
|
|
203
|
-
className:
|
|
204
|
-
[o.voteButtonThesisSynthesisMobile]: !
|
|
206
|
+
className: u(o.voteButtonThesis, {
|
|
207
|
+
[o.voteButtonThesisSynthesisMobile]: !I
|
|
205
208
|
}),
|
|
206
209
|
children: a
|
|
207
210
|
}
|
|
@@ -211,21 +214,21 @@ const We = ({
|
|
|
211
214
|
},
|
|
212
215
|
t
|
|
213
216
|
);
|
|
214
|
-
},
|
|
215
|
-
x ||
|
|
217
|
+
}, _e = () => {
|
|
218
|
+
x || T.actions?.unloggedVoteResults === !0 ? v(!0) : K({ loginAction: "vote" });
|
|
216
219
|
};
|
|
217
220
|
return /* @__PURE__ */ s(
|
|
218
221
|
"div",
|
|
219
222
|
{
|
|
220
|
-
className:
|
|
221
|
-
children: /* @__PURE__ */ s(
|
|
222
|
-
/* @__PURE__ */ s("div", { className: o.voteResults, children:
|
|
223
|
+
className: u(o.voteBox, { [U]: U }),
|
|
224
|
+
children: /* @__PURE__ */ s(be, { children: N || M ? /* @__PURE__ */ d("div", { className: o.voteResultsBox, "data-testid": "voteResultsBox", children: [
|
|
225
|
+
/* @__PURE__ */ s("div", { className: o.voteResults, children: i.map((e, t) => {
|
|
223
226
|
let a;
|
|
224
|
-
return t === 0 ? a =
|
|
225
|
-
/* @__PURE__ */
|
|
227
|
+
return t === 0 ? a = W.translatedContent : t === 1 ? a = Y.translatedContent : t === 2 && (a = z.translatedContent), /* @__PURE__ */ d("div", { children: [
|
|
228
|
+
/* @__PURE__ */ d(
|
|
226
229
|
"div",
|
|
227
230
|
{
|
|
228
|
-
className: t > 0 ?
|
|
231
|
+
className: t > 0 ? u(
|
|
229
232
|
o.voteProgressHeader,
|
|
230
233
|
o.voteProgressHeaderAgainst
|
|
231
234
|
) : o.voteProgressHeader,
|
|
@@ -235,64 +238,64 @@ const We = ({
|
|
|
235
238
|
l && l.position_id === e.id ? /* @__PURE__ */ s(
|
|
236
239
|
"span",
|
|
237
240
|
{
|
|
238
|
-
title:
|
|
241
|
+
title: j.formatMessage({
|
|
239
242
|
id: "vote.vote_box.vote_side"
|
|
240
243
|
}) + a,
|
|
241
244
|
className: o.sideIcon,
|
|
242
245
|
"aria-hidden": "true",
|
|
243
|
-
children: /* @__PURE__ */ s(
|
|
246
|
+
children: /* @__PURE__ */ s(E, { name: "checkbox", width: 16, height: 16 })
|
|
244
247
|
}
|
|
245
248
|
) : null
|
|
246
249
|
]
|
|
247
250
|
}
|
|
248
251
|
),
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
|
|
252
|
+
/* @__PURE__ */ d(
|
|
253
|
+
ye,
|
|
251
254
|
{
|
|
252
|
-
progress:
|
|
255
|
+
progress: n[e.id].percentage / 100,
|
|
253
256
|
goal: 1,
|
|
254
257
|
className: o.progress,
|
|
255
258
|
innerClassName: o.progressBar,
|
|
256
259
|
children: [
|
|
257
|
-
|
|
260
|
+
n[e.id].percentage,
|
|
258
261
|
"%"
|
|
259
262
|
]
|
|
260
263
|
}
|
|
261
264
|
)
|
|
262
265
|
] }, t);
|
|
263
266
|
}) }),
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
-
|
|
266
|
-
|
|
267
|
+
/* @__PURE__ */ d("div", { className: o.voteBoxFooter, children: [
|
|
268
|
+
se && /* @__PURE__ */ s("div", { className: o.voteResultsNumberVoters, children: /* @__PURE__ */ s(
|
|
269
|
+
m,
|
|
267
270
|
{
|
|
268
271
|
id: "vote.vote_box.votes",
|
|
269
|
-
values: { votesCount:
|
|
272
|
+
values: { votesCount: c },
|
|
270
273
|
defaultMessage: "{votesCount} votes"
|
|
271
274
|
}
|
|
272
275
|
) }),
|
|
273
|
-
!
|
|
276
|
+
!M && /* @__PURE__ */ s("div", { children: l ? /* @__PURE__ */ s(
|
|
274
277
|
"button",
|
|
275
278
|
{
|
|
276
279
|
"data-tid": "action_edit_vote",
|
|
277
280
|
className: o.voteActionButton,
|
|
278
281
|
type: "button",
|
|
279
|
-
onClick:
|
|
282
|
+
onClick: F,
|
|
280
283
|
children: /* @__PURE__ */ s(
|
|
281
|
-
|
|
284
|
+
m,
|
|
282
285
|
{
|
|
283
286
|
id: "vote.vote_box.update",
|
|
284
287
|
defaultMessage: "Modify"
|
|
285
288
|
}
|
|
286
289
|
)
|
|
287
290
|
}
|
|
288
|
-
) :
|
|
291
|
+
) : !D && /* @__PURE__ */ s(
|
|
289
292
|
"button",
|
|
290
293
|
{
|
|
291
294
|
type: "button",
|
|
292
295
|
className: o.voteActionButton,
|
|
293
|
-
onClick: () =>
|
|
296
|
+
onClick: () => v(!1),
|
|
294
297
|
children: /* @__PURE__ */ s(
|
|
295
|
-
|
|
298
|
+
m,
|
|
296
299
|
{
|
|
297
300
|
id: "vote.vote_box.back",
|
|
298
301
|
defaultMessage: "Back to vote"
|
|
@@ -301,40 +304,40 @@ const We = ({
|
|
|
301
304
|
}
|
|
302
305
|
) })
|
|
303
306
|
] })
|
|
304
|
-
] }) : /* @__PURE__ */
|
|
307
|
+
] }) : /* @__PURE__ */ d("div", { className: o.voteBoxActions, children: [
|
|
305
308
|
/* @__PURE__ */ s(
|
|
306
309
|
"div",
|
|
307
310
|
{
|
|
308
|
-
className:
|
|
309
|
-
[o.voteBoxActionsBodyColumn]:
|
|
310
|
-
[o.voteBoxActionsBodyOutlined]:
|
|
311
|
-
[o.voteBoxActionsBodyFilledNeutral]:
|
|
312
|
-
[
|
|
311
|
+
className: u(o.voteBoxActionsBody, {
|
|
312
|
+
[o.voteBoxActionsBodyColumn]: I,
|
|
313
|
+
[o.voteBoxActionsBodyOutlined]: T.layout?.outlinedVoteButtons,
|
|
314
|
+
[o.voteBoxActionsBodyFilledNeutral]: T.layout?.filledNeutralVoteButton,
|
|
315
|
+
[H]: H
|
|
313
316
|
}),
|
|
314
|
-
children:
|
|
315
|
-
(e, t) =>
|
|
317
|
+
children: i.map(
|
|
318
|
+
(e, t) => Ne(e, t)
|
|
316
319
|
)
|
|
317
320
|
}
|
|
318
321
|
),
|
|
319
|
-
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
-
/* @__PURE__ */ s(
|
|
322
|
+
ne && /* @__PURE__ */ d("div", { className: o.voteCommentCounts, children: [
|
|
323
|
+
/* @__PURE__ */ d("div", { className: o.debateNumberItem, children: [
|
|
324
|
+
/* @__PURE__ */ s(E, { name: "votebox", width: 20, height: 20 }),
|
|
322
325
|
/* @__PURE__ */ s("div", { className: o.debateNumberLabel, children: /* @__PURE__ */ s(
|
|
323
|
-
|
|
326
|
+
m,
|
|
324
327
|
{
|
|
325
328
|
id: "vote.vote_box.votes",
|
|
326
|
-
values: { votesCount:
|
|
329
|
+
values: { votesCount: c },
|
|
327
330
|
defaultMessage: "{votesCount} votes"
|
|
328
331
|
}
|
|
329
332
|
) })
|
|
330
333
|
] }),
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
-
/* @__PURE__ */ s(
|
|
334
|
+
/* @__PURE__ */ d("div", { className: o.debateNumberItem, children: [
|
|
335
|
+
/* @__PURE__ */ s(E, { name: "chat", width: 20, height: 20 }),
|
|
333
336
|
/* @__PURE__ */ s("div", { className: o.debateNumberLabel, children: /* @__PURE__ */ s(
|
|
334
|
-
|
|
337
|
+
m,
|
|
335
338
|
{
|
|
336
339
|
id: "vote.vote_box.comments",
|
|
337
|
-
values: { count:
|
|
340
|
+
values: { count: re ?? 0 },
|
|
338
341
|
defaultMessage: "{count} comments"
|
|
339
342
|
}
|
|
340
343
|
) })
|
|
@@ -343,24 +346,24 @@ const We = ({
|
|
|
343
346
|
/* @__PURE__ */ s(
|
|
344
347
|
"div",
|
|
345
348
|
{
|
|
346
|
-
className:
|
|
349
|
+
className: u(
|
|
347
350
|
o.voteBoxActions,
|
|
348
351
|
o.voteBoxShowResultContainer,
|
|
349
|
-
{ [
|
|
352
|
+
{ [q]: q }
|
|
350
353
|
),
|
|
351
|
-
children: /* @__PURE__ */ s("div", { className: o.voteBoxShowResult, children:
|
|
354
|
+
children: /* @__PURE__ */ s("div", { className: o.voteBoxShowResult, children: D ? !N && /* @__PURE__ */ s("div", { className: o.voteResultInfoText, children: j.formatMessage({
|
|
352
355
|
id: "vote.vote_box.result_after_vote",
|
|
353
356
|
defaultMessage: "Le résultat s'affichera après le vote."
|
|
354
|
-
}) }) : typeof window < "u" && !
|
|
357
|
+
}) }) : typeof window < "u" && !B ? /* @__PURE__ */ s(
|
|
355
358
|
"button",
|
|
356
359
|
{
|
|
357
360
|
type: "button",
|
|
358
|
-
onClick:
|
|
361
|
+
onClick: _e,
|
|
359
362
|
"data-tid": "show_vote_result",
|
|
360
363
|
"data-testid": "show-result",
|
|
361
364
|
className: o.showResultButton,
|
|
362
|
-
children: /* @__PURE__ */ s("span", { className:
|
|
363
|
-
|
|
365
|
+
children: /* @__PURE__ */ s("span", { className: u(o.boldShowResult, o.outlined), children: /* @__PURE__ */ s(
|
|
366
|
+
m,
|
|
364
367
|
{
|
|
365
368
|
id: "vote.vote_box.show_result",
|
|
366
369
|
defaultMessage: "Show result"
|
|
@@ -368,16 +371,16 @@ const We = ({
|
|
|
368
371
|
) })
|
|
369
372
|
}
|
|
370
373
|
) : /* @__PURE__ */ s(
|
|
371
|
-
|
|
374
|
+
Me,
|
|
372
375
|
{
|
|
373
|
-
to:
|
|
376
|
+
to: Z(null),
|
|
374
377
|
rel: "nofollow",
|
|
375
378
|
"data-tid": "show_vote_result",
|
|
376
379
|
target: "_top",
|
|
377
380
|
external: !0,
|
|
378
381
|
"data-testid": "show-result",
|
|
379
|
-
children: /* @__PURE__ */ s("span", { className:
|
|
380
|
-
|
|
382
|
+
children: /* @__PURE__ */ s("span", { className: u(o.boldShowResult, o.outlined), children: /* @__PURE__ */ s(
|
|
383
|
+
m,
|
|
381
384
|
{
|
|
382
385
|
id: "vote.vote_box.show_result",
|
|
383
386
|
defaultMessage: "Show result"
|
|
@@ -392,5 +395,5 @@ const We = ({
|
|
|
392
395
|
);
|
|
393
396
|
};
|
|
394
397
|
export {
|
|
395
|
-
|
|
398
|
+
Ke as VoteBox
|
|
396
399
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._headerBox_czmub_3{display:flex!important;flex-direction:column!important;padding:0!important}._headerBoxLabel_czmub_9{display:flex!important;justify-content:flex-start!important}._headerBoxLabel_czmub_9>._titleRedirectUrl_czmub_13{background:var(--background-color-primary, white)!important}._headerBoxLabel_czmub_9>._titleRedirectUrl_czmub_13:hover{background:var(--background-color-primary, white)!important}._headerBoxLabel_czmub_9 a{text-decoration:none!important}._headerLiveStat_czmub_24{margin-left:auto!important;margin-right:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;display:flex!important;align-items:center!important;justify-content:flex-end!important;color:var(--call-primary-color, #434343);font-size:var(--font-size-small, 16px);margin-left:30px}._headerLiveStat_czmub_24 span{margin-left:10px;margin-bottom:0!important}@media(prefers-color-scheme:dark){.logoraDarkMode ._headerLiveStat_czmub_24{color:#fff!important}.logoraDarkMode ._headerLiveNow_czmub_43{background-color:#fff!important}.logoraDarkMode ._headerLiveNow_czmub_43:before{background-color:#fff!important}}._headerLiveNow_czmub_43{min-width:8px;width:8px;height:8px;border-radius:50%;background-color:var(--call-primary-color, #434343);position:relative}._headerLiveNow_czmub_43:before{content:"";position:absolute;width:100%;height:100%;border-radius:50%;background-color:var(--call-primary-color, #434343);opacity:.4;animation-name:_livePin_czmub_1;animation-duration:1.6s;animation-iteration-count:infinite}@container (min-width: 576px){._headerLivePin_czmub_72{display:block!important}}._headerLivePin_czmub_72{display:none!important}@container (min-width: 576px){._headerLivePinMobile_czmub_81{display:none!important}}._headerLivePinMobile_czmub_81{display:block!important}@keyframes _livePin_czmub_1{0%{transform:scale(2.3)}50%{transform:scale(0)}to{transform:scale(2.3)}}._headerLabelText_czmub_100{background-color:var(--call-primary-color, #434343);color:var(--text-light, white);border-bottom:1px solid;border-color:var(--call-primary-color, #434343);border-radius:var(--box-border-radius, 6px) 0 var(--box-border-radius, 6px) 0;font-size:var(--font-size-normal, 16px);flex-wrap:nowrap;white-space:nowrap;padding-right:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;padding-left:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;padding-top:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;padding-bottom:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._debateName_czmub_115{color:var(--text-primary, #222222);font-weight:var(--font-weight-bold, 700);font-variation-settings:var(--font-variation-bold, normal);text-align:center;width:100%;display:flex!important;align-items:center!important;justify-content:center!important;padding-bottom:0!important;padding-top:var(--space-unit, 1em)!important;padding-right:var(--space-unit, 1em)!important;padding-left:var(--space-unit, 1em)!important}@container (min-width: 576px){._debateName_czmub_115{padding-right:0!important}}@container (min-width: 576px){._debateName_czmub_115{padding-left:0!important}}._debateName_czmub_115 a._debateLink_czmub_139{color:var(--text-primary, #222222)!important}._debateLink_czmub_139{font-size:var(--font-size-large, 20px);line-height:var(--line-height-normal, 1.26em);background:var(--background-color-primary, white)!important;text-decoration:none!important;color:var(--text-primary, #222222);font-weight:var(--font-weight-bold, 700);font-variation-settings:var(--font-variation-bold, normal)}._debateLink_czmub_139:hover{background:var(--background-color-primary, white)!important;text-decoration:underline!important}._left_czmub_157{justify-content:flex-start!important;padding-right:var(--space-unit, 1em)!important;padding-left:var(--space-unit, 1em)!important;padding-top:var(--space-unit, 1em)!important;padding-bottom:0!important;text-align:left}._headerLogo_czmub_166{width:100px!important;height:40px!important;object-fit:contain;object-position:left}._debateNameWithLogo_czmub_173{padding-right:0!important;padding-left:0!important}
|