@logora/debate 0.4.90 → 0.4.92

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,33 +1,33 @@
1
- import { jsx as o, Fragment as f, jsxs as s } from "react/jsx-runtime";
2
- import a from "classnames";
3
- import { useMemo as N } from "react";
4
- import { useIntl as _, FormattedMessage as l } from "react-intl";
5
- import e from "./ConsultationBox.module.scss.js";
6
- import { useRoutes as v } from "../../data/config_provider/useRoutes.js";
7
- import { useResponsive as x } from "../../hooks/use_responsive/useResponsive.js";
8
- import { Link as c } from "../../action/link/Link.js";
9
- import { Icon as d } from "../../icons/icon/Icon.js";
10
- import { TranslatedContent as M } from "../../translation/translated_content/TranslatedContent.js";
11
- import { Tooltip as h } from "../../dialog/tooltip/Tooltip.js";
12
- import { ProgressBar as b } from "../../progress/progress_bar/ProgressBar.js";
13
- const R = ({ consultation: t, showVoteProgress: p = !0 }) => {
14
- const n = _(), m = N(() => /* @__PURE__ */ new Date()), u = new Date(t.ends_at), i = t.ends_at && u < m || t.is_expired === !0, g = !i && t.is_active === !1, r = v(), { isMobile: S } = x();
15
- return /* @__PURE__ */ o(f, { children: /* @__PURE__ */ s("div", { className: e.container, children: [
16
- /* @__PURE__ */ s("div", { className: e.consultationImageBox, children: [
17
- /* @__PURE__ */ o(
18
- c,
1
+ import { jsx as e, Fragment as p, jsxs as s } from "react/jsx-runtime";
2
+ import i from "classnames";
3
+ import { useMemo as f } from "react";
4
+ import { useIntl as N, FormattedMessage as u } from "react-intl";
5
+ import o from "./ConsultationBox.module.scss.js";
6
+ import { useRoutes as _ } from "../../data/config_provider/useRoutes.js";
7
+ import { useResponsive as v } from "../../hooks/use_responsive/useResponsive.js";
8
+ import { Link as r } from "../../action/link/Link.js";
9
+ import { Icon as l } from "../../icons/icon/Icon.js";
10
+ import { TranslatedContent as x } from "../../translation/translated_content/TranslatedContent.js";
11
+ import { Tooltip as g } from "../../dialog/tooltip/Tooltip.js";
12
+ import { ProgressBar as M } from "../../progress/progress_bar/ProgressBar.js";
13
+ const P = ({ consultation: t, showVoteProgress: h = !0 }) => {
14
+ const a = N(), m = f(() => /* @__PURE__ */ new Date()), c = new Date(t.ends_at), d = t.ends_at && c < m || t.is_expired === !0 || t.is_active === !1, n = _(), { isMobile: b } = v();
15
+ return /* @__PURE__ */ e(p, { children: /* @__PURE__ */ s("div", { className: o.container, children: [
16
+ /* @__PURE__ */ s("div", { className: o.consultationImageBox, children: [
17
+ /* @__PURE__ */ e(
18
+ r,
19
19
  {
20
- to: r.consultationShowLocation.toUrl({
20
+ to: n.consultationShowLocation.toUrl({
21
21
  consultationSlug: t.slug
22
22
  }),
23
- children: /* @__PURE__ */ o(
23
+ children: /* @__PURE__ */ e(
24
24
  "img",
25
25
  {
26
26
  loading: "lazy",
27
- className: e.consultationImage,
27
+ className: o.consultationImage,
28
28
  src: t.image_url,
29
29
  height: 200,
30
- alt: n.formatMessage({
30
+ alt: a.formatMessage({
31
31
  id: "consultation.consultation_box.alt",
32
32
  defaultMessage: "Presentation image for the consultation"
33
33
  })
@@ -35,42 +35,35 @@ const R = ({ consultation: t, showVoteProgress: p = !0 }) => {
35
35
  )
36
36
  }
37
37
  ),
38
- i && /* @__PURE__ */ o("div", { className: a(e.consultationTime, e.ended), children: /* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
39
- l,
38
+ d && /* @__PURE__ */ e("div", { className: i(o.consultationTime, o.ended), children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
39
+ u,
40
40
  {
41
41
  id: "consultation.consultation_box.consultation_ended",
42
42
  defaultMessage: "Consultation ended"
43
43
  }
44
44
  ) }) }),
45
- g && /* @__PURE__ */ o("div", { className: a(e.consultationTime, e.ended), children: /* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
46
- l,
47
- {
48
- id: "consultation.consultation_box.consultation_suspended",
49
- defaultMessage: "Consultation suspended"
50
- }
51
- ) }) }),
52
- t.author && t.author.is_admin === !1 && /* @__PURE__ */ s("div", { className: e.consultationSuggestion, children: [
53
- /* @__PURE__ */ o(d, { name: "suggestion", width: 15, height: 15 }),
54
- /* @__PURE__ */ s("span", { className: e.authorSuggestion, children: [
55
- /* @__PURE__ */ o(
56
- l,
45
+ t.author && t.author.is_admin === !1 && /* @__PURE__ */ s("div", { className: o.consultationSuggestion, children: [
46
+ /* @__PURE__ */ e(l, { name: "suggestion", width: 15, height: 15 }),
47
+ /* @__PURE__ */ s("span", { className: o.authorSuggestion, children: [
48
+ /* @__PURE__ */ e(
49
+ u,
57
50
  {
58
51
  id: "consultation.consultation_box.suggestion_author_short",
59
52
  defaultMessage: "Suggested by"
60
53
  }
61
54
  ),
62
- /* @__PURE__ */ o("span", { className: e.authorName, children: t.author.full_name })
55
+ /* @__PURE__ */ e("span", { className: o.authorName, children: t.author.full_name })
63
56
  ] })
64
57
  ] })
65
58
  ] }),
66
- /* @__PURE__ */ o(
67
- c,
59
+ /* @__PURE__ */ e(
60
+ r,
68
61
  {
69
- to: r.consultationShowLocation.toUrl({
62
+ to: n.consultationShowLocation.toUrl({
70
63
  consultationSlug: t.slug
71
64
  }),
72
- children: /* @__PURE__ */ o("div", { className: e.consultationTitle, children: /* @__PURE__ */ o(
73
- M,
65
+ children: /* @__PURE__ */ e("div", { className: o.consultationTitle, children: /* @__PURE__ */ e(
66
+ x,
74
67
  {
75
68
  originalContent: t.title,
76
69
  originalLanguage: t.language,
@@ -80,20 +73,20 @@ const R = ({ consultation: t, showVoteProgress: p = !0 }) => {
80
73
  ) })
81
74
  }
82
75
  ),
83
- /* @__PURE__ */ o(
84
- c,
76
+ /* @__PURE__ */ e(
77
+ r,
85
78
  {
86
- to: r.consultationShowLocation.toUrl({
79
+ to: n.consultationShowLocation.toUrl({
87
80
  consultationSlug: t.slug
88
81
  })
89
82
  }
90
83
  ),
91
- /* @__PURE__ */ s("div", { className: e.consultationInformations, children: [
92
- /* @__PURE__ */ s("div", { className: e.consultationLeft, children: [
93
- /* @__PURE__ */ o(
94
- h,
84
+ /* @__PURE__ */ s("div", { className: o.consultationInformations, children: [
85
+ /* @__PURE__ */ s("div", { className: o.consultationLeft, children: [
86
+ /* @__PURE__ */ e(
87
+ g,
95
88
  {
96
- text: n.formatMessage({
89
+ text: a.formatMessage({
97
90
  id: "info.votes_count",
98
91
  defaultMessage: "Number of votes"
99
92
  }),
@@ -101,45 +94,45 @@ const R = ({ consultation: t, showVoteProgress: p = !0 }) => {
101
94
  children: /* @__PURE__ */ s(
102
95
  "div",
103
96
  {
104
- className: a(
105
- e.consultationGroupInformation,
106
- e.consultationGroupRight
97
+ className: i(
98
+ o.consultationGroupInformation,
99
+ o.consultationGroupRight
107
100
  ),
108
101
  children: [
109
- /* @__PURE__ */ o("span", { className: e.consultationTextInformation, children: t.total_votes }),
110
- /* @__PURE__ */ o(d, { name: "votebox", width: 15, height: 20, className: e.iconVote })
102
+ /* @__PURE__ */ e("span", { className: o.consultationTextInformation, children: t.total_votes }),
103
+ /* @__PURE__ */ e(l, { name: "votebox", width: 15, height: 20, className: o.iconVote })
111
104
  ]
112
105
  }
113
106
  )
114
107
  }
115
108
  ),
116
- /* @__PURE__ */ o(
117
- h,
109
+ /* @__PURE__ */ e(
110
+ g,
118
111
  {
119
- text: n.formatMessage({
112
+ text: a.formatMessage({
120
113
  id: "info.proposals_count",
121
114
  defaultMessage: "Number of proposals"
122
115
  }),
123
116
  position: "top",
124
- children: /* @__PURE__ */ s("div", { className: e.consultationGroupInformation, children: [
125
- /* @__PURE__ */ o("span", { className: e.consultationTextInformation, children: t.proposals_count }),
126
- /* @__PURE__ */ o(d, { name: "chat", width: 15, height: 20, className: e.iconChat })
117
+ children: /* @__PURE__ */ s("div", { className: o.consultationGroupInformation, children: [
118
+ /* @__PURE__ */ e("span", { className: o.consultationTextInformation, children: t.proposals_count }),
119
+ /* @__PURE__ */ e(l, { name: "chat", width: 15, height: 20, className: o.iconChat })
127
120
  ] })
128
121
  }
129
122
  )
130
123
  ] }),
131
- p && t.vote_goal > 0 && !i && !g && u > m && /* @__PURE__ */ o(
124
+ h && t.vote_goal > 0 && !d && c > m && /* @__PURE__ */ e(
132
125
  "div",
133
126
  {
134
- className: a(
135
- e.consultationGroupInformation,
136
- e.progressBarContainer
127
+ className: i(
128
+ o.consultationGroupInformation,
129
+ o.progressBarContainer
137
130
  ),
138
- children: /* @__PURE__ */ o(
139
- b,
131
+ children: /* @__PURE__ */ e(
132
+ M,
140
133
  {
141
- className: e.progress,
142
- innerClassName: e.bar,
134
+ className: o.progress,
135
+ innerClassName: o.bar,
143
136
  progress: t.total_votes,
144
137
  goal: t.vote_goal,
145
138
  showProgressSubtitle: !0,
@@ -152,5 +145,5 @@ const R = ({ consultation: t, showVoteProgress: p = !0 }) => {
152
145
  ] }) });
153
146
  };
154
147
  export {
155
- R as ConsultationBox
148
+ P as ConsultationBox
156
149
  };
@@ -6,9 +6,9 @@ import t from "./ContentHeader.module.scss.js";
6
6
  import { useRelativeTime as b } from "../../hooks/use_relative_time/useRelativeTime.js";
7
7
  import { useConfig as x } from "../../data/config_provider/useConfig.js";
8
8
  import { Icon as g } from "../../icons/icon/Icon.js";
9
- import { UserBoxSmall as H } from "../../user/user_box_small/UserBoxSmall.js";
10
- import { AuthorBox as w } from "../../user/author_box/AuthorBox.js";
11
- const $ = ({
9
+ import { UserBoxSmall as w } from "../../user/user_box_small/UserBoxSmall.js";
10
+ import { AuthorBox as H } from "../../user/author_box/AuthorBox.js";
11
+ const U = ({
12
12
  author: e,
13
13
  tag: r,
14
14
  tagClassName: _,
@@ -22,7 +22,9 @@ const $ = ({
22
22
  moderationPolicyUrl: m,
23
23
  showModerationFeedback: v = !1
24
24
  }) => {
25
- const M = b(new Date(l).getTime()), n = N(), f = x();
25
+ const M = b(
26
+ Math.min(new Date(l).getTime(), Date.now())
27
+ ), n = N(), f = x();
26
28
  return /* @__PURE__ */ o("div", { className: t.contentHeaderContainer, children: [
27
29
  v && /* @__PURE__ */ o("div", { className: t.moderationInfo, children: [
28
30
  /* @__PURE__ */ o("div", { className: t.moderationReason, children: [
@@ -82,14 +84,14 @@ const $ = ({
82
84
  ] }),
83
85
  /* @__PURE__ */ o("div", { className: t.contentHeader, children: [
84
86
  /* @__PURE__ */ a("div", { className: t.contentHeaderAuthorBox, children: i === !0 ? /* @__PURE__ */ a(
85
- H,
87
+ w,
86
88
  {
87
89
  userName: e.full_name,
88
90
  avatarUrl: e.image_url,
89
91
  userSlug: e.hash_id
90
92
  }
91
93
  ) : /* @__PURE__ */ a(
92
- w,
94
+ H,
93
95
  {
94
96
  fullName: e.full_name,
95
97
  avatarUrl: e.image_url,
@@ -124,5 +126,5 @@ const $ = ({
124
126
  ] });
125
127
  };
126
128
  export {
127
- $ as ContentHeader
129
+ U as ContentHeader
128
130
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.4.90",
3
+ "version": "0.4.92",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",