@logora/debate 0.4.98 → 0.4.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,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: [
|