@logora/debate 0.3.20 → 0.3.22
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.
|
@@ -9,24 +9,24 @@ import { useTranslatedContent as p } from "../../translation/translated_content/
|
|
|
9
9
|
import { lexicalToHtml as H } from "../../input/text_editor/lexicalToHtml.js";
|
|
10
10
|
import { HashScroll as L } from "../../tools/hash_scroll/HashScroll.js";
|
|
11
11
|
import { ContentHeader as U } from "../../user_content/content_header/ContentHeader.js";
|
|
12
|
-
import { ReadMore as
|
|
13
|
-
import { TranslationButton as
|
|
14
|
-
import { ContentFooter as
|
|
15
|
-
import { UpDownVoteBox as
|
|
12
|
+
import { ReadMore as D } from "../../text/read_more/ReadMore.js";
|
|
13
|
+
import { TranslationButton as P } from "../../translation/translation_button/TranslationButton.js";
|
|
14
|
+
import { ContentFooter as R } from "../../user_content/content_footer/ContentFooter.js";
|
|
15
|
+
import { UpDownVoteBox as $ } from "../../vote/up_down_vote_box/UpDownVoteBox.js";
|
|
16
16
|
const Z = ({
|
|
17
17
|
proposal: e,
|
|
18
|
-
disabled:
|
|
18
|
+
disabled: i = !1,
|
|
19
19
|
fixedContentHeight: C,
|
|
20
|
-
contentMaxHeight:
|
|
20
|
+
contentMaxHeight: F = 156,
|
|
21
21
|
enableEdition: T = !0,
|
|
22
22
|
hideFooter: _ = !1
|
|
23
23
|
}) => {
|
|
24
|
-
const [
|
|
24
|
+
const [d, x] = g(null), [v, M] = g(!1), a = N(), r = S(), { currentUser: l } = B(), c = l?.moderation_status === "banned", m = `proposal_${e.id}`, s = p(
|
|
25
25
|
e.title,
|
|
26
26
|
e.language,
|
|
27
27
|
"title",
|
|
28
28
|
e.translation_entries
|
|
29
|
-
),
|
|
29
|
+
), n = p(
|
|
30
30
|
e.content,
|
|
31
31
|
e.language,
|
|
32
32
|
"content",
|
|
@@ -42,12 +42,12 @@ const Z = ({
|
|
|
42
42
|
}
|
|
43
43
|
}, [e.rich_content]);
|
|
44
44
|
const w = () => {
|
|
45
|
-
|
|
45
|
+
s.toggleContent(), n.toggleContent();
|
|
46
46
|
};
|
|
47
|
-
return /* @__PURE__ */ t(L, { elementId: m, onScroll: () =>
|
|
47
|
+
return /* @__PURE__ */ t(L, { elementId: m, onScroll: () => M(!0), children: /* @__PURE__ */ f(
|
|
48
48
|
"div",
|
|
49
49
|
{
|
|
50
|
-
className: u(o.proposalBoxContainer, { [o.flash]:
|
|
50
|
+
className: u(o.proposalBoxContainer, { [o.flash]: v }),
|
|
51
51
|
id: m,
|
|
52
52
|
children: [
|
|
53
53
|
/* @__PURE__ */ t(
|
|
@@ -66,23 +66,23 @@ const Z = ({
|
|
|
66
66
|
[o.fixedHeight]: C
|
|
67
67
|
}),
|
|
68
68
|
children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
69
|
-
|
|
69
|
+
D,
|
|
70
70
|
{
|
|
71
71
|
content: /* @__PURE__ */ f(y, { children: [
|
|
72
72
|
e.is_edited && /* @__PURE__ */ t("div", { className: o.edited, children: a.formatMessage({
|
|
73
73
|
id: "proposal.updated",
|
|
74
74
|
defaultMessage: "Updated proposal"
|
|
75
75
|
}) }),
|
|
76
|
-
/* @__PURE__ */ t("div", { className: o.proposalTitle, children:
|
|
77
|
-
|
|
76
|
+
/* @__PURE__ */ t("div", { className: o.proposalTitle, children: s.translatedContent }),
|
|
77
|
+
d && !n.isTranslated ? /* @__PURE__ */ t(
|
|
78
78
|
"div",
|
|
79
79
|
{
|
|
80
80
|
className: o.proposalContent,
|
|
81
|
-
dangerouslySetInnerHTML: { __html:
|
|
81
|
+
dangerouslySetInnerHTML: { __html: d }
|
|
82
82
|
}
|
|
83
|
-
) : /* @__PURE__ */ t("div", { className: o.proposalContent, children:
|
|
84
|
-
(
|
|
85
|
-
|
|
83
|
+
) : /* @__PURE__ */ t("div", { className: o.proposalContent, children: n.translatedContent }),
|
|
84
|
+
(n.isTranslated || s.isTranslated) && /* @__PURE__ */ t(
|
|
85
|
+
P,
|
|
86
86
|
{
|
|
87
87
|
language: e.language,
|
|
88
88
|
callback: () => w()
|
|
@@ -103,10 +103,10 @@ const Z = ({
|
|
|
103
103
|
}
|
|
104
104
|
),
|
|
105
105
|
!_ && /* @__PURE__ */ t(
|
|
106
|
-
|
|
106
|
+
R,
|
|
107
107
|
{
|
|
108
108
|
resource: e,
|
|
109
|
-
disabled:
|
|
109
|
+
disabled: i || c,
|
|
110
110
|
reportType: "Proposal",
|
|
111
111
|
deleteType: "proposals",
|
|
112
112
|
deleteListId: "proposalsList",
|
|
@@ -115,18 +115,19 @@ const Z = ({
|
|
|
115
115
|
shareUrl: `https://app.logora.fr/share/p/${e.id}`,
|
|
116
116
|
shareTitle: a.formatMessage({ id: "share.proposal.title" }),
|
|
117
117
|
shareText: a.formatMessage({ id: "share.proposal.text" }),
|
|
118
|
-
shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${
|
|
119
|
-
showShareCode:
|
|
118
|
+
shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${r.shortname}&id=${e.id}&resource=proposal" frameborder="0" width="100%" height="335px" scrolling="no"></iframe>`,
|
|
119
|
+
showShareCode: r?.actions?.hideCodeShare !== !0,
|
|
120
120
|
showActions: !e.author.consultation_id,
|
|
121
121
|
enableEdition: T,
|
|
122
122
|
children: /* @__PURE__ */ t(
|
|
123
|
-
|
|
123
|
+
$,
|
|
124
124
|
{
|
|
125
125
|
voteableType: "Proposal",
|
|
126
126
|
voteableId: e.id,
|
|
127
127
|
totalUpvote: e.total_upvotes,
|
|
128
128
|
totalDownvote: e.total_downvotes,
|
|
129
|
-
disabled:
|
|
129
|
+
disabled: i || l?.id === e?.author?.id || c,
|
|
130
|
+
hideDownvotes: r?.actions?.hideDownvotes
|
|
130
131
|
}
|
|
131
132
|
)
|
|
132
133
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as s, Fragment as f } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { useLocation as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return
|
|
2
|
+
import { useEffect as m } from "react";
|
|
3
|
+
import { useLocation as a } from "react-router";
|
|
4
|
+
const l = ({ elementId: o, onScroll: n, children: r }) => {
|
|
5
|
+
const t = a();
|
|
6
|
+
return m(() => {
|
|
7
7
|
if (o && typeof window < "u") {
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
const
|
|
11
|
-
|
|
8
|
+
const c = t.pathname + t.hash.slice(1), i = new RegExp(o);
|
|
9
|
+
if (c.match(i)) {
|
|
10
|
+
const e = document.getElementById(o);
|
|
11
|
+
e && (n?.(), e.scrollIntoView({ behavior: "smooth" }));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
}, [
|
|
14
|
+
}, [t]), /* @__PURE__ */ s(f, { children: r });
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
l as HashScroll
|
|
18
18
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useLocation as
|
|
3
|
-
const
|
|
4
|
-
const { pathname:
|
|
1
|
+
import { useRef as f, useEffect as c } from "react";
|
|
2
|
+
import { useLocation as i } from "react-router";
|
|
3
|
+
const m = ({ elementId: o }) => {
|
|
4
|
+
const { pathname: r, search: n, hash: s } = i(), e = f(!0);
|
|
5
5
|
return c(() => {
|
|
6
6
|
if (typeof window < "u")
|
|
7
7
|
if (e.current)
|
|
8
8
|
e.current = !1;
|
|
9
9
|
else {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
if (s) return;
|
|
11
|
+
const t = document.getElementById(o);
|
|
12
|
+
t && t.scrollIntoView({ behavior: "smooth" });
|
|
12
13
|
}
|
|
13
|
-
}, [
|
|
14
|
+
}, [r, n]), null;
|
|
14
15
|
};
|
|
15
16
|
export {
|
|
16
|
-
|
|
17
|
+
m as ScrollToTop
|
|
17
18
|
};
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { jsxs as a, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import l from "classnames";
|
|
3
3
|
import "react";
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import { useVote as
|
|
4
|
+
import { useIntl as w } from "react-intl";
|
|
5
|
+
import e from "./UpDownVoteBox.module.scss.js";
|
|
6
|
+
import { useVote as x } from "../use_vote/useVote.js";
|
|
7
7
|
import { Icon as d } from "../../icons/icon/Icon.js";
|
|
8
|
-
const
|
|
8
|
+
const j = ({
|
|
9
9
|
voteableType: p,
|
|
10
10
|
voteableId: v,
|
|
11
11
|
totalUpvote: m = 0,
|
|
12
12
|
totalDownvote: c = 0,
|
|
13
|
-
disabled:
|
|
13
|
+
disabled: t = !1,
|
|
14
|
+
hideDownvotes: u = !1
|
|
14
15
|
}) => {
|
|
15
|
-
const { totalUpvotes:
|
|
16
|
-
return /* @__PURE__ */ a("div", { className:
|
|
16
|
+
const { totalUpvotes: f, totalDownvotes: h, activeVote: s, voteSide: n, handleVote: i } = x(p, v, m, c), r = w();
|
|
17
|
+
return /* @__PURE__ */ a("div", { className: e.container, children: [
|
|
17
18
|
/* @__PURE__ */ a(
|
|
18
19
|
"div",
|
|
19
20
|
{
|
|
20
|
-
className: l(
|
|
21
|
-
[
|
|
22
|
-
[
|
|
21
|
+
className: l(e.upvoteContainer, {
|
|
22
|
+
[e.disabled]: t,
|
|
23
|
+
[e.active]: s && n
|
|
23
24
|
}),
|
|
24
|
-
onClick:
|
|
25
|
+
onClick: t ? null : () => i(!0),
|
|
25
26
|
"data-testid": "upvote-button",
|
|
26
27
|
children: [
|
|
27
28
|
/* @__PURE__ */ o(
|
|
@@ -36,18 +37,18 @@ const V = ({
|
|
|
36
37
|
})
|
|
37
38
|
}
|
|
38
39
|
),
|
|
39
|
-
/* @__PURE__ */ o("div", { className:
|
|
40
|
+
/* @__PURE__ */ o("div", { className: e.voteText, children: f })
|
|
40
41
|
]
|
|
41
42
|
}
|
|
42
43
|
),
|
|
43
44
|
/* @__PURE__ */ a(
|
|
44
45
|
"div",
|
|
45
46
|
{
|
|
46
|
-
className: l(
|
|
47
|
-
[
|
|
48
|
-
[
|
|
47
|
+
className: l(e.downvoteContainer, {
|
|
48
|
+
[e.disabled]: t,
|
|
49
|
+
[e.active]: s && !n
|
|
49
50
|
}),
|
|
50
|
-
onClick:
|
|
51
|
+
onClick: t ? null : () => i(!1),
|
|
51
52
|
"data-testid": "downvote-button",
|
|
52
53
|
children: [
|
|
53
54
|
/* @__PURE__ */ o(
|
|
@@ -62,12 +63,12 @@ const V = ({
|
|
|
62
63
|
})
|
|
63
64
|
}
|
|
64
65
|
),
|
|
65
|
-
/* @__PURE__ */ o("div", { className:
|
|
66
|
+
!u && /* @__PURE__ */ o("div", { className: e.voteText, children: h })
|
|
66
67
|
]
|
|
67
68
|
}
|
|
68
69
|
)
|
|
69
70
|
] });
|
|
70
71
|
};
|
|
71
72
|
export {
|
|
72
|
-
|
|
73
|
+
j as UpDownVoteBox
|
|
73
74
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logora/debate",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"description": "Design system of @Logora made with React",
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
},
|
|
56
56
|
"homepage": "https://github.com/Logora/interface#readme",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@lexical/headless": "^0.
|
|
59
|
-
"@lexical/html": "^0.
|
|
60
|
-
"@lexical/list": "^0.
|
|
61
|
-
"@lexical/overflow": "^0.
|
|
62
|
-
"@lexical/react": "^0.
|
|
63
|
-
"@lexical/rich-text": "^0.
|
|
64
|
-
"@lexical/selection": "^0.
|
|
65
|
-
"@lexical/utils": "^0.
|
|
58
|
+
"@lexical/headless": "^0.43.0",
|
|
59
|
+
"@lexical/html": "^0.43.0",
|
|
60
|
+
"@lexical/list": "^0.43.0",
|
|
61
|
+
"@lexical/overflow": "^0.43.0",
|
|
62
|
+
"@lexical/react": "^0.43.0",
|
|
63
|
+
"@lexical/rich-text": "^0.43.0",
|
|
64
|
+
"@lexical/selection": "^0.43.0",
|
|
65
|
+
"@lexical/utils": "^0.43.0",
|
|
66
66
|
"@rooks/use-localstorage-state": "^4.11.2",
|
|
67
67
|
"@rooks/use-previous": "^4.11.2",
|
|
68
68
|
"@rooks/use-sessionstorage-state": "^4.11.2",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"classnames": "^2.5.1",
|
|
73
73
|
"dompurify": "^3.3.3",
|
|
74
74
|
"flat": "^5.0.2",
|
|
75
|
-
"lexical": "^0.
|
|
75
|
+
"lexical": "^0.43.0",
|
|
76
76
|
"path-to-regexp": "^6.3.0",
|
|
77
77
|
"react-chartjs-2": "^5.3.1",
|
|
78
78
|
"react-copy-to-clipboard": "^5.1.1",
|