@logora/debate 0.4.89 → 0.4.90

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