@logora/debate 0.4.98 → 0.4.100
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/vote/vote_box/VoteBox.module-GeWFaMvd.css +1 -0
- package/dist/components/proposal/proposal_box/ProposalBox.js +62 -57
- package/dist/components/report/report_box/ReportBox.js +12 -5
- package/dist/components/vote/vote_box/VoteBox.js +264 -213
- package/dist/components/vote/vote_box/VoteBox.module.scss.js +32 -30
- package/package.json +1 -1
- package/dist/assets/components/vote/vote_box/VoteBox.module-BM2Iqu7I.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._voteBox_18yph_3{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:center!important;width:100%}._voteResultsBox_18yph_11{display:flex!important;flex-direction:column!important;padding:0!important;width:100%}._voteResults_18yph_11{padding:0!important}._voteProgressHeader_18yph_22{margin-bottom:var(--spacer-xxs, calc(var(--space-unit, 1em) * .25))!important;display:flex!important;align-items:center!important;font-size:var(--font-size-normal, 16px);display:-webkit-box;word-wrap:break-word;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}._voteProgressHeaderAgainst_18yph_35{margin-top:var(--spacer-md, calc(var(--space-unit, 1em) * .75))!important}._voteResultsNumberVoters_18yph_39{display:flex!important;align-items:center!important;padding:0!important;font-size:var(--font-size-normal, 16px);color:var(--text-secondary, #5F5F5F)}._voteBoxFooter_18yph_47{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:space-between!important;margin-top:var(--space-unit, 1em)!important;padding:0!important}._voteFooterActions_18yph_56{display:flex!important;align-items:center!important;gap:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))}._voteBoxActions_18yph_62{display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center;gap:var(--space-unit, 1em);color:var(--text-secondary, #5F5F5F);width:100%}._voteBoxActionsBody_18yph_72{display:grid!important;grid-template-columns:repeat(2,1fr);gap:var(--spacer-md, calc(var(--space-unit, 1em) * .75));padding:0!important;width:100%}._voteBoxActionsBodyColumn_18yph_80{grid-template-columns:1fr}._voteAction_18yph_84{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:center!important;padding:0!important;max-width:100%!important;width:100%!important;text-align:center}._voteAction_18yph_84._buttonAlignLeft_18yph_94{justify-content:flex-start!important}button._voteButton_18yph_98,a._voteButton_18yph_98{-webkit-appearance:initial!important;width:100%;-webkit-hyphens:auto;-ms-hyphens:auto;-moz-hyphens:auto;hyphens:auto;padding:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._textAlignLeft_18yph_109{justify-content:flex-start!important}._voteBoxShowResultContainer_18yph_113{display:flex!important;flex-direction:row!important;justify-content:center;flex-wrap:wrap!important;margin-top:.3em}._voteBoxShowResult_18yph_113{cursor:pointer}._voteBoxShowResult_18yph_113 a{color:inherit;text-decoration:none;background:none!important}._voteBoxShowResult_18yph_113 a:hover{text-decoration:none;background:none!important}._voteBoxShowResult_18yph_113 a:focus:not(:focus-visible){outline:none;box-shadow:none}._voteBoxShowResult_18yph_113 ._boldShowResult_18yph_137{font-weight:var(--font-weight-bold, 700);font-variation-settings:var(--font-variation-bold, normal);color:var(--text-primary, #222222)}._outlined_18yph_143{padding:7px 15px;border-radius:var(--box-border-radius, 6px);border:1px solid var(--text-primary, #222222)!important;white-space:nowrap}._voteButtonThesis_18yph_150{display:block;text-align:left;display:-webkit-box;word-wrap:break-word;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}@container (max-width: 767.98px){._voteButtonThesisSynthesisMobile_18yph_162{text-align:center!important}}._voteBoxActionsBody_18yph_72 ._voteAction_18yph_84:first-child ._voteButton_18yph_98,._voteBoxActionsBody_18yph_72 ._voteAction_18yph_84:first-child ._voteButton_18yph_98:hover{background-color:var(--for-primary-color, #cc6a6d)!important;border-color:var(--for-primary-color, #cc6a6d)!important;border:1px solid var(--for-primary-color, #cc6a6d)!important}._voteBoxActionsBody_18yph_72 ._voteAction_18yph_84:nth-child(2) ._voteButton_18yph_98{background-color:var(--against-primary-color, #7980bb)!important;border-color:var(--against-primary-color, #7980bb)!important;border:1px solid var(--against-primary-color, #7980bb)!important}._voteBoxActionsBody_18yph_72 ._voteAction_18yph_84:nth-child(2) ._voteButton_18yph_98:hover{background-color:var(--against-primary-color, #7980bb)!important;border-color:var(--against-primary-color, #7980bb)!important;border:1px solid var(--against-primary-color, #7980bb)!important}._voteBoxActionsBody_18yph_72 ._voteAction_18yph_84:nth-child(3) ._voteButton_18yph_98{background-color:var(--text-light, white)!important;color:var(--third-position-color-primary, #9b9b9b)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteBoxActionsBody_18yph_72 ._voteAction_18yph_84:nth-child(3) ._voteButton_18yph_98:hover{background-color:var(--text-light, white)!important;color:var(--third-position-color-primary, #9b9b9b)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteBoxActionsBodyOutlined_18yph_201 ._voteAction_18yph_84:first-child ._voteButton_18yph_98,._voteBoxActionsBodyOutlined_18yph_201 ._voteAction_18yph_84:first-child ._voteButton_18yph_98:hover{background-color:var(--text-light, white)!important;color:var(--for-primary-color, #cc6a6d)!important;border-color:var(--for-primary-color, #cc6a6d)!important;border:1px solid var(--for-primary-color, #cc6a6d)!important}._voteBoxActionsBodyOutlined_18yph_201 ._voteAction_18yph_84:nth-child(2) ._voteButton_18yph_98{background-color:var(--text-light, white)!important;color:var(--against-primary-color, #7980bb)!important;border-color:var(--against-primary-color, #7980bb)!important;border:1px solid var(--against-primary-color, #7980bb)!important}._voteBoxActionsBodyOutlined_18yph_201 ._voteAction_18yph_84:nth-child(2) ._voteButton_18yph_98:hover{background-color:var(--text-light, white)!important;color:var(--against-primary-color, #7980bb)!important;border-color:var(--against-primary-color, #7980bb)!important;border:1px solid var(--against-primary-color, #7980bb)!important}._voteBoxActionsBodyOutlined_18yph_201 ._voteAction_18yph_84:nth-child(3) ._voteButton_18yph_98{background-color:var(--text-light, white)!important;color:var(--third-position-color-primary, #9b9b9b)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteBoxActionsBodyOutlined_18yph_201 ._voteAction_18yph_84:nth-child(3) ._voteButton_18yph_98:hover{background-color:var(--text-light, white)!important;color:var(--third-position-color-primary, #9b9b9b)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteBoxActionsBodyFilledNeutral_18yph_240 ._voteAction_18yph_84:nth-child(3) ._voteButton_18yph_98{background-color:var(--third-position-color-primary, #9b9b9b)!important;color:var(--text-light, white)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteBoxActionsBodyFilledNeutral_18yph_240 ._voteAction_18yph_84:nth-child(3) ._voteButton_18yph_98:hover{background-color:var(--third-position-color-primary, #9b9b9b)!important;color:var(--text-light, white)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteActionButton_18yph_253{cursor:pointer;-webkit-appearance:initial!important;background:none;border:none;color:var(--text-secondary, #5F5F5F)!important;font-size:inherit;padding:0;font-weight:var(--font-weight-bold, 700);font-variation-settings:var(--font-variation-bold, normal)}._voteActionButton_18yph_253:focus:not(:focus-visible){outline:none;box-shadow:none}._voteActionButton_18yph_253:disabled{cursor:default;opacity:.5}._sideIcon_18yph_273 svg{margin-left:5px;fill:var(--text-primary, #222222)}._progress_18yph_278{border-radius:var(--button-border-radius, var(--box-border-radius, 6px));color:var(--text-secondary, #5F5F5F);height:2.2em}._progressBar_18yph_284{border-radius:var(--button-border-radius, var(--box-border-radius, 6px));height:100%}._voteResults_18yph_11>div:first-child ._progress_18yph_278 ._progressBar_18yph_284{background-color:var(--for-primary-color, #cc6a6d)!important}._voteResults_18yph_11>div:nth-child(2) ._progress_18yph_278 ._progressBar_18yph_284{background-color:var(--against-primary-color, #7980bb)!important}._voteResults_18yph_11 div:nth-child(3) ._progress_18yph_278 ._progressBar_18yph_284{background-color:var(--third-position-color-primary, #9b9b9b)!important}._voteCommentCounts_18yph_301{display:flex;align-items:center;gap:var(--space-unit, 1em);width:100%;margin-top:var(--spacer-xxs, calc(var(--space-unit, 1em) * .25))!important}._debateNumberItem_18yph_309{display:flex;align-items:center;gap:var(--spacer-xxs, calc(var(--space-unit, 1em) * .25));font-size:var(--font-size-normal, 16px);color:var(--text-primary, #222222);white-space:nowrap}._debateNumberLabel_18yph_318{white-space:nowrap}._showResultButton_18yph_322{background:none;border:0;padding:0;font:inherit;color:inherit;cursor:pointer}._showResultButton_18yph_322:focus:not(:focus-visible){outline:none;box-shadow:none}._voteResultInfoText_18yph_335{font-size:var(--font-size-small, 16px);color:var(--text-secondary, #5F5F5F);text-align:left;width:100%;align-self:flex-start}
|
|
@@ -1,92 +1,97 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { buildShareUrl as
|
|
4
|
-
import
|
|
1
|
+
import { jsx as t, jsxs as l, Fragment as N } from "react/jsx-runtime";
|
|
2
|
+
import { useState as _, useEffect as I } from "react";
|
|
3
|
+
import { buildShareUrl as U } from "../../tools/share_url/index.js";
|
|
4
|
+
import p from "classnames";
|
|
5
5
|
import { useIntl as L } from "react-intl";
|
|
6
6
|
import o from "./ProposalBox.module.scss.js";
|
|
7
7
|
import { useConfig as B } from "../../data/config_provider/useConfig.js";
|
|
8
|
-
import { useAuth as
|
|
9
|
-
import { useTranslatedContent as
|
|
8
|
+
import { useAuth as F } from "../../auth/use_auth/useAuth.js";
|
|
9
|
+
import { useTranslatedContent as C } from "../../translation/translated_content/useTranslatedContent.js";
|
|
10
10
|
import { lexicalToHtml as H } from "../../input/text_editor/lexicalToHtml.js";
|
|
11
|
-
import { HashScroll as
|
|
12
|
-
import { ContentHeader as
|
|
13
|
-
import { ReadMore as
|
|
14
|
-
import { TranslationButton as
|
|
15
|
-
import { SourceListItem as
|
|
16
|
-
import { ContentFooter as
|
|
11
|
+
import { HashScroll as P } from "../../tools/hash_scroll/HashScroll.js";
|
|
12
|
+
import { ContentHeader as R } from "../../user_content/content_header/ContentHeader.js";
|
|
13
|
+
import { ReadMore as D } from "../../text/read_more/ReadMore.js";
|
|
14
|
+
import { TranslationButton as j } from "../../translation/translation_button/TranslationButton.js";
|
|
15
|
+
import { SourceListItem as k } from "../../source/source_list_item/SourceListItem.js";
|
|
16
|
+
import { ContentFooter as $ } from "../../user_content/content_footer/ContentFooter.js";
|
|
17
17
|
import { UpDownVoteBox as A } from "../../vote/up_down_vote_box/UpDownVoteBox.js";
|
|
18
|
-
const
|
|
18
|
+
const ae = ({
|
|
19
19
|
proposal: e,
|
|
20
|
-
disabled:
|
|
21
|
-
fixedContentHeight:
|
|
22
|
-
fitContent:
|
|
23
|
-
enableEdition:
|
|
24
|
-
hideFooter:
|
|
20
|
+
disabled: m = !1,
|
|
21
|
+
fixedContentHeight: c,
|
|
22
|
+
fitContent: v = !1,
|
|
23
|
+
enableEdition: T = !0,
|
|
24
|
+
hideFooter: M = !1,
|
|
25
|
+
showModerationFeedback: x
|
|
25
26
|
}) => {
|
|
26
|
-
const [h,
|
|
27
|
+
const [h, w] = _(null), [b, y] = _(!1), a = L(), n = B(), { currentUser: u } = F(), f = u?.moderation_status === "banned", g = `proposal_${e.id}`, i = C(
|
|
27
28
|
e.title,
|
|
28
29
|
e.language,
|
|
29
30
|
"title",
|
|
30
31
|
e.translation_entries
|
|
31
|
-
),
|
|
32
|
+
), s = C(
|
|
32
33
|
e.content,
|
|
33
34
|
e.language,
|
|
34
35
|
"content",
|
|
35
36
|
e.translation_entries
|
|
36
37
|
);
|
|
37
|
-
|
|
38
|
+
I(() => {
|
|
38
39
|
if (e.rich_content) {
|
|
39
40
|
const r = JSON.parse(e.rich_content);
|
|
40
41
|
if (r.hasOwnProperty("root")) {
|
|
41
|
-
const
|
|
42
|
-
|
|
42
|
+
const d = H(r);
|
|
43
|
+
w(d);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
}, [e.rich_content]);
|
|
46
47
|
const S = () => {
|
|
47
|
-
i.toggleContent(),
|
|
48
|
+
i.toggleContent(), s.toggleContent();
|
|
48
49
|
};
|
|
49
|
-
return /* @__PURE__ */ t(
|
|
50
|
+
return /* @__PURE__ */ t(P, { elementId: g, onScroll: () => y(!0), children: /* @__PURE__ */ l(
|
|
50
51
|
"div",
|
|
51
52
|
{
|
|
52
|
-
className:
|
|
53
|
+
className: p(o.proposalBoxContainer, { [o.flash]: b }),
|
|
53
54
|
id: g,
|
|
54
55
|
children: [
|
|
55
56
|
/* @__PURE__ */ t(
|
|
56
|
-
|
|
57
|
+
R,
|
|
57
58
|
{
|
|
58
59
|
author: e.author,
|
|
59
60
|
tag: e.tag?.display_name,
|
|
60
61
|
date: e.created_at,
|
|
61
|
-
oneLine: !1
|
|
62
|
+
oneLine: !1,
|
|
63
|
+
showModerationFeedback: x ?? (e.status === "rejected" && n.moderation?.showFeedback === !0),
|
|
64
|
+
moderationReason: e.moderation_entry?.moderation_reason,
|
|
65
|
+
moderationNotes: e.moderation_entry?.moderator_notes,
|
|
66
|
+
moderationPolicyUrl: n.provider?.userGuideUrl
|
|
62
67
|
}
|
|
63
68
|
),
|
|
64
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ l(
|
|
65
70
|
"div",
|
|
66
71
|
{
|
|
67
|
-
className:
|
|
68
|
-
[o.fixedHeight]:
|
|
69
|
-
[o.withMinHeight]: !
|
|
72
|
+
className: p(o.proposalBoxContent, {
|
|
73
|
+
[o.fixedHeight]: c,
|
|
74
|
+
[o.withMinHeight]: !v && !c
|
|
70
75
|
}),
|
|
71
76
|
children: [
|
|
72
77
|
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
73
|
-
|
|
78
|
+
D,
|
|
74
79
|
{
|
|
75
|
-
content: /* @__PURE__ */
|
|
76
|
-
e.is_edited && /* @__PURE__ */ t("div", { className: o.edited, children:
|
|
80
|
+
content: /* @__PURE__ */ l(N, { children: [
|
|
81
|
+
e.is_edited && /* @__PURE__ */ t("div", { className: o.edited, children: a.formatMessage({
|
|
77
82
|
id: "proposal.updated",
|
|
78
83
|
defaultMessage: "Updated proposal"
|
|
79
84
|
}) }),
|
|
80
85
|
/* @__PURE__ */ t("div", { className: o.proposalTitle, children: i.translatedContent }),
|
|
81
|
-
h && !
|
|
86
|
+
h && !s.isTranslated ? /* @__PURE__ */ t(
|
|
82
87
|
"div",
|
|
83
88
|
{
|
|
84
89
|
className: o.proposalContent,
|
|
85
90
|
dangerouslySetInnerHTML: { __html: h }
|
|
86
91
|
}
|
|
87
|
-
) : /* @__PURE__ */ t("div", { className: o.proposalContent, children:
|
|
88
|
-
(
|
|
89
|
-
|
|
92
|
+
) : /* @__PURE__ */ t("div", { className: o.proposalContent, children: s.translatedContent }),
|
|
93
|
+
(s.isTranslated || i.isTranslated) && /* @__PURE__ */ t(
|
|
94
|
+
j,
|
|
90
95
|
{
|
|
91
96
|
language: e.language,
|
|
92
97
|
callback: () => S()
|
|
@@ -94,45 +99,45 @@ const re = ({
|
|
|
94
99
|
)
|
|
95
100
|
] }),
|
|
96
101
|
lineCount: 7,
|
|
97
|
-
readMoreText:
|
|
102
|
+
readMoreText: a.formatMessage({
|
|
98
103
|
id: "action.read_more",
|
|
99
104
|
defaultMessage: "Read more"
|
|
100
105
|
}),
|
|
101
|
-
readLessText:
|
|
106
|
+
readLessText: a.formatMessage({
|
|
102
107
|
id: "action.read_less",
|
|
103
108
|
defaultMessage: "Read less"
|
|
104
109
|
})
|
|
105
110
|
}
|
|
106
111
|
) }),
|
|
107
|
-
e.sources?.length > 0 && /* @__PURE__ */ t("div", { className: o.proposalSourcesList, children: e.sources.map((r,
|
|
108
|
-
|
|
112
|
+
e.sources?.length > 0 && /* @__PURE__ */ t("div", { className: o.proposalSourcesList, children: e.sources.map((r, d) => /* @__PURE__ */ t(
|
|
113
|
+
k,
|
|
109
114
|
{
|
|
110
115
|
publisher: r.publisher,
|
|
111
116
|
url: r.source_url,
|
|
112
117
|
title: r.title,
|
|
113
|
-
index:
|
|
118
|
+
index: d
|
|
114
119
|
},
|
|
115
120
|
r.id
|
|
116
121
|
)) })
|
|
117
122
|
]
|
|
118
123
|
}
|
|
119
124
|
),
|
|
120
|
-
!
|
|
121
|
-
|
|
125
|
+
!M && /* @__PURE__ */ t(
|
|
126
|
+
$,
|
|
122
127
|
{
|
|
123
128
|
resource: e,
|
|
124
|
-
disabled:
|
|
129
|
+
disabled: m || f,
|
|
125
130
|
reportType: "Proposal",
|
|
126
131
|
deleteType: "proposals",
|
|
127
132
|
deleteListId: "proposalsList",
|
|
128
|
-
shareModalTitle:
|
|
129
|
-
shareUrl:
|
|
130
|
-
shareTitle:
|
|
131
|
-
shareText:
|
|
132
|
-
shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${
|
|
133
|
-
showShareCode:
|
|
133
|
+
shareModalTitle: a.formatMessage({ id: "share.proposal" }),
|
|
134
|
+
shareUrl: U(n, "p", e.id),
|
|
135
|
+
shareTitle: a.formatMessage({ id: "share.proposal.title" }),
|
|
136
|
+
shareText: a.formatMessage({ id: "share.proposal.text" }),
|
|
137
|
+
shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${n.shortname}&id=${e.id}&resource=proposal" frameborder="0" width="100%" height="335px" scrolling="no"></iframe>`,
|
|
138
|
+
showShareCode: n?.actions?.hideCodeShare !== !0,
|
|
134
139
|
showActions: !e.author.consultation_id,
|
|
135
|
-
enableEdition:
|
|
140
|
+
enableEdition: T,
|
|
136
141
|
children: /* @__PURE__ */ t(
|
|
137
142
|
A,
|
|
138
143
|
{
|
|
@@ -140,8 +145,8 @@ const re = ({
|
|
|
140
145
|
voteableId: e.id,
|
|
141
146
|
totalUpvote: e.total_upvotes,
|
|
142
147
|
totalDownvote: e.total_downvotes,
|
|
143
|
-
disabled:
|
|
144
|
-
hideDownvotes:
|
|
148
|
+
disabled: m || u?.id === e?.author?.id || f,
|
|
149
|
+
hideDownvotes: n?.actions?.hideDownvotes
|
|
145
150
|
}
|
|
146
151
|
)
|
|
147
152
|
}
|
|
@@ -151,5 +156,5 @@ const re = ({
|
|
|
151
156
|
) });
|
|
152
157
|
};
|
|
153
158
|
export {
|
|
154
|
-
|
|
159
|
+
ae as ProposalBox
|
|
155
160
|
};
|
|
@@ -8,13 +8,13 @@ import { SuggestionBox as M } from "../../suggestion/suggestion_box/SuggestionBo
|
|
|
8
8
|
import { ProposalBox as v } from "../../proposal/proposal_box/ProposalBox.js";
|
|
9
9
|
import { Argument as w } from "../../argument/argument/Argument.js";
|
|
10
10
|
const C = ({ report: e, flash: i }) => {
|
|
11
|
-
const o = g(), [
|
|
11
|
+
const o = g(), [c, d] = p(!1);
|
|
12
12
|
h(() => {
|
|
13
13
|
if (i === e.id) {
|
|
14
14
|
const r = document.getElementById(`reports_${e.id}`);
|
|
15
|
-
r && r.scrollIntoView({ behavior: "smooth", block: "center" }),
|
|
15
|
+
r && r.scrollIntoView({ behavior: "smooth", block: "center" }), d(!0);
|
|
16
16
|
} else
|
|
17
|
-
|
|
17
|
+
d(!1);
|
|
18
18
|
}, [i, e.id]);
|
|
19
19
|
const l = () => {
|
|
20
20
|
const { reportable_type: r, reportable: a } = e;
|
|
@@ -34,7 +34,14 @@ const C = ({ report: e, flash: i }) => {
|
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
case "Proposal":
|
|
37
|
-
return /* @__PURE__ */ t(
|
|
37
|
+
return /* @__PURE__ */ t(
|
|
38
|
+
v,
|
|
39
|
+
{
|
|
40
|
+
proposal: a,
|
|
41
|
+
hideFooter: !0,
|
|
42
|
+
showModerationFeedback: !1
|
|
43
|
+
}
|
|
44
|
+
);
|
|
38
45
|
case "Group":
|
|
39
46
|
return /* @__PURE__ */ t(M, { suggestion: a, hideFooter: !0 });
|
|
40
47
|
default:
|
|
@@ -65,7 +72,7 @@ const C = ({ report: e, flash: i }) => {
|
|
|
65
72
|
{
|
|
66
73
|
id: `reports_${e.id}`,
|
|
67
74
|
className: f(s.reportBox, {
|
|
68
|
-
[s.reportHighlighted]:
|
|
75
|
+
[s.reportHighlighted]: c
|
|
69
76
|
}),
|
|
70
77
|
children: e && /* @__PURE__ */ n("div", { className: s.reportItem, children: [
|
|
71
78
|
/* @__PURE__ */ n("div", { className: s.reportHeader, children: [
|
|
@@ -1,210 +1,241 @@
|
|
|
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 ne, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import f from "classnames";
|
|
3
|
+
import { useState as g, useEffect as k } from "react";
|
|
4
|
+
import { useIntl as Be, FormattedMessage as m } from "react-intl";
|
|
5
|
+
import { useLocation as xe } 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:
|
|
7
|
+
import { useTranslatedContent as $ } from "../../translation/translated_content/useTranslatedContent.js";
|
|
8
|
+
import { useSessionStorageState as re } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
|
|
9
|
+
import { useToast as Me } from "../../dialog/toast_provider/useToast.js";
|
|
10
|
+
import { useAuthRequired as Ae } from "../../hooks/use_auth_required/useAuthRequired.js";
|
|
11
|
+
import { useDataProvider as ye } from "../../data/data_provider/useDataProvider.js";
|
|
12
|
+
import { useConfig as Re } from "../../data/config_provider/useConfig.js";
|
|
13
|
+
import { useAuth as Le } from "../../auth/use_auth/useAuth.js";
|
|
14
|
+
import { Icon as q } from "../../icons/icon/Icon.js";
|
|
15
|
+
import { ProgressBar as ke } from "../../progress/progress_bar/ProgressBar.js";
|
|
16
|
+
import { Link as Te } from "../../action/link/Link.js";
|
|
17
|
+
import { Button as je } from "../../action/button/Button.js";
|
|
18
|
+
const Pe = ({
|
|
19
|
+
numberVotes: S,
|
|
20
20
|
votePositions: i,
|
|
21
|
-
voteableType:
|
|
22
|
-
voteableId:
|
|
23
|
-
redirectUrl:
|
|
24
|
-
displayColumn:
|
|
25
|
-
textAlignLeft:
|
|
26
|
-
showTotal:
|
|
27
|
-
voteBoxClassName:
|
|
28
|
-
buttonContainerClassName:
|
|
29
|
-
buttonClassName:
|
|
30
|
-
showResultClassName:
|
|
31
|
-
onVote:
|
|
32
|
-
onVoteCountsChange:
|
|
33
|
-
disabled:
|
|
34
|
-
showVotesCommentsNumber:
|
|
35
|
-
commentsCount:
|
|
36
|
-
hideShowResultButton:
|
|
21
|
+
voteableType: p,
|
|
22
|
+
voteableId: b,
|
|
23
|
+
redirectUrl: V,
|
|
24
|
+
displayColumn: Y,
|
|
25
|
+
textAlignLeft: ce,
|
|
26
|
+
showTotal: ie = !0,
|
|
27
|
+
voteBoxClassName: D,
|
|
28
|
+
buttonContainerClassName: G,
|
|
29
|
+
buttonClassName: W,
|
|
30
|
+
showResultClassName: z,
|
|
31
|
+
onVote: B,
|
|
32
|
+
onVoteCountsChange: le,
|
|
33
|
+
disabled: T = !1,
|
|
34
|
+
showVotesCommentsNumber: de = !1,
|
|
35
|
+
commentsCount: ue,
|
|
36
|
+
hideShowResultButton: J = !1
|
|
37
37
|
}) => {
|
|
38
|
-
const [
|
|
39
|
-
Number.parseFloat(
|
|
40
|
-
(
|
|
38
|
+
const [x, _] = g(!0), [c, M] = g(void 0), [N, h] = g(!1), [j, F] = g(!1), [l, O] = g(
|
|
39
|
+
Number.parseFloat(S.total) || Object.values(S).reduce(
|
|
40
|
+
(t, e) => t + Number.parseFloat(e),
|
|
41
41
|
0
|
|
42
42
|
) || 0
|
|
43
|
-
),
|
|
43
|
+
), K = $(
|
|
44
44
|
i[0]?.name,
|
|
45
45
|
i[0]?.language,
|
|
46
46
|
"name",
|
|
47
47
|
i[0]?.translation_entries
|
|
48
|
-
),
|
|
48
|
+
), Q = $(
|
|
49
49
|
i[1]?.name,
|
|
50
50
|
i[1]?.language,
|
|
51
51
|
"name",
|
|
52
52
|
i[1]?.translation_entries
|
|
53
|
-
),
|
|
53
|
+
), X = $(
|
|
54
54
|
i[2]?.name,
|
|
55
55
|
i[2]?.language,
|
|
56
56
|
"name",
|
|
57
57
|
i[2]?.translation_entries
|
|
58
|
-
), [
|
|
58
|
+
), [w, fe, E] = re(
|
|
59
59
|
"storedUserVote",
|
|
60
60
|
{}
|
|
61
|
-
), [
|
|
62
|
-
const
|
|
61
|
+
), [Fe, ve, Z] = re("userSide", {}), { toast: P } = Me() || {}, me = () => {
|
|
62
|
+
const t = {};
|
|
63
63
|
return i?.forEach(
|
|
64
|
-
(
|
|
65
|
-
count: Number.parseFloat(
|
|
66
|
-
percentage:
|
|
67
|
-
100 * ((
|
|
64
|
+
(e) => t[e.id] = {
|
|
65
|
+
count: Number.parseFloat(S[e.id]) || 0,
|
|
66
|
+
percentage: l === 0 ? 0 : Math.round(
|
|
67
|
+
100 * ((S[e.id] || 0) / l)
|
|
68
68
|
)
|
|
69
69
|
}
|
|
70
|
-
),
|
|
71
|
-
}, [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}, [
|
|
75
|
-
if (
|
|
76
|
-
const [
|
|
77
|
-
|
|
70
|
+
), t;
|
|
71
|
+
}, [r, A] = g(me()), ee = Ae(), he = xe(), y = ye(), I = Re(), R = Be(), { isLoggedIn: L, isLoggingIn: te } = Le();
|
|
72
|
+
k(() => {
|
|
73
|
+
te === !1 && (L ? pe(b) : _(!1));
|
|
74
|
+
}, [te, L]), k(() => {
|
|
75
|
+
if (x === !1 && !V) {
|
|
76
|
+
const [t, e] = ge();
|
|
77
|
+
t && (e ? se(e) : h(!0));
|
|
78
78
|
}
|
|
79
|
-
}, [
|
|
80
|
-
|
|
81
|
-
}, [
|
|
82
|
-
|
|
83
|
-
}, [
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
return
|
|
87
|
-
const
|
|
88
|
-
typeof window < "u" ? window.location.search :
|
|
89
|
-
),
|
|
90
|
-
return [
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}).catch((
|
|
95
|
-
|
|
79
|
+
}, [x]), k(() => {
|
|
80
|
+
B && B(c);
|
|
81
|
+
}, [c]), k(() => {
|
|
82
|
+
le?.({ total: l, counts: r });
|
|
83
|
+
}, [l, r]);
|
|
84
|
+
const ge = () => {
|
|
85
|
+
if (w && Object.keys(w).length !== 0)
|
|
86
|
+
return w.groupId === b && w.voteableType === p ? [!0, w.positionId] : (E(), [!1, !1]);
|
|
87
|
+
const t = new URLSearchParams(
|
|
88
|
+
typeof window < "u" ? window.location.search : he.search
|
|
89
|
+
), e = !!t.get("initVote"), a = Number.parseInt(t.get("positionId")) || !1;
|
|
90
|
+
return [e, a];
|
|
91
|
+
}, pe = (t) => {
|
|
92
|
+
_(!0), B && B(c), y.getOneWithToken("votes", `${p.toLowerCase()}/${t}`, {}).then((e) => {
|
|
93
|
+
e.data.data.resource ? (M(e.data.data.resource), h(!0), _(!1)) : (_(!1), h(!1));
|
|
94
|
+
}).catch((e) => {
|
|
95
|
+
_(!1);
|
|
96
96
|
});
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
const
|
|
101
|
-
voteable_id:
|
|
102
|
-
voteable_type:
|
|
103
|
-
position_id:
|
|
97
|
+
}, C = (t, e) => e === 0 ? 0 : Math.round(100 * (t / e)), U = ({ counts: t, total: e, vote: a }) => {
|
|
98
|
+
A(t), O(e), M(a);
|
|
99
|
+
}, be = (t) => {
|
|
100
|
+
const e = {
|
|
101
|
+
voteable_id: b,
|
|
102
|
+
voteable_type: p || "Group",
|
|
103
|
+
position_id: t
|
|
104
104
|
};
|
|
105
|
-
|
|
106
|
-
groupId:
|
|
107
|
-
voteableType:
|
|
108
|
-
positionId:
|
|
105
|
+
ve({
|
|
106
|
+
groupId: b,
|
|
107
|
+
voteableType: p,
|
|
108
|
+
positionId: t
|
|
109
109
|
});
|
|
110
|
-
const
|
|
111
|
-
counts:
|
|
112
|
-
total:
|
|
113
|
-
vote:
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
const n = {
|
|
111
|
+
counts: r,
|
|
112
|
+
total: l,
|
|
113
|
+
vote: c
|
|
114
|
+
}, d = (ae) => {
|
|
115
|
+
ae.data.success ? (M(ae.data.data.resource), P(
|
|
116
|
+
R.formatMessage({
|
|
117
117
|
id: "header.vote_confirm_modal",
|
|
118
118
|
defaultMessage: "Your vote has been saved !"
|
|
119
119
|
}),
|
|
120
120
|
{ type: "success" }
|
|
121
|
-
)) :
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
const
|
|
126
|
-
i.forEach((
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
count:
|
|
130
|
-
percentage:
|
|
121
|
+
)) : U(n);
|
|
122
|
+
}, v = () => U(n);
|
|
123
|
+
c ? (Ne(t, c.position_id), N === !1 && H(), t !== c.position_id && y.update("votes", c.id, e).then(d, v)) : (_e(t), H(), y.create("votes", e).then(d, v));
|
|
124
|
+
}, _e = (t) => {
|
|
125
|
+
const e = r[t].count + 1, a = l + 1, n = {};
|
|
126
|
+
i.forEach((d) => {
|
|
127
|
+
if (t === d.id)
|
|
128
|
+
n[d.id] = {
|
|
129
|
+
count: e,
|
|
130
|
+
percentage: C(e, a)
|
|
131
131
|
};
|
|
132
132
|
else {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
count:
|
|
136
|
-
percentage:
|
|
133
|
+
const v = r[d.id].count;
|
|
134
|
+
n[d.id] = {
|
|
135
|
+
count: v,
|
|
136
|
+
percentage: C(v, a)
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
}),
|
|
140
|
-
},
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
)
|
|
157
|
-
}
|
|
139
|
+
}), A(n), O(a);
|
|
140
|
+
}, Ne = (t, e) => {
|
|
141
|
+
if (e === t)
|
|
142
|
+
return;
|
|
143
|
+
const a = { ...r };
|
|
144
|
+
if (r[e]) {
|
|
145
|
+
const n = Math.max(r[e].count - 1, 0);
|
|
146
|
+
a[e] = {
|
|
147
|
+
count: n,
|
|
148
|
+
percentage: C(n, l)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
if (r[t]) {
|
|
152
|
+
const n = r[t].count + 1;
|
|
153
|
+
a[t] = {
|
|
154
|
+
count: n,
|
|
155
|
+
percentage: C(n, l)
|
|
158
156
|
};
|
|
159
|
-
L(a);
|
|
160
157
|
}
|
|
161
|
-
|
|
162
|
-
|
|
158
|
+
A(a);
|
|
159
|
+
}, we = (t) => {
|
|
160
|
+
const e = Math.max(l - 1, 0), a = {};
|
|
161
|
+
i.forEach((n) => {
|
|
162
|
+
const d = r[n.id]?.count ?? 0, v = n.id === t ? Math.max(d - 1, 0) : d;
|
|
163
|
+
a[n.id] = {
|
|
164
|
+
count: v,
|
|
165
|
+
percentage: C(v, e)
|
|
166
|
+
};
|
|
167
|
+
}), A(a), O(e);
|
|
168
|
+
}, Ce = () => {
|
|
169
|
+
if (!c || j)
|
|
170
|
+
return;
|
|
171
|
+
const t = {
|
|
172
|
+
counts: r,
|
|
173
|
+
total: l,
|
|
174
|
+
vote: c
|
|
175
|
+
}, e = () => {
|
|
176
|
+
U(t), P?.(
|
|
177
|
+
R.formatMessage({
|
|
178
|
+
id: "vote.vote_box.cancel_failed",
|
|
179
|
+
defaultMessage: "Your vote could not be cancelled."
|
|
180
|
+
}),
|
|
181
|
+
{ type: "error" }
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
we(c.position_id), F(!0), y.delete("votes", c.id).then(
|
|
185
|
+
(a) => {
|
|
186
|
+
F(!1), a.data?.success ? (M(void 0), h(!1), Z(), E()) : e();
|
|
187
|
+
},
|
|
188
|
+
() => {
|
|
189
|
+
F(!1), e();
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
}, oe = (t) => {
|
|
193
|
+
const e = new URLSearchParams({
|
|
163
194
|
initVote: "true",
|
|
164
|
-
...
|
|
195
|
+
...t && { positionId: t }
|
|
165
196
|
});
|
|
166
|
-
return
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
groupId:
|
|
170
|
-
voteableType:
|
|
171
|
-
positionId:
|
|
172
|
-
}),
|
|
173
|
-
},
|
|
174
|
-
N &&
|
|
175
|
-
},
|
|
197
|
+
return V + `?${e.toString()}`;
|
|
198
|
+
}, se = (t) => {
|
|
199
|
+
x || (L ? Object.keys(r).includes(t.toString()) && (be(t), E()) : (Object.keys(r).includes(t.toString()) && fe({
|
|
200
|
+
groupId: b,
|
|
201
|
+
voteableType: p,
|
|
202
|
+
positionId: t
|
|
203
|
+
}), ee({ loginAction: "vote" })));
|
|
204
|
+
}, H = () => {
|
|
205
|
+
N && Z(), h(!N);
|
|
206
|
+
}, Se = (t, e) => {
|
|
176
207
|
let a;
|
|
177
|
-
|
|
178
|
-
const
|
|
208
|
+
e === 0 ? a = K.translatedContent : e === 1 ? a = Q.translatedContent : e === 2 && (a = X.translatedContent);
|
|
209
|
+
const n = typeof window < "u" && !V;
|
|
179
210
|
return /* @__PURE__ */ s(
|
|
180
211
|
"div",
|
|
181
212
|
{
|
|
182
|
-
className:
|
|
213
|
+
className: f(o.voteAction, {
|
|
183
214
|
[o.buttonAlignLeft]: o.buttonAlignLeft
|
|
184
215
|
}),
|
|
185
216
|
children: /* @__PURE__ */ s(
|
|
186
|
-
|
|
217
|
+
je,
|
|
187
218
|
{
|
|
188
219
|
"data-tid": "action_vote",
|
|
189
220
|
type: "button",
|
|
190
221
|
title: a,
|
|
191
|
-
className:
|
|
192
|
-
[o.textAlignLeft]:
|
|
193
|
-
[
|
|
222
|
+
className: f(o.voteButton, {
|
|
223
|
+
[o.textAlignLeft]: ce,
|
|
224
|
+
[W]: W
|
|
194
225
|
}),
|
|
195
|
-
onClick:
|
|
196
|
-
disabled:
|
|
226
|
+
onClick: n ? () => se(t.id) : null,
|
|
227
|
+
disabled: T || n && x,
|
|
197
228
|
"data-testid": "voteButton",
|
|
198
|
-
to:
|
|
199
|
-
target:
|
|
200
|
-
rel:
|
|
201
|
-
external:
|
|
229
|
+
to: n ? null : oe(t.id),
|
|
230
|
+
target: n ? null : "_top",
|
|
231
|
+
rel: n ? null : "nofollow",
|
|
232
|
+
external: n ? null : !0,
|
|
202
233
|
children: /* @__PURE__ */ s(
|
|
203
234
|
"div",
|
|
204
235
|
{
|
|
205
236
|
"data-tid": "action_vote",
|
|
206
|
-
className:
|
|
207
|
-
[o.voteButtonThesisSynthesisMobile]: !
|
|
237
|
+
className: f(o.voteButtonThesis, {
|
|
238
|
+
[o.voteButtonThesisSynthesisMobile]: !Y
|
|
208
239
|
}),
|
|
209
240
|
children: a
|
|
210
241
|
}
|
|
@@ -212,88 +243,108 @@ const Ke = ({
|
|
|
212
243
|
}
|
|
213
244
|
)
|
|
214
245
|
},
|
|
215
|
-
|
|
246
|
+
e
|
|
216
247
|
);
|
|
217
|
-
},
|
|
218
|
-
|
|
248
|
+
}, Ve = () => {
|
|
249
|
+
L || I.actions?.unloggedVoteResults === !0 ? h(!0) : ee({ loginAction: "vote" });
|
|
219
250
|
};
|
|
220
251
|
return /* @__PURE__ */ s(
|
|
221
252
|
"div",
|
|
222
253
|
{
|
|
223
|
-
className:
|
|
224
|
-
children: /* @__PURE__ */ s(
|
|
225
|
-
/* @__PURE__ */ s("div", { className: o.voteResults, children: i.map((
|
|
254
|
+
className: f(o.voteBox, { [D]: D }),
|
|
255
|
+
children: /* @__PURE__ */ s(ne, { children: N || T ? /* @__PURE__ */ u("div", { className: o.voteResultsBox, "data-testid": "voteResultsBox", children: [
|
|
256
|
+
/* @__PURE__ */ s("div", { className: o.voteResults, children: i.map((t, e) => {
|
|
226
257
|
let a;
|
|
227
|
-
return
|
|
228
|
-
/* @__PURE__ */
|
|
258
|
+
return e === 0 ? a = K.translatedContent : e === 1 ? a = Q.translatedContent : e === 2 && (a = X.translatedContent), /* @__PURE__ */ u("div", { children: [
|
|
259
|
+
/* @__PURE__ */ u(
|
|
229
260
|
"div",
|
|
230
261
|
{
|
|
231
|
-
className:
|
|
262
|
+
className: e > 0 ? f(
|
|
232
263
|
o.voteProgressHeader,
|
|
233
264
|
o.voteProgressHeaderAgainst
|
|
234
265
|
) : o.voteProgressHeader,
|
|
235
266
|
children: [
|
|
236
267
|
a,
|
|
237
268
|
" ",
|
|
238
|
-
|
|
269
|
+
c && c.position_id === t.id ? /* @__PURE__ */ s(
|
|
239
270
|
"span",
|
|
240
271
|
{
|
|
241
|
-
title:
|
|
272
|
+
title: R.formatMessage({
|
|
242
273
|
id: "vote.vote_box.vote_side"
|
|
243
274
|
}) + a,
|
|
244
275
|
className: o.sideIcon,
|
|
245
276
|
"aria-hidden": "true",
|
|
246
|
-
children: /* @__PURE__ */ s(
|
|
277
|
+
children: /* @__PURE__ */ s(q, { name: "checkbox", width: 16, height: 16 })
|
|
247
278
|
}
|
|
248
279
|
) : null
|
|
249
280
|
]
|
|
250
281
|
}
|
|
251
282
|
),
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
|
|
283
|
+
/* @__PURE__ */ u(
|
|
284
|
+
ke,
|
|
254
285
|
{
|
|
255
|
-
progress:
|
|
286
|
+
progress: r[t.id].percentage / 100,
|
|
256
287
|
goal: 1,
|
|
257
288
|
className: o.progress,
|
|
258
289
|
innerClassName: o.progressBar,
|
|
259
290
|
children: [
|
|
260
|
-
|
|
291
|
+
r[t.id].percentage,
|
|
261
292
|
"%"
|
|
262
293
|
]
|
|
263
294
|
}
|
|
264
295
|
)
|
|
265
|
-
] },
|
|
296
|
+
] }, e);
|
|
266
297
|
}) }),
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
|
|
298
|
+
/* @__PURE__ */ u("div", { className: o.voteBoxFooter, children: [
|
|
299
|
+
ie && /* @__PURE__ */ s("div", { className: o.voteResultsNumberVoters, children: /* @__PURE__ */ s(
|
|
269
300
|
m,
|
|
270
301
|
{
|
|
271
302
|
id: "vote.vote_box.votes",
|
|
272
|
-
values: { votesCount:
|
|
303
|
+
values: { votesCount: l },
|
|
273
304
|
defaultMessage: "{votesCount} votes"
|
|
274
305
|
}
|
|
275
306
|
) }),
|
|
276
|
-
!
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
307
|
+
!T && /* @__PURE__ */ s("div", { className: o.voteFooterActions, children: c ? /* @__PURE__ */ u(ne, { children: [
|
|
308
|
+
/* @__PURE__ */ s(
|
|
309
|
+
"button",
|
|
310
|
+
{
|
|
311
|
+
"data-tid": "action_edit_vote",
|
|
312
|
+
className: o.voteActionButton,
|
|
313
|
+
type: "button",
|
|
314
|
+
onClick: H,
|
|
315
|
+
disabled: j,
|
|
316
|
+
children: /* @__PURE__ */ s(
|
|
317
|
+
m,
|
|
318
|
+
{
|
|
319
|
+
id: "vote.vote_box.update",
|
|
320
|
+
defaultMessage: "Modify"
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
),
|
|
325
|
+
/* @__PURE__ */ s(
|
|
326
|
+
"button",
|
|
327
|
+
{
|
|
328
|
+
"data-tid": "action_cancel_vote",
|
|
329
|
+
className: o.voteActionButton,
|
|
330
|
+
type: "button",
|
|
331
|
+
onClick: Ce,
|
|
332
|
+
disabled: j,
|
|
333
|
+
children: /* @__PURE__ */ s(
|
|
334
|
+
m,
|
|
335
|
+
{
|
|
336
|
+
id: "vote.vote_box.cancel",
|
|
337
|
+
defaultMessage: "Cancel"
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
] }) : !J && /* @__PURE__ */ s(
|
|
292
343
|
"button",
|
|
293
344
|
{
|
|
294
345
|
type: "button",
|
|
295
346
|
className: o.voteActionButton,
|
|
296
|
-
onClick: () =>
|
|
347
|
+
onClick: () => h(!1),
|
|
297
348
|
children: /* @__PURE__ */ s(
|
|
298
349
|
m,
|
|
299
350
|
{
|
|
@@ -304,40 +355,40 @@ const Ke = ({
|
|
|
304
355
|
}
|
|
305
356
|
) })
|
|
306
357
|
] })
|
|
307
|
-
] }) : /* @__PURE__ */
|
|
358
|
+
] }) : /* @__PURE__ */ u("div", { className: o.voteBoxActions, children: [
|
|
308
359
|
/* @__PURE__ */ s(
|
|
309
360
|
"div",
|
|
310
361
|
{
|
|
311
|
-
className:
|
|
312
|
-
[o.voteBoxActionsBodyColumn]:
|
|
313
|
-
[o.voteBoxActionsBodyOutlined]:
|
|
314
|
-
[o.voteBoxActionsBodyFilledNeutral]:
|
|
315
|
-
[
|
|
362
|
+
className: f(o.voteBoxActionsBody, {
|
|
363
|
+
[o.voteBoxActionsBodyColumn]: Y,
|
|
364
|
+
[o.voteBoxActionsBodyOutlined]: I.layout?.outlinedVoteButtons,
|
|
365
|
+
[o.voteBoxActionsBodyFilledNeutral]: I.layout?.filledNeutralVoteButton,
|
|
366
|
+
[G]: G
|
|
316
367
|
}),
|
|
317
368
|
children: i.map(
|
|
318
|
-
(
|
|
369
|
+
(t, e) => Se(t, e)
|
|
319
370
|
)
|
|
320
371
|
}
|
|
321
372
|
),
|
|
322
|
-
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
/* @__PURE__ */ s(
|
|
373
|
+
de && /* @__PURE__ */ u("div", { className: o.voteCommentCounts, children: [
|
|
374
|
+
/* @__PURE__ */ u("div", { className: o.debateNumberItem, children: [
|
|
375
|
+
/* @__PURE__ */ s(q, { name: "votebox", width: 20, height: 20 }),
|
|
325
376
|
/* @__PURE__ */ s("div", { className: o.debateNumberLabel, children: /* @__PURE__ */ s(
|
|
326
377
|
m,
|
|
327
378
|
{
|
|
328
379
|
id: "vote.vote_box.votes",
|
|
329
|
-
values: { votesCount:
|
|
380
|
+
values: { votesCount: l },
|
|
330
381
|
defaultMessage: "{votesCount} votes"
|
|
331
382
|
}
|
|
332
383
|
) })
|
|
333
384
|
] }),
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */ s(
|
|
385
|
+
/* @__PURE__ */ u("div", { className: o.debateNumberItem, children: [
|
|
386
|
+
/* @__PURE__ */ s(q, { name: "chat", width: 20, height: 20 }),
|
|
336
387
|
/* @__PURE__ */ s("div", { className: o.debateNumberLabel, children: /* @__PURE__ */ s(
|
|
337
388
|
m,
|
|
338
389
|
{
|
|
339
390
|
id: "vote.vote_box.comments",
|
|
340
|
-
values: { count:
|
|
391
|
+
values: { count: ue ?? 0 },
|
|
341
392
|
defaultMessage: "{count} comments"
|
|
342
393
|
}
|
|
343
394
|
) })
|
|
@@ -346,23 +397,23 @@ const Ke = ({
|
|
|
346
397
|
/* @__PURE__ */ s(
|
|
347
398
|
"div",
|
|
348
399
|
{
|
|
349
|
-
className:
|
|
400
|
+
className: f(
|
|
350
401
|
o.voteBoxActions,
|
|
351
402
|
o.voteBoxShowResultContainer,
|
|
352
|
-
{ [
|
|
403
|
+
{ [z]: z }
|
|
353
404
|
),
|
|
354
|
-
children: /* @__PURE__ */ s("div", { className: o.voteBoxShowResult, children:
|
|
405
|
+
children: /* @__PURE__ */ s("div", { className: o.voteBoxShowResult, children: J ? !N && /* @__PURE__ */ s("div", { className: o.voteResultInfoText, children: R.formatMessage({
|
|
355
406
|
id: "vote.vote_box.result_after_vote",
|
|
356
407
|
defaultMessage: "Le résultat s'affichera après le vote."
|
|
357
|
-
}) }) : typeof window < "u" && !
|
|
408
|
+
}) }) : typeof window < "u" && !V ? /* @__PURE__ */ s(
|
|
358
409
|
"button",
|
|
359
410
|
{
|
|
360
411
|
type: "button",
|
|
361
|
-
onClick:
|
|
412
|
+
onClick: Ve,
|
|
362
413
|
"data-tid": "show_vote_result",
|
|
363
414
|
"data-testid": "show-result",
|
|
364
415
|
className: o.showResultButton,
|
|
365
|
-
children: /* @__PURE__ */ s("span", { className:
|
|
416
|
+
children: /* @__PURE__ */ s("span", { className: f(o.boldShowResult, o.outlined), children: /* @__PURE__ */ s(
|
|
366
417
|
m,
|
|
367
418
|
{
|
|
368
419
|
id: "vote.vote_box.show_result",
|
|
@@ -371,15 +422,15 @@ const Ke = ({
|
|
|
371
422
|
) })
|
|
372
423
|
}
|
|
373
424
|
) : /* @__PURE__ */ s(
|
|
374
|
-
|
|
425
|
+
Te,
|
|
375
426
|
{
|
|
376
|
-
to:
|
|
427
|
+
to: oe(null),
|
|
377
428
|
rel: "nofollow",
|
|
378
429
|
"data-tid": "show_vote_result",
|
|
379
430
|
target: "_top",
|
|
380
431
|
external: !0,
|
|
381
432
|
"data-testid": "show-result",
|
|
382
|
-
children: /* @__PURE__ */ s("span", { className:
|
|
433
|
+
children: /* @__PURE__ */ s("span", { className: f(o.boldShowResult, o.outlined), children: /* @__PURE__ */ s(
|
|
383
434
|
m,
|
|
384
435
|
{
|
|
385
436
|
id: "vote.vote_box.show_result",
|
|
@@ -395,5 +446,5 @@ const Ke = ({
|
|
|
395
446
|
);
|
|
396
447
|
};
|
|
397
448
|
export {
|
|
398
|
-
|
|
449
|
+
Pe as VoteBox
|
|
399
450
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import '../../../assets/components/vote/vote_box/VoteBox.module-
|
|
1
|
+
import '../../../assets/components/vote/vote_box/VoteBox.module-GeWFaMvd.css';const o = "_voteBox_18yph_3", t = "_voteResultsBox_18yph_11", e = "_voteResults_18yph_11", s = "_voteProgressHeader_18yph_22", n = "_voteProgressHeaderAgainst_18yph_35", _ = "_voteResultsNumberVoters_18yph_39", u = "_voteBoxFooter_18yph_47", v = "_voteFooterActions_18yph_56", c = "_voteBoxActions_18yph_62", i = "_voteBoxActionsBody_18yph_72", B = "_voteBoxActionsBodyColumn_18yph_80", l = "_voteAction_18yph_84", r = "_buttonAlignLeft_18yph_94", h = "_voteButton_18yph_98", y = "_textAlignLeft_18yph_109", d = "_voteBoxShowResultContainer_18yph_113", p = "_voteBoxShowResult_18yph_113", x = "_boldShowResult_18yph_137", A = "_outlined_18yph_143", a = "_voteButtonThesis_18yph_150", b = "_voteButtonThesisSynthesisMobile_18yph_162", R = "_voteBoxActionsBodyOutlined_18yph_201", g = "_voteBoxActionsBodyFilledNeutral_18yph_240", m = "_voteActionButton_18yph_253", w = "_sideIcon_18yph_273", C = "_progress_18yph_278", N = "_progressBar_18yph_284", S = "_voteCommentCounts_18yph_301", f = "_debateNumberItem_18yph_309", F = "_debateNumberLabel_18yph_318", I = "_showResultButton_18yph_322", L = "_voteResultInfoText_18yph_335", T = {
|
|
2
2
|
voteBox: o,
|
|
3
3
|
voteResultsBox: t,
|
|
4
4
|
voteResults: e,
|
|
5
|
-
voteProgressHeader:
|
|
6
|
-
voteProgressHeaderAgainst:
|
|
5
|
+
voteProgressHeader: s,
|
|
6
|
+
voteProgressHeaderAgainst: n,
|
|
7
7
|
voteResultsNumberVoters: _,
|
|
8
8
|
voteBoxFooter: u,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
voteFooterActions: v,
|
|
10
|
+
voteBoxActions: c,
|
|
11
|
+
voteBoxActionsBody: i,
|
|
12
|
+
voteBoxActionsBodyColumn: B,
|
|
13
|
+
voteAction: l,
|
|
14
|
+
buttonAlignLeft: r,
|
|
15
|
+
voteButton: h,
|
|
16
|
+
textAlignLeft: y,
|
|
17
|
+
voteBoxShowResultContainer: d,
|
|
18
|
+
voteBoxShowResult: p,
|
|
18
19
|
boldShowResult: x,
|
|
19
20
|
outlined: A,
|
|
20
21
|
voteButtonThesis: a,
|
|
@@ -27,40 +28,41 @@ import '../../../assets/components/vote/vote_box/VoteBox.module-BM2Iqu7I.css';co
|
|
|
27
28
|
progressBar: N,
|
|
28
29
|
voteCommentCounts: S,
|
|
29
30
|
debateNumberItem: f,
|
|
30
|
-
debateNumberLabel:
|
|
31
|
-
showResultButton:
|
|
32
|
-
voteResultInfoText:
|
|
31
|
+
debateNumberLabel: F,
|
|
32
|
+
showResultButton: I,
|
|
33
|
+
voteResultInfoText: L
|
|
33
34
|
};
|
|
34
35
|
export {
|
|
35
36
|
x as boldShowResult,
|
|
36
|
-
|
|
37
|
+
r as buttonAlignLeft,
|
|
37
38
|
f as debateNumberItem,
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
F as debateNumberLabel,
|
|
40
|
+
T as default,
|
|
40
41
|
A as outlined,
|
|
41
42
|
C as progress,
|
|
42
43
|
N as progressBar,
|
|
43
|
-
|
|
44
|
+
I as showResultButton,
|
|
44
45
|
w as sideIcon,
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
y as textAlignLeft,
|
|
47
|
+
l as voteAction,
|
|
47
48
|
m as voteActionButton,
|
|
48
49
|
o as voteBox,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
c as voteBoxActions,
|
|
51
|
+
i as voteBoxActionsBody,
|
|
52
|
+
B as voteBoxActionsBodyColumn,
|
|
52
53
|
g as voteBoxActionsBodyFilledNeutral,
|
|
53
54
|
R as voteBoxActionsBodyOutlined,
|
|
54
55
|
u as voteBoxFooter,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
p as voteBoxShowResult,
|
|
57
|
+
d as voteBoxShowResultContainer,
|
|
58
|
+
h as voteButton,
|
|
58
59
|
a as voteButtonThesis,
|
|
59
60
|
b as voteButtonThesisSynthesisMobile,
|
|
60
61
|
S as voteCommentCounts,
|
|
61
|
-
|
|
62
|
-
s as
|
|
63
|
-
|
|
62
|
+
v as voteFooterActions,
|
|
63
|
+
s as voteProgressHeader,
|
|
64
|
+
n as voteProgressHeaderAgainst,
|
|
65
|
+
L as voteResultInfoText,
|
|
64
66
|
e as voteResults,
|
|
65
67
|
t as voteResultsBox,
|
|
66
68
|
_ as voteResultsNumberVoters
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._voteBox_1y5hn_3{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:center!important;width:100%}._voteResultsBox_1y5hn_11{display:flex!important;flex-direction:column!important;padding:0!important;width:100%}._voteResults_1y5hn_11{padding:0!important}._voteProgressHeader_1y5hn_22{margin-bottom:var(--spacer-xxs, calc(var(--space-unit, 1em) * .25))!important;display:flex!important;align-items:center!important;font-size:var(--font-size-normal, 16px);display:-webkit-box;word-wrap:break-word;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}._voteProgressHeaderAgainst_1y5hn_35{margin-top:var(--spacer-md, calc(var(--space-unit, 1em) * .75))!important}._voteResultsNumberVoters_1y5hn_39{display:flex!important;align-items:center!important;padding:0!important;font-size:var(--font-size-normal, 16px);color:var(--text-secondary, #5F5F5F)}._voteBoxFooter_1y5hn_47{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:space-between!important;margin-top:var(--space-unit, 1em)!important;padding:0!important}._voteBoxActions_1y5hn_56{display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center;gap:var(--space-unit, 1em);color:var(--text-secondary, #5F5F5F);width:100%}._voteBoxActionsBody_1y5hn_66{display:grid!important;grid-template-columns:repeat(2,1fr);gap:var(--spacer-md, calc(var(--space-unit, 1em) * .75));padding:0!important;width:100%}._voteBoxActionsBodyColumn_1y5hn_74{grid-template-columns:1fr}._voteAction_1y5hn_78{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:center!important;padding:0!important;max-width:100%!important;width:100%!important;text-align:center}._voteAction_1y5hn_78._buttonAlignLeft_1y5hn_88{justify-content:flex-start!important}button._voteButton_1y5hn_92,a._voteButton_1y5hn_92{-webkit-appearance:initial!important;width:100%;-webkit-hyphens:auto;-ms-hyphens:auto;-moz-hyphens:auto;hyphens:auto;padding:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._textAlignLeft_1y5hn_103{justify-content:flex-start!important}._voteBoxShowResultContainer_1y5hn_107{display:flex!important;flex-direction:row!important;justify-content:center;flex-wrap:wrap!important;margin-top:.3em}._voteBoxShowResult_1y5hn_107{cursor:pointer}._voteBoxShowResult_1y5hn_107 a{color:inherit;text-decoration:none;background:none!important}._voteBoxShowResult_1y5hn_107 a:hover{text-decoration:none;background:none!important}._voteBoxShowResult_1y5hn_107 a:focus:not(:focus-visible){outline:none;box-shadow:none}._voteBoxShowResult_1y5hn_107 ._boldShowResult_1y5hn_131{font-weight:var(--font-weight-bold, 700);font-variation-settings:var(--font-variation-bold, normal);color:var(--text-primary, #222222)}._outlined_1y5hn_137{padding:7px 15px;border-radius:var(--box-border-radius, 6px);border:1px solid var(--text-primary, #222222)!important;white-space:nowrap}._voteButtonThesis_1y5hn_144{display:block;text-align:left;display:-webkit-box;word-wrap:break-word;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}@container (max-width: 767.98px){._voteButtonThesisSynthesisMobile_1y5hn_156{text-align:center!important}}._voteBoxActionsBody_1y5hn_66 ._voteAction_1y5hn_78:first-child ._voteButton_1y5hn_92,._voteBoxActionsBody_1y5hn_66 ._voteAction_1y5hn_78:first-child ._voteButton_1y5hn_92:hover{background-color:var(--for-primary-color, #cc6a6d)!important;border-color:var(--for-primary-color, #cc6a6d)!important;border:1px solid var(--for-primary-color, #cc6a6d)!important}._voteBoxActionsBody_1y5hn_66 ._voteAction_1y5hn_78:nth-child(2) ._voteButton_1y5hn_92{background-color:var(--against-primary-color, #7980bb)!important;border-color:var(--against-primary-color, #7980bb)!important;border:1px solid var(--against-primary-color, #7980bb)!important}._voteBoxActionsBody_1y5hn_66 ._voteAction_1y5hn_78:nth-child(2) ._voteButton_1y5hn_92:hover{background-color:var(--against-primary-color, #7980bb)!important;border-color:var(--against-primary-color, #7980bb)!important;border:1px solid var(--against-primary-color, #7980bb)!important}._voteBoxActionsBody_1y5hn_66 ._voteAction_1y5hn_78:nth-child(3) ._voteButton_1y5hn_92{background-color:var(--text-light, white)!important;color:var(--third-position-color-primary, #9b9b9b)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteBoxActionsBody_1y5hn_66 ._voteAction_1y5hn_78:nth-child(3) ._voteButton_1y5hn_92:hover{background-color:var(--text-light, white)!important;color:var(--third-position-color-primary, #9b9b9b)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteBoxActionsBodyOutlined_1y5hn_195 ._voteAction_1y5hn_78:first-child ._voteButton_1y5hn_92,._voteBoxActionsBodyOutlined_1y5hn_195 ._voteAction_1y5hn_78:first-child ._voteButton_1y5hn_92:hover{background-color:var(--text-light, white)!important;color:var(--for-primary-color, #cc6a6d)!important;border-color:var(--for-primary-color, #cc6a6d)!important;border:1px solid var(--for-primary-color, #cc6a6d)!important}._voteBoxActionsBodyOutlined_1y5hn_195 ._voteAction_1y5hn_78:nth-child(2) ._voteButton_1y5hn_92{background-color:var(--text-light, white)!important;color:var(--against-primary-color, #7980bb)!important;border-color:var(--against-primary-color, #7980bb)!important;border:1px solid var(--against-primary-color, #7980bb)!important}._voteBoxActionsBodyOutlined_1y5hn_195 ._voteAction_1y5hn_78:nth-child(2) ._voteButton_1y5hn_92:hover{background-color:var(--text-light, white)!important;color:var(--against-primary-color, #7980bb)!important;border-color:var(--against-primary-color, #7980bb)!important;border:1px solid var(--against-primary-color, #7980bb)!important}._voteBoxActionsBodyOutlined_1y5hn_195 ._voteAction_1y5hn_78:nth-child(3) ._voteButton_1y5hn_92{background-color:var(--text-light, white)!important;color:var(--third-position-color-primary, #9b9b9b)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteBoxActionsBodyOutlined_1y5hn_195 ._voteAction_1y5hn_78:nth-child(3) ._voteButton_1y5hn_92:hover{background-color:var(--text-light, white)!important;color:var(--third-position-color-primary, #9b9b9b)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteBoxActionsBodyFilledNeutral_1y5hn_234 ._voteAction_1y5hn_78:nth-child(3) ._voteButton_1y5hn_92{background-color:var(--third-position-color-primary, #9b9b9b)!important;color:var(--text-light, white)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteBoxActionsBodyFilledNeutral_1y5hn_234 ._voteAction_1y5hn_78:nth-child(3) ._voteButton_1y5hn_92:hover{background-color:var(--third-position-color-primary, #9b9b9b)!important;color:var(--text-light, white)!important;border-color:var(--third-position-color-primary, #9b9b9b)!important;border:1px solid var(--third-position-color-primary, #9b9b9b)!important}._voteActionButton_1y5hn_247{cursor:pointer;-webkit-appearance:initial!important;background:none;border:none;color:var(--text-secondary, #5F5F5F)!important;font-size:inherit;padding:0;font-weight:var(--font-weight-bold, 700);font-variation-settings:var(--font-variation-bold, normal)}._voteActionButton_1y5hn_247:focus:not(:focus-visible){outline:none;box-shadow:none}._sideIcon_1y5hn_263 svg{margin-left:5px;fill:var(--text-primary, #222222)}._progress_1y5hn_268{border-radius:var(--button-border-radius, var(--box-border-radius, 6px));color:var(--text-secondary, #5F5F5F);height:2.2em}._progressBar_1y5hn_274{border-radius:var(--button-border-radius, var(--box-border-radius, 6px));height:100%}._voteResults_1y5hn_11>div:first-child ._progress_1y5hn_268 ._progressBar_1y5hn_274{background-color:var(--for-primary-color, #cc6a6d)!important}._voteResults_1y5hn_11>div:nth-child(2) ._progress_1y5hn_268 ._progressBar_1y5hn_274{background-color:var(--against-primary-color, #7980bb)!important}._voteResults_1y5hn_11 div:nth-child(3) ._progress_1y5hn_268 ._progressBar_1y5hn_274{background-color:var(--third-position-color-primary, #9b9b9b)!important}._voteCommentCounts_1y5hn_291{display:flex;align-items:center;gap:var(--space-unit, 1em);width:100%;margin-top:var(--spacer-xxs, calc(var(--space-unit, 1em) * .25))!important}._debateNumberItem_1y5hn_299{display:flex;align-items:center;gap:var(--spacer-xxs, calc(var(--space-unit, 1em) * .25));font-size:var(--font-size-normal, 16px);color:var(--text-primary, #222222);white-space:nowrap}._debateNumberLabel_1y5hn_308{white-space:nowrap}._showResultButton_1y5hn_312{background:none;border:0;padding:0;font:inherit;color:inherit;cursor:pointer}._showResultButton_1y5hn_312:focus:not(:focus-visible){outline:none;box-shadow:none}._voteResultInfoText_1y5hn_325{font-size:var(--font-size-small, 16px);color:var(--text-secondary, #5F5F5F);text-align:left;width:100%;align-self:flex-start}
|