@select-org/post-components 1.0.1 → 2.1.0
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/dist/index.d.ts +89 -5
- package/dist/index.js +304 -50
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -0
- package/package.json +7 -5
package/dist/index.js
CHANGED
|
@@ -64,18 +64,169 @@ function AppIcon({ name, ...props }) {
|
|
|
64
64
|
return /* @__PURE__ */ jsx(Icon, { ...props });
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
// src/utils/postTypeHint.ts
|
|
68
|
+
var MEDIA_TYPES = /* @__PURE__ */ new Set([
|
|
69
|
+
"new:post:media",
|
|
70
|
+
"new:post:image",
|
|
71
|
+
"mediaItemToUpload"
|
|
72
|
+
]);
|
|
73
|
+
function getPostTypeHint(postType, ctx = {}) {
|
|
74
|
+
const {
|
|
75
|
+
isInGroup = false,
|
|
76
|
+
isOwner = false,
|
|
77
|
+
isPrivate = false,
|
|
78
|
+
membersCount = 0,
|
|
79
|
+
isMetaDesc = false
|
|
80
|
+
} = ctx;
|
|
81
|
+
const isMedia = MEDIA_TYPES.has(postType);
|
|
82
|
+
if (isInGroup) {
|
|
83
|
+
if (isMetaDesc) {
|
|
84
|
+
if (isMedia)
|
|
85
|
+
return { key: "post_detail_meta_description_type_image_post" };
|
|
86
|
+
switch (postType) {
|
|
87
|
+
case "new:post:link":
|
|
88
|
+
return { key: "post_detail_meta_description_type_link_post" };
|
|
89
|
+
case "new:post:poll":
|
|
90
|
+
return { key: "post_detail_meta_description_type_poll_post" };
|
|
91
|
+
case "new:post:thread":
|
|
92
|
+
return {
|
|
93
|
+
key: "post_detail_one_liner_receive_and_send_group_thread_post"
|
|
94
|
+
};
|
|
95
|
+
case "new:post:text":
|
|
96
|
+
default:
|
|
97
|
+
return { key: "post_detail_meta_description_type_message_post" };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (isMedia)
|
|
101
|
+
return { key: "post_detail_one_liner_receive_and_send_group_image_post" };
|
|
102
|
+
switch (postType) {
|
|
103
|
+
case "new:post:link":
|
|
104
|
+
return {
|
|
105
|
+
key: "post_detail_one_liner_receive_and_send_group_link_post"
|
|
106
|
+
};
|
|
107
|
+
case "new:post:poll":
|
|
108
|
+
return {
|
|
109
|
+
key: "post_detail_one_liner_receive_and_send_group_poll_post"
|
|
110
|
+
};
|
|
111
|
+
case "new:post:thread":
|
|
112
|
+
return {
|
|
113
|
+
key: "post_detail_one_liner_receive_and_send_group_thread_post"
|
|
114
|
+
};
|
|
115
|
+
case "new:post:text":
|
|
116
|
+
default:
|
|
117
|
+
return {
|
|
118
|
+
key: "post_detail_one_liner_receive_and_send_group_message_post"
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (isOwner) {
|
|
123
|
+
return membersCount > 1 ? sentPlural(postType, membersCount) : sentSingular(postType);
|
|
124
|
+
}
|
|
125
|
+
if (isPrivate) {
|
|
126
|
+
if (isMedia)
|
|
127
|
+
return { key: "post_detail_one_liner_receive_private_image_post" };
|
|
128
|
+
switch (postType) {
|
|
129
|
+
case "new:post:link":
|
|
130
|
+
return { key: "post_detail_one_liner_receive_private_link_post" };
|
|
131
|
+
case "new:post:poll":
|
|
132
|
+
return { key: "post_detail_one_liner_receive_private_poll_post" };
|
|
133
|
+
case "new:post:thread":
|
|
134
|
+
case "new:post:text":
|
|
135
|
+
default:
|
|
136
|
+
return { key: "post_detail_one_liner_receive_message_post" };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return membersCount > 1 ? sentPlural(postType, membersCount) : sentSingular(postType);
|
|
140
|
+
}
|
|
141
|
+
function sentPlural(postType, count) {
|
|
142
|
+
const params = { count };
|
|
143
|
+
if (MEDIA_TYPES.has(postType))
|
|
144
|
+
return { key: "post_detail_one_liner_send_private_image_post_plural", params };
|
|
145
|
+
switch (postType) {
|
|
146
|
+
case "new:post:link":
|
|
147
|
+
return {
|
|
148
|
+
key: "post_detail_one_liner_send_private_link_post_plural",
|
|
149
|
+
params
|
|
150
|
+
};
|
|
151
|
+
case "new:post:poll":
|
|
152
|
+
return {
|
|
153
|
+
key: "post_detail_one_liner_send_private_link_poll_plural",
|
|
154
|
+
params
|
|
155
|
+
};
|
|
156
|
+
case "new:post:thread":
|
|
157
|
+
case "new:post:text":
|
|
158
|
+
default:
|
|
159
|
+
return { key: "post_detail_one_liner_send_message_post_plural", params };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function sentSingular(postType) {
|
|
163
|
+
if (MEDIA_TYPES.has(postType))
|
|
164
|
+
return { key: "post_detail_one_liner_send_private_image_post_singular" };
|
|
165
|
+
switch (postType) {
|
|
166
|
+
case "new:post:link":
|
|
167
|
+
return { key: "post_detail_one_liner_send_private_link_post_singular" };
|
|
168
|
+
case "new:post:poll":
|
|
169
|
+
return { key: "post_detail_one_liner_send_private_link_poll_singular" };
|
|
170
|
+
case "new:post:thread":
|
|
171
|
+
case "new:post:text":
|
|
172
|
+
default:
|
|
173
|
+
return { key: "post_detail_one_liner_send_message_post_singular" };
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
var POST_TYPE_HINT_DEFAULTS = {
|
|
177
|
+
// in-group (one-liner)
|
|
178
|
+
post_detail_one_liner_receive_and_send_group_image_post: () => "shared a media post in group",
|
|
179
|
+
post_detail_one_liner_receive_and_send_group_link_post: () => "shared a link post in group",
|
|
180
|
+
post_detail_one_liner_receive_and_send_group_poll_post: () => "shared a poll in group",
|
|
181
|
+
post_detail_one_liner_receive_and_send_group_thread_post: () => "shared a thread in group",
|
|
182
|
+
post_detail_one_liner_receive_and_send_group_message_post: () => "shared a post in group",
|
|
183
|
+
// in-group (meta description)
|
|
184
|
+
post_detail_meta_description_type_image_post: () => "A media post",
|
|
185
|
+
post_detail_meta_description_type_link_post: () => "A link post",
|
|
186
|
+
post_detail_meta_description_type_poll_post: () => "A poll",
|
|
187
|
+
post_detail_meta_description_type_message_post: () => "A post",
|
|
188
|
+
// owner / 1:M sent — plural
|
|
189
|
+
post_detail_one_liner_send_private_image_post_plural: (p) => `sent a media post to ${p?.count ?? 0} people`,
|
|
190
|
+
post_detail_one_liner_send_private_link_post_plural: (p) => `sent a link post to ${p?.count ?? 0} people`,
|
|
191
|
+
post_detail_one_liner_send_private_link_poll_plural: (p) => `sent a poll to ${p?.count ?? 0} people`,
|
|
192
|
+
post_detail_one_liner_send_message_post_plural: (p) => `sent a post to ${p?.count ?? 0} people`,
|
|
193
|
+
// owner / 1:M sent — singular
|
|
194
|
+
post_detail_one_liner_send_private_image_post_singular: () => "sent a media post",
|
|
195
|
+
post_detail_one_liner_send_private_link_post_singular: () => "sent a link post",
|
|
196
|
+
post_detail_one_liner_send_private_link_poll_singular: () => "sent a poll",
|
|
197
|
+
post_detail_one_liner_send_message_post_singular: () => "sent a post",
|
|
198
|
+
// private 1:1 received
|
|
199
|
+
post_detail_one_liner_receive_private_image_post: () => "sent you a media post",
|
|
200
|
+
post_detail_one_liner_receive_private_link_post: () => "sent you a link post",
|
|
201
|
+
post_detail_one_liner_receive_private_poll_post: () => "sent you a poll",
|
|
202
|
+
post_detail_one_liner_receive_message_post: () => "sent you a post"
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// src/utils/relativeTime.ts
|
|
206
|
+
var UNITS = [
|
|
207
|
+
["year", 31536e3],
|
|
208
|
+
["month", 2592e3],
|
|
209
|
+
["week", 604800],
|
|
210
|
+
["day", 86400],
|
|
211
|
+
["hour", 3600],
|
|
212
|
+
["minute", 60]
|
|
213
|
+
];
|
|
214
|
+
function formatRelativeTime(iso, locale = "en") {
|
|
215
|
+
const diffMs = Date.now() - new Date(iso).getTime();
|
|
216
|
+
const seconds = Math.round(diffMs / 1e3);
|
|
217
|
+
if (Math.abs(seconds) < 60) return "just now";
|
|
218
|
+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
219
|
+
for (const [unit, secs] of UNITS) {
|
|
220
|
+
if (Math.abs(seconds) >= secs) {
|
|
221
|
+
const value = Math.round(seconds / secs);
|
|
222
|
+
return rtf.format(-value, unit);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return "just now";
|
|
226
|
+
}
|
|
227
|
+
|
|
67
228
|
// src/components/PostHeader.tsx
|
|
68
229
|
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
69
|
-
function formatRelativeTime(iso) {
|
|
70
|
-
const diff = Date.now() - new Date(iso).getTime();
|
|
71
|
-
const minutes = Math.floor(diff / 6e4);
|
|
72
|
-
if (minutes < 1) return "just now";
|
|
73
|
-
if (minutes < 60) return `${minutes}m`;
|
|
74
|
-
const hours = Math.floor(minutes / 60);
|
|
75
|
-
if (hours < 24) return `${hours}h`;
|
|
76
|
-
const days = Math.floor(hours / 24);
|
|
77
|
-
return `${days}d`;
|
|
78
|
-
}
|
|
79
230
|
var PostHeader = ({
|
|
80
231
|
author,
|
|
81
232
|
authorHref,
|
|
@@ -83,8 +234,14 @@ var PostHeader = ({
|
|
|
83
234
|
groupHref,
|
|
84
235
|
postedAt,
|
|
85
236
|
postType,
|
|
237
|
+
isPrivate = false,
|
|
238
|
+
membersCount,
|
|
239
|
+
crossPostGroup,
|
|
240
|
+
locale,
|
|
241
|
+
translate,
|
|
86
242
|
isFeatured = false,
|
|
87
243
|
isPostPreview = false,
|
|
244
|
+
isPostDetail = false,
|
|
88
245
|
isAdmin = false,
|
|
89
246
|
isOwner = false,
|
|
90
247
|
onErasePress,
|
|
@@ -95,6 +252,13 @@ var PostHeader = ({
|
|
|
95
252
|
labels
|
|
96
253
|
}) => {
|
|
97
254
|
const cancelLabel = labels?.cancelPost ?? "Cancel";
|
|
255
|
+
const { key: hintKey, params: hintParams } = getPostTypeHint(postType, {
|
|
256
|
+
isInGroup: !!group,
|
|
257
|
+
isOwner,
|
|
258
|
+
isPrivate,
|
|
259
|
+
membersCount
|
|
260
|
+
});
|
|
261
|
+
const hintText = translate?.(hintKey, hintParams) ?? POST_TYPE_HINT_DEFAULTS[hintKey]?.(hintParams) ?? hintKey;
|
|
98
262
|
const badgeVariant = isOwner ? "owner" : isAdmin ? "admin" : void 0;
|
|
99
263
|
const authorNameNode = isPostPreview ? /* @__PURE__ */ jsx2("span", { className: "flex text-base font-semibold leading-[100%] text-foreground", children: author.name }) : LinkComponent ? /* @__PURE__ */ jsx2(
|
|
100
264
|
LinkComponent,
|
|
@@ -165,7 +329,7 @@ var PostHeader = ({
|
|
|
165
329
|
),
|
|
166
330
|
/* @__PURE__ */ jsxs("section", { className: "flex flex-1 flex-col justify-center min-w-0", children: [
|
|
167
331
|
/* @__PURE__ */ jsx2("section", { className: "flex items-baseline justify-between gap-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
168
|
-
/* @__PURE__ */ jsx2("div", { className: "font-semibold text-foreground truncate", children: authorNameNode }),
|
|
332
|
+
isPostDetail ? /* @__PURE__ */ jsx2("h2", { className: "font-semibold text-foreground truncate", children: authorNameNode }) : /* @__PURE__ */ jsx2("div", { className: "font-semibold text-foreground truncate", children: authorNameNode }),
|
|
169
333
|
isFeatured && /* @__PURE__ */ jsx2(
|
|
170
334
|
"svg",
|
|
171
335
|
{
|
|
@@ -173,7 +337,7 @@ var PostHeader = ({
|
|
|
173
337
|
viewBox: "0 0 24 24",
|
|
174
338
|
width: 14,
|
|
175
339
|
height: 14,
|
|
176
|
-
className: "text-
|
|
340
|
+
className: "text-highlight fill-highlight shrink-0",
|
|
177
341
|
"aria-label": "Featured post",
|
|
178
342
|
children: /* @__PURE__ */ jsx2("path", { d: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" })
|
|
179
343
|
}
|
|
@@ -186,16 +350,44 @@ var PostHeader = ({
|
|
|
186
350
|
title: postedAt,
|
|
187
351
|
className: "text-xs text-muted-foreground whitespace-nowrap shrink-0",
|
|
188
352
|
dateTime: postedAt,
|
|
189
|
-
children: formatRelativeTime(postedAt)
|
|
353
|
+
children: formatRelativeTime(postedAt, locale ?? "en")
|
|
190
354
|
}
|
|
191
355
|
)
|
|
192
356
|
] })
|
|
193
357
|
] }) }),
|
|
194
358
|
/* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground truncate mt-0.5", children: [
|
|
195
|
-
/* @__PURE__ */ jsx2("span", { children:
|
|
359
|
+
/* @__PURE__ */ jsx2("span", { children: hintText }),
|
|
196
360
|
groupLinkNode && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
197
361
|
/* @__PURE__ */ jsx2("span", { className: "mx-1" }),
|
|
198
362
|
groupLinkNode
|
|
363
|
+
] }),
|
|
364
|
+
crossPostGroup && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
365
|
+
/* @__PURE__ */ jsx2("span", { className: "mx-1", children: "via" }),
|
|
366
|
+
LinkComponent && crossPostGroup.href ? /* @__PURE__ */ jsxs(
|
|
367
|
+
LinkComponent,
|
|
368
|
+
{
|
|
369
|
+
href: crossPostGroup.href,
|
|
370
|
+
className: "text-action-primary font-medium hover:underline no-underline",
|
|
371
|
+
children: [
|
|
372
|
+
"#",
|
|
373
|
+
crossPostGroup.name
|
|
374
|
+
]
|
|
375
|
+
}
|
|
376
|
+
) : crossPostGroup.href ? /* @__PURE__ */ jsxs(
|
|
377
|
+
"a",
|
|
378
|
+
{
|
|
379
|
+
href: crossPostGroup.href,
|
|
380
|
+
onClick: (e) => e.stopPropagation(),
|
|
381
|
+
className: "text-action-primary font-medium hover:underline no-underline",
|
|
382
|
+
children: [
|
|
383
|
+
"#",
|
|
384
|
+
crossPostGroup.name
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
) : /* @__PURE__ */ jsxs("span", { className: "text-action-primary font-medium", children: [
|
|
388
|
+
"#",
|
|
389
|
+
crossPostGroup.name
|
|
390
|
+
] })
|
|
199
391
|
] })
|
|
200
392
|
] })
|
|
201
393
|
] })
|
|
@@ -288,7 +480,8 @@ var checkMentionDataIndex = (mentionData = [], copyMentionData = [], body = "")
|
|
|
288
480
|
};
|
|
289
481
|
var isLinkInternal = (url, supportDeepviewDomain) => {
|
|
290
482
|
if (!url) return false;
|
|
291
|
-
|
|
483
|
+
const domains = Array.isArray(supportDeepviewDomain) ? supportDeepviewDomain : supportDeepviewDomain ? [supportDeepviewDomain] : [];
|
|
484
|
+
return domains.some((d) => d.length > 0 && url.includes(d));
|
|
292
485
|
};
|
|
293
486
|
var getUrl = (match, phone) => {
|
|
294
487
|
const type = match.getType();
|
|
@@ -381,7 +574,7 @@ var AutoLink = ({
|
|
|
381
574
|
const renderLink = useCallback(
|
|
382
575
|
(text, match, index) => {
|
|
383
576
|
const [url] = getUrl(match, phone);
|
|
384
|
-
if (
|
|
577
|
+
if (isLinkInternal(url, supportDeepviewDomain)) {
|
|
385
578
|
const internal = true;
|
|
386
579
|
return /* @__PURE__ */ jsx3(
|
|
387
580
|
"a",
|
|
@@ -1251,7 +1444,7 @@ var MediaView = ({
|
|
|
1251
1444
|
return /* @__PURE__ */ jsx8(
|
|
1252
1445
|
"div",
|
|
1253
1446
|
{
|
|
1254
|
-
onClick:
|
|
1447
|
+
onClick: onCardPress,
|
|
1255
1448
|
className: textViewClass,
|
|
1256
1449
|
style: {
|
|
1257
1450
|
backgroundColor: item.option_color
|
|
@@ -1637,7 +1830,12 @@ var PostPollView_default = PostPollView;
|
|
|
1637
1830
|
|
|
1638
1831
|
// src/components/PostTextItem.tsx
|
|
1639
1832
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1640
|
-
var PostTextItem = ({
|
|
1833
|
+
var PostTextItem = ({
|
|
1834
|
+
textItems,
|
|
1835
|
+
showFullText,
|
|
1836
|
+
onNavigate,
|
|
1837
|
+
supportDeepviewDomain
|
|
1838
|
+
}) => {
|
|
1641
1839
|
return /* @__PURE__ */ jsx14("div", { className: "flex-1", children: /* @__PURE__ */ jsx14("div", { children: textItems.map((item, index) => {
|
|
1642
1840
|
const text = "text" in item ? item.text ?? "" : "";
|
|
1643
1841
|
const key = "key" in item ? item.key : index;
|
|
@@ -1647,6 +1845,8 @@ var PostTextItem = ({ textItems, showFullText }) => {
|
|
|
1647
1845
|
{
|
|
1648
1846
|
text: showFullText ? text : TruncateText(text, 300),
|
|
1649
1847
|
mentionData,
|
|
1848
|
+
onNavigate,
|
|
1849
|
+
supportDeepviewDomain,
|
|
1650
1850
|
className: "whitespace-normal px-4 pb-4 leading-relaxed text-gray-800",
|
|
1651
1851
|
style: {
|
|
1652
1852
|
whiteSpace: "pre-wrap",
|
|
@@ -1671,7 +1871,8 @@ var getHostFromUrl = (url) => {
|
|
|
1671
1871
|
}
|
|
1672
1872
|
};
|
|
1673
1873
|
var getLinkRel = (host, supportDeepviewDomain = "") => {
|
|
1674
|
-
const
|
|
1874
|
+
const domains = Array.isArray(supportDeepviewDomain) ? supportDeepviewDomain : supportDeepviewDomain ? [supportDeepviewDomain] : [];
|
|
1875
|
+
const isInternal = domains.some((d) => d.length > 0 && host.includes(d));
|
|
1675
1876
|
return isInternal ? "noreferrer" : "noreferrer nofollow";
|
|
1676
1877
|
};
|
|
1677
1878
|
var PostLinkItem = ({
|
|
@@ -2035,7 +2236,9 @@ var PostItemsView = ({
|
|
|
2035
2236
|
parentId,
|
|
2036
2237
|
isCommentScope,
|
|
2037
2238
|
imageComponent,
|
|
2038
|
-
mediaItemStatuses
|
|
2239
|
+
mediaItemStatuses,
|
|
2240
|
+
onNavigate,
|
|
2241
|
+
supportDeepviewDomain
|
|
2039
2242
|
}) => {
|
|
2040
2243
|
if (!primaryContent) return null;
|
|
2041
2244
|
switch (primaryContent.type) {
|
|
@@ -2067,7 +2270,8 @@ var PostItemsView = ({
|
|
|
2067
2270
|
type: "linkItem"
|
|
2068
2271
|
}
|
|
2069
2272
|
],
|
|
2070
|
-
imageComponent
|
|
2273
|
+
imageComponent,
|
|
2274
|
+
supportDeepviewDomain
|
|
2071
2275
|
}
|
|
2072
2276
|
);
|
|
2073
2277
|
case "media":
|
|
@@ -2087,7 +2291,9 @@ var PostItemsView = ({
|
|
|
2087
2291
|
{
|
|
2088
2292
|
textItems: primaryContent.items,
|
|
2089
2293
|
showFullText: isPostDetail,
|
|
2090
|
-
isPostDetail
|
|
2294
|
+
isPostDetail,
|
|
2295
|
+
onNavigate,
|
|
2296
|
+
supportDeepviewDomain
|
|
2091
2297
|
}
|
|
2092
2298
|
);
|
|
2093
2299
|
default:
|
|
@@ -2163,20 +2369,27 @@ var contentTypeConstants = {
|
|
|
2163
2369
|
};
|
|
2164
2370
|
|
|
2165
2371
|
// src/components/PostSectionSourceInfoView.tsx
|
|
2372
|
+
import { Avatar as Avatar2, AvatarImage as AvatarImage2, AvatarFallback as AvatarFallback2 } from "@select-org/ui";
|
|
2166
2373
|
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2167
|
-
var PostSectionSourceInfoView = ({
|
|
2374
|
+
var PostSectionSourceInfoView = ({
|
|
2375
|
+
sourceInfo,
|
|
2376
|
+
imageComponent
|
|
2377
|
+
}) => {
|
|
2168
2378
|
if (!sourceInfo) {
|
|
2169
2379
|
return null;
|
|
2170
2380
|
}
|
|
2171
2381
|
return /* @__PURE__ */ jsx20("div", { className: "mx-4 mb-3 mt-3 border-b border-gray-100 pb-3", children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-row items-center", children: [
|
|
2172
|
-
/* @__PURE__ */
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2382
|
+
/* @__PURE__ */ jsxs11(Avatar2, { size: "sm", className: "shrink-0 ring-1 ring-border-subtle", children: [
|
|
2383
|
+
/* @__PURE__ */ jsx20(
|
|
2384
|
+
AvatarImage2,
|
|
2385
|
+
{
|
|
2386
|
+
src: sourceInfo.avatar,
|
|
2387
|
+
alt: sourceInfo.username,
|
|
2388
|
+
imageComponent
|
|
2389
|
+
}
|
|
2390
|
+
),
|
|
2391
|
+
/* @__PURE__ */ jsx20(AvatarFallback2, { name: sourceInfo.username, className: "text-xs" })
|
|
2392
|
+
] }),
|
|
2180
2393
|
/* @__PURE__ */ jsxs11("div", { className: "ml-2 flex-col justify-center flex", children: [
|
|
2181
2394
|
/* @__PURE__ */ jsx20("div", { className: "text-sm font-semibold text-foreground leading-none", children: sourceInfo.username }),
|
|
2182
2395
|
/* @__PURE__ */ jsx20("div", { className: "text-xs text-muted-foreground mt-1 leading-none", children: sourceInfo.url })
|
|
@@ -2190,7 +2403,10 @@ import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
|
2190
2403
|
var PostSectionsView = ({
|
|
2191
2404
|
sections,
|
|
2192
2405
|
isPostDetail,
|
|
2193
|
-
onCardPress
|
|
2406
|
+
onCardPress,
|
|
2407
|
+
onNavigate,
|
|
2408
|
+
supportDeepviewDomain,
|
|
2409
|
+
imageComponent
|
|
2194
2410
|
}) => {
|
|
2195
2411
|
const renderSectionItem = useCallback3(
|
|
2196
2412
|
(section, index) => {
|
|
@@ -2205,14 +2421,22 @@ var PostSectionsView = ({
|
|
|
2205
2421
|
whiteSpace: "pre-wrap",
|
|
2206
2422
|
wordBreak: "break-word"
|
|
2207
2423
|
},
|
|
2208
|
-
mentionData: data.mentionData
|
|
2424
|
+
mentionData: data.mentionData,
|
|
2425
|
+
onNavigate,
|
|
2426
|
+
supportDeepviewDomain
|
|
2209
2427
|
},
|
|
2210
2428
|
`${index} - ${data.body}`
|
|
2211
2429
|
);
|
|
2212
2430
|
}
|
|
2213
2431
|
if (type === contentTypeConstants.NEW_POST_MEDIA) {
|
|
2214
2432
|
return /* @__PURE__ */ jsxs12("div", { className: "my-3", children: [
|
|
2215
|
-
data.sourceInfo && /* @__PURE__ */ jsx21(
|
|
2433
|
+
data.sourceInfo && /* @__PURE__ */ jsx21(
|
|
2434
|
+
PostSectionSourceInfoView_default,
|
|
2435
|
+
{
|
|
2436
|
+
sourceInfo: data.sourceInfo,
|
|
2437
|
+
imageComponent
|
|
2438
|
+
}
|
|
2439
|
+
),
|
|
2216
2440
|
data.body && /* @__PURE__ */ jsx21(
|
|
2217
2441
|
AutoLink_default,
|
|
2218
2442
|
{
|
|
@@ -2222,7 +2446,9 @@ var PostSectionsView = ({
|
|
|
2222
2446
|
whiteSpace: "pre-wrap",
|
|
2223
2447
|
wordBreak: "break-word"
|
|
2224
2448
|
},
|
|
2225
|
-
mentionData: data.mentionData
|
|
2449
|
+
mentionData: data.mentionData,
|
|
2450
|
+
onNavigate,
|
|
2451
|
+
supportDeepviewDomain
|
|
2226
2452
|
},
|
|
2227
2453
|
`${index} - ${data.body}`
|
|
2228
2454
|
),
|
|
@@ -2238,7 +2464,7 @@ var PostSectionsView = ({
|
|
|
2238
2464
|
}
|
|
2239
2465
|
return null;
|
|
2240
2466
|
},
|
|
2241
|
-
[isPostDetail, onCardPress]
|
|
2467
|
+
[isPostDetail, onCardPress, onNavigate, supportDeepviewDomain, imageComponent]
|
|
2242
2468
|
);
|
|
2243
2469
|
if (!sections || sections.length === 0) {
|
|
2244
2470
|
return null;
|
|
@@ -2262,6 +2488,7 @@ var PostFooter = ({
|
|
|
2262
2488
|
footerLinkHref = "/",
|
|
2263
2489
|
isSnoozed = false,
|
|
2264
2490
|
onSnoozeToggle,
|
|
2491
|
+
linkComponent: LinkComponent,
|
|
2265
2492
|
renderReactionTrigger,
|
|
2266
2493
|
renderReactionModal
|
|
2267
2494
|
}) => {
|
|
@@ -2321,7 +2548,18 @@ var PostFooter = ({
|
|
|
2321
2548
|
}
|
|
2322
2549
|
}) })
|
|
2323
2550
|
] }),
|
|
2324
|
-
/* @__PURE__ */ jsx22("div", { className: "relative flex items-center ml-auto", children: postHref ? /* @__PURE__ */ jsxs13(
|
|
2551
|
+
/* @__PURE__ */ jsx22("div", { className: "relative flex items-center ml-auto", children: postHref ? LinkComponent ? /* @__PURE__ */ jsxs13(
|
|
2552
|
+
LinkComponent,
|
|
2553
|
+
{
|
|
2554
|
+
href: postHref,
|
|
2555
|
+
className: cn(commentButtonClass, "no-underline"),
|
|
2556
|
+
children: [
|
|
2557
|
+
/* @__PURE__ */ jsx22(AppIcon, { name: "messageCircleMore", "aria-hidden": "true" }),
|
|
2558
|
+
/* @__PURE__ */ jsx22("span", { className: "sr-only", children: commentAriaLabel }),
|
|
2559
|
+
commentBadge
|
|
2560
|
+
]
|
|
2561
|
+
}
|
|
2562
|
+
) : /* @__PURE__ */ jsxs13(
|
|
2325
2563
|
"a",
|
|
2326
2564
|
{
|
|
2327
2565
|
href: postHref,
|
|
@@ -2339,14 +2577,10 @@ var PostFooter = ({
|
|
|
2339
2577
|
/* @__PURE__ */ jsx22(AppIcon, { name: "messageCircleMore", "aria-hidden": "true" }),
|
|
2340
2578
|
commentBadge
|
|
2341
2579
|
] }) }),
|
|
2342
|
-
showFooterLink && /* @__PURE__ */
|
|
2343
|
-
"
|
|
2344
|
-
{
|
|
2345
|
-
|
|
2346
|
-
className: "bg-action-primary/5 hover:bg-action-primary/10 transition-colors w-full text-center py-3 text-sm font-medium text-action-primary no-underline rounded-b-xl border-t border-action-primary/10",
|
|
2347
|
-
children: footerLinkLabel
|
|
2348
|
-
}
|
|
2349
|
-
) })
|
|
2580
|
+
showFooterLink && /* @__PURE__ */ (() => {
|
|
2581
|
+
const footerLinkClass = "bg-action-primary/5 hover:bg-action-primary/10 transition-colors w-full text-center py-3 text-sm font-medium text-action-primary no-underline rounded-b-xl border-t border-action-primary/10";
|
|
2582
|
+
return /* @__PURE__ */ jsx22("section", { className: "flex justify-center -mx-5 -mb-2.5 mt-2.5", children: LinkComponent ? /* @__PURE__ */ jsx22(LinkComponent, { href: footerLinkHref, className: footerLinkClass, children: footerLinkLabel }) : /* @__PURE__ */ jsx22("a", { href: footerLinkHref, className: footerLinkClass, children: footerLinkLabel }) });
|
|
2583
|
+
})()
|
|
2350
2584
|
] });
|
|
2351
2585
|
};
|
|
2352
2586
|
var PostFooter_default = PostFooter;
|
|
@@ -2567,7 +2801,13 @@ var PostCard = ({
|
|
|
2567
2801
|
imageComponent,
|
|
2568
2802
|
isAdmin,
|
|
2569
2803
|
isOwner,
|
|
2804
|
+
isPostOwner,
|
|
2570
2805
|
isPostPreview,
|
|
2806
|
+
isPrivate,
|
|
2807
|
+
membersCount,
|
|
2808
|
+
crossPostGroup,
|
|
2809
|
+
locale,
|
|
2810
|
+
translate,
|
|
2571
2811
|
onPostPress,
|
|
2572
2812
|
onErasePress,
|
|
2573
2813
|
onCancelPost,
|
|
@@ -2645,10 +2885,10 @@ var PostCard = ({
|
|
|
2645
2885
|
"article",
|
|
2646
2886
|
{
|
|
2647
2887
|
className: cn(
|
|
2648
|
-
"flex flex-col box-border bg-background",
|
|
2888
|
+
"w-full flex flex-col box-border bg-background",
|
|
2649
2889
|
!isPostDetail && "cursor-pointer sm:border border-border rounded-xl sm:rounded-2xl overflow-hidden shadow-sm hover:shadow-md transition-shadow duration-300 relative mt-6",
|
|
2650
2890
|
isPostDetail && "cursor-auto rounded-t-2xl w-full",
|
|
2651
|
-
post.isFeatured && !isPostDetail && "bg-surface
|
|
2891
|
+
post.isFeatured && !isPostDetail && "bg-highlight-surface border-highlight-border sm:border-t-4",
|
|
2652
2892
|
isPending && "cursor-default",
|
|
2653
2893
|
className
|
|
2654
2894
|
),
|
|
@@ -2695,8 +2935,14 @@ var PostCard = ({
|
|
|
2695
2935
|
postType: post.postType,
|
|
2696
2936
|
isFeatured: post.isFeatured,
|
|
2697
2937
|
isPostPreview,
|
|
2938
|
+
isPostDetail,
|
|
2698
2939
|
isAdmin,
|
|
2699
2940
|
isOwner,
|
|
2941
|
+
isPrivate,
|
|
2942
|
+
membersCount,
|
|
2943
|
+
crossPostGroup,
|
|
2944
|
+
locale,
|
|
2945
|
+
translate,
|
|
2700
2946
|
onErasePress: onErasePress ? handleErasePress : void 0,
|
|
2701
2947
|
onCancelPost,
|
|
2702
2948
|
renderActionsMenu,
|
|
@@ -2724,7 +2970,10 @@ var PostCard = ({
|
|
|
2724
2970
|
sections: resolvedContent.sections.sections,
|
|
2725
2971
|
isPostDetail,
|
|
2726
2972
|
onCardPress: onCardPress ?? (() => {
|
|
2727
|
-
})
|
|
2973
|
+
}),
|
|
2974
|
+
onNavigate,
|
|
2975
|
+
supportDeepviewDomain,
|
|
2976
|
+
imageComponent
|
|
2728
2977
|
}
|
|
2729
2978
|
),
|
|
2730
2979
|
/* @__PURE__ */ jsx25(
|
|
@@ -2736,11 +2985,13 @@ var PostCard = ({
|
|
|
2736
2985
|
}),
|
|
2737
2986
|
onVotePress: onVotePress ?? (() => {
|
|
2738
2987
|
}),
|
|
2739
|
-
isPostOwner
|
|
2988
|
+
isPostOwner,
|
|
2740
2989
|
parentId: post.context_id,
|
|
2741
2990
|
isCommentScope: false,
|
|
2742
2991
|
imageComponent,
|
|
2743
|
-
mediaItemStatuses
|
|
2992
|
+
mediaItemStatuses,
|
|
2993
|
+
onNavigate,
|
|
2994
|
+
supportDeepviewDomain
|
|
2744
2995
|
}
|
|
2745
2996
|
),
|
|
2746
2997
|
/* @__PURE__ */ jsx25(
|
|
@@ -2765,6 +3016,7 @@ var PostCard = ({
|
|
|
2765
3016
|
showFooterLink,
|
|
2766
3017
|
footerLinkLabel,
|
|
2767
3018
|
footerLinkHref,
|
|
3019
|
+
linkComponent,
|
|
2768
3020
|
renderReactionTrigger,
|
|
2769
3021
|
renderReactionModal
|
|
2770
3022
|
}
|
|
@@ -2900,6 +3152,7 @@ export {
|
|
|
2900
3152
|
AutoLink_default as AutoLink,
|
|
2901
3153
|
EraseConfirmModal_default as EraseConfirmModal,
|
|
2902
3154
|
MediaUploadStatusOverlay_default as MediaUploadStatusOverlay,
|
|
3155
|
+
POST_TYPE_HINT_DEFAULTS,
|
|
2903
3156
|
PostBody_default as PostBody,
|
|
2904
3157
|
PostCard_default as PostCard,
|
|
2905
3158
|
PostEmail_default as PostEmail,
|
|
@@ -2916,6 +3169,7 @@ export {
|
|
|
2916
3169
|
PostTextItem_default as PostTextItem,
|
|
2917
3170
|
PostUploadStrip_default as PostUploadStrip,
|
|
2918
3171
|
ReactionModal,
|
|
3172
|
+
getPostTypeHint,
|
|
2919
3173
|
hasMeaningfulHtml,
|
|
2920
3174
|
resolvePostContent
|
|
2921
3175
|
};
|