fansunited-frontend-components 1.0.0 → 1.0.2
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/Betslip.js +1 -1
- package/ChanceGame.js +1 -1
- package/ClassicQuizPlay.js +1 -1
- package/CollectLead.js +1 -1
- package/CompetitionStatistics.js +1 -1
- package/CompetitorCard.js +1 -1
- package/Discussion.js +2 -2
- package/EitherOrPlay.js +1 -1
- package/EventCard.js +1 -1
- package/EventGamePlay.js +1 -1
- package/Leaderboard.js +1 -1
- package/List.js +1 -1
- package/MatchQuizPlay.js +1 -1
- package/Odds.js +1 -1
- package/PersonalityQuizPlay.js +1 -1
- package/PickThePair.js +1 -1
- package/PlayerOfTheMatch.js +1 -1
- package/PollVote.js +1 -1
- package/Predictor.js +2 -2
- package/Standings.js +1 -1
- package/TopX.js +2 -2
- package/chunks/index-DqQtGqBF.js +4 -0
- package/chunks/{main-gV165E-A.js → main-WkCv5Rjl.js} +401 -399
- package/chunks/{predictionsHelpers-fwXaMadu.js → predictionsHelpers-D8j0Y78z.js} +4 -2
- package/chunks/{withVersionStamp-CPDfSE5H.js → withVersionStamp-KKp-FjR1.js} +1 -1
- package/package.json +6 -2
- package/chunks/index-CVRI82Gb.js +0 -4
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as y, jsx as n, Fragment as Re } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { InlineSpinner as bt, useTextareaAutosize as xt, autosizeShadowStyle as vt, Modal as lt, Avatar as St, Notification as dt, useSelect as wt, Spinner as Oe, WidgetPortal as Ct } from "fansunited-frontend-core/ui/emotion";
|
|
3
|
-
import Ie, { useState as
|
|
3
|
+
import Ie, { useState as B, useEffect as he, useRef as V, useCallback as Ce, useLayoutEffect as kt, useId as Rt } from "react";
|
|
4
4
|
import { useDisableCache as It, useColors as Et, bidiIsolateAuto as Dt, useIsRtl as Bt, useConstantContext as Ke, ConstantsContext as Ue, toIntlLocale as ut } from "fansunited-frontend-core";
|
|
5
5
|
import { css as o } from "@emotion/react";
|
|
6
6
|
import { useTranslation as be } from "react-i18next";
|
|
7
|
-
import { ThumbUpIcon as Pt, ThumbDownIcon as Tt, FavoriteIcon as At, SentimentSatisfiedIcon as Mt, FavoriteBorderIcon as Lt, EmojiEmotionsIcon as zt, SentimentVeryDissatisfiedIcon as
|
|
7
|
+
import { ThumbUpIcon as Pt, ThumbDownIcon as Tt, FavoriteIcon as At, SentimentSatisfiedIcon as Mt, FavoriteBorderIcon as Lt, EmojiEmotionsIcon as zt, SentimentVeryDissatisfiedIcon as $t, MoodBadIcon as Ft, ReplyIcon as Xt, MoreVertIcon as Ht, DeleteIcon as Ot, FlagIcon as Nt, CloseIcon as Wt, PersonIcon as Kt, RemoveCircleOutlineIcon as Ut, BlockIcon as Vt, KeyboardArrowDownIcon as _t, UnfoldIcon as jt } from "fansunited-frontend-core/ui/icons";
|
|
8
8
|
import { createPortal as Yt } from "react-dom";
|
|
9
9
|
const Gt = (t, r) => {
|
|
10
|
-
const [i, s] =
|
|
10
|
+
const [i, s] = B(null), [u, a] = B(!0), [f, d] = B(null), [l, c] = B(!1);
|
|
11
11
|
return he(() => {
|
|
12
12
|
r && (async () => {
|
|
13
13
|
try {
|
|
14
14
|
a(!0);
|
|
15
|
-
const
|
|
16
|
-
s(
|
|
17
|
-
} catch (
|
|
18
|
-
(t.helpers.getSDKConfiguration().errorHandlingMode === "standard" ?
|
|
15
|
+
const g = await t.discussions.getById(r);
|
|
16
|
+
s(g), d(null), c(!1);
|
|
17
|
+
} catch (g) {
|
|
18
|
+
(t.helpers.getSDKConfiguration().errorHandlingMode === "standard" ? g.error.code === 404 : g.data.error.code === 404) ? (c(!0), d(null), s(null)) : (d(f), s(null), c(!1));
|
|
19
19
|
} finally {
|
|
20
20
|
a(!1);
|
|
21
21
|
}
|
|
22
22
|
})();
|
|
23
|
-
}, [t, r]), { discussion: i, setDiscussion: s, isLoading: u, error:
|
|
24
|
-
}, Jt = 5e3, qt = 5, Qt = (t, r, i = null, s = "", u = "LATEST", a = 20,
|
|
25
|
-
const c = a <= 0, [
|
|
23
|
+
}, [t, r]), { discussion: i, setDiscussion: s, isLoading: u, error: f, isNotFound: l };
|
|
24
|
+
}, Jt = 5e3, qt = 5, Qt = (t, r, i = null, s = "", u = "LATEST", a = 20, f, d = !1, l = 0) => {
|
|
25
|
+
const c = a <= 0, [b, g] = B([]), [C, v] = B(!c), [m, E] = B(!1), [I, x] = B(null), [p, R] = B(u), [M, D] = B(
|
|
26
26
|
null
|
|
27
|
-
), [
|
|
28
|
-
async (
|
|
27
|
+
), [$, J] = B(!1), [K, _] = B(() => /* @__PURE__ */ new Set()), q = V(0), P = Ce(
|
|
28
|
+
async (k, S, w = !1) => {
|
|
29
29
|
var A, N;
|
|
30
30
|
w || (q.current += 1, _(/* @__PURE__ */ new Set()));
|
|
31
31
|
try {
|
|
32
|
-
|
|
32
|
+
v(!0);
|
|
33
33
|
const H = await t.discussions.getPosts(r, {
|
|
34
|
-
sort:
|
|
34
|
+
sort: k,
|
|
35
35
|
limit: a,
|
|
36
36
|
startAfter: S,
|
|
37
37
|
skipDeleted: !0,
|
|
38
38
|
skipModerated: !d
|
|
39
39
|
}), ae = H.data;
|
|
40
|
-
|
|
40
|
+
g(w ? (F) => [...F, ...ae] : ae);
|
|
41
41
|
const h = !!((A = H.meta.pagination) != null && A.nextPageStartsAfter) && ae.length === a;
|
|
42
|
-
|
|
42
|
+
D(
|
|
43
43
|
((N = H.meta.pagination) == null ? void 0 : N.nextPageStartsAfter) || null
|
|
44
|
-
), J(h),
|
|
44
|
+
), J(h), x(null);
|
|
45
45
|
} catch (H) {
|
|
46
|
-
(t.helpers.getSDKConfiguration().errorHandlingMode === "standard" ? H.error.code === 404 : H.data.error.code === 404) ? (
|
|
46
|
+
(t.helpers.getSDKConfiguration().errorHandlingMode === "standard" ? H.error.code === 404 : H.data.error.code === 404) ? (g([]), J(!1), D(null), x(null)) : x(I);
|
|
47
47
|
} finally {
|
|
48
|
-
|
|
48
|
+
v(!1);
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on the query inputs; the setError(error) no-op is deliberate
|
|
@@ -53,33 +53,33 @@ const Gt = (t, r) => {
|
|
|
53
53
|
);
|
|
54
54
|
he(() => {
|
|
55
55
|
if (c) {
|
|
56
|
-
|
|
56
|
+
g([]), J(!1), v(!1);
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
r &&
|
|
60
|
-
}, [r, p,
|
|
61
|
-
const j = (
|
|
62
|
-
|
|
63
|
-
}, oe = V(
|
|
64
|
-
oe.current =
|
|
59
|
+
r && P(p);
|
|
60
|
+
}, [r, p, P, c]);
|
|
61
|
+
const j = (k) => {
|
|
62
|
+
R(k), D(null);
|
|
63
|
+
}, oe = V(C);
|
|
64
|
+
oe.current = C;
|
|
65
65
|
const ne = V(M);
|
|
66
66
|
ne.current = M;
|
|
67
67
|
const pe = Ce(() => {
|
|
68
|
-
ne.current && !oe.current &&
|
|
69
|
-
}, [
|
|
70
|
-
Q.current =
|
|
71
|
-
const de = V(
|
|
72
|
-
de.current =
|
|
73
|
-
const re = V(
|
|
74
|
-
re.current =
|
|
68
|
+
ne.current && !oe.current && P(p, ne.current, !0);
|
|
69
|
+
}, [P, p]), Q = V(b);
|
|
70
|
+
Q.current = b;
|
|
71
|
+
const de = V($);
|
|
72
|
+
de.current = $;
|
|
73
|
+
const re = V(f);
|
|
74
|
+
re.current = f;
|
|
75
75
|
const ie = V(!1), Z = Ce(async () => {
|
|
76
76
|
var H, ae;
|
|
77
77
|
if (oe.current || ie.current) return;
|
|
78
|
-
const
|
|
78
|
+
const k = p === "LATEST" || !de.current;
|
|
79
79
|
ie.current = !0;
|
|
80
80
|
const S = q.current, w = Q.current, A = new Map(w.map((h) => [h.id, h])), N = (h) => !A.has(h.id);
|
|
81
81
|
try {
|
|
82
|
-
const h = [],
|
|
82
|
+
const h = [], F = /* @__PURE__ */ new Map();
|
|
83
83
|
let ee;
|
|
84
84
|
for (let W = 0; W < qt; W++) {
|
|
85
85
|
const Y = await t.discussions.getPosts(r, {
|
|
@@ -90,16 +90,16 @@ const Gt = (t, r) => {
|
|
|
90
90
|
// Always included, so a shown post that got moderated can be detected
|
|
91
91
|
skipModerated: !1
|
|
92
92
|
}), G = Y.data;
|
|
93
|
-
G.forEach((
|
|
94
|
-
const je = A.get(
|
|
95
|
-
je ?
|
|
93
|
+
G.forEach((me) => {
|
|
94
|
+
const je = A.get(me.id);
|
|
95
|
+
je ? me.moderated && !je.moderated && F.set(me.id, me) : (d || !me.moderated) && h.push(me);
|
|
96
96
|
}), ee = ((H = Y.meta.pagination) == null ? void 0 : H.nextPageStartsAfter) || void 0;
|
|
97
97
|
const xe = G.length === a && G.every(N);
|
|
98
|
-
if (!
|
|
98
|
+
if (!k || !w.length || !xe || !ee) break;
|
|
99
99
|
}
|
|
100
|
-
if (S !== q.current || (
|
|
100
|
+
if (S !== q.current || (F.size && g(
|
|
101
101
|
(W) => d ? W.map((Y) => {
|
|
102
|
-
const G =
|
|
102
|
+
const G = F.get(Y.id);
|
|
103
103
|
return G ? {
|
|
104
104
|
...Y,
|
|
105
105
|
moderated: !0,
|
|
@@ -107,16 +107,16 @@ const Gt = (t, r) => {
|
|
|
107
107
|
moderatedBy: G.moderatedBy,
|
|
108
108
|
moderatedReason: G.moderatedReason
|
|
109
109
|
} : Y;
|
|
110
|
-
}) : W.filter((Y) =>
|
|
111
|
-
), !
|
|
110
|
+
}) : W.filter((Y) => !F.has(Y.id))
|
|
111
|
+
), !k)) return;
|
|
112
112
|
const ke = new Set(Q.current.map((W) => W.id)), ce = h.filter((W) => !ke.has(W.id));
|
|
113
113
|
if (!ce.length) return;
|
|
114
|
-
w.length ?
|
|
114
|
+
w.length ? g((W) => {
|
|
115
115
|
const Y = new Set(W.map((xe) => xe.id)), G = ce.filter((xe) => !Y.has(xe.id));
|
|
116
116
|
return p === "LATEST" ? [...G, ...W].sort(
|
|
117
|
-
(xe,
|
|
117
|
+
(xe, me) => Date.parse(me.createdAt) - Date.parse(xe.createdAt)
|
|
118
118
|
) : [...W, ...G.reverse()];
|
|
119
|
-
}) : await
|
|
119
|
+
}) : await P(p), _((W) => {
|
|
120
120
|
const Y = new Set(W);
|
|
121
121
|
return ce.forEach((G) => Y.add(G.id)), Y;
|
|
122
122
|
}), (ae = re.current) == null || ae.call(re, ce.length);
|
|
@@ -130,43 +130,43 @@ const Gt = (t, r) => {
|
|
|
130
130
|
a,
|
|
131
131
|
d,
|
|
132
132
|
p,
|
|
133
|
-
|
|
133
|
+
P
|
|
134
134
|
]), se = l > 0 ? Math.max(l, Jt) : 0;
|
|
135
135
|
he(() => {
|
|
136
136
|
if (!se || c || !r) return;
|
|
137
|
-
const
|
|
137
|
+
const k = () => {
|
|
138
138
|
document.visibilityState !== "hidden" && Z();
|
|
139
139
|
}, S = () => {
|
|
140
140
|
document.visibilityState === "visible" && Z();
|
|
141
|
-
}, w = setInterval(
|
|
141
|
+
}, w = setInterval(k, se);
|
|
142
142
|
return document.addEventListener("visibilitychange", S), () => {
|
|
143
143
|
clearInterval(w), document.removeEventListener("visibilitychange", S);
|
|
144
144
|
};
|
|
145
145
|
}, [se, c, r, Z]);
|
|
146
|
-
const
|
|
146
|
+
const T = Ce((k) => {
|
|
147
147
|
_((S) => {
|
|
148
|
-
if (!S.has(
|
|
148
|
+
if (!S.has(k)) return S;
|
|
149
149
|
const w = new Set(S);
|
|
150
|
-
return w.delete(
|
|
150
|
+
return w.delete(k), w;
|
|
151
151
|
});
|
|
152
152
|
}, []);
|
|
153
153
|
return {
|
|
154
|
-
posts:
|
|
154
|
+
posts: b,
|
|
155
155
|
postsHidden: c,
|
|
156
|
-
isLoading:
|
|
157
|
-
isSubmitting:
|
|
158
|
-
error:
|
|
156
|
+
isLoading: C,
|
|
157
|
+
isSubmitting: m,
|
|
158
|
+
error: I,
|
|
159
159
|
currentSort: p,
|
|
160
|
-
hasMore:
|
|
160
|
+
hasMore: $,
|
|
161
161
|
newPostIds: K,
|
|
162
|
-
markPostSeen:
|
|
162
|
+
markPostSeen: T,
|
|
163
163
|
handleSortChange: j,
|
|
164
164
|
handleLoadMore: pe,
|
|
165
|
-
handleCreatePost: async (
|
|
165
|
+
handleCreatePost: async (k, S) => {
|
|
166
166
|
try {
|
|
167
167
|
E(!0);
|
|
168
168
|
let A = await t.discussions.createPost(r, {
|
|
169
|
-
content:
|
|
169
|
+
content: k,
|
|
170
170
|
replyId: S || null,
|
|
171
171
|
userNickname: null,
|
|
172
172
|
discussionLabel: i,
|
|
@@ -182,49 +182,49 @@ const Gt = (t, r) => {
|
|
|
182
182
|
A = { ...A, userModel: N };
|
|
183
183
|
} catch {
|
|
184
184
|
}
|
|
185
|
-
S ?
|
|
185
|
+
S ? g(
|
|
186
186
|
(N) => N.map(
|
|
187
187
|
(H) => H.id === S ? { ...H, repliesCount: (H.repliesCount || 0) + 1 } : H
|
|
188
188
|
)
|
|
189
|
-
) : c ||
|
|
189
|
+
) : c || g((N) => [A, ...N]), f == null || f(1), x(null);
|
|
190
190
|
} catch (w) {
|
|
191
|
-
throw
|
|
191
|
+
throw x(
|
|
192
192
|
w
|
|
193
193
|
), w;
|
|
194
194
|
} finally {
|
|
195
195
|
E(!1);
|
|
196
196
|
}
|
|
197
197
|
},
|
|
198
|
-
handleReact: async (
|
|
198
|
+
handleReact: async (k, S) => {
|
|
199
199
|
try {
|
|
200
|
-
const w = await t.discussions.react(
|
|
201
|
-
return
|
|
202
|
-
(A) => A.map((N) => N.id ===
|
|
203
|
-
),
|
|
200
|
+
const w = await t.discussions.react(k, S);
|
|
201
|
+
return g(
|
|
202
|
+
(A) => A.map((N) => N.id === k ? w : N)
|
|
203
|
+
), x(null), w;
|
|
204
204
|
} catch (w) {
|
|
205
|
-
throw console.error("Error reacting to post:", w),
|
|
205
|
+
throw console.error("Error reacting to post:", w), x(
|
|
206
206
|
w
|
|
207
207
|
), w;
|
|
208
208
|
}
|
|
209
209
|
},
|
|
210
|
-
handleDeletePost: async (
|
|
210
|
+
handleDeletePost: async (k, S) => {
|
|
211
211
|
try {
|
|
212
|
-
await t.discussions.deletePost(
|
|
212
|
+
await t.discussions.deletePost(k), g((w) => w.filter((A) => A.id !== k)), S && g(
|
|
213
213
|
(w) => w.map(
|
|
214
214
|
(A) => A.id === S ? { ...A, repliesCount: Math.max(0, (A.repliesCount || 0) - 1) } : A
|
|
215
215
|
)
|
|
216
|
-
),
|
|
216
|
+
), f == null || f(-1), x(null);
|
|
217
217
|
} catch (w) {
|
|
218
|
-
throw
|
|
218
|
+
throw x(
|
|
219
219
|
w
|
|
220
220
|
), w;
|
|
221
221
|
}
|
|
222
222
|
},
|
|
223
|
-
handleReportPost: async (
|
|
223
|
+
handleReportPost: async (k, S, w) => {
|
|
224
224
|
try {
|
|
225
|
-
await t.discussions.reportPost(
|
|
225
|
+
await t.discussions.reportPost(k, S, w), x(null);
|
|
226
226
|
} catch (A) {
|
|
227
|
-
throw
|
|
227
|
+
throw x(
|
|
228
228
|
A
|
|
229
229
|
), A;
|
|
230
230
|
}
|
|
@@ -244,7 +244,7 @@ const Gt = (t, r) => {
|
|
|
244
244
|
}
|
|
245
245
|
}, eo = (t, r) => {
|
|
246
246
|
var d;
|
|
247
|
-
const [i, s] =
|
|
247
|
+
const [i, s] = B(null), u = It(), a = Ce(
|
|
248
248
|
async (l) => {
|
|
249
249
|
if (!r) {
|
|
250
250
|
s(null);
|
|
@@ -263,8 +263,8 @@ const Gt = (t, r) => {
|
|
|
263
263
|
he(() => {
|
|
264
264
|
a(u);
|
|
265
265
|
}, [a, u]);
|
|
266
|
-
const
|
|
267
|
-
return { ban: i, isBanned: !!((d = i == null ? void 0 : i.activeBan) != null && d.banned), refresh:
|
|
266
|
+
const f = Ce(() => a(!0), [a]);
|
|
267
|
+
return { ban: i, isBanned: !!((d = i == null ? void 0 : i.activeBan) != null && d.banned), refresh: f };
|
|
268
268
|
}, pt = (t) => {
|
|
269
269
|
var r, i, s;
|
|
270
270
|
return (((r = t == null ? void 0 : t.error) == null ? void 0 : r.status) ?? ((s = (i = t == null ? void 0 : t.data) == null ? void 0 : i.error) == null ? void 0 : s.status)) === "ban";
|
|
@@ -377,7 +377,7 @@ const Gt = (t, r) => {
|
|
|
377
377
|
}),
|
|
378
378
|
decorator: o({ display: "inherit", marginInlineEnd: "calc(0.375em / 0.8125)" }),
|
|
379
379
|
loading: o({ display: "flex", position: "absolute", left: "50%", transform: "translateX(-50%)" })
|
|
380
|
-
}, ue = ({ look: t, loading: r, startDecorator: i, disabled: s, children: u, ...a }) => /* @__PURE__ */
|
|
380
|
+
}, ue = ({ look: t, loading: r, startDecorator: i, disabled: s, children: u, ...a }) => /* @__PURE__ */ y("button", { type: "button", css: Pe[t], disabled: s || r, ...a, children: [
|
|
381
381
|
i && /* @__PURE__ */ n("span", { css: Pe.decorator, children: i }),
|
|
382
382
|
u,
|
|
383
383
|
r && /* @__PURE__ */ n("span", { css: Pe.loading, children: /* @__PURE__ */ n(bt, { size: 20, color: "var(--fu-ucrc-primary-solid-bg)" }) })
|
|
@@ -424,17 +424,17 @@ const Gt = (t, r) => {
|
|
|
424
424
|
font: "inherit",
|
|
425
425
|
"&::placeholder": { color: "inherit", opacity: 0.64 }
|
|
426
426
|
})
|
|
427
|
-
},
|
|
427
|
+
}, ft = ({
|
|
428
428
|
value: t,
|
|
429
429
|
onChange: r,
|
|
430
430
|
placeholder: i,
|
|
431
431
|
minRows: s,
|
|
432
432
|
maxRows: u,
|
|
433
433
|
disabled: a,
|
|
434
|
-
marginBottom:
|
|
434
|
+
marginBottom: f
|
|
435
435
|
}) => {
|
|
436
436
|
const { inputRef: d, shadowRef: l } = xt(s, u, i);
|
|
437
|
-
return /* @__PURE__ */
|
|
437
|
+
return /* @__PURE__ */ y("div", { css: Te.root, "data-disabled": a || void 0, style: { marginBottom: f }, children: [
|
|
438
438
|
/* @__PURE__ */ n(
|
|
439
439
|
"textarea",
|
|
440
440
|
{
|
|
@@ -453,42 +453,42 @@ const Gt = (t, r) => {
|
|
|
453
453
|
form: o({ marginBottom: e.spaceLg }),
|
|
454
454
|
replyingTo: o(z.bodySm, { marginBottom: e.spaceXs, color: e.textSecondary }),
|
|
455
455
|
actions: o({ display: "flex", gap: e.spaceXs, justifyContent: "flex-end" })
|
|
456
|
-
},
|
|
456
|
+
}, mt = ({
|
|
457
457
|
onSubmit: t,
|
|
458
458
|
userIsLoggedIn: r,
|
|
459
459
|
onSignInClick: i,
|
|
460
460
|
placeholder: s,
|
|
461
461
|
isSubmitting: u,
|
|
462
462
|
replyTo: a,
|
|
463
|
-
onCancel:
|
|
463
|
+
onCancel: f,
|
|
464
464
|
disabled: d = !1
|
|
465
465
|
}) => {
|
|
466
|
-
const { t: l } = be(), [c,
|
|
467
|
-
if (
|
|
466
|
+
const { t: l } = be(), [c, b] = B(""), g = async (C) => {
|
|
467
|
+
if (C.preventDefault(), !(!c.trim() || d))
|
|
468
468
|
try {
|
|
469
|
-
await t(c),
|
|
470
|
-
} catch (
|
|
471
|
-
console.error("Failed to submit comment:",
|
|
469
|
+
await t(c), b("");
|
|
470
|
+
} catch (v) {
|
|
471
|
+
console.error("Failed to submit comment:", v);
|
|
472
472
|
}
|
|
473
473
|
};
|
|
474
|
-
return r ? /* @__PURE__ */
|
|
474
|
+
return r ? /* @__PURE__ */ y("form", { onSubmit: g, css: De.form, children: [
|
|
475
475
|
a && /* @__PURE__ */ n("p", { css: De.replyingTo, children: l("discussion.replyingTo", "Replying to {{name}}", {
|
|
476
476
|
name: Dt(a)
|
|
477
477
|
}) }),
|
|
478
478
|
/* @__PURE__ */ n(
|
|
479
|
-
|
|
479
|
+
ft,
|
|
480
480
|
{
|
|
481
481
|
placeholder: s || l("discussion.writeComment", "Write a comment..."),
|
|
482
482
|
value: c,
|
|
483
|
-
onChange:
|
|
483
|
+
onChange: b,
|
|
484
484
|
minRows: 3,
|
|
485
485
|
maxRows: 8,
|
|
486
486
|
disabled: u || d,
|
|
487
487
|
marginBottom: e.spaceSm
|
|
488
488
|
}
|
|
489
489
|
),
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
|
|
490
|
+
/* @__PURE__ */ y("div", { css: De.actions, children: [
|
|
491
|
+
f && /* @__PURE__ */ n(ue, { look: "plain", onClick: f, disabled: u, children: l("common.cancel", "Cancel") }),
|
|
492
492
|
/* @__PURE__ */ n(
|
|
493
493
|
ue,
|
|
494
494
|
{
|
|
@@ -508,8 +508,8 @@ const Gt = (t, r) => {
|
|
|
508
508
|
LAUGH: /* @__PURE__ */ n(Mt, { ...ge }),
|
|
509
509
|
CARE: /* @__PURE__ */ n(Lt, { ...ge }),
|
|
510
510
|
WOW: /* @__PURE__ */ n(zt, { ...ge }),
|
|
511
|
-
SAD: /* @__PURE__ */ n(
|
|
512
|
-
ANGRY: /* @__PURE__ */ n(
|
|
511
|
+
SAD: /* @__PURE__ */ n($t, { ...ge }),
|
|
512
|
+
ANGRY: /* @__PURE__ */ n(Ft, { ...ge })
|
|
513
513
|
}, Ae = o({
|
|
514
514
|
display: "inline-flex",
|
|
515
515
|
alignItems: "center",
|
|
@@ -526,7 +526,7 @@ const Gt = (t, r) => {
|
|
|
526
526
|
}, Le = {
|
|
527
527
|
cursor: "pointer",
|
|
528
528
|
"&:hover": { backgroundColor: "var(--fu-ucrc-neutral-soft-hover-bg)" }
|
|
529
|
-
}, ze = { opacity: 0.5 },
|
|
529
|
+
}, ze = { opacity: 0.5 }, $e = {
|
|
530
530
|
pill: {
|
|
531
531
|
enabled: {
|
|
532
532
|
idle: o(Se.idle, Le),
|
|
@@ -548,20 +548,20 @@ const Gt = (t, r) => {
|
|
|
548
548
|
onClick: s,
|
|
549
549
|
disabled: u
|
|
550
550
|
}) => {
|
|
551
|
-
const a = (d) => d >= 1e6 ? (d / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : d >= 1e3 ? (d / 1e3).toFixed(1).replace(/\.0$/, "") + "K" : d.toString(),
|
|
552
|
-
return /* @__PURE__ */
|
|
551
|
+
const a = (d) => d >= 1e6 ? (d / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : d >= 1e3 ? (d / 1e3).toFixed(1).replace(/\.0$/, "") + "K" : d.toString(), f = i ? t === "LOVE" || t === "ANGRY" ? "danger" : "primary" : "idle";
|
|
552
|
+
return /* @__PURE__ */ y(
|
|
553
553
|
"div",
|
|
554
554
|
{
|
|
555
|
-
css:
|
|
555
|
+
css: $e.pill[u ? "disabled" : "enabled"][f],
|
|
556
556
|
onClick: u ? void 0 : s,
|
|
557
557
|
children: [
|
|
558
|
-
/* @__PURE__ */ n("div", { css:
|
|
559
|
-
r > 0 && /* @__PURE__ */ n("p", { css:
|
|
558
|
+
/* @__PURE__ */ n("div", { css: $e.icon, children: oo[t] }),
|
|
559
|
+
r > 0 && /* @__PURE__ */ n("p", { css: $e.count[f], children: a(r) })
|
|
560
560
|
]
|
|
561
561
|
}
|
|
562
562
|
);
|
|
563
563
|
}, gt = (t, r) => {
|
|
564
|
-
const [i, s] =
|
|
564
|
+
const [i, s] = B(null);
|
|
565
565
|
return he(() => {
|
|
566
566
|
(async () => {
|
|
567
567
|
if (r)
|
|
@@ -590,19 +590,19 @@ const Gt = (t, r) => {
|
|
|
590
590
|
onSignInClick: s,
|
|
591
591
|
onReact: u,
|
|
592
592
|
showReactions: a = !0,
|
|
593
|
-
showReplyButton:
|
|
593
|
+
showReplyButton: f = !0,
|
|
594
594
|
onReplyClick: d,
|
|
595
595
|
isBanned: l = !1
|
|
596
596
|
}) => {
|
|
597
|
-
var
|
|
598
|
-
const { t: c } = be(),
|
|
599
|
-
if (!
|
|
597
|
+
var m, E, I, x;
|
|
598
|
+
const { t: c } = be(), b = gt(r, i), C = (() => {
|
|
599
|
+
if (!b || !t.reactions)
|
|
600
600
|
return null;
|
|
601
601
|
for (const p of t.reactions)
|
|
602
|
-
if (p.userIds.includes(
|
|
602
|
+
if (p.userIds.includes(b))
|
|
603
603
|
return p.type;
|
|
604
604
|
return null;
|
|
605
|
-
})(),
|
|
605
|
+
})(), v = (p) => {
|
|
606
606
|
if (!i) {
|
|
607
607
|
s == null || s();
|
|
608
608
|
return;
|
|
@@ -610,15 +610,15 @@ const Gt = (t, r) => {
|
|
|
610
610
|
u(t.id, p).catch(() => {
|
|
611
611
|
});
|
|
612
612
|
};
|
|
613
|
-
return /* @__PURE__ */
|
|
614
|
-
a && /* @__PURE__ */
|
|
613
|
+
return /* @__PURE__ */ y("div", { css: qe.row, children: [
|
|
614
|
+
a && /* @__PURE__ */ y(Re, { children: [
|
|
615
615
|
/* @__PURE__ */ n(
|
|
616
616
|
Je,
|
|
617
617
|
{
|
|
618
618
|
reaction: "LIKE",
|
|
619
|
-
count: ((E = (
|
|
620
|
-
isActive:
|
|
621
|
-
onClick: () =>
|
|
619
|
+
count: ((E = (m = t.reactions) == null ? void 0 : m.find((p) => p.type === "LIKE")) == null ? void 0 : E.reactionCount) || 0,
|
|
620
|
+
isActive: C === "LIKE",
|
|
621
|
+
onClick: () => v("LIKE"),
|
|
622
622
|
disabled: !i || l
|
|
623
623
|
}
|
|
624
624
|
),
|
|
@@ -626,14 +626,14 @@ const Gt = (t, r) => {
|
|
|
626
626
|
Je,
|
|
627
627
|
{
|
|
628
628
|
reaction: "DISLIKE",
|
|
629
|
-
count: ((
|
|
630
|
-
isActive:
|
|
631
|
-
onClick: () =>
|
|
629
|
+
count: ((x = (I = t.reactions) == null ? void 0 : I.find((p) => p.type === "DISLIKE")) == null ? void 0 : x.reactionCount) || 0,
|
|
630
|
+
isActive: C === "DISLIKE",
|
|
631
|
+
onClick: () => v("DISLIKE"),
|
|
632
632
|
disabled: !i || l
|
|
633
633
|
}
|
|
634
634
|
)
|
|
635
635
|
] }),
|
|
636
|
-
|
|
636
|
+
f && /* @__PURE__ */ n(
|
|
637
637
|
ue,
|
|
638
638
|
{
|
|
639
639
|
look: "reply",
|
|
@@ -644,25 +644,27 @@ const Gt = (t, r) => {
|
|
|
644
644
|
}
|
|
645
645
|
)
|
|
646
646
|
] });
|
|
647
|
-
},
|
|
648
|
-
const u = Bt(), [a,
|
|
647
|
+
}, Fe = 4, Qe = { visibility: "hidden" }, ht = (t, r, i, s) => {
|
|
648
|
+
const u = Bt(), [a, f] = B(Qe);
|
|
649
649
|
return kt(() => {
|
|
650
650
|
if (!t) {
|
|
651
|
-
|
|
651
|
+
f(Qe);
|
|
652
652
|
return;
|
|
653
653
|
}
|
|
654
654
|
const d = () => {
|
|
655
|
-
var
|
|
656
|
-
const l = (
|
|
655
|
+
var R;
|
|
656
|
+
const l = (R = r.current) == null ? void 0 : R.getBoundingClientRect(), c = i.current;
|
|
657
657
|
if (!l || !c) return;
|
|
658
|
-
s === "start" && (c.style.width = `${l.width}px`);
|
|
659
|
-
const { width:
|
|
660
|
-
let
|
|
661
|
-
|
|
662
|
-
let
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
658
|
+
s === "start" && (c.style.width = `${l.width}px`), c.style.left = "0px", c.style.top = "0px";
|
|
659
|
+
const { left: b, top: g, width: C, height: v } = c.getBoundingClientRect(), m = document.documentElement;
|
|
660
|
+
let E = s === "center" ? l.left + l.width / 2 - C / 2 : u ? l.right - C : l.left;
|
|
661
|
+
E = Math.max(0, Math.min(E, m.clientWidth - C));
|
|
662
|
+
let I = l.bottom + Fe;
|
|
663
|
+
I + v > m.clientHeight && l.top - Fe - v >= 0 && (I = l.top - Fe - v);
|
|
664
|
+
const x = Math.round(E - b), p = Math.round(I - g);
|
|
665
|
+
c.style.left = `${x}px`, c.style.top = `${p}px`, f({
|
|
666
|
+
left: x,
|
|
667
|
+
top: p,
|
|
666
668
|
width: s === "start" ? l.width : void 0
|
|
667
669
|
});
|
|
668
670
|
};
|
|
@@ -744,63 +746,63 @@ const Gt = (t, r) => {
|
|
|
744
746
|
onReport: s,
|
|
745
747
|
disabled: u = !1
|
|
746
748
|
}) => {
|
|
747
|
-
const { t: a } = be(), { shadowRootElement:
|
|
749
|
+
const { t: a } = be(), { shadowRootElement: f } = Ke(Ue), d = Rt(), [l, c] = Ie.useState(!1), b = V(null), g = V(null), C = ht(l, b, g, "center");
|
|
748
750
|
if (Ie.useEffect(() => {
|
|
749
751
|
if (!l) return;
|
|
750
752
|
const p = (M) => {
|
|
751
|
-
const
|
|
752
|
-
|
|
753
|
-
},
|
|
753
|
+
const D = M.composedPath();
|
|
754
|
+
b.current && D.includes(b.current) || g.current && D.includes(g.current) || c(!1);
|
|
755
|
+
}, R = setTimeout(() => {
|
|
754
756
|
document.addEventListener("click", p, !0);
|
|
755
757
|
}, 0);
|
|
756
758
|
return () => {
|
|
757
|
-
clearTimeout(
|
|
759
|
+
clearTimeout(R), document.removeEventListener("click", p, !0);
|
|
758
760
|
};
|
|
759
761
|
}, [l]), !t && !r) return null;
|
|
760
|
-
const
|
|
762
|
+
const v = () => {
|
|
761
763
|
var p;
|
|
762
|
-
return [...((p =
|
|
763
|
-
},
|
|
764
|
+
return [...((p = g.current) == null ? void 0 : p.querySelectorAll('[role="menuitem"]')) ?? []];
|
|
765
|
+
}, m = () => {
|
|
764
766
|
var p;
|
|
765
|
-
c(!1), (p =
|
|
767
|
+
c(!1), (p = b.current) == null || p.focus();
|
|
766
768
|
}, E = (p) => {
|
|
767
|
-
var
|
|
768
|
-
c(!1), (
|
|
769
|
-
},
|
|
770
|
-
const
|
|
769
|
+
var R;
|
|
770
|
+
c(!1), (R = b.current) == null || R.focus(), p();
|
|
771
|
+
}, I = (p) => {
|
|
772
|
+
const R = v(), M = R.indexOf(p.target), D = (J) => {
|
|
771
773
|
var K;
|
|
772
|
-
return (K =
|
|
773
|
-
},
|
|
774
|
-
ArrowDown: () =>
|
|
775
|
-
ArrowUp: () =>
|
|
776
|
-
Home: () =>
|
|
777
|
-
End: () => R
|
|
778
|
-
Escape:
|
|
774
|
+
return (K = R[(J + R.length) % R.length]) == null ? void 0 : K.focus();
|
|
775
|
+
}, $ = {
|
|
776
|
+
ArrowDown: () => D(M + 1),
|
|
777
|
+
ArrowUp: () => D(M - 1),
|
|
778
|
+
Home: () => D(0),
|
|
779
|
+
End: () => D(R.length - 1),
|
|
780
|
+
Escape: m
|
|
779
781
|
};
|
|
780
|
-
|
|
781
|
-
},
|
|
782
|
+
$[p.key] ? (p.preventDefault(), $[p.key]()) : p.key === "Tab" && c(!1);
|
|
783
|
+
}, x = (p, R, M, D) => /* @__PURE__ */ y(
|
|
782
784
|
"li",
|
|
783
785
|
{
|
|
784
786
|
role: "menuitem",
|
|
785
787
|
tabIndex: -1,
|
|
786
788
|
"aria-disabled": u,
|
|
787
789
|
css: Xe.item,
|
|
788
|
-
onClick: () => E(
|
|
789
|
-
onKeyDown: (
|
|
790
|
-
|
|
790
|
+
onClick: () => E(D),
|
|
791
|
+
onKeyDown: ($) => {
|
|
792
|
+
$.key !== "Enter" && $.key !== " " || ($.preventDefault(), u || E(D));
|
|
791
793
|
},
|
|
792
794
|
children: [
|
|
793
|
-
|
|
795
|
+
R,
|
|
794
796
|
M
|
|
795
797
|
]
|
|
796
798
|
},
|
|
797
799
|
p
|
|
798
800
|
);
|
|
799
|
-
return /* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ y(Re, { children: [
|
|
800
802
|
/* @__PURE__ */ n(
|
|
801
803
|
"button",
|
|
802
804
|
{
|
|
803
|
-
ref:
|
|
805
|
+
ref: b,
|
|
804
806
|
type: "button",
|
|
805
807
|
"aria-haspopup": "menu",
|
|
806
808
|
"aria-expanded": l,
|
|
@@ -808,19 +810,19 @@ const Gt = (t, r) => {
|
|
|
808
810
|
css: Xe.trigger,
|
|
809
811
|
onClick: (p) => {
|
|
810
812
|
c(!l), !l && p.detail === 0 && requestAnimationFrame(() => {
|
|
811
|
-
var
|
|
812
|
-
return (
|
|
813
|
+
var R;
|
|
814
|
+
return (R = v()[0]) == null ? void 0 : R.focus();
|
|
813
815
|
});
|
|
814
816
|
},
|
|
815
817
|
children: /* @__PURE__ */ n(Ht, { size: "1.25em" })
|
|
816
818
|
}
|
|
817
819
|
),
|
|
818
|
-
l &&
|
|
819
|
-
/* @__PURE__ */
|
|
820
|
-
t &&
|
|
821
|
-
r &&
|
|
820
|
+
l && f && Yt(
|
|
821
|
+
/* @__PURE__ */ y("ul", { ref: g, id: d, role: "menu", css: Xe.menu, style: C, onKeyDown: I, children: [
|
|
822
|
+
t && x("delete", /* @__PURE__ */ n(Ot, { size: "1em", color: e.icon, style: Ze }), a("discussion.delete.action", "Delete"), i),
|
|
823
|
+
r && x("report", /* @__PURE__ */ n(Nt, { size: "1em", color: e.icon, style: Ze }), a("discussion.report.action", "Report"), s)
|
|
822
824
|
] }),
|
|
823
|
-
|
|
825
|
+
f
|
|
824
826
|
)
|
|
825
827
|
] });
|
|
826
828
|
}, et = "rgba(var(--fu-ucrc-shadow-channel) / var(--fu-ucrc-shadow-opacity))", tt = o({
|
|
@@ -860,7 +862,7 @@ const Gt = (t, r) => {
|
|
|
860
862
|
onConfirm: i,
|
|
861
863
|
onError: s
|
|
862
864
|
}) => {
|
|
863
|
-
const { t: u } = be(), a = Ve(),
|
|
865
|
+
const { t: u } = be(), a = Ve(), f = Ie.useId(), [d, l] = B(!1), c = async () => {
|
|
864
866
|
l(!0);
|
|
865
867
|
try {
|
|
866
868
|
await i(), r();
|
|
@@ -875,13 +877,13 @@ const Gt = (t, r) => {
|
|
|
875
877
|
l(!1);
|
|
876
878
|
}
|
|
877
879
|
};
|
|
878
|
-
return /* @__PURE__ */ n(lt, { open: t, onClose: r, children: /* @__PURE__ */
|
|
879
|
-
/* @__PURE__ */ n("p", { id:
|
|
880
|
+
return /* @__PURE__ */ n(lt, { open: t, onClose: r, children: /* @__PURE__ */ y("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": f, tabIndex: -1, css: ye.delete, style: a, children: [
|
|
881
|
+
/* @__PURE__ */ n("p", { id: f, css: ot.title, children: u("discussion.delete.title", "Delete comment") }),
|
|
880
882
|
/* @__PURE__ */ n("p", { css: ot.description, children: u(
|
|
881
883
|
"discussion.delete.description",
|
|
882
884
|
"Are you sure you want to delete this comment? This action cannot be undone."
|
|
883
885
|
) }),
|
|
884
|
-
/* @__PURE__ */
|
|
886
|
+
/* @__PURE__ */ y("div", { css: ye.actions, children: [
|
|
885
887
|
/* @__PURE__ */ n(ue, { look: "plain", onClick: r, children: u("common.cancel", "Cancel") }),
|
|
886
888
|
/* @__PURE__ */ n(ue, { look: "solid", loading: d, onClick: c, children: u("discussion.delete.action", "Delete") })
|
|
887
889
|
] })
|
|
@@ -1015,20 +1017,20 @@ const Gt = (t, r) => {
|
|
|
1015
1017
|
onSuccess: s,
|
|
1016
1018
|
onError: u
|
|
1017
1019
|
}) => {
|
|
1018
|
-
const { t: a } = be(),
|
|
1019
|
-
r(), c(""),
|
|
1020
|
+
const { t: a } = be(), f = Ve(), d = Ie.useId(), [l, c] = B(""), [b, g] = B(""), [C, v] = B(!1), m = () => {
|
|
1021
|
+
r(), c(""), g("");
|
|
1020
1022
|
}, E = async () => {
|
|
1021
|
-
|
|
1023
|
+
v(!0);
|
|
1022
1024
|
try {
|
|
1023
1025
|
await i(
|
|
1024
1026
|
l,
|
|
1025
|
-
l === "OTHER" ?
|
|
1027
|
+
l === "OTHER" ? b : void 0
|
|
1026
1028
|
), s(
|
|
1027
1029
|
a(
|
|
1028
1030
|
"discussion.report.success",
|
|
1029
1031
|
"Post reported successfully. Thank you."
|
|
1030
1032
|
)
|
|
1031
|
-
),
|
|
1033
|
+
), m();
|
|
1032
1034
|
} catch {
|
|
1033
1035
|
u(
|
|
1034
1036
|
a(
|
|
@@ -1037,59 +1039,59 @@ const Gt = (t, r) => {
|
|
|
1037
1039
|
)
|
|
1038
1040
|
);
|
|
1039
1041
|
} finally {
|
|
1040
|
-
|
|
1042
|
+
v(!1);
|
|
1041
1043
|
}
|
|
1042
1044
|
};
|
|
1043
|
-
return /* @__PURE__ */ n(lt, { open: t, onClose:
|
|
1044
|
-
/* @__PURE__ */ n("button", { type: "button", "aria-label": a("common.rules.close", "Close"), css: le.close, onClick:
|
|
1045
|
+
return /* @__PURE__ */ n(lt, { open: t, onClose: m, children: /* @__PURE__ */ y("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": `${d}title`, tabIndex: -1, css: ye.report, style: f, children: [
|
|
1046
|
+
/* @__PURE__ */ n("button", { type: "button", "aria-label": a("common.rules.close", "Close"), css: le.close, onClick: m, children: /* @__PURE__ */ n(Wt, { size: "calc(2em / 1.5)" }) }),
|
|
1045
1047
|
/* @__PURE__ */ n("p", { id: `${d}title`, css: le.title, children: a("discussion.report.title", "Report post") }),
|
|
1046
1048
|
/* @__PURE__ */ n("p", { css: le.description, children: a(
|
|
1047
1049
|
"discussion.report.description",
|
|
1048
1050
|
"Why are you reporting this post?"
|
|
1049
1051
|
) }),
|
|
1050
|
-
/* @__PURE__ */ n("div", { role: "radiogroup", css: le.group, children: so.map((
|
|
1051
|
-
const
|
|
1052
|
-
return /* @__PURE__ */
|
|
1053
|
-
/* @__PURE__ */
|
|
1052
|
+
/* @__PURE__ */ n("div", { role: "radiogroup", css: le.group, children: so.map((I) => {
|
|
1053
|
+
const x = l === I.value, p = x ? "checked" : "unchecked";
|
|
1054
|
+
return /* @__PURE__ */ y("span", { css: le.radio, children: [
|
|
1055
|
+
/* @__PURE__ */ y("span", { css: le.circle[p], children: [
|
|
1054
1056
|
/* @__PURE__ */ n("span", { css: le.dot[p] }),
|
|
1055
1057
|
/* @__PURE__ */ n("span", { css: le.action, children: /* @__PURE__ */ n(
|
|
1056
1058
|
"input",
|
|
1057
1059
|
{
|
|
1058
|
-
id: `${d}${
|
|
1060
|
+
id: `${d}${I.value}`,
|
|
1059
1061
|
type: "radio",
|
|
1060
1062
|
name: `${d}reason`,
|
|
1061
|
-
value:
|
|
1062
|
-
checked:
|
|
1063
|
-
onChange: (
|
|
1063
|
+
value: I.value,
|
|
1064
|
+
checked: x,
|
|
1065
|
+
onChange: (R) => c(R.target.value),
|
|
1064
1066
|
css: le.input
|
|
1065
1067
|
}
|
|
1066
1068
|
) })
|
|
1067
1069
|
] }),
|
|
1068
|
-
/* @__PURE__ */ n("label", { htmlFor: `${d}${
|
|
1069
|
-
] },
|
|
1070
|
+
/* @__PURE__ */ n("label", { htmlFor: `${d}${I.value}`, css: le.label, children: a(I.labelKey, I.fallback) })
|
|
1071
|
+
] }, I.value);
|
|
1070
1072
|
}) }),
|
|
1071
1073
|
l === "OTHER" && /* @__PURE__ */ n(
|
|
1072
|
-
|
|
1074
|
+
ft,
|
|
1073
1075
|
{
|
|
1074
1076
|
placeholder: a(
|
|
1075
1077
|
"discussion.report.detailsPlaceholder",
|
|
1076
1078
|
"Please provide more details..."
|
|
1077
1079
|
),
|
|
1078
|
-
value:
|
|
1079
|
-
onChange:
|
|
1080
|
+
value: b,
|
|
1081
|
+
onChange: g,
|
|
1080
1082
|
minRows: 2,
|
|
1081
1083
|
maxRows: 4,
|
|
1082
1084
|
marginBottom: e.spaceMd
|
|
1083
1085
|
}
|
|
1084
1086
|
),
|
|
1085
|
-
/* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */ n(ue, { look: "plain", onClick:
|
|
1087
|
+
/* @__PURE__ */ y("div", { css: ye.actions, children: [
|
|
1088
|
+
/* @__PURE__ */ n(ue, { look: "plain", onClick: m, children: a("common.cancel", "Cancel") }),
|
|
1087
1089
|
/* @__PURE__ */ n(
|
|
1088
1090
|
ue,
|
|
1089
1091
|
{
|
|
1090
1092
|
look: "solid",
|
|
1091
1093
|
disabled: !l,
|
|
1092
|
-
loading:
|
|
1094
|
+
loading: C,
|
|
1093
1095
|
onClick: E,
|
|
1094
1096
|
children: a("discussion.report.action", "Report")
|
|
1095
1097
|
}
|
|
@@ -1097,8 +1099,8 @@ const Gt = (t, r) => {
|
|
|
1097
1099
|
] })
|
|
1098
1100
|
] }) });
|
|
1099
1101
|
}, co = (t, r, i) => {
|
|
1100
|
-
const s = new Date(t), a = (/* @__PURE__ */ new Date()).getTime() - s.getTime(),
|
|
1101
|
-
return
|
|
1102
|
+
const s = new Date(t), a = (/* @__PURE__ */ new Date()).getTime() - s.getTime(), f = Math.floor(a / 6e4), d = Math.floor(a / 36e5), l = Math.floor(a / 864e5);
|
|
1103
|
+
return f < 1 ? r("discussion.justNow", "Just now") : f < 60 ? r("discussion.minutesAgo", "{{count}}m ago", { count: f }) : d < 24 ? r("discussion.hoursAgo", "{{count}}h ago", { count: d }) : l < 7 ? r("discussion.daysAgo", "{{count}}d ago", { count: l }) : s.toLocaleDateString(ut(i));
|
|
1102
1104
|
}, Ne = o({ marginBottom: e.spaceMd }), We = o(Ne, {
|
|
1103
1105
|
paddingInline: e.spaceSm,
|
|
1104
1106
|
paddingBlock: e.spaceXs,
|
|
@@ -1167,50 +1169,50 @@ const Gt = (t, r) => {
|
|
|
1167
1169
|
onSignInClick: s,
|
|
1168
1170
|
showReactions: u = !0,
|
|
1169
1171
|
showReplies: a = !0,
|
|
1170
|
-
showReportPost:
|
|
1172
|
+
showReportPost: f = !0,
|
|
1171
1173
|
onReply: d,
|
|
1172
1174
|
onReact: l,
|
|
1173
1175
|
onDelete: c,
|
|
1174
|
-
onReport:
|
|
1175
|
-
isSubmitting:
|
|
1176
|
-
showModeratedPosts:
|
|
1177
|
-
isBanned:
|
|
1178
|
-
highlightable:
|
|
1176
|
+
onReport: b,
|
|
1177
|
+
isSubmitting: g,
|
|
1178
|
+
showModeratedPosts: C = !1,
|
|
1179
|
+
isBanned: v = !1,
|
|
1180
|
+
highlightable: m = !1,
|
|
1179
1181
|
isNew: E = !1,
|
|
1180
|
-
onNewSeen:
|
|
1181
|
-
depth:
|
|
1182
|
+
onNewSeen: I,
|
|
1183
|
+
depth: x = 0,
|
|
1182
1184
|
parentPostId: p,
|
|
1183
|
-
onReplyCreated:
|
|
1185
|
+
onReplyCreated: R,
|
|
1184
1186
|
onDeleteSuccess: M
|
|
1185
1187
|
}) => {
|
|
1186
1188
|
var A, N, H, ae;
|
|
1187
|
-
const { t:
|
|
1189
|
+
const { t: D } = be(), { language: $ } = Ke(Ue), J = gt(r, i), [K, _] = B(!1), [q, P] = B([]), [j, oe] = B(!1), [ne, pe] = B(!1), [Q, de] = B(!1), [re, ie] = B({ open: !1, variant: "success", title: "", message: "" }), Z = V(null);
|
|
1188
1190
|
he(() => {
|
|
1189
|
-
if (!E || !
|
|
1191
|
+
if (!E || !I || !Z.current) return;
|
|
1190
1192
|
let h;
|
|
1191
|
-
const
|
|
1193
|
+
const F = new IntersectionObserver(
|
|
1192
1194
|
([ee]) => {
|
|
1193
|
-
ee.isIntersecting && (
|
|
1195
|
+
ee.isIntersecting && (F.disconnect(), h = setTimeout(() => I(t.id), po));
|
|
1194
1196
|
},
|
|
1195
1197
|
{ threshold: 0.5 }
|
|
1196
1198
|
);
|
|
1197
|
-
return
|
|
1198
|
-
|
|
1199
|
+
return F.observe(Z.current), () => {
|
|
1200
|
+
F.disconnect(), clearTimeout(h);
|
|
1199
1201
|
};
|
|
1200
|
-
}, [E,
|
|
1201
|
-
const se = !!(i && J && t.userId === J),
|
|
1202
|
+
}, [E, I, t.id]);
|
|
1203
|
+
const se = !!(i && J && t.userId === J), T = !!t.moderated, U = async (h) => {
|
|
1202
1204
|
var ce;
|
|
1203
|
-
const
|
|
1204
|
-
await d(
|
|
1205
|
+
const F = x === 1 && p || t.id, ee = ((ce = t.userModel) == null ? void 0 : ce.name) || t.anonymousNickname || D("discussion.anonymous", "Anonymous"), ke = x === 1 ? `@${ee} ${h}` : h;
|
|
1206
|
+
await d(F, ke), _(!1), x === 1 && R ? R() : x === 0 && (oe(!0), X());
|
|
1205
1207
|
}, X = async () => {
|
|
1206
|
-
if (!(!a ||
|
|
1208
|
+
if (!(!a || x >= 2))
|
|
1207
1209
|
try {
|
|
1208
1210
|
const h = await r.discussions.getPostReplies(t.id, {
|
|
1209
1211
|
limit: 25,
|
|
1210
1212
|
skipDeleted: !0,
|
|
1211
|
-
skipModerated: !
|
|
1213
|
+
skipModerated: !C
|
|
1212
1214
|
});
|
|
1213
|
-
|
|
1215
|
+
P(h.data);
|
|
1214
1216
|
} catch (h) {
|
|
1215
1217
|
console.error("Failed to load replies:", h);
|
|
1216
1218
|
}
|
|
@@ -1219,46 +1221,46 @@ const Gt = (t, r) => {
|
|
|
1219
1221
|
j && q.length === 0 && X();
|
|
1220
1222
|
}, [j]);
|
|
1221
1223
|
const Ee = async (h) => {
|
|
1222
|
-
await c(h, t.id),
|
|
1223
|
-
},
|
|
1224
|
-
const ee = await l(h,
|
|
1225
|
-
ee && q.length > 0 &&
|
|
1224
|
+
await c(h, t.id), P((F) => F.filter((ee) => ee.id !== h));
|
|
1225
|
+
}, fe = async (h, F) => {
|
|
1226
|
+
const ee = await l(h, F);
|
|
1227
|
+
ee && q.length > 0 && P(
|
|
1226
1228
|
(ke) => ke.map((ce) => ce.id === h ? ee : ce)
|
|
1227
1229
|
);
|
|
1228
|
-
},
|
|
1229
|
-
ie({ open: !0, variant:
|
|
1230
|
-
}, S =
|
|
1231
|
-
return /* @__PURE__ */
|
|
1230
|
+
}, k = (h, F) => {
|
|
1231
|
+
ie({ open: !0, variant: F, title: "", message: h });
|
|
1232
|
+
}, S = x > 0 ? "reply" : "top", w = ((A = t.userModel) == null ? void 0 : A.name) || t.anonymousNickname || "User";
|
|
1233
|
+
return /* @__PURE__ */ y(
|
|
1232
1234
|
"div",
|
|
1233
1235
|
{
|
|
1234
|
-
css:
|
|
1236
|
+
css: m ? E ? O.highlighted[S] : O.highlightable[S] : O.post[S],
|
|
1235
1237
|
children: [
|
|
1236
|
-
/* @__PURE__ */
|
|
1238
|
+
/* @__PURE__ */ y("div", { css: O.row, children: [
|
|
1237
1239
|
/* @__PURE__ */ n(St, { src: (N = t.userModel) == null ? void 0 : N.avatar, alt: w, css: O.avatar, children: /* @__PURE__ */ n(Kt, { color: e.icon, style: lo }) }),
|
|
1238
|
-
/* @__PURE__ */
|
|
1239
|
-
/* @__PURE__ */
|
|
1240
|
-
/* @__PURE__ */ n("p", { css: O.name, children: ((H = t.userModel) == null ? void 0 : H.name) || t.anonymousNickname ||
|
|
1241
|
-
/* @__PURE__ */ n("span", { css: O.time, children: co(t.createdAt,
|
|
1242
|
-
E && /* @__PURE__ */ n("span", { css: O.badge, children:
|
|
1240
|
+
/* @__PURE__ */ y("div", { css: O.body, children: [
|
|
1241
|
+
/* @__PURE__ */ y("div", { ref: Z, css: O.header, children: [
|
|
1242
|
+
/* @__PURE__ */ n("p", { css: O.name, children: ((H = t.userModel) == null ? void 0 : H.name) || t.anonymousNickname || D("discussion.anonymous", "Anonymous") }),
|
|
1243
|
+
/* @__PURE__ */ n("span", { css: O.time, children: co(t.createdAt, D, $) }),
|
|
1244
|
+
E && /* @__PURE__ */ n("span", { css: O.badge, children: D("discussion.newPost", "New") }),
|
|
1243
1245
|
/* @__PURE__ */ n(
|
|
1244
1246
|
ro,
|
|
1245
1247
|
{
|
|
1246
1248
|
isOwnPost: se,
|
|
1247
|
-
canReport: !!(
|
|
1249
|
+
canReport: !!(f && i && !se) && !T,
|
|
1248
1250
|
onDelete: () => pe(!0),
|
|
1249
1251
|
onReport: () => de(!0),
|
|
1250
|
-
disabled:
|
|
1252
|
+
disabled: v
|
|
1251
1253
|
}
|
|
1252
1254
|
)
|
|
1253
1255
|
] }),
|
|
1254
|
-
|
|
1256
|
+
T && C ? /* @__PURE__ */ y("div", { css: O.moderated, children: [
|
|
1255
1257
|
/* @__PURE__ */ n(Ut, { size: "0.9375em", color: e.textSecondary, style: uo }),
|
|
1256
|
-
/* @__PURE__ */ n("p", { css: O.moderatedText, children: t.moderatedReason ||
|
|
1258
|
+
/* @__PURE__ */ n("p", { css: O.moderatedText, children: t.moderatedReason || D(
|
|
1257
1259
|
"discussion.moderatedPost",
|
|
1258
1260
|
"This comment has been moderated"
|
|
1259
1261
|
) })
|
|
1260
1262
|
] }) : /* @__PURE__ */ n("p", { css: O.content, children: t.content }),
|
|
1261
|
-
!
|
|
1263
|
+
!T && /* @__PURE__ */ n(
|
|
1262
1264
|
no,
|
|
1263
1265
|
{
|
|
1264
1266
|
post: t,
|
|
@@ -1267,35 +1269,35 @@ const Gt = (t, r) => {
|
|
|
1267
1269
|
onSignInClick: s,
|
|
1268
1270
|
onReact: l,
|
|
1269
1271
|
showReactions: u,
|
|
1270
|
-
showReplyButton: a &&
|
|
1272
|
+
showReplyButton: a && x < 2,
|
|
1271
1273
|
onReplyClick: () => _(!K),
|
|
1272
|
-
isBanned:
|
|
1274
|
+
isBanned: v
|
|
1273
1275
|
}
|
|
1274
1276
|
),
|
|
1275
|
-
a && t.repliesCount > 0 && /* @__PURE__ */ n("div", { css: O.repliesRow, children: /* @__PURE__ */
|
|
1277
|
+
a && t.repliesCount > 0 && /* @__PURE__ */ n("div", { css: O.repliesRow, children: /* @__PURE__ */ y(
|
|
1276
1278
|
"p",
|
|
1277
1279
|
{
|
|
1278
1280
|
css: O.repliesToggle,
|
|
1279
1281
|
onClick: () => oe(!j),
|
|
1280
1282
|
children: [
|
|
1281
|
-
j ?
|
|
1283
|
+
j ? D("discussion.hideReplies", "Hide replies") : D("discussion.repliesCount", "{{count}} replies", {
|
|
1282
1284
|
count: t.repliesCount
|
|
1283
1285
|
}),
|
|
1284
1286
|
!j && " ▼"
|
|
1285
1287
|
]
|
|
1286
1288
|
}
|
|
1287
1289
|
) }),
|
|
1288
|
-
K && !
|
|
1289
|
-
|
|
1290
|
+
K && !T && /* @__PURE__ */ n("div", { css: O.nested, children: /* @__PURE__ */ n(
|
|
1291
|
+
mt,
|
|
1290
1292
|
{
|
|
1291
1293
|
onSubmit: U,
|
|
1292
1294
|
userIsLoggedIn: i,
|
|
1293
1295
|
onSignInClick: s,
|
|
1294
|
-
placeholder:
|
|
1295
|
-
isSubmitting:
|
|
1296
|
+
placeholder: D("discussion.writeReply", "Write a reply..."),
|
|
1297
|
+
isSubmitting: g,
|
|
1296
1298
|
replyTo: ((ae = t.userModel) == null ? void 0 : ae.name) || t.anonymousNickname,
|
|
1297
1299
|
onCancel: () => _(!1),
|
|
1298
|
-
disabled:
|
|
1300
|
+
disabled: v
|
|
1299
1301
|
}
|
|
1300
1302
|
) }),
|
|
1301
1303
|
j && q.length > 0 && /* @__PURE__ */ n("div", { css: O.nested, children: q.map((h) => /* @__PURE__ */ n(
|
|
@@ -1307,17 +1309,17 @@ const Gt = (t, r) => {
|
|
|
1307
1309
|
onSignInClick: s,
|
|
1308
1310
|
showReactions: u,
|
|
1309
1311
|
showReplies: a,
|
|
1310
|
-
showReportPost:
|
|
1312
|
+
showReportPost: f,
|
|
1311
1313
|
onReply: d,
|
|
1312
|
-
onReact:
|
|
1314
|
+
onReact: fe,
|
|
1313
1315
|
onDelete: Ee,
|
|
1314
|
-
onReport:
|
|
1315
|
-
isSubmitting:
|
|
1316
|
-
showModeratedPosts:
|
|
1317
|
-
isBanned:
|
|
1318
|
-
depth:
|
|
1319
|
-
parentPostId:
|
|
1320
|
-
onReplyCreated:
|
|
1316
|
+
onReport: b,
|
|
1317
|
+
isSubmitting: g,
|
|
1318
|
+
showModeratedPosts: C,
|
|
1319
|
+
isBanned: v,
|
|
1320
|
+
depth: x + 1,
|
|
1321
|
+
parentPostId: x === 0 ? t.id : p,
|
|
1322
|
+
onReplyCreated: x === 0 ? X : void 0,
|
|
1321
1323
|
onDeleteSuccess: M
|
|
1322
1324
|
},
|
|
1323
1325
|
h.id
|
|
@@ -1332,7 +1334,7 @@ const Gt = (t, r) => {
|
|
|
1332
1334
|
onConfirm: async () => {
|
|
1333
1335
|
await c(t.id), M == null || M();
|
|
1334
1336
|
},
|
|
1335
|
-
onError: (h) =>
|
|
1337
|
+
onError: (h) => k(h, "error")
|
|
1336
1338
|
}
|
|
1337
1339
|
),
|
|
1338
1340
|
/* @__PURE__ */ n(
|
|
@@ -1340,9 +1342,9 @@ const Gt = (t, r) => {
|
|
|
1340
1342
|
{
|
|
1341
1343
|
open: Q,
|
|
1342
1344
|
onClose: () => de(!1),
|
|
1343
|
-
onSubmit: (h,
|
|
1344
|
-
onSuccess: (h) =>
|
|
1345
|
-
onError: (h) =>
|
|
1345
|
+
onSubmit: (h, F) => b(t.id, h, F),
|
|
1346
|
+
onSuccess: (h) => k(h, "success"),
|
|
1347
|
+
onError: (h) => k(h, "error")
|
|
1346
1348
|
}
|
|
1347
1349
|
),
|
|
1348
1350
|
/* @__PURE__ */ n(
|
|
@@ -1422,62 +1424,62 @@ const Gt = (t, r) => {
|
|
|
1422
1424
|
entryReason: o(Be, { unicodeBidi: "plaintext" }),
|
|
1423
1425
|
entryLifted: o(Be, { fontStyle: "italic" }),
|
|
1424
1426
|
isolate: o({ unicodeBidi: "isolate" })
|
|
1425
|
-
},
|
|
1427
|
+
}, fo = ({
|
|
1426
1428
|
ban: t,
|
|
1427
1429
|
showBanHistory: r = !1
|
|
1428
1430
|
}) => {
|
|
1429
|
-
const { t: i } = be(), { language: s } = Ke(Ue), [u, a] =
|
|
1431
|
+
const { t: i } = be(), { language: s } = Ke(Ue), [u, a] = B(!1), f = ut(s), d = (m) => new Date(m).toLocaleDateString(f, { dateStyle: "medium" }), l = (m) => new Date(m).toLocaleString(f, {
|
|
1430
1432
|
dateStyle: "medium",
|
|
1431
1433
|
timeStyle: "short"
|
|
1432
|
-
}), { activeBan: c } = t,
|
|
1434
|
+
}), { activeBan: c } = t, b = c.bannedPeriodInDays === st, g = new Date(
|
|
1433
1435
|
new Date(c.bannedAt).getTime() + c.bannedPeriodInDays * He
|
|
1434
|
-
),
|
|
1436
|
+
), C = Math.max(
|
|
1435
1437
|
1,
|
|
1436
|
-
Math.ceil((
|
|
1437
|
-
),
|
|
1438
|
-
(
|
|
1438
|
+
Math.ceil((g.getTime() - Date.now()) / He)
|
|
1439
|
+
), v = (t.history || []).filter(
|
|
1440
|
+
(m) => m.bannedAt !== c.bannedAt
|
|
1439
1441
|
);
|
|
1440
|
-
return /* @__PURE__ */ n("div", { role: "status", css: L.root, children: /* @__PURE__ */
|
|
1442
|
+
return /* @__PURE__ */ n("div", { role: "status", css: L.root, children: /* @__PURE__ */ y("div", { css: L.row, children: [
|
|
1441
1443
|
/* @__PURE__ */ n("div", { css: L.badge, children: /* @__PURE__ */ n(Vt, { size: "1.25em", color: e.icon }) }),
|
|
1442
|
-
/* @__PURE__ */
|
|
1444
|
+
/* @__PURE__ */ y("div", { css: L.body, children: [
|
|
1443
1445
|
/* @__PURE__ */ n("p", { css: L.title, children: i("discussion.ban.title", "You've been banned from commenting") }),
|
|
1444
|
-
/* @__PURE__ */ n("p", { css: L.description, children:
|
|
1446
|
+
/* @__PURE__ */ n("p", { css: L.description, children: b ? i(
|
|
1445
1447
|
"discussion.ban.descriptionPermanent",
|
|
1446
1448
|
"You can still read the discussion, but you can no longer post, reply or react."
|
|
1447
1449
|
) : i(
|
|
1448
1450
|
"discussion.ban.description",
|
|
1449
1451
|
"You can still read the discussion, but you can't post, reply or react until the ban ends."
|
|
1450
1452
|
) }),
|
|
1451
|
-
/* @__PURE__ */
|
|
1452
|
-
/* @__PURE__ */ n("span", { css: L.pill, children:
|
|
1453
|
-
count:
|
|
1453
|
+
/* @__PURE__ */ y("div", { css: L.pills, children: [
|
|
1454
|
+
/* @__PURE__ */ n("span", { css: L.pill, children: b ? i("discussion.ban.permanent", "Permanent ban") : i("discussion.ban.daysLeft", "{{count}} days left", {
|
|
1455
|
+
count: C
|
|
1454
1456
|
}) }),
|
|
1455
1457
|
/* @__PURE__ */ n("span", { css: L.meta, children: i("discussion.ban.since", "Since {{date}}", {
|
|
1456
1458
|
date: d(c.bannedAt)
|
|
1457
1459
|
}) }),
|
|
1458
|
-
!
|
|
1460
|
+
!b && /* @__PURE__ */ y("span", { css: L.meta, children: [
|
|
1459
1461
|
"·",
|
|
1460
1462
|
" ",
|
|
1461
1463
|
i("discussion.ban.until", "Until {{date}}", {
|
|
1462
|
-
date: l(
|
|
1464
|
+
date: l(g)
|
|
1463
1465
|
})
|
|
1464
1466
|
] })
|
|
1465
1467
|
] }),
|
|
1466
|
-
c.bannedReason && /* @__PURE__ */
|
|
1468
|
+
c.bannedReason && /* @__PURE__ */ y("div", { css: L.reasonBox, children: [
|
|
1467
1469
|
/* @__PURE__ */ n("span", { css: L.reasonLabel, children: i("discussion.ban.reason", "Reason") }),
|
|
1468
1470
|
/* @__PURE__ */ n("p", { css: L.reason, children: c.bannedReason })
|
|
1469
1471
|
] }),
|
|
1470
|
-
r &&
|
|
1471
|
-
/* @__PURE__ */
|
|
1472
|
+
r && v.length > 0 && /* @__PURE__ */ y("div", { css: L.history, children: [
|
|
1473
|
+
/* @__PURE__ */ y(
|
|
1472
1474
|
"button",
|
|
1473
1475
|
{
|
|
1474
1476
|
type: "button",
|
|
1475
1477
|
"aria-expanded": u,
|
|
1476
|
-
onClick: () => a((
|
|
1478
|
+
onClick: () => a((m) => !m),
|
|
1477
1479
|
css: L.toggle,
|
|
1478
1480
|
children: [
|
|
1479
1481
|
i("discussion.ban.previousBans", "Previous bans ({{count}})", {
|
|
1480
|
-
count:
|
|
1482
|
+
count: v.length
|
|
1481
1483
|
}),
|
|
1482
1484
|
/* @__PURE__ */ n(
|
|
1483
1485
|
_t,
|
|
@@ -1490,33 +1492,33 @@ const Gt = (t, r) => {
|
|
|
1490
1492
|
]
|
|
1491
1493
|
}
|
|
1492
1494
|
),
|
|
1493
|
-
u && /* @__PURE__ */ n("ul", { css: L.list, children:
|
|
1494
|
-
const E =
|
|
1495
|
-
new Date(
|
|
1495
|
+
u && /* @__PURE__ */ n("ul", { css: L.list, children: v.map((m) => {
|
|
1496
|
+
const E = m.unbannedAt ?? (m.bannedPeriodInDays > 0 ? new Date(
|
|
1497
|
+
new Date(m.bannedAt).getTime() + m.bannedPeriodInDays * He
|
|
1496
1498
|
) : null);
|
|
1497
|
-
return /* @__PURE__ */
|
|
1498
|
-
/* @__PURE__ */
|
|
1499
|
-
d(
|
|
1499
|
+
return /* @__PURE__ */ y("li", { css: L.entry, children: [
|
|
1500
|
+
/* @__PURE__ */ y("p", { css: L.entryDates, children: [
|
|
1501
|
+
d(m.bannedAt),
|
|
1500
1502
|
E && ` – ${d(E)}`,
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
+
m.bannedPeriodInDays === st && ` · ${i("discussion.ban.permanent", "Permanent ban")}`,
|
|
1504
|
+
m.bannedPeriodInDays > 0 && ` · ${i("discussion.ban.days", "{{count}} days", { count: m.bannedPeriodInDays })}`
|
|
1503
1505
|
] }),
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
+
m.bannedReason && /* @__PURE__ */ n("p", { css: L.entryReason, children: m.bannedReason }),
|
|
1507
|
+
m.unbannedAt && /* @__PURE__ */ y("p", { css: L.entryLifted, children: [
|
|
1506
1508
|
i("discussion.ban.lifted", "Lifted on {{date}}", {
|
|
1507
|
-
date: d(
|
|
1509
|
+
date: d(m.unbannedAt)
|
|
1508
1510
|
}),
|
|
1509
|
-
|
|
1511
|
+
m.unbannedReason && /* @__PURE__ */ y(Re, { children: [
|
|
1510
1512
|
": ",
|
|
1511
|
-
/* @__PURE__ */ n("span", { css: L.isolate, children:
|
|
1513
|
+
/* @__PURE__ */ n("span", { css: L.isolate, children: m.unbannedReason })
|
|
1512
1514
|
] })
|
|
1513
1515
|
] })
|
|
1514
|
-
] },
|
|
1516
|
+
] }, m.bannedAt);
|
|
1515
1517
|
}) })
|
|
1516
1518
|
] })
|
|
1517
1519
|
] })
|
|
1518
1520
|
] }) });
|
|
1519
|
-
},
|
|
1521
|
+
}, mo = (t) => {
|
|
1520
1522
|
var r, i, s;
|
|
1521
1523
|
return (((r = t == null ? void 0 : t.error) == null ? void 0 : r.code) ?? ((s = (i = t == null ? void 0 : t.data) == null ? void 0 : i.error) == null ? void 0 : s.code) ?? (t == null ? void 0 : t.status)) === 429;
|
|
1522
1524
|
}, ct = { display: "flex", alignItems: "center", marginInlineStart: "0.5em", marginInlineEnd: "-2px" }, we = {
|
|
@@ -1615,15 +1617,15 @@ const Gt = (t, r) => {
|
|
|
1615
1617
|
r.map((c) => c.value),
|
|
1616
1618
|
t,
|
|
1617
1619
|
(c) => i(c)
|
|
1618
|
-
), u = V(null), a = V(null),
|
|
1619
|
-
var
|
|
1620
|
-
const
|
|
1621
|
-
(
|
|
1620
|
+
), u = V(null), a = V(null), f = ht(s.open, s.rootRef, a, "start"), d = (c) => {
|
|
1621
|
+
var g, C, v;
|
|
1622
|
+
const b = c.target;
|
|
1623
|
+
(g = u.current) != null && g.contains(b) || (C = a.current) != null && C.contains(b) || ((v = u.current) == null || v.focus(), s.triggerProps.onClick());
|
|
1622
1624
|
};
|
|
1623
|
-
return /* @__PURE__ */
|
|
1625
|
+
return /* @__PURE__ */ y("div", { ref: s.rootRef, css: we.root, onClick: d, children: [
|
|
1624
1626
|
/* @__PURE__ */ n("button", { ref: u, ...s.triggerProps, css: we.button, children: (l = r.find((c) => c.value === t)) == null ? void 0 : l.label }),
|
|
1625
1627
|
/* @__PURE__ */ n("span", { css: s.open ? we.indicatorOpen : we.indicatorClosed, children: /* @__PURE__ */ n(jt, {}) }),
|
|
1626
|
-
s.open && /* @__PURE__ */ n("ul", { ref: a, ...s.listboxProps, css: we.list, style:
|
|
1628
|
+
s.open && /* @__PURE__ */ n("ul", { ref: a, ...s.listboxProps, css: we.list, style: f, children: r.map((c, b) => /* @__PURE__ */ n("li", { ...s.optionProps(b), css: we.option, children: c.label }, c.value)) })
|
|
1627
1629
|
] });
|
|
1628
1630
|
}, te = {
|
|
1629
1631
|
root: o({ marginInline: "auto", maxHeight: "100%", overflowY: "auto", backgroundColor: e.surface }),
|
|
@@ -1659,151 +1661,151 @@ const Gt = (t, r) => {
|
|
|
1659
1661
|
sdk: s,
|
|
1660
1662
|
userIsLoggedIn: u,
|
|
1661
1663
|
onSignInClick: a,
|
|
1662
|
-
showReactions:
|
|
1664
|
+
showReactions: f,
|
|
1663
1665
|
showReplies: d,
|
|
1664
1666
|
showReportPost: l,
|
|
1665
1667
|
currentSort: c,
|
|
1666
|
-
onSortChange:
|
|
1667
|
-
onCreatePost:
|
|
1668
|
-
onReact:
|
|
1669
|
-
onDeletePost:
|
|
1670
|
-
onReportPost:
|
|
1668
|
+
onSortChange: b,
|
|
1669
|
+
onCreatePost: g,
|
|
1670
|
+
onReact: C,
|
|
1671
|
+
onDeletePost: v,
|
|
1672
|
+
onReportPost: m,
|
|
1671
1673
|
onLoadMore: E,
|
|
1672
|
-
hasMore:
|
|
1673
|
-
liveRefresh:
|
|
1674
|
+
hasMore: I,
|
|
1675
|
+
liveRefresh: x = !1,
|
|
1674
1676
|
newPostIds: p,
|
|
1675
|
-
onNewPostSeen:
|
|
1677
|
+
onNewPostSeen: R,
|
|
1676
1678
|
isLoading: M,
|
|
1677
|
-
isSubmitting:
|
|
1678
|
-
infiniteScroll:
|
|
1679
|
+
isSubmitting: D,
|
|
1680
|
+
infiniteScroll: $ = !1,
|
|
1679
1681
|
showModeratedPosts: J = !1,
|
|
1680
1682
|
ban: K,
|
|
1681
1683
|
isBanned: _ = !1,
|
|
1682
1684
|
showBanHistory: q = !1
|
|
1683
1685
|
}) => {
|
|
1684
|
-
const { t:
|
|
1686
|
+
const { t: P } = be(), j = Ve(), oe = V(null), ne = V(null);
|
|
1685
1687
|
he(() => {
|
|
1686
|
-
if (
|
|
1687
|
-
const
|
|
1688
|
+
if (!$ || !ne.current) return;
|
|
1689
|
+
const T = new IntersectionObserver(
|
|
1688
1690
|
(U) => {
|
|
1689
|
-
U[0].isIntersecting &&
|
|
1691
|
+
U[0].isIntersecting && I && !M && E();
|
|
1690
1692
|
},
|
|
1691
1693
|
{ root: oe.current, threshold: 0.1 }
|
|
1692
1694
|
);
|
|
1693
|
-
return
|
|
1694
|
-
}, [
|
|
1695
|
-
const [pe, Q] =
|
|
1695
|
+
return T.observe(ne.current), () => T.disconnect();
|
|
1696
|
+
}, [$, I, M, E]);
|
|
1697
|
+
const [pe, Q] = B({ open: !1, variant: "success", title: "", message: "" }), de = () => {
|
|
1696
1698
|
Q({
|
|
1697
1699
|
open: !0,
|
|
1698
1700
|
variant: "success",
|
|
1699
1701
|
title: "",
|
|
1700
|
-
message:
|
|
1702
|
+
message: P("discussion.delete.success", "Comment deleted successfully.")
|
|
1701
1703
|
});
|
|
1702
|
-
}, re = (
|
|
1703
|
-
pt(
|
|
1704
|
+
}, re = (T, U) => {
|
|
1705
|
+
pt(T) || Q({
|
|
1704
1706
|
open: !0,
|
|
1705
1707
|
variant: "error",
|
|
1706
1708
|
title: "",
|
|
1707
|
-
message:
|
|
1709
|
+
message: mo(T) ? P(
|
|
1708
1710
|
"discussion.rateLimited",
|
|
1709
1711
|
"You're doing that too often. Please wait a moment and try again."
|
|
1710
1712
|
) : U
|
|
1711
1713
|
});
|
|
1712
|
-
}, ie = async (
|
|
1714
|
+
}, ie = async (T, U) => {
|
|
1713
1715
|
try {
|
|
1714
|
-
return await
|
|
1716
|
+
return await C(T, U);
|
|
1715
1717
|
} catch (X) {
|
|
1716
1718
|
throw re(
|
|
1717
1719
|
X,
|
|
1718
|
-
|
|
1720
|
+
P("discussion.reactError", "Failed to add reaction. Please try again.")
|
|
1719
1721
|
), X;
|
|
1720
1722
|
}
|
|
1721
|
-
}, Z = async (
|
|
1723
|
+
}, Z = async (T, U) => {
|
|
1722
1724
|
try {
|
|
1723
|
-
await
|
|
1725
|
+
await g(T, U);
|
|
1724
1726
|
} catch (X) {
|
|
1725
1727
|
throw re(
|
|
1726
1728
|
X,
|
|
1727
|
-
|
|
1729
|
+
P("discussion.postError", "Failed to post comment. Please try again.")
|
|
1728
1730
|
), X;
|
|
1729
1731
|
}
|
|
1730
1732
|
Q({
|
|
1731
1733
|
open: !0,
|
|
1732
1734
|
variant: "success",
|
|
1733
1735
|
title: "",
|
|
1734
|
-
message:
|
|
1736
|
+
message: P("discussion.postSuccess", "Comment posted successfully.")
|
|
1735
1737
|
});
|
|
1736
1738
|
}, se = [
|
|
1737
|
-
{ value: "LATEST", label:
|
|
1738
|
-
{ value: "OLDEST", label:
|
|
1739
|
-
{ value: "POPULAR", label:
|
|
1739
|
+
{ value: "LATEST", label: P("discussion.sort.latest", "Latest") },
|
|
1740
|
+
{ value: "OLDEST", label: P("discussion.sort.oldest", "Oldest") },
|
|
1741
|
+
{ value: "POPULAR", label: P("discussion.sort.popular", "Popular") },
|
|
1740
1742
|
{
|
|
1741
1743
|
value: "INTERACTED",
|
|
1742
|
-
label:
|
|
1744
|
+
label: P("discussion.sort.interacted", "Most Interacted")
|
|
1743
1745
|
}
|
|
1744
1746
|
];
|
|
1745
|
-
return /* @__PURE__ */
|
|
1746
|
-
/* @__PURE__ */
|
|
1747
|
-
/* @__PURE__ */ n("h3", { css: te.title, children: t.label ||
|
|
1748
|
-
!i && /* @__PURE__ */ n("p", { css: te.count, children:
|
|
1747
|
+
return /* @__PURE__ */ y("div", { ref: oe, css: te.root, style: j, children: [
|
|
1748
|
+
/* @__PURE__ */ y("div", { css: te.header, children: [
|
|
1749
|
+
/* @__PURE__ */ n("h3", { css: te.title, children: t.label || P("discussion.title", "Discussion") }),
|
|
1750
|
+
!i && /* @__PURE__ */ n("p", { css: te.count, children: P("discussion.postsCount", "{{count}} posts", {
|
|
1749
1751
|
count: t.postsCount || 0
|
|
1750
1752
|
}) })
|
|
1751
1753
|
] }),
|
|
1752
|
-
_ && K && /* @__PURE__ */ n(
|
|
1754
|
+
_ && K && /* @__PURE__ */ n(fo, { ban: K, showBanHistory: q }),
|
|
1753
1755
|
/* @__PURE__ */ n(
|
|
1754
|
-
|
|
1756
|
+
mt,
|
|
1755
1757
|
{
|
|
1756
|
-
onSubmit: (
|
|
1758
|
+
onSubmit: (T) => Z(T),
|
|
1757
1759
|
userIsLoggedIn: u,
|
|
1758
1760
|
onSignInClick: a,
|
|
1759
|
-
isSubmitting:
|
|
1761
|
+
isSubmitting: D,
|
|
1760
1762
|
disabled: _
|
|
1761
1763
|
}
|
|
1762
1764
|
),
|
|
1763
|
-
!i && /* @__PURE__ */
|
|
1765
|
+
!i && /* @__PURE__ */ y(Re, { children: [
|
|
1764
1766
|
/* @__PURE__ */ n("hr", { css: te.divider }),
|
|
1765
|
-
/* @__PURE__ */
|
|
1766
|
-
/* @__PURE__ */ n("p", { css: z.titleMd, children:
|
|
1767
|
-
/* @__PURE__ */ n(go, { value: c, options: se, onChange:
|
|
1767
|
+
/* @__PURE__ */ y("div", { css: te.sortRow, children: [
|
|
1768
|
+
/* @__PURE__ */ n("p", { css: z.titleMd, children: P("discussion.comments", "Comments") }),
|
|
1769
|
+
/* @__PURE__ */ n(go, { value: c, options: se, onChange: b })
|
|
1768
1770
|
] }),
|
|
1769
|
-
M && r.length === 0 ? /* @__PURE__ */ n("div", { css: te.listSpinner, children: /* @__PURE__ */ n(Oe, { marginBlock: "32px" }) }) : r.length === 0 ? /* @__PURE__ */ n("div", { css: te.empty, children: /* @__PURE__ */ n("p", { css: te.emptyText, children:
|
|
1771
|
+
M && r.length === 0 ? /* @__PURE__ */ n("div", { css: te.listSpinner, children: /* @__PURE__ */ n(Oe, { marginBlock: "32px" }) }) : r.length === 0 ? /* @__PURE__ */ n("div", { css: te.empty, children: /* @__PURE__ */ n("p", { css: te.emptyText, children: P(
|
|
1770
1772
|
"discussion.noPosts",
|
|
1771
1773
|
"No comments yet. Be the first to comment!"
|
|
1772
|
-
) }) }) : /* @__PURE__ */
|
|
1773
|
-
/* @__PURE__ */ n("div", { children: r.map((
|
|
1774
|
+
) }) }) : /* @__PURE__ */ y(Re, { children: [
|
|
1775
|
+
/* @__PURE__ */ n("div", { children: r.map((T) => /* @__PURE__ */ n(
|
|
1774
1776
|
yt,
|
|
1775
1777
|
{
|
|
1776
|
-
post:
|
|
1778
|
+
post: T,
|
|
1777
1779
|
sdk: s,
|
|
1778
1780
|
userIsLoggedIn: u,
|
|
1779
1781
|
onSignInClick: a,
|
|
1780
|
-
showReactions:
|
|
1782
|
+
showReactions: f,
|
|
1781
1783
|
showReplies: d,
|
|
1782
1784
|
showReportPost: l,
|
|
1783
1785
|
onReply: (U, X) => Z(X, U),
|
|
1784
1786
|
onReact: ie,
|
|
1785
|
-
onDelete:
|
|
1786
|
-
onReport:
|
|
1787
|
-
isSubmitting:
|
|
1787
|
+
onDelete: v,
|
|
1788
|
+
onReport: m,
|
|
1789
|
+
isSubmitting: D,
|
|
1788
1790
|
showModeratedPosts: J,
|
|
1789
1791
|
isBanned: _,
|
|
1790
|
-
highlightable:
|
|
1791
|
-
isNew: p == null ? void 0 : p.has(
|
|
1792
|
-
onNewSeen:
|
|
1792
|
+
highlightable: x,
|
|
1793
|
+
isNew: p == null ? void 0 : p.has(T.id),
|
|
1794
|
+
onNewSeen: R,
|
|
1793
1795
|
onDeleteSuccess: de
|
|
1794
1796
|
},
|
|
1795
|
-
|
|
1797
|
+
T.id
|
|
1796
1798
|
)) }),
|
|
1797
|
-
|
|
1799
|
+
$ && /* @__PURE__ */ n("div", { ref: ne, css: te.sentinel })
|
|
1798
1800
|
] }),
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
+
$ && M && r.length > 0 && /* @__PURE__ */ n("div", { css: te.moreSpinner, children: /* @__PURE__ */ n(Oe, { marginBlock: "16px" }) }),
|
|
1802
|
+
!$ && I && /* @__PURE__ */ n("div", { css: te.loadMore, children: /* @__PURE__ */ n(ue, { look: "outlined", onClick: E, loading: M, children: P("discussion.loadMore", "Load More") }) })
|
|
1801
1803
|
] }),
|
|
1802
1804
|
/* @__PURE__ */ n(
|
|
1803
1805
|
dt,
|
|
1804
1806
|
{
|
|
1805
1807
|
notification: pe,
|
|
1806
|
-
onClose: () => Q((
|
|
1808
|
+
onClose: () => Q((T) => ({ ...T, open: !1 }))
|
|
1807
1809
|
}
|
|
1808
1810
|
)
|
|
1809
1811
|
] });
|
|
@@ -1814,21 +1816,21 @@ const Gt = (t, r) => {
|
|
|
1814
1816
|
discussionLabel: s,
|
|
1815
1817
|
discussionUrl: u = "",
|
|
1816
1818
|
defaultSort: a = "LATEST",
|
|
1817
|
-
postsPerPage:
|
|
1819
|
+
postsPerPage: f = 20,
|
|
1818
1820
|
showReactions: d = !0,
|
|
1819
1821
|
showReplies: l = !0,
|
|
1820
1822
|
showReportPost: c = !0,
|
|
1821
|
-
infiniteScroll:
|
|
1822
|
-
showModeratedPosts:
|
|
1823
|
-
userIsLoggedIn:
|
|
1824
|
-
showBanHistory:
|
|
1825
|
-
refreshInterval:
|
|
1823
|
+
infiniteScroll: b = !1,
|
|
1824
|
+
showModeratedPosts: g = !1,
|
|
1825
|
+
userIsLoggedIn: C = !1,
|
|
1826
|
+
showBanHistory: v = !1,
|
|
1827
|
+
refreshInterval: m = 0,
|
|
1826
1828
|
onSignInClick: E
|
|
1827
|
-
} = t, { ban:
|
|
1828
|
-
discussion:
|
|
1829
|
+
} = t, { ban: I, isBanned: x, refresh: p } = eo(i, C), {
|
|
1830
|
+
discussion: R,
|
|
1829
1831
|
setDiscussion: M,
|
|
1830
|
-
isLoading:
|
|
1831
|
-
error:
|
|
1832
|
+
isLoading: D,
|
|
1833
|
+
error: $,
|
|
1832
1834
|
isNotFound: J
|
|
1833
1835
|
} = Gt(i, r), K = () => ({
|
|
1834
1836
|
id: r,
|
|
@@ -1836,14 +1838,14 @@ const Gt = (t, r) => {
|
|
|
1836
1838
|
postsCount: 0,
|
|
1837
1839
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1838
1840
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1839
|
-
}), _ = (
|
|
1840
|
-
M((
|
|
1841
|
-
const S =
|
|
1842
|
-
return { ...S, postsCount: Math.max(0, S.postsCount +
|
|
1841
|
+
}), _ = (fe) => {
|
|
1842
|
+
M((k) => {
|
|
1843
|
+
const S = k ?? K();
|
|
1844
|
+
return { ...S, postsCount: Math.max(0, S.postsCount + fe) };
|
|
1843
1845
|
});
|
|
1844
1846
|
}, {
|
|
1845
1847
|
posts: q,
|
|
1846
|
-
postsHidden:
|
|
1848
|
+
postsHidden: P,
|
|
1847
1849
|
isLoading: j,
|
|
1848
1850
|
isSubmitting: oe,
|
|
1849
1851
|
currentSort: ne,
|
|
@@ -1854,7 +1856,7 @@ const Gt = (t, r) => {
|
|
|
1854
1856
|
handleLoadMore: ie,
|
|
1855
1857
|
handleCreatePost: Z,
|
|
1856
1858
|
handleReact: se,
|
|
1857
|
-
handleDeletePost:
|
|
1859
|
+
handleDeletePost: T,
|
|
1858
1860
|
handleReportPost: U
|
|
1859
1861
|
} = Qt(
|
|
1860
1862
|
i,
|
|
@@ -1862,32 +1864,32 @@ const Gt = (t, r) => {
|
|
|
1862
1864
|
s || null,
|
|
1863
1865
|
u,
|
|
1864
1866
|
a,
|
|
1865
|
-
m,
|
|
1866
|
-
_,
|
|
1867
1867
|
f,
|
|
1868
|
-
|
|
1869
|
-
|
|
1868
|
+
_,
|
|
1869
|
+
g,
|
|
1870
|
+
m
|
|
1871
|
+
), X = (fe) => async (...k) => {
|
|
1870
1872
|
try {
|
|
1871
|
-
return await
|
|
1873
|
+
return await fe(...k);
|
|
1872
1874
|
} catch (S) {
|
|
1873
1875
|
throw pt(S) && p(), S;
|
|
1874
1876
|
}
|
|
1875
1877
|
};
|
|
1876
|
-
if (
|
|
1878
|
+
if (D || !R && !J && j)
|
|
1877
1879
|
return /* @__PURE__ */ n(Oe, { marginBlock: "160px" });
|
|
1878
|
-
if (
|
|
1880
|
+
if ($)
|
|
1879
1881
|
return /* @__PURE__ */ n("div", { style: { padding: "20px", textAlign: "center" }, children: /* @__PURE__ */ n("p", { children: "Failed to load discussion. Please try again later." }) });
|
|
1880
|
-
const Ee = async (
|
|
1881
|
-
await Z(
|
|
1882
|
+
const Ee = async (fe, k) => {
|
|
1883
|
+
await Z(fe, k), s && M((S) => ({ ...S ?? K(), label: s }));
|
|
1882
1884
|
};
|
|
1883
1885
|
return /* @__PURE__ */ n(
|
|
1884
1886
|
ho,
|
|
1885
1887
|
{
|
|
1886
|
-
discussion:
|
|
1888
|
+
discussion: R ?? K(),
|
|
1887
1889
|
posts: q,
|
|
1888
|
-
postsHidden:
|
|
1890
|
+
postsHidden: P,
|
|
1889
1891
|
sdk: i,
|
|
1890
|
-
userIsLoggedIn:
|
|
1892
|
+
userIsLoggedIn: C,
|
|
1891
1893
|
onSignInClick: E,
|
|
1892
1894
|
showReactions: d,
|
|
1893
1895
|
showReplies: l,
|
|
@@ -1896,20 +1898,20 @@ const Gt = (t, r) => {
|
|
|
1896
1898
|
onSortChange: re,
|
|
1897
1899
|
onCreatePost: X(Ee),
|
|
1898
1900
|
onReact: X(se),
|
|
1899
|
-
onDeletePost: X(
|
|
1901
|
+
onDeletePost: X(T),
|
|
1900
1902
|
onReportPost: X(U),
|
|
1901
1903
|
onLoadMore: ie,
|
|
1902
1904
|
hasMore: pe,
|
|
1903
|
-
liveRefresh:
|
|
1905
|
+
liveRefresh: m > 0,
|
|
1904
1906
|
newPostIds: Q,
|
|
1905
1907
|
onNewPostSeen: de,
|
|
1906
1908
|
isLoading: j,
|
|
1907
1909
|
isSubmitting: oe,
|
|
1908
|
-
infiniteScroll:
|
|
1909
|
-
showModeratedPosts:
|
|
1910
|
-
ban:
|
|
1911
|
-
isBanned:
|
|
1912
|
-
showBanHistory:
|
|
1910
|
+
infiniteScroll: b,
|
|
1911
|
+
showModeratedPosts: g,
|
|
1912
|
+
ban: I,
|
|
1913
|
+
isBanned: x,
|
|
1914
|
+
showBanHistory: v
|
|
1913
1915
|
}
|
|
1914
1916
|
);
|
|
1915
1917
|
}, Io = (t) => /* @__PURE__ */ n(
|