@logora/debate 0.3.83 → 0.3.85
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/proposal/proposal_box/ProposalBox.module-Dm8XDnr1.css +1 -0
- package/dist/components/proposal/proposal_box/ProposalBox.js +60 -58
- package/dist/components/proposal/proposal_box/ProposalBox.module.scss.js +13 -11
- package/dist/components/vote/vote_box/VoteBox.js +7 -7
- package/package.json +1 -1
- package/dist/assets/components/proposal/proposal_box/ProposalBox.module-C9BaTFDH.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._proposalBoxContainer_5x1d0_3{display:flex!important;flex-direction:column!important;justify-content:space-between!important;position:relative;box-shadow:var(--box-shadow, 0px 2px 5px rgba(7, 42, 68, .1));border:var(--box-border, 1px solid rgba(7, 42, 68, .1));color:var(--text-primary, #222222);border-radius:var(--box-border-radius, 6px);background-color:var(--background-color-primary, white);scroll-margin-top:150px;padding:var(--box-spacing, var(--space-unit, 1em));gap:var(--box-spacing, var(--space-unit, 1em))}._proposalBoxContainer_5x1d0_3._flash_5x1d0_17{-webkit-transition:box-shadow .8s ease-in-out;-moz-transition:box-shadow .8s ease-in-out;-o-transition:box-shadow .8s ease-in-out;transition:box-shadow .8s ease-in-out;box-shadow:0 0 15px var(--call-primary-color, #434343)}._edited_5x1d0_25{font-size:var(--font-size-extra-small, 14px);color:var(--text-secondary, #5F5F5F);line-height:var(--line-height-loose, 1.38em);margin-bottom:var(--spacer-xs, calc(var(--space-unit, 1em) * .325))!important}._proposalBoxContent_5x1d0_32{text-align:left;white-space:pre-line;line-height:var(--line-height-loose, 1.38em);font-size:var(--font-size-small, 16px)}@container (min-width: 768px){._proposalBoxContent_5x1d0_32._withMinHeight_5x1d0_40{min-height:185px}}._proposalBoxContent_5x1d0_32 ._proposalTitle_5x1d0_44{font-size:var(--font-size-normal, 16px);font-weight:var(--font-weight-bold, 700);padding-bottom:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._proposalBoxContent_5x1d0_32 ._proposalTitle_5x1d0_44:first-letter{text-transform:uppercase}._proposalBoxContent_5x1d0_32 ._proposalContent_5x1d0_52 *{font-size:var(--font-size-small, 16px)}._proposalSourcesList_5x1d0_56{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;font-size:var(--font-size-extra-small, 14px);font-weight:var(--font-weight-normal, 400)}._proposalSourcesList_5x1d0_56 a{text-decoration:none}._fixedHeight_5x1d0_68{height:200px;overflow:hidden;position:relative}._fixedHeight_5x1d0_68:after{content:"";position:absolute;z-index:1;bottom:0;left:0;right:0;pointer-events:none;background-image:linear-gradient(to bottom,#fff0,#fff 90%);width:100%;height:5em}
|
|
@@ -1,57 +1,58 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { useIntl as
|
|
1
|
+
import { jsx as t, jsxs as g, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useEffect as N } from "react";
|
|
3
|
+
import C from "classnames";
|
|
4
|
+
import { useIntl as y } from "react-intl";
|
|
5
5
|
import o from "./ProposalBox.module.scss.js";
|
|
6
|
-
import { useConfig as
|
|
7
|
-
import { useAuth as
|
|
8
|
-
import { useTranslatedContent as
|
|
9
|
-
import { lexicalToHtml as
|
|
10
|
-
import { HashScroll as
|
|
11
|
-
import { ContentHeader as
|
|
12
|
-
import { ReadMore as
|
|
13
|
-
import { TranslationButton as
|
|
14
|
-
import { SourceListItem as
|
|
15
|
-
import { ContentFooter as
|
|
16
|
-
import { UpDownVoteBox as
|
|
17
|
-
const
|
|
6
|
+
import { useConfig as L } from "../../data/config_provider/useConfig.js";
|
|
7
|
+
import { useAuth as B } from "../../auth/use_auth/useAuth.js";
|
|
8
|
+
import { useTranslatedContent as _ } from "../../translation/translated_content/useTranslatedContent.js";
|
|
9
|
+
import { lexicalToHtml as H } from "../../input/text_editor/lexicalToHtml.js";
|
|
10
|
+
import { HashScroll as U } from "../../tools/hash_scroll/HashScroll.js";
|
|
11
|
+
import { ContentHeader as D } from "../../user_content/content_header/ContentHeader.js";
|
|
12
|
+
import { ReadMore as P } from "../../text/read_more/ReadMore.js";
|
|
13
|
+
import { TranslationButton as R } from "../../translation/translation_button/TranslationButton.js";
|
|
14
|
+
import { SourceListItem as $ } from "../../source/source_list_item/SourceListItem.js";
|
|
15
|
+
import { ContentFooter as F } from "../../user_content/content_footer/ContentFooter.js";
|
|
16
|
+
import { UpDownVoteBox as j } from "../../vote/up_down_vote_box/UpDownVoteBox.js";
|
|
17
|
+
const te = ({
|
|
18
18
|
proposal: e,
|
|
19
19
|
disabled: d = !1,
|
|
20
|
-
fixedContentHeight:
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
fixedContentHeight: c,
|
|
21
|
+
fitContent: T = !1,
|
|
22
|
+
enableEdition: v = !0,
|
|
23
|
+
hideFooter: x = !1
|
|
23
24
|
}) => {
|
|
24
|
-
const [
|
|
25
|
+
const [m, M] = p(null), [w, b] = p(!1), r = y(), n = L(), { currentUser: h } = B(), f = h?.moderation_status === "banned", u = `proposal_${e.id}`, i = _(
|
|
25
26
|
e.title,
|
|
26
27
|
e.language,
|
|
27
28
|
"title",
|
|
28
29
|
e.translation_entries
|
|
29
|
-
), a =
|
|
30
|
+
), a = _(
|
|
30
31
|
e.content,
|
|
31
32
|
e.language,
|
|
32
33
|
"content",
|
|
33
34
|
e.translation_entries
|
|
34
35
|
);
|
|
35
|
-
|
|
36
|
+
N(() => {
|
|
36
37
|
if (e.rich_content) {
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
const l =
|
|
40
|
-
|
|
38
|
+
const s = JSON.parse(e.rich_content);
|
|
39
|
+
if (s.hasOwnProperty("root")) {
|
|
40
|
+
const l = H(s);
|
|
41
|
+
M(l);
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
}, [e.rich_content]);
|
|
44
|
-
const
|
|
45
|
+
const S = () => {
|
|
45
46
|
i.toggleContent(), a.toggleContent();
|
|
46
47
|
};
|
|
47
|
-
return /* @__PURE__ */ t(
|
|
48
|
+
return /* @__PURE__ */ t(U, { elementId: u, onScroll: () => b(!0), children: /* @__PURE__ */ g(
|
|
48
49
|
"div",
|
|
49
50
|
{
|
|
50
|
-
className:
|
|
51
|
-
id:
|
|
51
|
+
className: C(o.proposalBoxContainer, { [o.flash]: w }),
|
|
52
|
+
id: u,
|
|
52
53
|
children: [
|
|
53
54
|
/* @__PURE__ */ t(
|
|
54
|
-
|
|
55
|
+
D,
|
|
55
56
|
{
|
|
56
57
|
author: e.author,
|
|
57
58
|
tag: e.tag?.display_name,
|
|
@@ -62,39 +63,40 @@ const ee = ({
|
|
|
62
63
|
/* @__PURE__ */ t(
|
|
63
64
|
"div",
|
|
64
65
|
{
|
|
65
|
-
className:
|
|
66
|
-
[o.fixedHeight]:
|
|
66
|
+
className: C(o.proposalBoxContent, {
|
|
67
|
+
[o.fixedHeight]: c,
|
|
68
|
+
[o.withMinHeight]: !T && !c
|
|
67
69
|
}),
|
|
68
70
|
children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
69
|
-
|
|
71
|
+
P,
|
|
70
72
|
{
|
|
71
|
-
content: /* @__PURE__ */
|
|
72
|
-
e.is_edited && /* @__PURE__ */ t("div", { className: o.edited, children:
|
|
73
|
+
content: /* @__PURE__ */ g(I, { children: [
|
|
74
|
+
e.is_edited && /* @__PURE__ */ t("div", { className: o.edited, children: r.formatMessage({
|
|
73
75
|
id: "proposal.updated",
|
|
74
76
|
defaultMessage: "Updated proposal"
|
|
75
77
|
}) }),
|
|
76
78
|
/* @__PURE__ */ t("div", { className: o.proposalTitle, children: i.translatedContent }),
|
|
77
|
-
|
|
79
|
+
m && !a.isTranslated ? /* @__PURE__ */ t(
|
|
78
80
|
"div",
|
|
79
81
|
{
|
|
80
82
|
className: o.proposalContent,
|
|
81
|
-
dangerouslySetInnerHTML: { __html:
|
|
83
|
+
dangerouslySetInnerHTML: { __html: m }
|
|
82
84
|
}
|
|
83
85
|
) : /* @__PURE__ */ t("div", { className: o.proposalContent, children: a.translatedContent }),
|
|
84
86
|
(a.isTranslated || i.isTranslated) && /* @__PURE__ */ t(
|
|
85
|
-
|
|
87
|
+
R,
|
|
86
88
|
{
|
|
87
89
|
language: e.language,
|
|
88
|
-
callback: () =>
|
|
90
|
+
callback: () => S()
|
|
89
91
|
}
|
|
90
92
|
)
|
|
91
93
|
] }),
|
|
92
94
|
lineCount: 7,
|
|
93
|
-
readMoreText:
|
|
95
|
+
readMoreText: r.formatMessage({
|
|
94
96
|
id: "action.read_more",
|
|
95
97
|
defaultMessage: "Read more"
|
|
96
98
|
}),
|
|
97
|
-
readLessText:
|
|
99
|
+
readLessText: r.formatMessage({
|
|
98
100
|
id: "action.read_less",
|
|
99
101
|
defaultMessage: "Read less"
|
|
100
102
|
})
|
|
@@ -102,40 +104,40 @@ const ee = ({
|
|
|
102
104
|
) })
|
|
103
105
|
}
|
|
104
106
|
),
|
|
105
|
-
e.sources?.length > 0 && /* @__PURE__ */ t("div", { className: o.proposalSourcesList, children: e.sources.map((
|
|
106
|
-
|
|
107
|
+
e.sources?.length > 0 && /* @__PURE__ */ t("div", { className: o.proposalSourcesList, children: e.sources.map((s, l) => /* @__PURE__ */ t(
|
|
108
|
+
$,
|
|
107
109
|
{
|
|
108
|
-
publisher:
|
|
109
|
-
url:
|
|
110
|
-
title:
|
|
110
|
+
publisher: s.publisher,
|
|
111
|
+
url: s.source_url,
|
|
112
|
+
title: s.title,
|
|
111
113
|
index: l
|
|
112
114
|
},
|
|
113
|
-
|
|
115
|
+
s.id
|
|
114
116
|
)) }),
|
|
115
|
-
!
|
|
116
|
-
|
|
117
|
+
!x && /* @__PURE__ */ t(
|
|
118
|
+
F,
|
|
117
119
|
{
|
|
118
120
|
resource: e,
|
|
119
|
-
disabled: d ||
|
|
121
|
+
disabled: d || f,
|
|
120
122
|
reportType: "Proposal",
|
|
121
123
|
deleteType: "proposals",
|
|
122
124
|
deleteListId: "proposalsList",
|
|
123
|
-
shareModalTitle:
|
|
125
|
+
shareModalTitle: r.formatMessage({ id: "share.proposal" }),
|
|
124
126
|
shareUrl: `https://app.logora.fr/share/p/${e.id}`,
|
|
125
|
-
shareTitle:
|
|
126
|
-
shareText:
|
|
127
|
+
shareTitle: r.formatMessage({ id: "share.proposal.title" }),
|
|
128
|
+
shareText: r.formatMessage({ id: "share.proposal.text" }),
|
|
127
129
|
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>`,
|
|
128
130
|
showShareCode: n?.actions?.hideCodeShare !== !0,
|
|
129
131
|
showActions: !e.author.consultation_id,
|
|
130
|
-
enableEdition:
|
|
132
|
+
enableEdition: v,
|
|
131
133
|
children: /* @__PURE__ */ t(
|
|
132
|
-
|
|
134
|
+
j,
|
|
133
135
|
{
|
|
134
136
|
voteableType: "Proposal",
|
|
135
137
|
voteableId: e.id,
|
|
136
138
|
totalUpvote: e.total_upvotes,
|
|
137
139
|
totalDownvote: e.total_downvotes,
|
|
138
|
-
disabled: d ||
|
|
140
|
+
disabled: d || h?.id === e?.author?.id || f,
|
|
139
141
|
hideDownvotes: n?.actions?.hideDownvotes
|
|
140
142
|
}
|
|
141
143
|
)
|
|
@@ -146,5 +148,5 @@ const ee = ({
|
|
|
146
148
|
) });
|
|
147
149
|
};
|
|
148
150
|
export {
|
|
149
|
-
|
|
151
|
+
te as ProposalBox
|
|
150
152
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import '../../../assets/components/proposal/proposal_box/ProposalBox.module-
|
|
1
|
+
import '../../../assets/components/proposal/proposal_box/ProposalBox.module-Dm8XDnr1.css';const o = "_proposalBoxContainer_5x1d0_3", t = "_flash_5x1d0_17", s = "_edited_5x1d0_25", e = "_proposalBoxContent_5x1d0_32", n = "_withMinHeight_5x1d0_40", p = "_proposalTitle_5x1d0_44", i = "_proposalContent_5x1d0_52", _ = "_proposalSourcesList_5x1d0_56", a = "_fixedHeight_5x1d0_68", l = {
|
|
2
2
|
proposalBoxContainer: o,
|
|
3
3
|
flash: t,
|
|
4
4
|
edited: s,
|
|
5
|
-
proposalBoxContent:
|
|
5
|
+
proposalBoxContent: e,
|
|
6
|
+
withMinHeight: n,
|
|
6
7
|
proposalTitle: p,
|
|
7
|
-
proposalContent:
|
|
8
|
-
proposalSourcesList:
|
|
9
|
-
fixedHeight:
|
|
8
|
+
proposalContent: i,
|
|
9
|
+
proposalSourcesList: _,
|
|
10
|
+
fixedHeight: a
|
|
10
11
|
};
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
l as default,
|
|
13
14
|
s as edited,
|
|
14
|
-
|
|
15
|
+
a as fixedHeight,
|
|
15
16
|
t as flash,
|
|
16
17
|
o as proposalBoxContainer,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
p as proposalTitle
|
|
18
|
+
e as proposalBoxContent,
|
|
19
|
+
i as proposalContent,
|
|
20
|
+
_ as proposalSourcesList,
|
|
21
|
+
p as proposalTitle,
|
|
22
|
+
n as withMinHeight
|
|
21
23
|
};
|
|
@@ -67,7 +67,7 @@ const We = ({
|
|
|
67
67
|
)
|
|
68
68
|
}
|
|
69
69
|
), e;
|
|
70
|
-
}, [i, W] = b(ce()), z = Se(), le = be(),
|
|
70
|
+
}, [i, W] = b(ce()), z = Se(), le = be(), y = we(), J = Be(), B = _e(), { isLoggedIn: C, isLoggingIn: K } = Ce();
|
|
71
71
|
L(() => {
|
|
72
72
|
K === !1 && (C ? ue(h) : g(!1));
|
|
73
73
|
}, [K, C]), L(() => {
|
|
@@ -86,7 +86,7 @@ const We = ({
|
|
|
86
86
|
), t = !!e.get("initVote"), a = Number.parseInt(e.get("positionId")) || !1;
|
|
87
87
|
return [t, a];
|
|
88
88
|
}, ue = (e) => {
|
|
89
|
-
g(!0), w && w(c),
|
|
89
|
+
g(!0), w && w(c), y.getOneWithToken("votes", `${v.toLowerCase()}/${e}`, {}).then((t) => {
|
|
90
90
|
t.data.data.resource ? (A(t.data.data.resource), f(!0), g(!1)) : (g(!1), f(!1));
|
|
91
91
|
}).catch((t) => {
|
|
92
92
|
g(!1);
|
|
@@ -101,7 +101,7 @@ const We = ({
|
|
|
101
101
|
groupId: h,
|
|
102
102
|
voteableType: v,
|
|
103
103
|
positionId: e
|
|
104
|
-
}), c ? (ve(e, c.position_id), p === !1 &&
|
|
104
|
+
}), c ? (ve(e, c.position_id), p === !1 && R(), e !== c.position_id && y.update("votes", c.id, t).then((n) => {
|
|
105
105
|
n.data.success && (A(n.data.data.resource), G(
|
|
106
106
|
B.formatMessage({
|
|
107
107
|
id: "header.vote_confirm_modal",
|
|
@@ -109,7 +109,7 @@ const We = ({
|
|
|
109
109
|
}),
|
|
110
110
|
{ type: "success" }
|
|
111
111
|
));
|
|
112
|
-
})) : (fe(e),
|
|
112
|
+
})) : (fe(e), R(), y.create("votes", t).then((n) => {
|
|
113
113
|
n.data.success && (A(n.data.data.resource), G(
|
|
114
114
|
B.formatMessage({
|
|
115
115
|
id: "header.vote_confirm_modal",
|
|
@@ -167,7 +167,7 @@ const We = ({
|
|
|
167
167
|
voteableType: v,
|
|
168
168
|
positionId: e
|
|
169
169
|
}), z({ loginAction: "vote" }));
|
|
170
|
-
},
|
|
170
|
+
}, R = () => {
|
|
171
171
|
p && ie(), f(!p);
|
|
172
172
|
}, he = (e, t) => {
|
|
173
173
|
let a;
|
|
@@ -276,7 +276,7 @@ const We = ({
|
|
|
276
276
|
"data-tid": "action_edit_vote",
|
|
277
277
|
className: o.voteActionButton,
|
|
278
278
|
type: "button",
|
|
279
|
-
onClick:
|
|
279
|
+
onClick: R,
|
|
280
280
|
children: /* @__PURE__ */ s(
|
|
281
281
|
m,
|
|
282
282
|
{
|
|
@@ -307,7 +307,7 @@ const We = ({
|
|
|
307
307
|
{
|
|
308
308
|
className: d(o.voteBoxActionsBody, {
|
|
309
309
|
[o.voteBoxActionsBodyColumn]: j,
|
|
310
|
-
[o.voteBoxActionsBodyOutlined]: J.
|
|
310
|
+
[o.voteBoxActionsBodyOutlined]: J.layout?.outlinedVoteButtons,
|
|
311
311
|
[F]: F
|
|
312
312
|
}),
|
|
313
313
|
children: r.map(
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._proposalBoxContainer_5d6lc_3{display:flex!important;flex-direction:column!important;justify-content:space-between!important;position:relative;box-shadow:var(--box-shadow, 0px 2px 5px rgba(7, 42, 68, .1));border:var(--box-border, 1px solid rgba(7, 42, 68, .1));color:var(--text-primary, #222222);border-radius:var(--box-border-radius, 6px);background-color:var(--background-color-primary, white);scroll-margin-top:150px;padding:var(--box-spacing, var(--space-unit, 1em));gap:var(--box-spacing, var(--space-unit, 1em))}._proposalBoxContainer_5d6lc_3._flash_5d6lc_17{-webkit-transition:box-shadow .8s ease-in-out;-moz-transition:box-shadow .8s ease-in-out;-o-transition:box-shadow .8s ease-in-out;transition:box-shadow .8s ease-in-out;box-shadow:0 0 15px var(--call-primary-color, #434343)}._edited_5d6lc_25{font-size:var(--font-size-extra-small, 14px);color:var(--text-secondary, #5F5F5F);line-height:var(--line-height-loose, 1.38em);margin-bottom:var(--spacer-xs, calc(var(--space-unit, 1em) * .325))!important}._proposalBoxContent_5d6lc_32{text-align:left;white-space:pre-line;line-height:var(--line-height-loose, 1.38em);font-size:var(--font-size-small, 16px)}@container (min-width: 768px){._proposalBoxContent_5d6lc_32{min-height:185px}}._proposalBoxContent_5d6lc_32 ._proposalTitle_5d6lc_44{font-size:var(--font-size-normal, 16px);font-weight:var(--font-weight-bold, 700);padding-bottom:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._proposalBoxContent_5d6lc_32 ._proposalTitle_5d6lc_44:first-letter{text-transform:uppercase}._proposalBoxContent_5d6lc_32 ._proposalContent_5d6lc_52 *{font-size:var(--font-size-small, 16px)}._proposalSourcesList_5d6lc_56{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;font-size:var(--font-size-extra-small, 14px);font-weight:var(--font-weight-normal, 400)}._proposalSourcesList_5d6lc_56 a{text-decoration:none}._fixedHeight_5d6lc_68{height:200px;overflow:hidden;position:relative}._fixedHeight_5d6lc_68:after{content:"";position:absolute;z-index:1;bottom:0;left:0;right:0;pointer-events:none;background-image:linear-gradient(to bottom,#fff0,#fff 90%);width:100%;height:5em}
|