fansunited-frontend-components 0.0.99 → 1.0.1
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 +2 -2
- package/ChanceGame.js +496 -505
- package/ClassicQuizPlay.js +2 -2
- package/CollectLead.js +405 -1163
- package/CompetitionStatistics.js +2 -2
- package/CompetitorCard.js +445 -425
- package/Discussion.js +2 -2
- package/EitherOrPlay.js +2 -2
- package/EventCard.js +648 -593
- package/EventGamePlay.js +2 -2
- package/Leaderboard.js +142 -132
- package/List.js +675 -713
- package/MatchQuizPlay.js +2 -2
- package/Odds.js +1 -1
- package/PersonalityQuizPlay.js +2 -2
- package/PickThePair.js +925 -1824
- package/PlayerOfTheMatch.js +2106 -2223
- package/PollVote.js +2 -2
- package/Predictor.js +4209 -18629
- package/Standings.js +497 -486
- package/TopX.js +3223 -16958
- package/chunks/{ChanceGameEmbedVariant-DM9eLG5s.js → ChanceGameEmbedVariant-z8XYzgDW.js} +1 -1
- package/chunks/PickOneOfX-IvE4OvyT.js +3146 -0
- package/chunks/index-BNl8scz6.js +4 -0
- package/chunks/index-CSa2JU4m.js +4 -0
- package/chunks/index-Cd1dg0KI.js +4 -0
- package/chunks/index-Cei2fzi7.js +4 -0
- package/chunks/index-Cxb4wEJU.js +4 -0
- package/chunks/index-DqQtGqBF.js +4 -0
- package/chunks/index-w1LGN5dz.js +4 -0
- package/chunks/main-07vzblS8.js +2091 -0
- package/chunks/main-C7X4dM_P.js +4827 -0
- package/chunks/main-D_QDfmAw.js +6417 -0
- package/chunks/{main-CzfWaEQP.js → main-DdL0UekL.js} +1931 -2025
- package/chunks/main-DmBfwyb4.js +2992 -0
- package/chunks/main-LEE8n2cG.js +3117 -0
- package/chunks/{main-DxvBjXsd.js → main-P2WNvBZE.js} +473 -444
- package/chunks/{main-DiBlJBNb.js → main-WkCv5Rjl.js} +668 -694
- package/chunks/predictionsHelpers-D8j0Y78z.js +10065 -0
- package/chunks/{withVersionStamp-BsLyhvNA.js → withVersionStamp-BPvy9XSs.js} +1 -1
- package/package.json +2 -6
- package/withVersionStamp.d.ts.map +1 -1
- package/chunks/CheckCircle-I1FktW5Y.js +0 -13
- package/chunks/Person-CXRqyF4E.js +0 -11
- package/chunks/PickOneOfX-DET4ZhjV.js +0 -3117
- package/chunks/Search-CIXthh0D.js +0 -17
- package/chunks/TimerOutlined-D-WA_vpE.js +0 -8
- package/chunks/WorkspacePremiumOutlined-DUXVgJlF.js +0 -136
- package/chunks/chevrons-right-HWKW2c4I.js +0 -45
- package/chunks/createLucideIcon-YBRjY5Kl.js +0 -79
- package/chunks/index-BENM3N_w.js +0 -4
- package/chunks/index-BRxAV693.js +0 -4
- package/chunks/index-BXYTsvIX.js +0 -4
- package/chunks/index-C0ilols1.js +0 -4
- package/chunks/index-D7VhczXH.js +0 -4
- package/chunks/index-DKwvdw9t.js +0 -4
- package/chunks/index-DZN-AITW.js +0 -4
- package/chunks/main-B2sDRFF4.js +0 -2184
- package/chunks/main-DFNl3g_U.js +0 -4910
- package/chunks/main-DLwnvntz.js +0 -4020
- package/chunks/main-S8_NDSiY.js +0 -3209
- package/chunks/main-lBgr8Liq.js +0 -6571
|
@@ -1,86 +1,87 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { InlineSpinner as vt, Modal as
|
|
3
|
-
import Ie, { useState as
|
|
4
|
-
import { useDisableCache as
|
|
1
|
+
import { jsxs as y, jsx as n, Fragment as Re } from "@emotion/react/jsx-runtime";
|
|
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 B, useEffect as he, useRef as V, useCallback as Ce, useLayoutEffect as kt, useId as Rt } from "react";
|
|
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
|
-
import { useTranslation as
|
|
7
|
-
import { ThumbUpIcon as
|
|
8
|
-
import { createPortal as
|
|
9
|
-
const
|
|
10
|
-
const [i, s] =
|
|
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 $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
|
+
import { createPortal as Yt } from "react-dom";
|
|
9
|
+
const Gt = (t, r) => {
|
|
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:
|
|
24
|
-
},
|
|
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
|
-
), [$, J] =
|
|
28
|
-
async (
|
|
29
|
-
var
|
|
30
|
-
|
|
27
|
+
), [$, J] = B(!1), [K, _] = B(() => /* @__PURE__ */ new Set()), q = V(0), P = Ce(
|
|
28
|
+
async (k, S, w = !1) => {
|
|
29
|
+
var A, N;
|
|
30
|
+
w || (q.current += 1, _(/* @__PURE__ */ new Set()));
|
|
31
31
|
try {
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
sort:
|
|
32
|
+
v(!0);
|
|
33
|
+
const H = await t.discussions.getPosts(r, {
|
|
34
|
+
sort: k,
|
|
35
35
|
limit: a,
|
|
36
|
-
startAfter:
|
|
36
|
+
startAfter: S,
|
|
37
37
|
skipDeleted: !0,
|
|
38
38
|
skipModerated: !d
|
|
39
|
-
}), ae =
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
((N =
|
|
44
|
-
), J(
|
|
45
|
-
} catch (
|
|
46
|
-
(t.helpers.getSDKConfiguration().errorHandlingMode === "standard" ?
|
|
39
|
+
}), ae = H.data;
|
|
40
|
+
g(w ? (F) => [...F, ...ae] : ae);
|
|
41
|
+
const h = !!((A = H.meta.pagination) != null && A.nextPageStartsAfter) && ae.length === a;
|
|
42
|
+
D(
|
|
43
|
+
((N = H.meta.pagination) == null ? void 0 : N.nextPageStartsAfter) || null
|
|
44
|
+
), J(h), x(null);
|
|
45
|
+
} catch (H) {
|
|
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
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on the query inputs; the setError(error) no-op is deliberate
|
|
51
52
|
[t, r, a, d]
|
|
52
53
|
);
|
|
53
54
|
he(() => {
|
|
54
55
|
if (c) {
|
|
55
|
-
|
|
56
|
+
g([]), J(!1), v(!1);
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
|
-
r &&
|
|
59
|
-
}, [r,
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
}, oe =
|
|
63
|
-
oe.current =
|
|
64
|
-
const ne =
|
|
65
|
-
ne.current =
|
|
66
|
-
const pe =
|
|
67
|
-
ne.current && !oe.current &&
|
|
68
|
-
}, [
|
|
69
|
-
|
|
70
|
-
const de =
|
|
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
|
+
const ne = V(M);
|
|
66
|
+
ne.current = M;
|
|
67
|
+
const pe = Ce(() => {
|
|
68
|
+
ne.current && !oe.current && P(p, ne.current, !0);
|
|
69
|
+
}, [P, p]), Q = V(b);
|
|
70
|
+
Q.current = b;
|
|
71
|
+
const de = V($);
|
|
71
72
|
de.current = $;
|
|
72
|
-
const re =
|
|
73
|
-
re.current =
|
|
74
|
-
const ie =
|
|
75
|
-
var
|
|
73
|
+
const re = V(f);
|
|
74
|
+
re.current = f;
|
|
75
|
+
const ie = V(!1), Z = Ce(async () => {
|
|
76
|
+
var H, ae;
|
|
76
77
|
if (oe.current || ie.current) return;
|
|
77
|
-
const
|
|
78
|
+
const k = p === "LATEST" || !de.current;
|
|
78
79
|
ie.current = !0;
|
|
79
|
-
const
|
|
80
|
+
const S = q.current, w = Q.current, A = new Map(w.map((h) => [h.id, h])), N = (h) => !A.has(h.id);
|
|
80
81
|
try {
|
|
81
|
-
const
|
|
82
|
+
const h = [], F = /* @__PURE__ */ new Map();
|
|
82
83
|
let ee;
|
|
83
|
-
for (let
|
|
84
|
+
for (let W = 0; W < qt; W++) {
|
|
84
85
|
const Y = await t.discussions.getPosts(r, {
|
|
85
86
|
sort: "LATEST",
|
|
86
87
|
limit: a,
|
|
@@ -90,14 +91,14 @@ const _t = (t, r) => {
|
|
|
90
91
|
skipModerated: !1
|
|
91
92
|
}), G = Y.data;
|
|
92
93
|
G.forEach((me) => {
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
}), ee = ((
|
|
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
|
+
}), ee = ((H = Y.meta.pagination) == null ? void 0 : H.nextPageStartsAfter) || void 0;
|
|
96
97
|
const xe = G.length === a && G.every(N);
|
|
97
|
-
if (!
|
|
98
|
+
if (!k || !w.length || !xe || !ee) break;
|
|
98
99
|
}
|
|
99
|
-
if (
|
|
100
|
-
(
|
|
100
|
+
if (S !== q.current || (F.size && g(
|
|
101
|
+
(W) => d ? W.map((Y) => {
|
|
101
102
|
const G = F.get(Y.id);
|
|
102
103
|
return G ? {
|
|
103
104
|
...Y,
|
|
@@ -106,17 +107,17 @@ const _t = (t, r) => {
|
|
|
106
107
|
moderatedBy: G.moderatedBy,
|
|
107
108
|
moderatedReason: G.moderatedReason
|
|
108
109
|
} : Y;
|
|
109
|
-
}) :
|
|
110
|
-
), !
|
|
111
|
-
const ke = new Set(
|
|
110
|
+
}) : W.filter((Y) => !F.has(Y.id))
|
|
111
|
+
), !k)) return;
|
|
112
|
+
const ke = new Set(Q.current.map((W) => W.id)), ce = h.filter((W) => !ke.has(W.id));
|
|
112
113
|
if (!ce.length) return;
|
|
113
|
-
|
|
114
|
-
const Y = new Set(
|
|
115
|
-
return
|
|
114
|
+
w.length ? g((W) => {
|
|
115
|
+
const Y = new Set(W.map((xe) => xe.id)), G = ce.filter((xe) => !Y.has(xe.id));
|
|
116
|
+
return p === "LATEST" ? [...G, ...W].sort(
|
|
116
117
|
(xe, me) => Date.parse(me.createdAt) - Date.parse(xe.createdAt)
|
|
117
|
-
) : [...
|
|
118
|
-
}) : await
|
|
119
|
-
const Y = new Set(
|
|
118
|
+
) : [...W, ...G.reverse()];
|
|
119
|
+
}) : await P(p), _((W) => {
|
|
120
|
+
const Y = new Set(W);
|
|
120
121
|
return ce.forEach((G) => Y.add(G.id)), Y;
|
|
121
122
|
}), (ae = re.current) == null || ae.call(re, ce.length);
|
|
122
123
|
} catch {
|
|
@@ -128,45 +129,45 @@ const _t = (t, r) => {
|
|
|
128
129
|
r,
|
|
129
130
|
a,
|
|
130
131
|
d,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
]), se = l > 0 ? Math.max(l,
|
|
132
|
+
p,
|
|
133
|
+
P
|
|
134
|
+
]), se = l > 0 ? Math.max(l, Jt) : 0;
|
|
134
135
|
he(() => {
|
|
135
136
|
if (!se || c || !r) return;
|
|
136
|
-
const
|
|
137
|
-
document.visibilityState !== "hidden" &&
|
|
138
|
-
},
|
|
139
|
-
document.visibilityState === "visible" &&
|
|
140
|
-
},
|
|
141
|
-
return document.addEventListener("visibilitychange",
|
|
142
|
-
clearInterval(
|
|
137
|
+
const k = () => {
|
|
138
|
+
document.visibilityState !== "hidden" && Z();
|
|
139
|
+
}, S = () => {
|
|
140
|
+
document.visibilityState === "visible" && Z();
|
|
141
|
+
}, w = setInterval(k, se);
|
|
142
|
+
return document.addEventListener("visibilitychange", S), () => {
|
|
143
|
+
clearInterval(w), document.removeEventListener("visibilitychange", S);
|
|
143
144
|
};
|
|
144
|
-
}, [se, c, r,
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
if (!
|
|
148
|
-
const
|
|
149
|
-
return
|
|
145
|
+
}, [se, c, r, Z]);
|
|
146
|
+
const T = Ce((k) => {
|
|
147
|
+
_((S) => {
|
|
148
|
+
if (!S.has(k)) return S;
|
|
149
|
+
const w = new Set(S);
|
|
150
|
+
return w.delete(k), w;
|
|
150
151
|
});
|
|
151
152
|
}, []);
|
|
152
153
|
return {
|
|
153
|
-
posts:
|
|
154
|
+
posts: b,
|
|
154
155
|
postsHidden: c,
|
|
155
|
-
isLoading:
|
|
156
|
-
isSubmitting:
|
|
156
|
+
isLoading: C,
|
|
157
|
+
isSubmitting: m,
|
|
157
158
|
error: I,
|
|
158
|
-
currentSort:
|
|
159
|
+
currentSort: p,
|
|
159
160
|
hasMore: $,
|
|
160
|
-
newPostIds:
|
|
161
|
-
markPostSeen:
|
|
162
|
-
handleSortChange:
|
|
161
|
+
newPostIds: K,
|
|
162
|
+
markPostSeen: T,
|
|
163
|
+
handleSortChange: j,
|
|
163
164
|
handleLoadMore: pe,
|
|
164
|
-
handleCreatePost: async (
|
|
165
|
+
handleCreatePost: async (k, S) => {
|
|
165
166
|
try {
|
|
166
|
-
|
|
167
|
-
let
|
|
168
|
-
content:
|
|
169
|
-
replyId:
|
|
167
|
+
E(!0);
|
|
168
|
+
let A = await t.discussions.createPost(r, {
|
|
169
|
+
content: k,
|
|
170
|
+
replyId: S || null,
|
|
170
171
|
userNickname: null,
|
|
171
172
|
discussionLabel: i,
|
|
172
173
|
discussionUrl: s,
|
|
@@ -178,79 +179,79 @@ const _t = (t, r) => {
|
|
|
178
179
|
});
|
|
179
180
|
try {
|
|
180
181
|
const N = await t.profile.getOwn().getInfo();
|
|
181
|
-
|
|
182
|
+
A = { ...A, userModel: N };
|
|
182
183
|
} catch {
|
|
183
184
|
}
|
|
184
|
-
|
|
185
|
+
S ? g(
|
|
185
186
|
(N) => N.map(
|
|
186
|
-
(
|
|
187
|
+
(H) => H.id === S ? { ...H, repliesCount: (H.repliesCount || 0) + 1 } : H
|
|
187
188
|
)
|
|
188
|
-
) : c ||
|
|
189
|
-
} catch (
|
|
190
|
-
throw
|
|
191
|
-
|
|
192
|
-
),
|
|
189
|
+
) : c || g((N) => [A, ...N]), f == null || f(1), x(null);
|
|
190
|
+
} catch (w) {
|
|
191
|
+
throw x(
|
|
192
|
+
w
|
|
193
|
+
), w;
|
|
193
194
|
} finally {
|
|
194
|
-
|
|
195
|
+
E(!1);
|
|
195
196
|
}
|
|
196
197
|
},
|
|
197
|
-
handleReact: async (
|
|
198
|
+
handleReact: async (k, S) => {
|
|
198
199
|
try {
|
|
199
|
-
const
|
|
200
|
-
return
|
|
201
|
-
(
|
|
202
|
-
),
|
|
203
|
-
} catch (
|
|
204
|
-
throw console.error("Error reacting to post:",
|
|
205
|
-
|
|
206
|
-
),
|
|
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
|
+
} catch (w) {
|
|
205
|
+
throw console.error("Error reacting to post:", w), x(
|
|
206
|
+
w
|
|
207
|
+
), w;
|
|
207
208
|
}
|
|
208
209
|
},
|
|
209
|
-
handleDeletePost: async (
|
|
210
|
+
handleDeletePost: async (k, S) => {
|
|
210
211
|
try {
|
|
211
|
-
await t.discussions.deletePost(
|
|
212
|
-
(
|
|
213
|
-
(
|
|
212
|
+
await t.discussions.deletePost(k), g((w) => w.filter((A) => A.id !== k)), S && g(
|
|
213
|
+
(w) => w.map(
|
|
214
|
+
(A) => A.id === S ? { ...A, repliesCount: Math.max(0, (A.repliesCount || 0) - 1) } : A
|
|
214
215
|
)
|
|
215
|
-
),
|
|
216
|
-
} catch (
|
|
217
|
-
throw
|
|
218
|
-
|
|
219
|
-
),
|
|
216
|
+
), f == null || f(-1), x(null);
|
|
217
|
+
} catch (w) {
|
|
218
|
+
throw x(
|
|
219
|
+
w
|
|
220
|
+
), w;
|
|
220
221
|
}
|
|
221
222
|
},
|
|
222
|
-
handleReportPost: async (
|
|
223
|
+
handleReportPost: async (k, S, w) => {
|
|
223
224
|
try {
|
|
224
|
-
await t.discussions.reportPost(
|
|
225
|
-
} catch (
|
|
226
|
-
throw
|
|
227
|
-
|
|
228
|
-
),
|
|
225
|
+
await t.discussions.reportPost(k, S, w), x(null);
|
|
226
|
+
} catch (A) {
|
|
227
|
+
throw x(
|
|
228
|
+
A
|
|
229
|
+
), A;
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
};
|
|
232
|
-
},
|
|
233
|
+
}, Zt = async (t) => {
|
|
233
234
|
var r;
|
|
234
235
|
try {
|
|
235
|
-
const s = (r = t.helpers.getSDKConfiguration().authProvider) == null ? void 0 : r.getIdToken(),
|
|
236
|
-
if (!
|
|
236
|
+
const s = (r = t.helpers.getSDKConfiguration().authProvider) == null ? void 0 : r.getIdToken(), u = s == null ? void 0 : s.split(".")[1];
|
|
237
|
+
if (!u) return null;
|
|
237
238
|
const { sub: a } = JSON.parse(
|
|
238
|
-
atob(
|
|
239
|
+
atob(u.replace(/-/g, "+").replace(/_/g, "/"))
|
|
239
240
|
);
|
|
240
241
|
return typeof a == "string" && a ? a : null;
|
|
241
242
|
} catch {
|
|
242
243
|
return null;
|
|
243
244
|
}
|
|
244
|
-
},
|
|
245
|
+
}, eo = (t, r) => {
|
|
245
246
|
var d;
|
|
246
|
-
const [i, s] =
|
|
247
|
+
const [i, s] = B(null), u = It(), a = Ce(
|
|
247
248
|
async (l) => {
|
|
248
249
|
if (!r) {
|
|
249
250
|
s(null);
|
|
250
251
|
return;
|
|
251
252
|
}
|
|
252
253
|
try {
|
|
253
|
-
const c = await
|
|
254
|
+
const c = await Zt(t);
|
|
254
255
|
if (!c) return;
|
|
255
256
|
s(await t.discussions.getUserBan(c, l));
|
|
256
257
|
} catch (c) {
|
|
@@ -260,11 +261,11 @@ const _t = (t, r) => {
|
|
|
260
261
|
[t, r]
|
|
261
262
|
);
|
|
262
263
|
he(() => {
|
|
263
|
-
a(
|
|
264
|
-
}, [a,
|
|
265
|
-
const
|
|
266
|
-
return { ban: i, isBanned: !!((d = i == null ? void 0 : i.activeBan) != null && d.banned), refresh:
|
|
267
|
-
},
|
|
264
|
+
a(u);
|
|
265
|
+
}, [a, u]);
|
|
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
|
+
}, pt = (t) => {
|
|
268
269
|
var r, i, s;
|
|
269
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";
|
|
270
271
|
}, e = {
|
|
@@ -279,8 +280,8 @@ const _t = (t, r) => {
|
|
|
279
280
|
danger: "var(--fu-ucrc-danger-plain-color)",
|
|
280
281
|
dangerSoft: "var(--fu-ucrc-danger-soft-bg)",
|
|
281
282
|
// Joy's own defaults, where a Joy component painted something the client theme doesn't set.
|
|
282
|
-
|
|
283
|
-
icon: "var(--fu-ucrc-
|
|
283
|
+
paletteTextPrimary: "var(--fu-ucrc-palette-text-primary)",
|
|
284
|
+
icon: "var(--fu-ucrc-palette-text-icon)",
|
|
284
285
|
focus: "var(--fu-ucrc-focus-visible)",
|
|
285
286
|
fontPrimary: "var(--fu-ucrc-font-primary)",
|
|
286
287
|
fontBody: "var(--fu-ucrc-font-body)",
|
|
@@ -301,8 +302,8 @@ const _t = (t, r) => {
|
|
|
301
302
|
text14: "var(--fu-ucrc-dsc-text-14)",
|
|
302
303
|
danger1f: "var(--fu-ucrc-dsc-danger-1f)",
|
|
303
304
|
danger33: "var(--fu-ucrc-dsc-danger-33)"
|
|
304
|
-
},
|
|
305
|
-
const t =
|
|
305
|
+
}, Ve = () => {
|
|
306
|
+
const t = Et(), r = t.palette.primary.plainColor, i = t.palette.danger.plainColor, s = t.textPrimary;
|
|
306
307
|
return Ie.useMemo(
|
|
307
308
|
() => ({
|
|
308
309
|
"--fu-ucrc-dsc-primary-14": `${r}14`,
|
|
@@ -315,14 +316,14 @@ const _t = (t, r) => {
|
|
|
315
316
|
[r, i, s]
|
|
316
317
|
);
|
|
317
318
|
}, ve = (t, r, i) => o({ margin: 0, fontFamily: e.fontBody, fontSize: t, fontWeight: r, lineHeight: i }), z = {
|
|
318
|
-
h3: o(ve("1.5em", 600, 1.33334), { letterSpacing: "-0.025em", color: e.
|
|
319
|
-
titleLg: o(ve("1.25em", 600, 1.33334), { color: e.
|
|
320
|
-
titleMd: o(ve("1em", 500, 1.5), { color: e.
|
|
319
|
+
h3: o(ve("1.5em", 600, 1.33334), { letterSpacing: "-0.025em", color: e.paletteTextPrimary }),
|
|
320
|
+
titleLg: o(ve("1.25em", 600, 1.33334), { color: e.paletteTextPrimary }),
|
|
321
|
+
titleMd: o(ve("1em", 500, 1.5), { color: e.paletteTextPrimary }),
|
|
321
322
|
titleSm: ve("0.875em", 500, 1.42858),
|
|
322
323
|
bodyMd: ve("1em", 400, 1.5),
|
|
323
324
|
bodySm: ve("0.875em", 400, 1.5),
|
|
324
325
|
bodyXs: ve("0.75em", 500, 1.5)
|
|
325
|
-
},
|
|
326
|
+
}, _e = o({
|
|
326
327
|
boxSizing: "border-box",
|
|
327
328
|
position: "relative",
|
|
328
329
|
display: "inline-flex",
|
|
@@ -341,32 +342,32 @@ const _t = (t, r) => {
|
|
|
341
342
|
userSelect: "none",
|
|
342
343
|
"&:focus-visible": { outline: `2px solid ${e.focus}`, outlineOffset: "2px" },
|
|
343
344
|
"&:disabled": { pointerEvents: "none", cursor: "default" }
|
|
344
|
-
}),
|
|
345
|
+
}), to = o(_e, {
|
|
345
346
|
fontFamily: e.fontPrimary,
|
|
346
347
|
color: e.onPrimary,
|
|
347
348
|
backgroundColor: e.primary,
|
|
348
349
|
"&:active": { backgroundColor: "var(--fu-ucrc-primary-solid-active-bg)" },
|
|
349
350
|
"&:hover": { backgroundColor: e.primary, opacity: 0.9 },
|
|
350
351
|
"&:disabled": { opacity: 0.4 }
|
|
351
|
-
}),
|
|
352
|
+
}), Ye = o(_e, {
|
|
352
353
|
fontFamily: e.fontPrimary,
|
|
353
354
|
color: e.text,
|
|
354
355
|
"&:active": { backgroundColor: "var(--fu-ucrc-primary-plain-active-bg)" },
|
|
355
356
|
"&:hover": { backgroundColor: e.text14 },
|
|
356
357
|
"&:disabled": { color: "var(--fu-ucrc-neutral-plain-disabled-color)" }
|
|
357
|
-
}),
|
|
358
|
+
}), Ge = o(_e, {
|
|
358
359
|
border: `1px solid ${e.primary}`,
|
|
359
360
|
color: e.primary,
|
|
360
361
|
"&:active": { backgroundColor: "var(--fu-ucrc-primary-outlined-active-bg)" },
|
|
361
362
|
"&:hover": { backgroundColor: e.primary14, borderColor: e.primary },
|
|
362
363
|
"&:disabled": { opacity: 0.4 }
|
|
363
364
|
}), Pe = {
|
|
364
|
-
solid:
|
|
365
|
-
plain:
|
|
366
|
-
outlined:
|
|
367
|
-
signIn: o(
|
|
365
|
+
solid: to,
|
|
366
|
+
plain: Ye,
|
|
367
|
+
outlined: Ge,
|
|
368
|
+
signIn: o(Ge, { width: "100%", paddingBlock: e.spaceSm, fontFamily: e.fontPrimary }),
|
|
368
369
|
// Joy's small plain button, as the post's Reply action.
|
|
369
|
-
reply: o(
|
|
370
|
+
reply: o(Ye, {
|
|
370
371
|
minHeight: "auto",
|
|
371
372
|
marginInlineStart: e.spaceXs,
|
|
372
373
|
paddingBlock: e.space2xs,
|
|
@@ -376,11 +377,11 @@ const _t = (t, r) => {
|
|
|
376
377
|
}),
|
|
377
378
|
decorator: o({ display: "inherit", marginInlineEnd: "calc(0.375em / 0.8125)" }),
|
|
378
379
|
loading: o({ display: "flex", position: "absolute", left: "50%", transform: "translateX(-50%)" })
|
|
379
|
-
}, ue = ({ look: t, loading: r, startDecorator: i, disabled: s, children:
|
|
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: [
|
|
380
381
|
i && /* @__PURE__ */ n("span", { css: Pe.decorator, children: i }),
|
|
381
|
-
|
|
382
|
-
r && /* @__PURE__ */ n("span", { css: Pe.loading, children: /* @__PURE__ */ n(
|
|
383
|
-
] }),
|
|
382
|
+
u,
|
|
383
|
+
r && /* @__PURE__ */ n("span", { css: Pe.loading, children: /* @__PURE__ */ n(bt, { size: 20, color: "var(--fu-ucrc-primary-solid-bg)" }) })
|
|
384
|
+
] }), Te = {
|
|
384
385
|
// Joy's outlined Textarea with the widget's overrides.
|
|
385
386
|
root: o({
|
|
386
387
|
boxSizing: "border-box",
|
|
@@ -423,122 +424,92 @@ const _t = (t, r) => {
|
|
|
423
424
|
font: "inherit",
|
|
424
425
|
"&::placeholder": { color: "inherit", opacity: 0.64 }
|
|
425
426
|
})
|
|
426
|
-
},
|
|
427
|
-
visibility: "hidden",
|
|
428
|
-
position: "absolute",
|
|
429
|
-
overflow: "hidden",
|
|
430
|
-
height: 0,
|
|
431
|
-
top: 0,
|
|
432
|
-
left: 0,
|
|
433
|
-
transform: "translateZ(0)",
|
|
434
|
-
paddingTop: 0,
|
|
435
|
-
paddingBottom: 0
|
|
436
|
-
}, De = (t) => parseInt(t, 10) || 0, gt = ({
|
|
427
|
+
}, ft = ({
|
|
437
428
|
value: t,
|
|
438
429
|
onChange: r,
|
|
439
430
|
placeholder: i,
|
|
440
431
|
minRows: s,
|
|
441
|
-
maxRows:
|
|
432
|
+
maxRows: u,
|
|
442
433
|
disabled: a,
|
|
443
|
-
marginBottom:
|
|
434
|
+
marginBottom: f
|
|
444
435
|
}) => {
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
if (!u || !y) return;
|
|
448
|
-
const b = getComputedStyle(u);
|
|
449
|
-
if (b.width === "0px") return;
|
|
450
|
-
y.style.width = b.width, y.value = u.value || i || "x", y.value.slice(-1) === `
|
|
451
|
-
` && (y.value += " ");
|
|
452
|
-
const g = y.scrollHeight;
|
|
453
|
-
y.value = "x";
|
|
454
|
-
const k = y.scrollHeight, I = Math.max(Math.min(Math.max(s * k, g), p * k), k), v = I + (b.boxSizing === "border-box" ? De(b.paddingTop) + De(b.paddingBottom) + De(b.borderTopWidth) + De(b.borderBottomWidth) : 0);
|
|
455
|
-
v !== 0 && (c.current !== v && (c.current = v, u.style.height = `${v}px`), u.style.overflow = Math.abs(I - g) <= 1 ? "hidden" : "");
|
|
456
|
-
}, [s, p, i]);
|
|
457
|
-
return Ne(() => {
|
|
458
|
-
h();
|
|
459
|
-
}), Ne(() => {
|
|
460
|
-
const u = d.current;
|
|
461
|
-
if (!u) return;
|
|
462
|
-
const y = new ResizeObserver(() => h());
|
|
463
|
-
return y.observe(u), window.addEventListener("resize", h), () => {
|
|
464
|
-
y.disconnect(), window.removeEventListener("resize", h);
|
|
465
|
-
};
|
|
466
|
-
}, [h]), /* @__PURE__ */ S("div", { css: Me.root, "data-disabled": a || void 0, style: { marginBottom: m }, children: [
|
|
436
|
+
const { inputRef: d, shadowRef: l } = xt(s, u, i);
|
|
437
|
+
return /* @__PURE__ */ y("div", { css: Te.root, "data-disabled": a || void 0, style: { marginBottom: f }, children: [
|
|
467
438
|
/* @__PURE__ */ n(
|
|
468
439
|
"textarea",
|
|
469
440
|
{
|
|
470
441
|
ref: d,
|
|
471
|
-
css:
|
|
442
|
+
css: Te.textarea,
|
|
472
443
|
rows: s,
|
|
473
444
|
value: t,
|
|
474
445
|
placeholder: i,
|
|
475
446
|
disabled: a,
|
|
476
|
-
onChange: (
|
|
447
|
+
onChange: (c) => r(c.target.value)
|
|
477
448
|
}
|
|
478
449
|
),
|
|
479
|
-
/* @__PURE__ */ n("textarea", { ref: l, css:
|
|
450
|
+
/* @__PURE__ */ n("textarea", { ref: l, css: Te.textarea, "aria-hidden": !0, readOnly: !0, tabIndex: -1, style: vt })
|
|
480
451
|
] });
|
|
481
|
-
},
|
|
452
|
+
}, De = {
|
|
482
453
|
form: o({ marginBottom: e.spaceLg }),
|
|
483
454
|
replyingTo: o(z.bodySm, { marginBottom: e.spaceXs, color: e.textSecondary }),
|
|
484
455
|
actions: o({ display: "flex", gap: e.spaceXs, justifyContent: "flex-end" })
|
|
485
|
-
},
|
|
456
|
+
}, mt = ({
|
|
486
457
|
onSubmit: t,
|
|
487
458
|
userIsLoggedIn: r,
|
|
488
459
|
onSignInClick: i,
|
|
489
460
|
placeholder: s,
|
|
490
|
-
isSubmitting:
|
|
461
|
+
isSubmitting: u,
|
|
491
462
|
replyTo: a,
|
|
492
|
-
onCancel:
|
|
463
|
+
onCancel: f,
|
|
493
464
|
disabled: d = !1
|
|
494
465
|
}) => {
|
|
495
|
-
const { t: l } =
|
|
496
|
-
if (
|
|
466
|
+
const { t: l } = be(), [c, b] = B(""), g = async (C) => {
|
|
467
|
+
if (C.preventDefault(), !(!c.trim() || d))
|
|
497
468
|
try {
|
|
498
|
-
await t(c),
|
|
499
|
-
} catch (
|
|
500
|
-
console.error("Failed to submit comment:",
|
|
469
|
+
await t(c), b("");
|
|
470
|
+
} catch (v) {
|
|
471
|
+
console.error("Failed to submit comment:", v);
|
|
501
472
|
}
|
|
502
473
|
};
|
|
503
|
-
return r ? /* @__PURE__ */
|
|
504
|
-
a && /* @__PURE__ */ n("p", { css:
|
|
505
|
-
name: a
|
|
474
|
+
return r ? /* @__PURE__ */ y("form", { onSubmit: g, css: De.form, children: [
|
|
475
|
+
a && /* @__PURE__ */ n("p", { css: De.replyingTo, children: l("discussion.replyingTo", "Replying to {{name}}", {
|
|
476
|
+
name: Dt(a)
|
|
506
477
|
}) }),
|
|
507
478
|
/* @__PURE__ */ n(
|
|
508
|
-
|
|
479
|
+
ft,
|
|
509
480
|
{
|
|
510
481
|
placeholder: s || l("discussion.writeComment", "Write a comment..."),
|
|
511
482
|
value: c,
|
|
512
|
-
onChange:
|
|
483
|
+
onChange: b,
|
|
513
484
|
minRows: 3,
|
|
514
485
|
maxRows: 8,
|
|
515
|
-
disabled:
|
|
486
|
+
disabled: u || d,
|
|
516
487
|
marginBottom: e.spaceSm
|
|
517
488
|
}
|
|
518
489
|
),
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
|
|
490
|
+
/* @__PURE__ */ y("div", { css: De.actions, children: [
|
|
491
|
+
f && /* @__PURE__ */ n(ue, { look: "plain", onClick: f, disabled: u, children: l("common.cancel", "Cancel") }),
|
|
521
492
|
/* @__PURE__ */ n(
|
|
522
493
|
ue,
|
|
523
494
|
{
|
|
524
495
|
look: "solid",
|
|
525
496
|
type: "submit",
|
|
526
|
-
disabled: !c.trim() ||
|
|
527
|
-
loading:
|
|
497
|
+
disabled: !c.trim() || u || d,
|
|
498
|
+
loading: u,
|
|
528
499
|
children: a ? l("discussion.reply", "Reply") : l("discussion.post", "Post")
|
|
529
500
|
}
|
|
530
501
|
)
|
|
531
502
|
] })
|
|
532
|
-
] }) : /* @__PURE__ */ n("div", { css:
|
|
533
|
-
}, ge = { size: "1em", color: e.icon },
|
|
534
|
-
LIKE: /* @__PURE__ */ n(
|
|
535
|
-
DISLIKE: /* @__PURE__ */ n(
|
|
536
|
-
LOVE: /* @__PURE__ */ n(
|
|
537
|
-
LAUGH: /* @__PURE__ */ n(
|
|
538
|
-
CARE: /* @__PURE__ */ n(
|
|
539
|
-
WOW: /* @__PURE__ */ n(
|
|
540
|
-
SAD: /* @__PURE__ */ n(
|
|
541
|
-
ANGRY: /* @__PURE__ */ n(
|
|
503
|
+
] }) : /* @__PURE__ */ n("div", { css: De.form, children: /* @__PURE__ */ n(ue, { look: "signIn", onClick: i, children: l("discussion.signInToPost", "Sign in to post") }) });
|
|
504
|
+
}, ge = { size: "1em", color: e.icon }, oo = {
|
|
505
|
+
LIKE: /* @__PURE__ */ n(Pt, { ...ge }),
|
|
506
|
+
DISLIKE: /* @__PURE__ */ n(Tt, { ...ge }),
|
|
507
|
+
LOVE: /* @__PURE__ */ n(At, { ...ge }),
|
|
508
|
+
LAUGH: /* @__PURE__ */ n(Mt, { ...ge }),
|
|
509
|
+
CARE: /* @__PURE__ */ n(Lt, { ...ge }),
|
|
510
|
+
WOW: /* @__PURE__ */ n(zt, { ...ge }),
|
|
511
|
+
SAD: /* @__PURE__ */ n($t, { ...ge }),
|
|
512
|
+
ANGRY: /* @__PURE__ */ n(Ft, { ...ge })
|
|
542
513
|
}, Ae = o({
|
|
543
514
|
display: "inline-flex",
|
|
544
515
|
alignItems: "center",
|
|
@@ -548,49 +519,49 @@ const _t = (t, r) => {
|
|
|
548
519
|
borderRadius: "18px",
|
|
549
520
|
backgroundColor: "transparent",
|
|
550
521
|
color: e.textSecondary
|
|
551
|
-
}),
|
|
522
|
+
}), Me = o(z.bodySm, { fontWeight: 500, color: e.text }), Se = {
|
|
552
523
|
idle: Ae,
|
|
553
524
|
primary: o(Ae, { backgroundColor: "var(--fu-ucrc-neutral-soft-bg)", color: e.primary }),
|
|
554
525
|
danger: o(Ae, { backgroundColor: "var(--fu-ucrc-neutral-soft-bg)", color: e.danger })
|
|
555
|
-
},
|
|
526
|
+
}, Le = {
|
|
556
527
|
cursor: "pointer",
|
|
557
528
|
"&:hover": { backgroundColor: "var(--fu-ucrc-neutral-soft-hover-bg)" }
|
|
558
|
-
},
|
|
529
|
+
}, ze = { opacity: 0.5 }, $e = {
|
|
559
530
|
pill: {
|
|
560
531
|
enabled: {
|
|
561
|
-
idle: o(
|
|
562
|
-
primary: o(
|
|
563
|
-
danger: o(
|
|
532
|
+
idle: o(Se.idle, Le),
|
|
533
|
+
primary: o(Se.primary, Le),
|
|
534
|
+
danger: o(Se.danger, Le)
|
|
564
535
|
},
|
|
565
536
|
disabled: {
|
|
566
|
-
idle: o(
|
|
567
|
-
primary: o(
|
|
568
|
-
danger: o(
|
|
537
|
+
idle: o(Se.idle, ze),
|
|
538
|
+
primary: o(Se.primary, ze),
|
|
539
|
+
danger: o(Se.danger, ze)
|
|
569
540
|
}
|
|
570
541
|
},
|
|
571
542
|
icon: o({ display: "flex", alignItems: "center", fontSize: "1.25em", color: "inherit" }),
|
|
572
|
-
count: { idle:
|
|
573
|
-
},
|
|
543
|
+
count: { idle: Me, primary: o(Me, { color: e.primary }), danger: o(Me, { color: e.danger }) }
|
|
544
|
+
}, Je = ({
|
|
574
545
|
reaction: t,
|
|
575
546
|
count: r,
|
|
576
547
|
isActive: i,
|
|
577
548
|
onClick: s,
|
|
578
|
-
disabled:
|
|
549
|
+
disabled: u
|
|
579
550
|
}) => {
|
|
580
|
-
const a = (d) => d >= 1e6 ? (d / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : d >= 1e3 ? (d / 1e3).toFixed(1).replace(/\.0$/, "") + "K" : d.toString(),
|
|
581
|
-
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(
|
|
582
553
|
"div",
|
|
583
554
|
{
|
|
584
|
-
css:
|
|
585
|
-
onClick:
|
|
555
|
+
css: $e.pill[u ? "disabled" : "enabled"][f],
|
|
556
|
+
onClick: u ? void 0 : s,
|
|
586
557
|
children: [
|
|
587
|
-
/* @__PURE__ */ n("div", { css:
|
|
588
|
-
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) })
|
|
589
560
|
]
|
|
590
561
|
}
|
|
591
562
|
);
|
|
592
|
-
},
|
|
593
|
-
const [i, s] =
|
|
563
|
+
}, gt = (t, r) => {
|
|
564
|
+
const [i, s] = B(null);
|
|
594
565
|
return he(() => {
|
|
595
566
|
(async () => {
|
|
596
567
|
if (r)
|
|
@@ -602,7 +573,7 @@ const _t = (t, r) => {
|
|
|
602
573
|
}
|
|
603
574
|
})();
|
|
604
575
|
}, [r, t]), i;
|
|
605
|
-
},
|
|
576
|
+
}, qe = {
|
|
606
577
|
row: o({
|
|
607
578
|
display: "flex",
|
|
608
579
|
gap: e.spaceXs,
|
|
@@ -612,93 +583,95 @@ const _t = (t, r) => {
|
|
|
612
583
|
}),
|
|
613
584
|
// Joy set --Icon-color to the text colour on this button; disabled, it follows the label.
|
|
614
585
|
replyIcon: o({ color: e.text, "button:disabled &": { color: "currentColor" } })
|
|
615
|
-
},
|
|
586
|
+
}, no = ({
|
|
616
587
|
post: t,
|
|
617
588
|
sdk: r,
|
|
618
589
|
userIsLoggedIn: i,
|
|
619
590
|
onSignInClick: s,
|
|
620
|
-
onReact:
|
|
591
|
+
onReact: u,
|
|
621
592
|
showReactions: a = !0,
|
|
622
|
-
showReplyButton:
|
|
593
|
+
showReplyButton: f = !0,
|
|
623
594
|
onReplyClick: d,
|
|
624
595
|
isBanned: l = !1
|
|
625
596
|
}) => {
|
|
626
|
-
var
|
|
627
|
-
const { t: c } =
|
|
628
|
-
if (!
|
|
597
|
+
var m, E, I, x;
|
|
598
|
+
const { t: c } = be(), b = gt(r, i), C = (() => {
|
|
599
|
+
if (!b || !t.reactions)
|
|
629
600
|
return null;
|
|
630
|
-
for (const
|
|
631
|
-
if (
|
|
632
|
-
return
|
|
601
|
+
for (const p of t.reactions)
|
|
602
|
+
if (p.userIds.includes(b))
|
|
603
|
+
return p.type;
|
|
633
604
|
return null;
|
|
634
|
-
})(),
|
|
605
|
+
})(), v = (p) => {
|
|
635
606
|
if (!i) {
|
|
636
607
|
s == null || s();
|
|
637
608
|
return;
|
|
638
609
|
}
|
|
639
|
-
|
|
610
|
+
u(t.id, p).catch(() => {
|
|
640
611
|
});
|
|
641
612
|
};
|
|
642
|
-
return /* @__PURE__ */
|
|
643
|
-
a && /* @__PURE__ */
|
|
613
|
+
return /* @__PURE__ */ y("div", { css: qe.row, children: [
|
|
614
|
+
a && /* @__PURE__ */ y(Re, { children: [
|
|
644
615
|
/* @__PURE__ */ n(
|
|
645
|
-
|
|
616
|
+
Je,
|
|
646
617
|
{
|
|
647
618
|
reaction: "LIKE",
|
|
648
|
-
count: ((
|
|
649
|
-
isActive:
|
|
650
|
-
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"),
|
|
651
622
|
disabled: !i || l
|
|
652
623
|
}
|
|
653
624
|
),
|
|
654
625
|
/* @__PURE__ */ n(
|
|
655
|
-
|
|
626
|
+
Je,
|
|
656
627
|
{
|
|
657
628
|
reaction: "DISLIKE",
|
|
658
|
-
count: ((
|
|
659
|
-
isActive:
|
|
660
|
-
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"),
|
|
661
632
|
disabled: !i || l
|
|
662
633
|
}
|
|
663
634
|
)
|
|
664
635
|
] }),
|
|
665
|
-
|
|
636
|
+
f && /* @__PURE__ */ n(
|
|
666
637
|
ue,
|
|
667
638
|
{
|
|
668
639
|
look: "reply",
|
|
669
640
|
onClick: d,
|
|
670
641
|
disabled: l,
|
|
671
|
-
startDecorator: /* @__PURE__ */ n(
|
|
642
|
+
startDecorator: /* @__PURE__ */ n(Xt, { size: "1em", css: qe.replyIcon, style: { marginLeft: "calc(0.375em / -1.625)" } }),
|
|
672
643
|
children: c("discussion.reply", "Reply")
|
|
673
644
|
}
|
|
674
645
|
)
|
|
675
646
|
] });
|
|
676
|
-
},
|
|
677
|
-
const
|
|
678
|
-
return
|
|
647
|
+
}, Fe = 4, Qe = { visibility: "hidden" }, ht = (t, r, i, s) => {
|
|
648
|
+
const u = Bt(), [a, f] = B(Qe);
|
|
649
|
+
return kt(() => {
|
|
679
650
|
if (!t) {
|
|
680
|
-
|
|
651
|
+
f(Qe);
|
|
681
652
|
return;
|
|
682
653
|
}
|
|
683
654
|
const d = () => {
|
|
684
|
-
var
|
|
685
|
-
const l = (
|
|
655
|
+
var R;
|
|
656
|
+
const l = (R = r.current) == null ? void 0 : R.getBoundingClientRect(), c = i.current;
|
|
686
657
|
if (!l || !c) return;
|
|
687
|
-
s === "start" && (c.style.width = `${l.width}px`);
|
|
688
|
-
const { width:
|
|
689
|
-
let
|
|
690
|
-
|
|
691
|
-
let
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
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,
|
|
695
668
|
width: s === "start" ? l.width : void 0
|
|
696
669
|
});
|
|
697
670
|
};
|
|
698
671
|
return d(), window.addEventListener("resize", d), window.addEventListener("scroll", d, { capture: !0, passive: !0 }), () => {
|
|
699
672
|
window.removeEventListener("resize", d), window.removeEventListener("scroll", d, { capture: !0 });
|
|
700
673
|
};
|
|
701
|
-
}, [t, s,
|
|
674
|
+
}, [t, s, u, r, i]), a;
|
|
702
675
|
}, Xe = {
|
|
703
676
|
// Joy's small plain IconButton; its radius variable never resolved, so it's square.
|
|
704
677
|
trigger: o({
|
|
@@ -766,93 +739,93 @@ const _t = (t, r) => {
|
|
|
766
739
|
"&:hover, &:focus-visible": { backgroundColor: e.surfaceVariant },
|
|
767
740
|
"&[aria-disabled='true']": { pointerEvents: "none", cursor: "default" }
|
|
768
741
|
})
|
|
769
|
-
},
|
|
742
|
+
}, Ze = { marginInlineEnd: e.spaceXs }, ro = ({
|
|
770
743
|
isOwnPost: t,
|
|
771
744
|
canReport: r,
|
|
772
745
|
onDelete: i,
|
|
773
746
|
onReport: s,
|
|
774
|
-
disabled:
|
|
747
|
+
disabled: u = !1
|
|
775
748
|
}) => {
|
|
776
|
-
const { t: a } =
|
|
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");
|
|
777
750
|
if (Ie.useEffect(() => {
|
|
778
751
|
if (!l) return;
|
|
779
|
-
const
|
|
780
|
-
const
|
|
781
|
-
|
|
782
|
-
},
|
|
783
|
-
document.addEventListener("click",
|
|
752
|
+
const p = (M) => {
|
|
753
|
+
const D = M.composedPath();
|
|
754
|
+
b.current && D.includes(b.current) || g.current && D.includes(g.current) || c(!1);
|
|
755
|
+
}, R = setTimeout(() => {
|
|
756
|
+
document.addEventListener("click", p, !0);
|
|
784
757
|
}, 0);
|
|
785
758
|
return () => {
|
|
786
|
-
clearTimeout(
|
|
759
|
+
clearTimeout(R), document.removeEventListener("click", p, !0);
|
|
787
760
|
};
|
|
788
761
|
}, [l]), !t && !r) return null;
|
|
789
|
-
const
|
|
790
|
-
var
|
|
791
|
-
return [...((
|
|
792
|
-
},
|
|
793
|
-
var
|
|
794
|
-
c(!1), (
|
|
795
|
-
},
|
|
796
|
-
var
|
|
797
|
-
c(!1), (
|
|
798
|
-
}, I = (
|
|
799
|
-
const
|
|
800
|
-
var
|
|
801
|
-
return (
|
|
762
|
+
const v = () => {
|
|
763
|
+
var p;
|
|
764
|
+
return [...((p = g.current) == null ? void 0 : p.querySelectorAll('[role="menuitem"]')) ?? []];
|
|
765
|
+
}, m = () => {
|
|
766
|
+
var p;
|
|
767
|
+
c(!1), (p = b.current) == null || p.focus();
|
|
768
|
+
}, E = (p) => {
|
|
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) => {
|
|
773
|
+
var K;
|
|
774
|
+
return (K = R[(J + R.length) % R.length]) == null ? void 0 : K.focus();
|
|
802
775
|
}, $ = {
|
|
803
|
-
ArrowDown: () =>
|
|
804
|
-
ArrowUp: () =>
|
|
805
|
-
Home: () =>
|
|
806
|
-
End: () =>
|
|
807
|
-
Escape:
|
|
776
|
+
ArrowDown: () => D(M + 1),
|
|
777
|
+
ArrowUp: () => D(M - 1),
|
|
778
|
+
Home: () => D(0),
|
|
779
|
+
End: () => D(R.length - 1),
|
|
780
|
+
Escape: m
|
|
808
781
|
};
|
|
809
|
-
$[
|
|
810
|
-
},
|
|
782
|
+
$[p.key] ? (p.preventDefault(), $[p.key]()) : p.key === "Tab" && c(!1);
|
|
783
|
+
}, x = (p, R, M, D) => /* @__PURE__ */ y(
|
|
811
784
|
"li",
|
|
812
785
|
{
|
|
813
786
|
role: "menuitem",
|
|
814
787
|
tabIndex: -1,
|
|
815
|
-
"aria-disabled":
|
|
788
|
+
"aria-disabled": u,
|
|
816
789
|
css: Xe.item,
|
|
817
|
-
onClick: () =>
|
|
790
|
+
onClick: () => E(D),
|
|
818
791
|
onKeyDown: ($) => {
|
|
819
|
-
$.key !== "Enter" && $.key !== " " || ($.preventDefault(),
|
|
792
|
+
$.key !== "Enter" && $.key !== " " || ($.preventDefault(), u || E(D));
|
|
820
793
|
},
|
|
821
794
|
children: [
|
|
822
|
-
|
|
823
|
-
|
|
795
|
+
R,
|
|
796
|
+
M
|
|
824
797
|
]
|
|
825
798
|
},
|
|
826
|
-
|
|
799
|
+
p
|
|
827
800
|
);
|
|
828
|
-
return /* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ y(Re, { children: [
|
|
829
802
|
/* @__PURE__ */ n(
|
|
830
803
|
"button",
|
|
831
804
|
{
|
|
832
|
-
ref:
|
|
805
|
+
ref: b,
|
|
833
806
|
type: "button",
|
|
834
807
|
"aria-haspopup": "menu",
|
|
835
808
|
"aria-expanded": l,
|
|
836
809
|
"aria-controls": l ? d : void 0,
|
|
837
810
|
css: Xe.trigger,
|
|
838
|
-
onClick: (
|
|
839
|
-
c(!l), !l &&
|
|
840
|
-
var
|
|
841
|
-
return (
|
|
811
|
+
onClick: (p) => {
|
|
812
|
+
c(!l), !l && p.detail === 0 && requestAnimationFrame(() => {
|
|
813
|
+
var R;
|
|
814
|
+
return (R = v()[0]) == null ? void 0 : R.focus();
|
|
842
815
|
});
|
|
843
816
|
},
|
|
844
|
-
children: /* @__PURE__ */ n(
|
|
817
|
+
children: /* @__PURE__ */ n(Ht, { size: "1.25em" })
|
|
845
818
|
}
|
|
846
819
|
),
|
|
847
|
-
l &&
|
|
848
|
-
/* @__PURE__ */
|
|
849
|
-
t &&
|
|
850
|
-
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)
|
|
851
824
|
] }),
|
|
852
|
-
|
|
825
|
+
f
|
|
853
826
|
)
|
|
854
827
|
] });
|
|
855
|
-
},
|
|
828
|
+
}, et = "rgba(var(--fu-ucrc-shadow-channel) / var(--fu-ucrc-shadow-opacity))", tt = o({
|
|
856
829
|
position: "absolute",
|
|
857
830
|
top: "50%",
|
|
858
831
|
left: "50%",
|
|
@@ -867,35 +840,35 @@ const _t = (t, r) => {
|
|
|
867
840
|
border: "1px solid var(--fu-ucrc-neutral-outlined-border)",
|
|
868
841
|
borderRadius: e.radiusMd,
|
|
869
842
|
outline: 0,
|
|
870
|
-
boxShadow: `var(--fu-ucrc-shadow-ring), 0px 2px 8px -2px ${
|
|
843
|
+
boxShadow: `var(--fu-ucrc-shadow-ring), 0px 2px 8px -2px ${et}, 0px 6px 12px -2px ${et}`,
|
|
871
844
|
backgroundColor: e.surface,
|
|
872
845
|
color: e.text,
|
|
873
846
|
fontFamily: e.fontBody,
|
|
874
847
|
fontSize: "1em",
|
|
875
848
|
fontWeight: 400,
|
|
876
849
|
lineHeight: 1.5
|
|
877
|
-
}),
|
|
878
|
-
delete: o(
|
|
879
|
-
report: o(
|
|
850
|
+
}), ye = {
|
|
851
|
+
delete: o(tt, { maxWidth: "400px" }),
|
|
852
|
+
report: o(tt, { maxWidth: "440px" }),
|
|
880
853
|
title: o(z.titleLg, { fontFamily: e.fontPrimary }),
|
|
881
854
|
description: o(z.bodySm, { color: e.textSecondary }),
|
|
882
855
|
actions: o({ display: "flex", gap: e.spaceXs, justifyContent: "flex-end" })
|
|
883
|
-
},
|
|
884
|
-
title: o(
|
|
885
|
-
description: o(
|
|
886
|
-
},
|
|
856
|
+
}, ot = {
|
|
857
|
+
title: o(ye.title, { marginBottom: e.spaceXs }),
|
|
858
|
+
description: o(ye.description, { marginBottom: e.spaceLg })
|
|
859
|
+
}, io = ({
|
|
887
860
|
open: t,
|
|
888
861
|
onClose: r,
|
|
889
862
|
onConfirm: i,
|
|
890
863
|
onError: s
|
|
891
864
|
}) => {
|
|
892
|
-
const { t:
|
|
865
|
+
const { t: u } = be(), a = Ve(), f = Ie.useId(), [d, l] = B(!1), c = async () => {
|
|
893
866
|
l(!0);
|
|
894
867
|
try {
|
|
895
868
|
await i(), r();
|
|
896
869
|
} catch {
|
|
897
870
|
s(
|
|
898
|
-
|
|
871
|
+
u(
|
|
899
872
|
"discussion.delete.error",
|
|
900
873
|
"Failed to delete comment. Please try again."
|
|
901
874
|
)
|
|
@@ -904,18 +877,18 @@ const _t = (t, r) => {
|
|
|
904
877
|
l(!1);
|
|
905
878
|
}
|
|
906
879
|
};
|
|
907
|
-
return /* @__PURE__ */ n(
|
|
908
|
-
/* @__PURE__ */ n("p", { id:
|
|
909
|
-
/* @__PURE__ */ n("p", { css:
|
|
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") }),
|
|
882
|
+
/* @__PURE__ */ n("p", { css: ot.description, children: u(
|
|
910
883
|
"discussion.delete.description",
|
|
911
884
|
"Are you sure you want to delete this comment? This action cannot be undone."
|
|
912
885
|
) }),
|
|
913
|
-
/* @__PURE__ */
|
|
914
|
-
/* @__PURE__ */ n(ue, { look: "plain", onClick: r, children:
|
|
915
|
-
/* @__PURE__ */ n(ue, { look: "solid", loading: d, onClick: c, children:
|
|
886
|
+
/* @__PURE__ */ y("div", { css: ye.actions, children: [
|
|
887
|
+
/* @__PURE__ */ n(ue, { look: "plain", onClick: r, children: u("common.cancel", "Cancel") }),
|
|
888
|
+
/* @__PURE__ */ n(ue, { look: "solid", loading: d, onClick: c, children: u("discussion.delete.action", "Delete") })
|
|
916
889
|
] })
|
|
917
890
|
] }) });
|
|
918
|
-
},
|
|
891
|
+
}, nt = o({
|
|
919
892
|
boxSizing: "border-box",
|
|
920
893
|
display: "inline-flex",
|
|
921
894
|
justifyContent: "center",
|
|
@@ -930,7 +903,7 @@ const _t = (t, r) => {
|
|
|
930
903
|
color: "var(--fu-ucrc-neutral-outlined-color)",
|
|
931
904
|
"&:active": { backgroundColor: "var(--fu-ucrc-neutral-outlined-active-bg)" },
|
|
932
905
|
"&:hover": { backgroundColor: e.surface, borderColor: e.border }
|
|
933
|
-
}),
|
|
906
|
+
}), rt = o({
|
|
934
907
|
width: "0.625em",
|
|
935
908
|
height: "0.625em",
|
|
936
909
|
borderRadius: "inherit",
|
|
@@ -938,8 +911,8 @@ const _t = (t, r) => {
|
|
|
938
911
|
backgroundColor: "currentColor",
|
|
939
912
|
transform: "scale(0)"
|
|
940
913
|
}), le = {
|
|
941
|
-
title: o(
|
|
942
|
-
description: o(
|
|
914
|
+
title: o(ye.title, { marginBottom: e.spaceMd }),
|
|
915
|
+
description: o(ye.description, { marginBottom: e.spaceMd }),
|
|
943
916
|
// Joy's ModalClose: an 8px inset, 2rem square.
|
|
944
917
|
close: o({
|
|
945
918
|
position: "absolute",
|
|
@@ -988,14 +961,14 @@ const _t = (t, r) => {
|
|
|
988
961
|
"& + &": { marginBlockStart: "0.875em" }
|
|
989
962
|
}),
|
|
990
963
|
circle: {
|
|
991
|
-
unchecked:
|
|
992
|
-
checked: o(
|
|
964
|
+
unchecked: nt,
|
|
965
|
+
checked: o(nt, {
|
|
993
966
|
color: "var(--fu-ucrc-primary-outlined-color)",
|
|
994
967
|
"&:active": { backgroundColor: "var(--fu-ucrc-primary-outlined-active-bg)" },
|
|
995
968
|
"&:hover": { backgroundColor: e.surface, borderColor: e.border }
|
|
996
969
|
})
|
|
997
970
|
},
|
|
998
|
-
dot: { unchecked:
|
|
971
|
+
dot: { unchecked: rt, checked: o(rt, { transform: "none" }) },
|
|
999
972
|
action: o({
|
|
1000
973
|
position: "absolute",
|
|
1001
974
|
inset: "-1px",
|
|
@@ -1012,7 +985,7 @@ const _t = (t, r) => {
|
|
|
1012
985
|
cursor: "pointer"
|
|
1013
986
|
}),
|
|
1014
987
|
label: o({ flex: 1, minWidth: 0 })
|
|
1015
|
-
},
|
|
988
|
+
}, so = [
|
|
1016
989
|
{ value: "SPAM", labelKey: "discussion.report.spam", fallback: "Spam" },
|
|
1017
990
|
{
|
|
1018
991
|
value: "NOT_ON_THE_SUBJECT",
|
|
@@ -1037,50 +1010,50 @@ const _t = (t, r) => {
|
|
|
1037
1010
|
},
|
|
1038
1011
|
{ value: "INSULT", labelKey: "discussion.report.insult", fallback: "Insult" },
|
|
1039
1012
|
{ value: "OTHER", labelKey: "discussion.report.other", fallback: "Other" }
|
|
1040
|
-
],
|
|
1013
|
+
], ao = ({
|
|
1041
1014
|
open: t,
|
|
1042
1015
|
onClose: r,
|
|
1043
1016
|
onSubmit: i,
|
|
1044
1017
|
onSuccess: s,
|
|
1045
|
-
onError:
|
|
1018
|
+
onError: u
|
|
1046
1019
|
}) => {
|
|
1047
|
-
const { t: a } =
|
|
1048
|
-
r(), c(""),
|
|
1049
|
-
},
|
|
1050
|
-
|
|
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("");
|
|
1022
|
+
}, E = async () => {
|
|
1023
|
+
v(!0);
|
|
1051
1024
|
try {
|
|
1052
1025
|
await i(
|
|
1053
1026
|
l,
|
|
1054
|
-
l === "OTHER" ?
|
|
1027
|
+
l === "OTHER" ? b : void 0
|
|
1055
1028
|
), s(
|
|
1056
1029
|
a(
|
|
1057
1030
|
"discussion.report.success",
|
|
1058
1031
|
"Post reported successfully. Thank you."
|
|
1059
1032
|
)
|
|
1060
|
-
),
|
|
1033
|
+
), m();
|
|
1061
1034
|
} catch {
|
|
1062
|
-
|
|
1035
|
+
u(
|
|
1063
1036
|
a(
|
|
1064
1037
|
"discussion.report.error",
|
|
1065
1038
|
"Failed to report post. Please try again."
|
|
1066
1039
|
)
|
|
1067
1040
|
);
|
|
1068
1041
|
} finally {
|
|
1069
|
-
|
|
1042
|
+
v(!1);
|
|
1070
1043
|
}
|
|
1071
1044
|
};
|
|
1072
|
-
return /* @__PURE__ */ n(
|
|
1073
|
-
/* @__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)" }) }),
|
|
1074
1047
|
/* @__PURE__ */ n("p", { id: `${d}title`, css: le.title, children: a("discussion.report.title", "Report post") }),
|
|
1075
1048
|
/* @__PURE__ */ n("p", { css: le.description, children: a(
|
|
1076
1049
|
"discussion.report.description",
|
|
1077
1050
|
"Why are you reporting this post?"
|
|
1078
1051
|
) }),
|
|
1079
|
-
/* @__PURE__ */ n("div", { role: "radiogroup", css: le.group, children:
|
|
1080
|
-
const
|
|
1081
|
-
return /* @__PURE__ */
|
|
1082
|
-
/* @__PURE__ */
|
|
1083
|
-
/* @__PURE__ */ n("span", { css: le.dot[
|
|
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: [
|
|
1056
|
+
/* @__PURE__ */ n("span", { css: le.dot[p] }),
|
|
1084
1057
|
/* @__PURE__ */ n("span", { css: le.action, children: /* @__PURE__ */ n(
|
|
1085
1058
|
"input",
|
|
1086
1059
|
{
|
|
@@ -1088,8 +1061,8 @@ const _t = (t, r) => {
|
|
|
1088
1061
|
type: "radio",
|
|
1089
1062
|
name: `${d}reason`,
|
|
1090
1063
|
value: I.value,
|
|
1091
|
-
checked:
|
|
1092
|
-
onChange: (
|
|
1064
|
+
checked: x,
|
|
1065
|
+
onChange: (R) => c(R.target.value),
|
|
1093
1066
|
css: le.input
|
|
1094
1067
|
}
|
|
1095
1068
|
) })
|
|
@@ -1098,47 +1071,47 @@ const _t = (t, r) => {
|
|
|
1098
1071
|
] }, I.value);
|
|
1099
1072
|
}) }),
|
|
1100
1073
|
l === "OTHER" && /* @__PURE__ */ n(
|
|
1101
|
-
|
|
1074
|
+
ft,
|
|
1102
1075
|
{
|
|
1103
1076
|
placeholder: a(
|
|
1104
1077
|
"discussion.report.detailsPlaceholder",
|
|
1105
1078
|
"Please provide more details..."
|
|
1106
1079
|
),
|
|
1107
|
-
value:
|
|
1108
|
-
onChange:
|
|
1080
|
+
value: b,
|
|
1081
|
+
onChange: g,
|
|
1109
1082
|
minRows: 2,
|
|
1110
1083
|
maxRows: 4,
|
|
1111
1084
|
marginBottom: e.spaceMd
|
|
1112
1085
|
}
|
|
1113
1086
|
),
|
|
1114
|
-
/* @__PURE__ */
|
|
1115
|
-
/* @__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") }),
|
|
1116
1089
|
/* @__PURE__ */ n(
|
|
1117
1090
|
ue,
|
|
1118
1091
|
{
|
|
1119
1092
|
look: "solid",
|
|
1120
1093
|
disabled: !l,
|
|
1121
|
-
loading:
|
|
1122
|
-
onClick:
|
|
1094
|
+
loading: C,
|
|
1095
|
+
onClick: E,
|
|
1123
1096
|
children: a("discussion.report.action", "Report")
|
|
1124
1097
|
}
|
|
1125
1098
|
)
|
|
1126
1099
|
] })
|
|
1127
1100
|
] }) });
|
|
1128
|
-
},
|
|
1129
|
-
const s = new Date(t), a = (/* @__PURE__ */ new Date()).getTime() - s.getTime(),
|
|
1130
|
-
return
|
|
1131
|
-
},
|
|
1101
|
+
}, co = (t, r, i) => {
|
|
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));
|
|
1104
|
+
}, Ne = o({ marginBottom: e.spaceMd }), We = o(Ne, {
|
|
1132
1105
|
paddingInline: e.spaceSm,
|
|
1133
1106
|
paddingBlock: e.spaceXs,
|
|
1134
1107
|
borderInlineStart: "3px solid transparent",
|
|
1135
1108
|
borderRadius: e.radiusXs,
|
|
1136
1109
|
backgroundColor: "transparent",
|
|
1137
1110
|
transition: "background-color 0.6s ease, border-color 0.6s ease"
|
|
1138
|
-
}),
|
|
1139
|
-
post: { top:
|
|
1140
|
-
highlightable: { top:
|
|
1141
|
-
highlighted: { top:
|
|
1111
|
+
}), it = o(We, { borderInlineStartColor: e.primary, backgroundColor: e.primary1a }), lo = { width: "64%", height: "64%" }, uo = { marginTop: "2px" }, O = {
|
|
1112
|
+
post: { top: Ne, reply: o(Ne, { marginLeft: e.spaceXl }) },
|
|
1113
|
+
highlightable: { top: We, reply: o(We, { marginLeft: e.spaceXl }) },
|
|
1114
|
+
highlighted: { top: it, reply: o(it, { marginLeft: e.spaceXl }) },
|
|
1142
1115
|
row: o({ display: "flex", gap: e.spaceSm }),
|
|
1143
1116
|
// Joy's small soft Avatar: 2rem square, in its own 0.875em font.
|
|
1144
1117
|
avatar: o({
|
|
@@ -1154,7 +1127,7 @@ const _t = (t, r) => {
|
|
|
1154
1127
|
}),
|
|
1155
1128
|
body: o({ flex: 1, minWidth: 0 }),
|
|
1156
1129
|
header: o({ display: "flex", alignItems: "center", gap: e.spaceXs, marginBottom: e.space2xs }),
|
|
1157
|
-
name: o(z.titleSm, { color: e.text }),
|
|
1130
|
+
name: o(z.titleSm, { color: e.text, unicodeBidi: "plaintext" }),
|
|
1158
1131
|
time: o(z.bodyXs, { color: e.textSecondary }),
|
|
1159
1132
|
badge: o(z.bodyXs, {
|
|
1160
1133
|
fontWeight: 600,
|
|
@@ -1175,8 +1148,9 @@ const _t = (t, r) => {
|
|
|
1175
1148
|
borderLeft: `3px solid ${e.border}`,
|
|
1176
1149
|
backgroundColor: e.surfaceVariant
|
|
1177
1150
|
}),
|
|
1178
|
-
moderatedText: o(z.bodySm, { fontStyle: "italic", color: e.textSecondary }),
|
|
1179
|
-
|
|
1151
|
+
moderatedText: o(z.bodySm, { fontStyle: "italic", color: e.textSecondary, unicodeBidi: "plaintext" }),
|
|
1152
|
+
// User text: each line takes its own direction.
|
|
1153
|
+
content: o(z.bodySm, { marginBottom: e.spaceXs, whiteSpace: "pre-wrap", color: e.textBody, unicodeBidi: "plaintext" }),
|
|
1180
1154
|
repliesRow: o({ marginBottom: e.spaceXs }),
|
|
1181
1155
|
repliesToggle: o(z.bodySm, {
|
|
1182
1156
|
display: "flex",
|
|
@@ -1188,202 +1162,202 @@ const _t = (t, r) => {
|
|
|
1188
1162
|
"&:hover": { textDecoration: "underline", textUnderlineOffset: "2px" }
|
|
1189
1163
|
}),
|
|
1190
1164
|
nested: o({ marginTop: e.spaceMd })
|
|
1191
|
-
},
|
|
1165
|
+
}, po = 8e3, yt = ({
|
|
1192
1166
|
post: t,
|
|
1193
1167
|
sdk: r,
|
|
1194
1168
|
userIsLoggedIn: i,
|
|
1195
1169
|
onSignInClick: s,
|
|
1196
|
-
showReactions:
|
|
1170
|
+
showReactions: u = !0,
|
|
1197
1171
|
showReplies: a = !0,
|
|
1198
|
-
showReportPost:
|
|
1172
|
+
showReportPost: f = !0,
|
|
1199
1173
|
onReply: d,
|
|
1200
1174
|
onReact: l,
|
|
1201
1175
|
onDelete: c,
|
|
1202
|
-
onReport:
|
|
1203
|
-
isSubmitting:
|
|
1204
|
-
showModeratedPosts:
|
|
1205
|
-
isBanned:
|
|
1206
|
-
highlightable:
|
|
1207
|
-
isNew:
|
|
1176
|
+
onReport: b,
|
|
1177
|
+
isSubmitting: g,
|
|
1178
|
+
showModeratedPosts: C = !1,
|
|
1179
|
+
isBanned: v = !1,
|
|
1180
|
+
highlightable: m = !1,
|
|
1181
|
+
isNew: E = !1,
|
|
1208
1182
|
onNewSeen: I,
|
|
1209
|
-
depth:
|
|
1210
|
-
parentPostId:
|
|
1211
|
-
onReplyCreated:
|
|
1212
|
-
onDeleteSuccess:
|
|
1183
|
+
depth: x = 0,
|
|
1184
|
+
parentPostId: p,
|
|
1185
|
+
onReplyCreated: R,
|
|
1186
|
+
onDeleteSuccess: M
|
|
1213
1187
|
}) => {
|
|
1214
|
-
var
|
|
1215
|
-
const { t:
|
|
1188
|
+
var A, N, H, ae;
|
|
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);
|
|
1216
1190
|
he(() => {
|
|
1217
|
-
if (!
|
|
1218
|
-
let
|
|
1191
|
+
if (!E || !I || !Z.current) return;
|
|
1192
|
+
let h;
|
|
1219
1193
|
const F = new IntersectionObserver(
|
|
1220
1194
|
([ee]) => {
|
|
1221
|
-
ee.isIntersecting && (F.disconnect(),
|
|
1195
|
+
ee.isIntersecting && (F.disconnect(), h = setTimeout(() => I(t.id), po));
|
|
1222
1196
|
},
|
|
1223
1197
|
{ threshold: 0.5 }
|
|
1224
1198
|
);
|
|
1225
|
-
return F.observe(
|
|
1226
|
-
F.disconnect(), clearTimeout(
|
|
1199
|
+
return F.observe(Z.current), () => {
|
|
1200
|
+
F.disconnect(), clearTimeout(h);
|
|
1227
1201
|
};
|
|
1228
|
-
}, [
|
|
1229
|
-
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) => {
|
|
1230
1204
|
var ce;
|
|
1231
|
-
const F =
|
|
1232
|
-
await d(F, ke),
|
|
1233
|
-
},
|
|
1234
|
-
if (!(!a ||
|
|
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());
|
|
1207
|
+
}, X = async () => {
|
|
1208
|
+
if (!(!a || x >= 2))
|
|
1235
1209
|
try {
|
|
1236
|
-
const
|
|
1210
|
+
const h = await r.discussions.getPostReplies(t.id, {
|
|
1237
1211
|
limit: 25,
|
|
1238
1212
|
skipDeleted: !0,
|
|
1239
|
-
skipModerated: !
|
|
1213
|
+
skipModerated: !C
|
|
1240
1214
|
});
|
|
1241
|
-
|
|
1242
|
-
} catch (
|
|
1243
|
-
console.error("Failed to load replies:",
|
|
1215
|
+
P(h.data);
|
|
1216
|
+
} catch (h) {
|
|
1217
|
+
console.error("Failed to load replies:", h);
|
|
1244
1218
|
}
|
|
1245
1219
|
};
|
|
1246
1220
|
he(() => {
|
|
1247
|
-
|
|
1248
|
-
}, [
|
|
1249
|
-
const Ee = async (
|
|
1250
|
-
await c(
|
|
1251
|
-
}, fe = async (
|
|
1252
|
-
const ee = await l(
|
|
1253
|
-
ee && q.length > 0 &&
|
|
1254
|
-
(ke) => ke.map((ce) => ce.id ===
|
|
1221
|
+
j && q.length === 0 && X();
|
|
1222
|
+
}, [j]);
|
|
1223
|
+
const Ee = async (h) => {
|
|
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(
|
|
1228
|
+
(ke) => ke.map((ce) => ce.id === h ? ee : ce)
|
|
1255
1229
|
);
|
|
1256
|
-
},
|
|
1257
|
-
ie({ open: !0, variant: F, title: "", message:
|
|
1258
|
-
},
|
|
1259
|
-
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(
|
|
1260
1234
|
"div",
|
|
1261
1235
|
{
|
|
1262
|
-
css:
|
|
1236
|
+
css: m ? E ? O.highlighted[S] : O.highlightable[S] : O.post[S],
|
|
1263
1237
|
children: [
|
|
1264
|
-
/* @__PURE__ */
|
|
1265
|
-
/* @__PURE__ */ n(St, { src: (N = t.userModel) == null ? void 0 : N.avatar, alt:
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
/* @__PURE__ */
|
|
1268
|
-
/* @__PURE__ */ n("p", { css: O.name, children: ((
|
|
1269
|
-
/* @__PURE__ */ n("span", { css: O.time, children:
|
|
1270
|
-
|
|
1238
|
+
/* @__PURE__ */ y("div", { css: O.row, children: [
|
|
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 }) }),
|
|
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") }),
|
|
1271
1245
|
/* @__PURE__ */ n(
|
|
1272
|
-
|
|
1246
|
+
ro,
|
|
1273
1247
|
{
|
|
1274
1248
|
isOwnPost: se,
|
|
1275
|
-
canReport: !!(
|
|
1249
|
+
canReport: !!(f && i && !se) && !T,
|
|
1276
1250
|
onDelete: () => pe(!0),
|
|
1277
1251
|
onReport: () => de(!0),
|
|
1278
|
-
disabled:
|
|
1252
|
+
disabled: v
|
|
1279
1253
|
}
|
|
1280
1254
|
)
|
|
1281
1255
|
] }),
|
|
1282
|
-
|
|
1283
|
-
/* @__PURE__ */ n(
|
|
1284
|
-
/* @__PURE__ */ n("p", { css: O.moderatedText, children: t.moderatedReason ||
|
|
1256
|
+
T && C ? /* @__PURE__ */ y("div", { css: O.moderated, children: [
|
|
1257
|
+
/* @__PURE__ */ n(Ut, { size: "0.9375em", color: e.textSecondary, style: uo }),
|
|
1258
|
+
/* @__PURE__ */ n("p", { css: O.moderatedText, children: t.moderatedReason || D(
|
|
1285
1259
|
"discussion.moderatedPost",
|
|
1286
1260
|
"This comment has been moderated"
|
|
1287
1261
|
) })
|
|
1288
1262
|
] }) : /* @__PURE__ */ n("p", { css: O.content, children: t.content }),
|
|
1289
|
-
!
|
|
1290
|
-
|
|
1263
|
+
!T && /* @__PURE__ */ n(
|
|
1264
|
+
no,
|
|
1291
1265
|
{
|
|
1292
1266
|
post: t,
|
|
1293
1267
|
sdk: r,
|
|
1294
1268
|
userIsLoggedIn: i,
|
|
1295
1269
|
onSignInClick: s,
|
|
1296
1270
|
onReact: l,
|
|
1297
|
-
showReactions:
|
|
1298
|
-
showReplyButton: a &&
|
|
1299
|
-
onReplyClick: () =>
|
|
1300
|
-
isBanned:
|
|
1271
|
+
showReactions: u,
|
|
1272
|
+
showReplyButton: a && x < 2,
|
|
1273
|
+
onReplyClick: () => _(!K),
|
|
1274
|
+
isBanned: v
|
|
1301
1275
|
}
|
|
1302
1276
|
),
|
|
1303
|
-
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(
|
|
1304
1278
|
"p",
|
|
1305
1279
|
{
|
|
1306
1280
|
css: O.repliesToggle,
|
|
1307
|
-
onClick: () => oe(!
|
|
1281
|
+
onClick: () => oe(!j),
|
|
1308
1282
|
children: [
|
|
1309
|
-
|
|
1283
|
+
j ? D("discussion.hideReplies", "Hide replies") : D("discussion.repliesCount", "{{count}} replies", {
|
|
1310
1284
|
count: t.repliesCount
|
|
1311
1285
|
}),
|
|
1312
|
-
!
|
|
1286
|
+
!j && " ▼"
|
|
1313
1287
|
]
|
|
1314
1288
|
}
|
|
1315
1289
|
) }),
|
|
1316
|
-
|
|
1317
|
-
|
|
1290
|
+
K && !T && /* @__PURE__ */ n("div", { css: O.nested, children: /* @__PURE__ */ n(
|
|
1291
|
+
mt,
|
|
1318
1292
|
{
|
|
1319
|
-
onSubmit:
|
|
1293
|
+
onSubmit: U,
|
|
1320
1294
|
userIsLoggedIn: i,
|
|
1321
1295
|
onSignInClick: s,
|
|
1322
|
-
placeholder:
|
|
1323
|
-
isSubmitting:
|
|
1296
|
+
placeholder: D("discussion.writeReply", "Write a reply..."),
|
|
1297
|
+
isSubmitting: g,
|
|
1324
1298
|
replyTo: ((ae = t.userModel) == null ? void 0 : ae.name) || t.anonymousNickname,
|
|
1325
|
-
onCancel: () =>
|
|
1326
|
-
disabled:
|
|
1299
|
+
onCancel: () => _(!1),
|
|
1300
|
+
disabled: v
|
|
1327
1301
|
}
|
|
1328
1302
|
) }),
|
|
1329
|
-
|
|
1330
|
-
|
|
1303
|
+
j && q.length > 0 && /* @__PURE__ */ n("div", { css: O.nested, children: q.map((h) => /* @__PURE__ */ n(
|
|
1304
|
+
yt,
|
|
1331
1305
|
{
|
|
1332
|
-
post:
|
|
1306
|
+
post: h,
|
|
1333
1307
|
sdk: r,
|
|
1334
1308
|
userIsLoggedIn: i,
|
|
1335
1309
|
onSignInClick: s,
|
|
1336
|
-
showReactions:
|
|
1310
|
+
showReactions: u,
|
|
1337
1311
|
showReplies: a,
|
|
1338
|
-
showReportPost:
|
|
1312
|
+
showReportPost: f,
|
|
1339
1313
|
onReply: d,
|
|
1340
1314
|
onReact: fe,
|
|
1341
1315
|
onDelete: Ee,
|
|
1342
|
-
onReport:
|
|
1343
|
-
isSubmitting:
|
|
1344
|
-
showModeratedPosts:
|
|
1345
|
-
isBanned:
|
|
1346
|
-
depth:
|
|
1347
|
-
parentPostId:
|
|
1348
|
-
onReplyCreated:
|
|
1349
|
-
onDeleteSuccess:
|
|
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,
|
|
1323
|
+
onDeleteSuccess: M
|
|
1350
1324
|
},
|
|
1351
|
-
|
|
1325
|
+
h.id
|
|
1352
1326
|
)) })
|
|
1353
1327
|
] })
|
|
1354
1328
|
] }),
|
|
1355
1329
|
/* @__PURE__ */ n(
|
|
1356
|
-
|
|
1330
|
+
io,
|
|
1357
1331
|
{
|
|
1358
1332
|
open: ne,
|
|
1359
1333
|
onClose: () => pe(!1),
|
|
1360
1334
|
onConfirm: async () => {
|
|
1361
|
-
await c(t.id),
|
|
1335
|
+
await c(t.id), M == null || M();
|
|
1362
1336
|
},
|
|
1363
|
-
onError: (
|
|
1337
|
+
onError: (h) => k(h, "error")
|
|
1364
1338
|
}
|
|
1365
1339
|
),
|
|
1366
1340
|
/* @__PURE__ */ n(
|
|
1367
|
-
|
|
1341
|
+
ao,
|
|
1368
1342
|
{
|
|
1369
|
-
open:
|
|
1343
|
+
open: Q,
|
|
1370
1344
|
onClose: () => de(!1),
|
|
1371
|
-
onSubmit: (
|
|
1372
|
-
onSuccess: (
|
|
1373
|
-
onError: (
|
|
1345
|
+
onSubmit: (h, F) => b(t.id, h, F),
|
|
1346
|
+
onSuccess: (h) => k(h, "success"),
|
|
1347
|
+
onError: (h) => k(h, "error")
|
|
1374
1348
|
}
|
|
1375
1349
|
),
|
|
1376
1350
|
/* @__PURE__ */ n(
|
|
1377
|
-
|
|
1351
|
+
dt,
|
|
1378
1352
|
{
|
|
1379
1353
|
notification: re,
|
|
1380
|
-
onClose: () => ie((
|
|
1354
|
+
onClose: () => ie((h) => ({ ...h, open: !1 }))
|
|
1381
1355
|
}
|
|
1382
1356
|
)
|
|
1383
1357
|
]
|
|
1384
1358
|
}
|
|
1385
1359
|
);
|
|
1386
|
-
},
|
|
1360
|
+
}, He = 864e5, st = -1, Be = o(z.bodyMd, { fontSize: "0.8125em", color: e.textSecondary }), at = o({ transition: "transform 0.2s" }), L = {
|
|
1387
1361
|
root: o({
|
|
1388
1362
|
fontSize: "1em",
|
|
1389
1363
|
marginBottom: e.spaceSm,
|
|
@@ -1417,7 +1391,7 @@ const _t = (t, r) => {
|
|
|
1417
1391
|
paddingInline: e.spaceXs,
|
|
1418
1392
|
paddingBlock: "0.125em"
|
|
1419
1393
|
}),
|
|
1420
|
-
meta:
|
|
1394
|
+
meta: Be,
|
|
1421
1395
|
reasonBox: o({
|
|
1422
1396
|
marginTop: e.spaceSm,
|
|
1423
1397
|
paddingInline: e.spaceSm,
|
|
@@ -1443,111 +1417,111 @@ const _t = (t, r) => {
|
|
|
1443
1417
|
backgroundColor: "transparent",
|
|
1444
1418
|
cursor: "pointer"
|
|
1445
1419
|
}),
|
|
1446
|
-
chevron: { closed:
|
|
1420
|
+
chevron: { closed: at, open: o(at, { transform: "rotate(180deg)" }) },
|
|
1447
1421
|
list: o({ listStyle: "none", margin: 0, padding: 0, marginTop: e.spaceXs }),
|
|
1448
1422
|
entry: o({ paddingBlock: e.spaceXs, borderTop: `1px solid ${e.danger33}` }),
|
|
1449
|
-
entryDates: o(
|
|
1450
|
-
entryReason: o(
|
|
1451
|
-
entryLifted: o(
|
|
1423
|
+
entryDates: o(Be, { fontWeight: 600, color: e.text }),
|
|
1424
|
+
entryReason: o(Be, { unicodeBidi: "plaintext" }),
|
|
1425
|
+
entryLifted: o(Be, { fontStyle: "italic" }),
|
|
1452
1426
|
isolate: o({ unicodeBidi: "isolate" })
|
|
1453
|
-
},
|
|
1427
|
+
}, fo = ({
|
|
1454
1428
|
ban: t,
|
|
1455
1429
|
showBanHistory: r = !1
|
|
1456
1430
|
}) => {
|
|
1457
|
-
const { t: i } =
|
|
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, {
|
|
1458
1432
|
dateStyle: "medium",
|
|
1459
1433
|
timeStyle: "short"
|
|
1460
|
-
}), { activeBan: c } = t,
|
|
1461
|
-
new Date(c.bannedAt).getTime() + c.bannedPeriodInDays *
|
|
1462
|
-
),
|
|
1434
|
+
}), { activeBan: c } = t, b = c.bannedPeriodInDays === st, g = new Date(
|
|
1435
|
+
new Date(c.bannedAt).getTime() + c.bannedPeriodInDays * He
|
|
1436
|
+
), C = Math.max(
|
|
1463
1437
|
1,
|
|
1464
|
-
Math.ceil((
|
|
1465
|
-
),
|
|
1466
|
-
(
|
|
1438
|
+
Math.ceil((g.getTime() - Date.now()) / He)
|
|
1439
|
+
), v = (t.history || []).filter(
|
|
1440
|
+
(m) => m.bannedAt !== c.bannedAt
|
|
1467
1441
|
);
|
|
1468
|
-
return /* @__PURE__ */ n("div", { role: "status", css: L.root, children: /* @__PURE__ */
|
|
1469
|
-
/* @__PURE__ */ n("div", { css: L.badge, children: /* @__PURE__ */ n(
|
|
1470
|
-
/* @__PURE__ */
|
|
1442
|
+
return /* @__PURE__ */ n("div", { role: "status", css: L.root, children: /* @__PURE__ */ y("div", { css: L.row, children: [
|
|
1443
|
+
/* @__PURE__ */ n("div", { css: L.badge, children: /* @__PURE__ */ n(Vt, { size: "1.25em", color: e.icon }) }),
|
|
1444
|
+
/* @__PURE__ */ y("div", { css: L.body, children: [
|
|
1471
1445
|
/* @__PURE__ */ n("p", { css: L.title, children: i("discussion.ban.title", "You've been banned from commenting") }),
|
|
1472
|
-
/* @__PURE__ */ n("p", { css: L.description, children:
|
|
1446
|
+
/* @__PURE__ */ n("p", { css: L.description, children: b ? i(
|
|
1473
1447
|
"discussion.ban.descriptionPermanent",
|
|
1474
1448
|
"You can still read the discussion, but you can no longer post, reply or react."
|
|
1475
1449
|
) : i(
|
|
1476
1450
|
"discussion.ban.description",
|
|
1477
1451
|
"You can still read the discussion, but you can't post, reply or react until the ban ends."
|
|
1478
1452
|
) }),
|
|
1479
|
-
/* @__PURE__ */
|
|
1480
|
-
/* @__PURE__ */ n("span", { css: L.pill, children:
|
|
1481
|
-
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
|
|
1482
1456
|
}) }),
|
|
1483
1457
|
/* @__PURE__ */ n("span", { css: L.meta, children: i("discussion.ban.since", "Since {{date}}", {
|
|
1484
1458
|
date: d(c.bannedAt)
|
|
1485
1459
|
}) }),
|
|
1486
|
-
!
|
|
1460
|
+
!b && /* @__PURE__ */ y("span", { css: L.meta, children: [
|
|
1487
1461
|
"·",
|
|
1488
1462
|
" ",
|
|
1489
1463
|
i("discussion.ban.until", "Until {{date}}", {
|
|
1490
|
-
date: l(
|
|
1464
|
+
date: l(g)
|
|
1491
1465
|
})
|
|
1492
1466
|
] })
|
|
1493
1467
|
] }),
|
|
1494
|
-
c.bannedReason && /* @__PURE__ */
|
|
1468
|
+
c.bannedReason && /* @__PURE__ */ y("div", { css: L.reasonBox, children: [
|
|
1495
1469
|
/* @__PURE__ */ n("span", { css: L.reasonLabel, children: i("discussion.ban.reason", "Reason") }),
|
|
1496
1470
|
/* @__PURE__ */ n("p", { css: L.reason, children: c.bannedReason })
|
|
1497
1471
|
] }),
|
|
1498
|
-
r &&
|
|
1499
|
-
/* @__PURE__ */
|
|
1472
|
+
r && v.length > 0 && /* @__PURE__ */ y("div", { css: L.history, children: [
|
|
1473
|
+
/* @__PURE__ */ y(
|
|
1500
1474
|
"button",
|
|
1501
1475
|
{
|
|
1502
1476
|
type: "button",
|
|
1503
|
-
"aria-expanded":
|
|
1504
|
-
onClick: () => a((
|
|
1477
|
+
"aria-expanded": u,
|
|
1478
|
+
onClick: () => a((m) => !m),
|
|
1505
1479
|
css: L.toggle,
|
|
1506
1480
|
children: [
|
|
1507
1481
|
i("discussion.ban.previousBans", "Previous bans ({{count}})", {
|
|
1508
|
-
count:
|
|
1482
|
+
count: v.length
|
|
1509
1483
|
}),
|
|
1510
1484
|
/* @__PURE__ */ n(
|
|
1511
|
-
|
|
1485
|
+
_t,
|
|
1512
1486
|
{
|
|
1513
1487
|
size: "1.25em",
|
|
1514
1488
|
color: e.icon,
|
|
1515
|
-
css:
|
|
1489
|
+
css: u ? L.chevron.open : L.chevron.closed
|
|
1516
1490
|
}
|
|
1517
1491
|
)
|
|
1518
1492
|
]
|
|
1519
1493
|
}
|
|
1520
1494
|
),
|
|
1521
|
-
|
|
1522
|
-
const
|
|
1523
|
-
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
|
|
1524
1498
|
) : null);
|
|
1525
|
-
return /* @__PURE__ */
|
|
1526
|
-
/* @__PURE__ */
|
|
1527
|
-
d(
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1499
|
+
return /* @__PURE__ */ y("li", { css: L.entry, children: [
|
|
1500
|
+
/* @__PURE__ */ y("p", { css: L.entryDates, children: [
|
|
1501
|
+
d(m.bannedAt),
|
|
1502
|
+
E && ` – ${d(E)}`,
|
|
1503
|
+
m.bannedPeriodInDays === st && ` · ${i("discussion.ban.permanent", "Permanent ban")}`,
|
|
1504
|
+
m.bannedPeriodInDays > 0 && ` · ${i("discussion.ban.days", "{{count}} days", { count: m.bannedPeriodInDays })}`
|
|
1531
1505
|
] }),
|
|
1532
|
-
|
|
1533
|
-
|
|
1506
|
+
m.bannedReason && /* @__PURE__ */ n("p", { css: L.entryReason, children: m.bannedReason }),
|
|
1507
|
+
m.unbannedAt && /* @__PURE__ */ y("p", { css: L.entryLifted, children: [
|
|
1534
1508
|
i("discussion.ban.lifted", "Lifted on {{date}}", {
|
|
1535
|
-
date: d(
|
|
1509
|
+
date: d(m.unbannedAt)
|
|
1536
1510
|
}),
|
|
1537
|
-
|
|
1511
|
+
m.unbannedReason && /* @__PURE__ */ y(Re, { children: [
|
|
1538
1512
|
": ",
|
|
1539
|
-
/* @__PURE__ */ n("span", { css: L.isolate, children:
|
|
1513
|
+
/* @__PURE__ */ n("span", { css: L.isolate, children: m.unbannedReason })
|
|
1540
1514
|
] })
|
|
1541
1515
|
] })
|
|
1542
|
-
] },
|
|
1516
|
+
] }, m.bannedAt);
|
|
1543
1517
|
}) })
|
|
1544
1518
|
] })
|
|
1545
1519
|
] })
|
|
1546
1520
|
] }) });
|
|
1547
|
-
},
|
|
1521
|
+
}, mo = (t) => {
|
|
1548
1522
|
var r, i, s;
|
|
1549
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;
|
|
1550
|
-
},
|
|
1524
|
+
}, ct = { display: "flex", alignItems: "center", marginInlineStart: "0.5em", marginInlineEnd: "-2px" }, we = {
|
|
1551
1525
|
root: o({
|
|
1552
1526
|
boxSizing: "border-box",
|
|
1553
1527
|
position: "relative",
|
|
@@ -1596,8 +1570,8 @@ const _t = (t, r) => {
|
|
|
1596
1570
|
cursor: "pointer"
|
|
1597
1571
|
}),
|
|
1598
1572
|
// Joy's icon grey on the svg only; open, it takes the field's colour.
|
|
1599
|
-
indicatorClosed: o({ ...
|
|
1600
|
-
indicatorOpen: o(
|
|
1573
|
+
indicatorClosed: o({ ...ct, "& svg": { color: e.icon } }),
|
|
1574
|
+
indicatorOpen: o(ct),
|
|
1601
1575
|
list: o({
|
|
1602
1576
|
position: "fixed",
|
|
1603
1577
|
zIndex: 1300,
|
|
@@ -1637,26 +1611,26 @@ const _t = (t, r) => {
|
|
|
1637
1611
|
cursor: "pointer",
|
|
1638
1612
|
"&:hover, &[aria-selected='true']": { backgroundColor: e.surfaceVariant }
|
|
1639
1613
|
})
|
|
1640
|
-
},
|
|
1614
|
+
}, go = ({ value: t, options: r, onChange: i }) => {
|
|
1641
1615
|
var l;
|
|
1642
1616
|
const s = wt(
|
|
1643
1617
|
r.map((c) => c.value),
|
|
1644
1618
|
t,
|
|
1645
1619
|
(c) => i(c)
|
|
1646
|
-
),
|
|
1647
|
-
var
|
|
1648
|
-
const
|
|
1649
|
-
(
|
|
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());
|
|
1650
1624
|
};
|
|
1651
|
-
return /* @__PURE__ */
|
|
1652
|
-
/* @__PURE__ */ n("button", { ref:
|
|
1653
|
-
/* @__PURE__ */ n("span", { css: s.open ?
|
|
1654
|
-
s.open && /* @__PURE__ */ n("ul", { ref: a, ...s.listboxProps, css:
|
|
1625
|
+
return /* @__PURE__ */ y("div", { ref: s.rootRef, css: we.root, onClick: d, children: [
|
|
1626
|
+
/* @__PURE__ */ n("button", { ref: u, ...s.triggerProps, css: we.button, children: (l = r.find((c) => c.value === t)) == null ? void 0 : l.label }),
|
|
1627
|
+
/* @__PURE__ */ n("span", { css: s.open ? we.indicatorOpen : we.indicatorClosed, children: /* @__PURE__ */ n(jt, {}) }),
|
|
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)) })
|
|
1655
1629
|
] });
|
|
1656
1630
|
}, te = {
|
|
1657
1631
|
root: o({ marginInline: "auto", maxHeight: "100%", overflowY: "auto", backgroundColor: e.surface }),
|
|
1658
1632
|
header: o({ marginBottom: e.spaceLg }),
|
|
1659
|
-
title: o(z.h3, { marginBottom: e.spaceXs }),
|
|
1633
|
+
title: o(z.h3, { marginBottom: e.spaceXs, unicodeBidi: "plaintext" }),
|
|
1660
1634
|
count: o(z.bodySm, { color: e.textSecondary }),
|
|
1661
1635
|
divider: o({
|
|
1662
1636
|
position: "relative",
|
|
@@ -1680,267 +1654,267 @@ const _t = (t, r) => {
|
|
|
1680
1654
|
sentinel: o({ height: "1px" }),
|
|
1681
1655
|
moreSpinner: o({ paddingBlock: e.spaceMd }),
|
|
1682
1656
|
loadMore: o({ display: "flex", justifyContent: "center", marginTop: e.spaceLg })
|
|
1683
|
-
},
|
|
1657
|
+
}, ho = ({
|
|
1684
1658
|
discussion: t,
|
|
1685
1659
|
posts: r,
|
|
1686
1660
|
postsHidden: i = !1,
|
|
1687
1661
|
sdk: s,
|
|
1688
|
-
userIsLoggedIn:
|
|
1662
|
+
userIsLoggedIn: u,
|
|
1689
1663
|
onSignInClick: a,
|
|
1690
|
-
showReactions:
|
|
1664
|
+
showReactions: f,
|
|
1691
1665
|
showReplies: d,
|
|
1692
1666
|
showReportPost: l,
|
|
1693
1667
|
currentSort: c,
|
|
1694
|
-
onSortChange:
|
|
1695
|
-
onCreatePost:
|
|
1696
|
-
onReact:
|
|
1697
|
-
onDeletePost:
|
|
1698
|
-
onReportPost:
|
|
1699
|
-
onLoadMore:
|
|
1668
|
+
onSortChange: b,
|
|
1669
|
+
onCreatePost: g,
|
|
1670
|
+
onReact: C,
|
|
1671
|
+
onDeletePost: v,
|
|
1672
|
+
onReportPost: m,
|
|
1673
|
+
onLoadMore: E,
|
|
1700
1674
|
hasMore: I,
|
|
1701
|
-
liveRefresh:
|
|
1702
|
-
newPostIds:
|
|
1703
|
-
onNewPostSeen:
|
|
1704
|
-
isLoading:
|
|
1705
|
-
isSubmitting:
|
|
1675
|
+
liveRefresh: x = !1,
|
|
1676
|
+
newPostIds: p,
|
|
1677
|
+
onNewPostSeen: R,
|
|
1678
|
+
isLoading: M,
|
|
1679
|
+
isSubmitting: D,
|
|
1706
1680
|
infiniteScroll: $ = !1,
|
|
1707
1681
|
showModeratedPosts: J = !1,
|
|
1708
|
-
ban:
|
|
1709
|
-
isBanned:
|
|
1682
|
+
ban: K,
|
|
1683
|
+
isBanned: _ = !1,
|
|
1710
1684
|
showBanHistory: q = !1
|
|
1711
1685
|
}) => {
|
|
1712
|
-
const { t:
|
|
1686
|
+
const { t: P } = be(), j = Ve(), oe = V(null), ne = V(null);
|
|
1713
1687
|
he(() => {
|
|
1714
1688
|
if (!$ || !ne.current) return;
|
|
1715
|
-
const
|
|
1716
|
-
(
|
|
1717
|
-
|
|
1689
|
+
const T = new IntersectionObserver(
|
|
1690
|
+
(U) => {
|
|
1691
|
+
U[0].isIntersecting && I && !M && E();
|
|
1718
1692
|
},
|
|
1719
1693
|
{ root: oe.current, threshold: 0.1 }
|
|
1720
1694
|
);
|
|
1721
|
-
return
|
|
1722
|
-
}, [$, I,
|
|
1723
|
-
const [pe,
|
|
1724
|
-
|
|
1695
|
+
return T.observe(ne.current), () => T.disconnect();
|
|
1696
|
+
}, [$, I, M, E]);
|
|
1697
|
+
const [pe, Q] = B({ open: !1, variant: "success", title: "", message: "" }), de = () => {
|
|
1698
|
+
Q({
|
|
1725
1699
|
open: !0,
|
|
1726
1700
|
variant: "success",
|
|
1727
1701
|
title: "",
|
|
1728
|
-
message:
|
|
1702
|
+
message: P("discussion.delete.success", "Comment deleted successfully.")
|
|
1729
1703
|
});
|
|
1730
|
-
}, re = (
|
|
1731
|
-
|
|
1704
|
+
}, re = (T, U) => {
|
|
1705
|
+
pt(T) || Q({
|
|
1732
1706
|
open: !0,
|
|
1733
1707
|
variant: "error",
|
|
1734
1708
|
title: "",
|
|
1735
|
-
message:
|
|
1709
|
+
message: mo(T) ? P(
|
|
1736
1710
|
"discussion.rateLimited",
|
|
1737
1711
|
"You're doing that too often. Please wait a moment and try again."
|
|
1738
|
-
) :
|
|
1712
|
+
) : U
|
|
1739
1713
|
});
|
|
1740
|
-
}, ie = async (
|
|
1714
|
+
}, ie = async (T, U) => {
|
|
1741
1715
|
try {
|
|
1742
|
-
return await
|
|
1743
|
-
} catch (
|
|
1716
|
+
return await C(T, U);
|
|
1717
|
+
} catch (X) {
|
|
1744
1718
|
throw re(
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
),
|
|
1719
|
+
X,
|
|
1720
|
+
P("discussion.reactError", "Failed to add reaction. Please try again.")
|
|
1721
|
+
), X;
|
|
1748
1722
|
}
|
|
1749
|
-
},
|
|
1723
|
+
}, Z = async (T, U) => {
|
|
1750
1724
|
try {
|
|
1751
|
-
await
|
|
1752
|
-
} catch (
|
|
1725
|
+
await g(T, U);
|
|
1726
|
+
} catch (X) {
|
|
1753
1727
|
throw re(
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
),
|
|
1728
|
+
X,
|
|
1729
|
+
P("discussion.postError", "Failed to post comment. Please try again.")
|
|
1730
|
+
), X;
|
|
1757
1731
|
}
|
|
1758
|
-
|
|
1732
|
+
Q({
|
|
1759
1733
|
open: !0,
|
|
1760
1734
|
variant: "success",
|
|
1761
1735
|
title: "",
|
|
1762
|
-
message:
|
|
1736
|
+
message: P("discussion.postSuccess", "Comment posted successfully.")
|
|
1763
1737
|
});
|
|
1764
1738
|
}, se = [
|
|
1765
|
-
{ value: "LATEST", label:
|
|
1766
|
-
{ value: "OLDEST", label:
|
|
1767
|
-
{ 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") },
|
|
1768
1742
|
{
|
|
1769
1743
|
value: "INTERACTED",
|
|
1770
|
-
label:
|
|
1744
|
+
label: P("discussion.sort.interacted", "Most Interacted")
|
|
1771
1745
|
}
|
|
1772
1746
|
];
|
|
1773
|
-
return /* @__PURE__ */
|
|
1774
|
-
/* @__PURE__ */
|
|
1775
|
-
/* @__PURE__ */ n("h3", { css: te.title, children: t.label ||
|
|
1776
|
-
!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", {
|
|
1777
1751
|
count: t.postsCount || 0
|
|
1778
1752
|
}) })
|
|
1779
1753
|
] }),
|
|
1780
|
-
|
|
1754
|
+
_ && K && /* @__PURE__ */ n(fo, { ban: K, showBanHistory: q }),
|
|
1781
1755
|
/* @__PURE__ */ n(
|
|
1782
|
-
|
|
1756
|
+
mt,
|
|
1783
1757
|
{
|
|
1784
|
-
onSubmit: (
|
|
1785
|
-
userIsLoggedIn:
|
|
1758
|
+
onSubmit: (T) => Z(T),
|
|
1759
|
+
userIsLoggedIn: u,
|
|
1786
1760
|
onSignInClick: a,
|
|
1787
|
-
isSubmitting:
|
|
1788
|
-
disabled:
|
|
1761
|
+
isSubmitting: D,
|
|
1762
|
+
disabled: _
|
|
1789
1763
|
}
|
|
1790
1764
|
),
|
|
1791
|
-
!i && /* @__PURE__ */
|
|
1765
|
+
!i && /* @__PURE__ */ y(Re, { children: [
|
|
1792
1766
|
/* @__PURE__ */ n("hr", { css: te.divider }),
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */ n("p", { css: z.titleMd, children:
|
|
1795
|
-
/* @__PURE__ */ n(
|
|
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 })
|
|
1796
1770
|
] }),
|
|
1797
|
-
|
|
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(
|
|
1798
1772
|
"discussion.noPosts",
|
|
1799
1773
|
"No comments yet. Be the first to comment!"
|
|
1800
|
-
) }) }) : /* @__PURE__ */
|
|
1801
|
-
/* @__PURE__ */ n("div", { children: r.map((
|
|
1802
|
-
|
|
1774
|
+
) }) }) : /* @__PURE__ */ y(Re, { children: [
|
|
1775
|
+
/* @__PURE__ */ n("div", { children: r.map((T) => /* @__PURE__ */ n(
|
|
1776
|
+
yt,
|
|
1803
1777
|
{
|
|
1804
|
-
post:
|
|
1778
|
+
post: T,
|
|
1805
1779
|
sdk: s,
|
|
1806
|
-
userIsLoggedIn:
|
|
1780
|
+
userIsLoggedIn: u,
|
|
1807
1781
|
onSignInClick: a,
|
|
1808
|
-
showReactions:
|
|
1782
|
+
showReactions: f,
|
|
1809
1783
|
showReplies: d,
|
|
1810
1784
|
showReportPost: l,
|
|
1811
|
-
onReply: (
|
|
1785
|
+
onReply: (U, X) => Z(X, U),
|
|
1812
1786
|
onReact: ie,
|
|
1813
|
-
onDelete:
|
|
1814
|
-
onReport:
|
|
1815
|
-
isSubmitting:
|
|
1787
|
+
onDelete: v,
|
|
1788
|
+
onReport: m,
|
|
1789
|
+
isSubmitting: D,
|
|
1816
1790
|
showModeratedPosts: J,
|
|
1817
|
-
isBanned:
|
|
1818
|
-
highlightable:
|
|
1819
|
-
isNew:
|
|
1820
|
-
onNewSeen:
|
|
1791
|
+
isBanned: _,
|
|
1792
|
+
highlightable: x,
|
|
1793
|
+
isNew: p == null ? void 0 : p.has(T.id),
|
|
1794
|
+
onNewSeen: R,
|
|
1821
1795
|
onDeleteSuccess: de
|
|
1822
1796
|
},
|
|
1823
|
-
|
|
1797
|
+
T.id
|
|
1824
1798
|
)) }),
|
|
1825
1799
|
$ && /* @__PURE__ */ n("div", { ref: ne, css: te.sentinel })
|
|
1826
1800
|
] }),
|
|
1827
|
-
$ &&
|
|
1828
|
-
!$ && I && /* @__PURE__ */ n("div", { css: te.loadMore, children: /* @__PURE__ */ n(ue, { look: "outlined", onClick:
|
|
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") }) })
|
|
1829
1803
|
] }),
|
|
1830
1804
|
/* @__PURE__ */ n(
|
|
1831
|
-
|
|
1805
|
+
dt,
|
|
1832
1806
|
{
|
|
1833
1807
|
notification: pe,
|
|
1834
|
-
onClose: () =>
|
|
1808
|
+
onClose: () => Q((T) => ({ ...T, open: !1 }))
|
|
1835
1809
|
}
|
|
1836
1810
|
)
|
|
1837
1811
|
] });
|
|
1838
|
-
},
|
|
1812
|
+
}, yo = (t) => {
|
|
1839
1813
|
const {
|
|
1840
1814
|
entityId: r,
|
|
1841
1815
|
sdk: i,
|
|
1842
1816
|
discussionLabel: s,
|
|
1843
|
-
discussionUrl:
|
|
1817
|
+
discussionUrl: u = "",
|
|
1844
1818
|
defaultSort: a = "LATEST",
|
|
1845
|
-
postsPerPage:
|
|
1819
|
+
postsPerPage: f = 20,
|
|
1846
1820
|
showReactions: d = !0,
|
|
1847
1821
|
showReplies: l = !0,
|
|
1848
1822
|
showReportPost: c = !0,
|
|
1849
|
-
infiniteScroll:
|
|
1850
|
-
showModeratedPosts:
|
|
1851
|
-
userIsLoggedIn:
|
|
1852
|
-
showBanHistory:
|
|
1853
|
-
refreshInterval:
|
|
1854
|
-
onSignInClick:
|
|
1855
|
-
} = t, { ban: I, isBanned:
|
|
1856
|
-
discussion:
|
|
1857
|
-
setDiscussion:
|
|
1858
|
-
isLoading:
|
|
1823
|
+
infiniteScroll: b = !1,
|
|
1824
|
+
showModeratedPosts: g = !1,
|
|
1825
|
+
userIsLoggedIn: C = !1,
|
|
1826
|
+
showBanHistory: v = !1,
|
|
1827
|
+
refreshInterval: m = 0,
|
|
1828
|
+
onSignInClick: E
|
|
1829
|
+
} = t, { ban: I, isBanned: x, refresh: p } = eo(i, C), {
|
|
1830
|
+
discussion: R,
|
|
1831
|
+
setDiscussion: M,
|
|
1832
|
+
isLoading: D,
|
|
1859
1833
|
error: $,
|
|
1860
1834
|
isNotFound: J
|
|
1861
|
-
} =
|
|
1835
|
+
} = Gt(i, r), K = () => ({
|
|
1862
1836
|
id: r,
|
|
1863
1837
|
label: "",
|
|
1864
1838
|
postsCount: 0,
|
|
1865
1839
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1866
1840
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1867
|
-
}),
|
|
1868
|
-
|
|
1869
|
-
const
|
|
1870
|
-
return { ...
|
|
1841
|
+
}), _ = (fe) => {
|
|
1842
|
+
M((k) => {
|
|
1843
|
+
const S = k ?? K();
|
|
1844
|
+
return { ...S, postsCount: Math.max(0, S.postsCount + fe) };
|
|
1871
1845
|
});
|
|
1872
1846
|
}, {
|
|
1873
1847
|
posts: q,
|
|
1874
|
-
postsHidden:
|
|
1875
|
-
isLoading:
|
|
1848
|
+
postsHidden: P,
|
|
1849
|
+
isLoading: j,
|
|
1876
1850
|
isSubmitting: oe,
|
|
1877
1851
|
currentSort: ne,
|
|
1878
1852
|
hasMore: pe,
|
|
1879
|
-
newPostIds:
|
|
1853
|
+
newPostIds: Q,
|
|
1880
1854
|
markPostSeen: de,
|
|
1881
1855
|
handleSortChange: re,
|
|
1882
1856
|
handleLoadMore: ie,
|
|
1883
|
-
handleCreatePost:
|
|
1857
|
+
handleCreatePost: Z,
|
|
1884
1858
|
handleReact: se,
|
|
1885
|
-
handleDeletePost:
|
|
1886
|
-
handleReportPost:
|
|
1887
|
-
} =
|
|
1859
|
+
handleDeletePost: T,
|
|
1860
|
+
handleReportPost: U
|
|
1861
|
+
} = Qt(
|
|
1888
1862
|
i,
|
|
1889
1863
|
r,
|
|
1890
1864
|
s || null,
|
|
1891
|
-
p,
|
|
1892
|
-
a,
|
|
1893
|
-
m,
|
|
1894
|
-
V,
|
|
1895
1865
|
u,
|
|
1896
|
-
|
|
1897
|
-
|
|
1866
|
+
a,
|
|
1867
|
+
f,
|
|
1868
|
+
_,
|
|
1869
|
+
g,
|
|
1870
|
+
m
|
|
1871
|
+
), X = (fe) => async (...k) => {
|
|
1898
1872
|
try {
|
|
1899
|
-
return await fe(...
|
|
1900
|
-
} catch (
|
|
1901
|
-
throw
|
|
1873
|
+
return await fe(...k);
|
|
1874
|
+
} catch (S) {
|
|
1875
|
+
throw pt(S) && p(), S;
|
|
1902
1876
|
}
|
|
1903
1877
|
};
|
|
1904
|
-
if (
|
|
1905
|
-
return /* @__PURE__ */ n(
|
|
1878
|
+
if (D || !R && !J && j)
|
|
1879
|
+
return /* @__PURE__ */ n(Oe, { marginBlock: "160px" });
|
|
1906
1880
|
if ($)
|
|
1907
1881
|
return /* @__PURE__ */ n("div", { style: { padding: "20px", textAlign: "center" }, children: /* @__PURE__ */ n("p", { children: "Failed to load discussion. Please try again later." }) });
|
|
1908
|
-
const Ee = async (fe,
|
|
1909
|
-
await
|
|
1882
|
+
const Ee = async (fe, k) => {
|
|
1883
|
+
await Z(fe, k), s && M((S) => ({ ...S ?? K(), label: s }));
|
|
1910
1884
|
};
|
|
1911
1885
|
return /* @__PURE__ */ n(
|
|
1912
|
-
|
|
1886
|
+
ho,
|
|
1913
1887
|
{
|
|
1914
|
-
discussion:
|
|
1888
|
+
discussion: R ?? K(),
|
|
1915
1889
|
posts: q,
|
|
1916
|
-
postsHidden:
|
|
1890
|
+
postsHidden: P,
|
|
1917
1891
|
sdk: i,
|
|
1918
|
-
userIsLoggedIn:
|
|
1919
|
-
onSignInClick:
|
|
1892
|
+
userIsLoggedIn: C,
|
|
1893
|
+
onSignInClick: E,
|
|
1920
1894
|
showReactions: d,
|
|
1921
1895
|
showReplies: l,
|
|
1922
1896
|
showReportPost: c,
|
|
1923
1897
|
currentSort: ne,
|
|
1924
1898
|
onSortChange: re,
|
|
1925
|
-
onCreatePost:
|
|
1926
|
-
onReact:
|
|
1927
|
-
onDeletePost:
|
|
1928
|
-
onReportPost:
|
|
1899
|
+
onCreatePost: X(Ee),
|
|
1900
|
+
onReact: X(se),
|
|
1901
|
+
onDeletePost: X(T),
|
|
1902
|
+
onReportPost: X(U),
|
|
1929
1903
|
onLoadMore: ie,
|
|
1930
1904
|
hasMore: pe,
|
|
1931
|
-
liveRefresh:
|
|
1932
|
-
newPostIds:
|
|
1905
|
+
liveRefresh: m > 0,
|
|
1906
|
+
newPostIds: Q,
|
|
1933
1907
|
onNewPostSeen: de,
|
|
1934
|
-
isLoading:
|
|
1908
|
+
isLoading: j,
|
|
1935
1909
|
isSubmitting: oe,
|
|
1936
|
-
infiniteScroll:
|
|
1937
|
-
showModeratedPosts:
|
|
1910
|
+
infiniteScroll: b,
|
|
1911
|
+
showModeratedPosts: g,
|
|
1938
1912
|
ban: I,
|
|
1939
|
-
isBanned:
|
|
1940
|
-
showBanHistory:
|
|
1913
|
+
isBanned: x,
|
|
1914
|
+
showBanHistory: v
|
|
1941
1915
|
}
|
|
1942
1916
|
);
|
|
1943
|
-
},
|
|
1917
|
+
}, Io = (t) => /* @__PURE__ */ n(
|
|
1944
1918
|
Ct,
|
|
1945
1919
|
{
|
|
1946
1920
|
packageName: "discussion",
|
|
@@ -1948,9 +1922,9 @@ const _t = (t, r) => {
|
|
|
1948
1922
|
themeOptions: t.themeOptions,
|
|
1949
1923
|
disableCache: t.disableCache,
|
|
1950
1924
|
fillHeight: !0,
|
|
1951
|
-
children: /* @__PURE__ */ n(
|
|
1925
|
+
children: /* @__PURE__ */ n(yo, { ...t })
|
|
1952
1926
|
}
|
|
1953
1927
|
);
|
|
1954
1928
|
export {
|
|
1955
|
-
|
|
1929
|
+
Io as M
|
|
1956
1930
|
};
|