@openpeepshq/react 0.7.0 → 0.8.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.
Files changed (251) hide show
  1. package/dist/components/configuration/ConfigurationCategory.js +3 -2
  2. package/dist/components/configuration/ConfigurationList.js +1 -1
  3. package/dist/components/form/LocationInput.js +1 -1
  4. package/dist/components/jams/JamCapacityGate.js +1 -1
  5. package/dist/components/jams/JamConference.js +2 -0
  6. package/dist/components/jams/JamParticipantConference.js +2 -0
  7. package/dist/components/jams/JamRoom.js +2 -3
  8. package/dist/components/jams/LiveJamsSection.js +8 -2
  9. package/dist/components/jams/LivekitUnavailableNotice.d.ts +9 -0
  10. package/dist/components/jams/LivekitUnavailableNotice.js +19 -0
  11. package/dist/components/jams/dropLateAudio.d.ts +22 -0
  12. package/dist/components/jams/dropLateAudio.js +115 -0
  13. package/dist/components/jams/index.d.ts +1 -0
  14. package/dist/components/jams/index.js +1 -0
  15. package/dist/components/markdown/compileMarkdown.js +1 -0
  16. package/dist/components/navigation/FooterMobile.js +4 -3
  17. package/dist/components/navigation/HeaderMobile.js +5 -2
  18. package/dist/components/navigation/MobileMenuItem.d.ts +3 -1
  19. package/dist/components/navigation/MobileMenuItem.js +7 -2
  20. package/dist/components/navigation/NavWithTooltip.d.ts +9 -0
  21. package/dist/components/navigation/NavWithTooltip.js +4 -0
  22. package/dist/components/navigation/index.d.ts +2 -0
  23. package/dist/components/navigation/index.js +1 -0
  24. package/dist/components/navigation/sideBarNavLinkClass.d.ts +6 -4
  25. package/dist/components/navigation/sideBarNavLinkClass.js +6 -2
  26. package/dist/components/notifications/TypedNotification.js +46 -4
  27. package/dist/components/post/CompactReplyParent.js +5 -6
  28. package/dist/components/post/Markdown.d.ts +2 -2
  29. package/dist/components/post/Markdown.js +1 -1
  30. package/dist/components/post/TruncatedMarkdown.d.ts +27 -0
  31. package/dist/components/post/TruncatedMarkdown.js +37 -0
  32. package/dist/components/post/attachmentPreview.js +1 -1
  33. package/dist/components/post/helpers.d.ts +2 -2
  34. package/dist/components/post/helpers.js +3 -16
  35. package/dist/components/post/index.d.ts +2 -0
  36. package/dist/components/post/index.js +1 -0
  37. package/dist/components/post/pieces/Attachments.js +23 -17
  38. package/dist/components/post/pieces/EventLocation.js +14 -0
  39. package/dist/components/post/pieces/EventRsvpButton.js +39 -7
  40. package/dist/components/post/pieces/EventRsvpList.js +23 -3
  41. package/dist/components/post/pieces/EventRsvpScopeDialog.d.ts +1 -1
  42. package/dist/components/post/pieces/EventRsvpScopeDialog.js +34 -22
  43. package/dist/components/post/pieces/EventWaitlistJoinDialog.d.ts +10 -0
  44. package/dist/components/post/pieces/EventWaitlistJoinDialog.js +26 -0
  45. package/dist/components/post/pieces/ParticipantsCard.d.ts +1 -1
  46. package/dist/components/post/pieces/ParticipantsCard.js +1 -1
  47. package/dist/components/post/pieces/PollContent.js +8 -2
  48. package/dist/components/post/pieces/PostActions.d.ts +1 -1
  49. package/dist/components/post/pieces/PostActions.js +20 -12
  50. package/dist/components/post/pieces/ShareMenu.d.ts +6 -1
  51. package/dist/components/post/pieces/ShareMenu.js +40 -7
  52. package/dist/components/post/post-form/ArticleForm.js +1 -1
  53. package/dist/components/post/post-form/EventForm.js +33 -5
  54. package/dist/components/post/post-form/ResourceForm.d.ts +3 -1
  55. package/dist/components/post/post-form/ResourceForm.js +48 -7
  56. package/dist/components/post/post-form/VisibilitySelector.js +9 -3
  57. package/dist/components/post/types/Article.js +2 -3
  58. package/dist/components/post/types/Event.js +10 -1
  59. package/dist/components/post/types/article/FullArticle.js +1 -1
  60. package/dist/components/post/types/event/CardEvent.js +2 -1
  61. package/dist/components/post/types/event/FullEvent.js +22 -13
  62. package/dist/components/post/types/event/ProfileEventRelationship.js +8 -0
  63. package/dist/components/post/types/resource/FullResource.js +3 -3
  64. package/dist/components/preview-link/LocalPreviewLink.js +4 -2
  65. package/dist/components/preview-link/PreviewLink.js +1 -1
  66. package/dist/components/preview-link/helpers.d.ts +5 -0
  67. package/dist/components/preview-link/helpers.js +27 -1
  68. package/dist/components/preview-link/local/WelcomePreview.d.ts +1 -0
  69. package/dist/components/preview-link/local/WelcomePreview.js +8 -0
  70. package/dist/components/profile/Avatar.js +2 -2
  71. package/dist/components/profile/ProfileFromId.js +1 -1
  72. package/dist/components/resources/ResourceCard.d.ts +5 -1
  73. package/dist/components/resources/ResourceCard.js +29 -5
  74. package/dist/components/resources/ResourceCard.test.d.ts +1 -0
  75. package/dist/components/resources/ResourceCard.test.js +75 -0
  76. package/dist/components/resources/ResourceLibrary.js +1 -1
  77. package/dist/components/server-data/context.d.ts +1 -0
  78. package/dist/contexts/openpeeps/hooks/accounts.d.ts +5 -5
  79. package/dist/contexts/openpeeps/hooks/accounts.js +1 -3
  80. package/dist/contexts/openpeeps/hooks/admin.d.ts +165 -66
  81. package/dist/contexts/openpeeps/hooks/admin.js +11 -3
  82. package/dist/contexts/openpeeps/hooks/auth.d.ts +2 -2
  83. package/dist/contexts/openpeeps/hooks/groups.d.ts +8 -8
  84. package/dist/contexts/openpeeps/hooks/jams.d.ts +73 -24
  85. package/dist/contexts/openpeeps/hooks/other.d.ts +7 -6
  86. package/dist/contexts/openpeeps/hooks/payments.d.ts +2 -2
  87. package/dist/contexts/openpeeps/hooks/posts.d.ts +368 -170
  88. package/dist/contexts/openpeeps/hooks/streaming.d.ts +1 -1
  89. package/dist/hooks/admin/useCanAccessAdminSection.d.ts +13 -0
  90. package/dist/hooks/admin/useCanAccessAdminSection.js +21 -0
  91. package/dist/hooks/events/useEventComposer.d.ts +94 -41
  92. package/dist/hooks/events/useEventForm.d.ts +1 -0
  93. package/dist/hooks/events/useEventRsvp.d.ts +12 -2
  94. package/dist/hooks/events/useEventRsvp.js +59 -10
  95. package/dist/hooks/events/useEventsCalendar.d.ts +174 -76
  96. package/dist/hooks/groups/useNewGroup.js +22 -2
  97. package/dist/hooks/index.d.ts +5 -1
  98. package/dist/hooks/index.js +4 -1
  99. package/dist/hooks/jams/useCanDiagnoseLivekit.d.ts +2 -0
  100. package/dist/hooks/jams/useCanDiagnoseLivekit.js +3 -0
  101. package/dist/hooks/jams/useCreateNewJamForm.d.ts +3 -1
  102. package/dist/hooks/jams/useJamDetails.d.ts +87 -38
  103. package/dist/hooks/jams/useJamLobby.d.ts +1 -0
  104. package/dist/hooks/jams/useJamRoom.d.ts +175 -76
  105. package/dist/hooks/posts/useArticleComposer.d.ts +93 -41
  106. package/dist/hooks/posts/useFeedPostPresentation.d.ts +174 -76
  107. package/dist/hooks/posts/usePostDetailTitle.d.ts +87 -38
  108. package/dist/hooks/posts/useResourceComposer.d.ts +95 -41
  109. package/dist/hooks/posts/useResourceComposer.js +135 -27
  110. package/dist/hooks/posts/useShareMenu.d.ts +2 -0
  111. package/dist/hooks/posts/useShareMenu.js +7 -0
  112. package/dist/hooks/resources/useResourceLibrary.d.ts +177 -79
  113. package/dist/hooks/resources/useResourceLibrary.js +6 -2
  114. package/dist/hooks/settings/useNotificationPreferences.d.ts +1 -1
  115. package/dist/hooks/useWelcomePreview.d.ts +16 -0
  116. package/dist/hooks/useWelcomePreview.js +40 -0
  117. package/dist/lib/groupFormErrors.d.ts +1 -0
  118. package/dist/lib/groupFormErrors.js +5 -2
  119. package/dist/lib/threadHelpers.js +1 -5
  120. package/dist/navigation/menuItems.js +15 -0
  121. package/dist/navigation/targets.d.ts +2 -0
  122. package/dist/pages/admin/ConfigurationCommunity.js +1 -1
  123. package/dist/pages/admin/Diagnostics.js +1 -1
  124. package/dist/pages/admin/DiagnosticsLivekit.d.ts +1 -0
  125. package/dist/pages/admin/DiagnosticsLivekit.js +50 -0
  126. package/dist/pages/admin/Invites.js +5 -3
  127. package/dist/pages/admin/Media.d.ts +1 -0
  128. package/dist/pages/admin/Media.js +135 -0
  129. package/dist/pages/admin/community/CommunityForbiddenUsernames.d.ts +1 -0
  130. package/dist/pages/admin/community/CommunityForbiddenUsernames.js +106 -0
  131. package/dist/pages/admin/community/CommunityMarkdownPage.js +2 -1
  132. package/dist/pages/admin/community/CommunityRoles.js +1 -1
  133. package/dist/pages/admin/community/useCommunityConfig.d.ts +2 -0
  134. package/dist/pages/admin/components/EditInviteLinkModal.d.ts +5 -0
  135. package/dist/pages/admin/components/EditInviteLinkModal.js +131 -0
  136. package/dist/pages/auth/Register.js +33 -9
  137. package/dist/pages/conversations/Show.js +11 -0
  138. package/dist/pages/index.d.ts +3 -0
  139. package/dist/pages/index.js +3 -0
  140. package/dist/pages/jams/Index.js +2 -4
  141. package/dist/pages/resources/Edit.js +3 -3
  142. package/dist/pages/resources/New.js +2 -2
  143. package/dist/pages/settings/Account.js +30 -2
  144. package/dist/pages/settings/PublicProfile.js +15 -3
  145. package/dist/pwa/sw.d.ts +0 -1
  146. package/dist/react-native.d.ts +1 -0
  147. package/dist/react-native.js +1 -0
  148. package/dist/stores/newPosts.d.ts +4 -2
  149. package/dist/stores/newPosts.js +6 -1
  150. package/package.json +12 -7
  151. package/src/components/configuration/ConfigurationCategory.tsx +23 -10
  152. package/src/components/configuration/ConfigurationList.tsx +6 -1
  153. package/src/components/form/LocationInput.tsx +7 -1
  154. package/src/components/jams/JamCapacityGate.tsx +1 -1
  155. package/src/components/jams/JamConference.tsx +2 -0
  156. package/src/components/jams/JamParticipantConference.tsx +2 -0
  157. package/src/components/jams/JamRoom.tsx +2 -6
  158. package/src/components/jams/LiveJamsSection.tsx +16 -2
  159. package/src/components/jams/LivekitUnavailableNotice.tsx +40 -0
  160. package/src/components/jams/dropLateAudio.ts +153 -0
  161. package/src/components/jams/index.ts +1 -0
  162. package/src/components/markdown/compileMarkdown.ts +1 -0
  163. package/src/components/navigation/FooterMobile.tsx +41 -33
  164. package/src/components/navigation/HeaderMobile.tsx +55 -41
  165. package/src/components/navigation/MobileMenuItem.tsx +15 -2
  166. package/src/components/navigation/NavWithTooltip.tsx +26 -0
  167. package/src/components/navigation/index.ts +2 -0
  168. package/src/components/navigation/sideBarNavLinkClass.ts +9 -6
  169. package/src/components/notifications/TypedNotification.tsx +81 -9
  170. package/src/components/post/CompactReplyParent.tsx +17 -10
  171. package/src/components/post/Markdown.tsx +8 -2
  172. package/src/components/post/TruncatedMarkdown.tsx +91 -0
  173. package/src/components/post/attachmentPreview.ts +1 -3
  174. package/src/components/post/helpers.ts +4 -18
  175. package/src/components/post/index.ts +2 -0
  176. package/src/components/post/pieces/Attachments.tsx +93 -78
  177. package/src/components/post/pieces/EventLocation.tsx +27 -0
  178. package/src/components/post/pieces/EventRsvpButton.tsx +110 -7
  179. package/src/components/post/pieces/EventRsvpList.tsx +64 -0
  180. package/src/components/post/pieces/EventRsvpScopeDialog.tsx +39 -27
  181. package/src/components/post/pieces/EventWaitlistJoinDialog.tsx +77 -0
  182. package/src/components/post/pieces/ParticipantsCard.tsx +4 -1
  183. package/src/components/post/pieces/PollContent.tsx +8 -2
  184. package/src/components/post/pieces/PostActions.tsx +73 -42
  185. package/src/components/post/pieces/ShareMenu.tsx +67 -9
  186. package/src/components/post/post-form/ArticleForm.tsx +1 -1
  187. package/src/components/post/post-form/EventForm.tsx +69 -15
  188. package/src/components/post/post-form/ResourceForm.tsx +132 -4
  189. package/src/components/post/post-form/VisibilitySelector.tsx +12 -5
  190. package/src/components/post/types/Article.tsx +6 -6
  191. package/src/components/post/types/Event.tsx +68 -7
  192. package/src/components/post/types/article/FullArticle.tsx +2 -2
  193. package/src/components/post/types/event/CardEvent.tsx +26 -14
  194. package/src/components/post/types/event/FullEvent.tsx +48 -35
  195. package/src/components/post/types/event/ProfileEventRelationship.tsx +8 -0
  196. package/src/components/post/types/note/FullNote.tsx +1 -4
  197. package/src/components/post/types/poll/FullPoll.tsx +1 -4
  198. package/src/components/post/types/resource/FullResource.tsx +9 -1
  199. package/src/components/preview-link/LocalPreviewLink.tsx +4 -1
  200. package/src/components/preview-link/PreviewLink.tsx +2 -7
  201. package/src/components/preview-link/helpers.ts +32 -1
  202. package/src/components/preview-link/local/GroupPreview.tsx +1 -1
  203. package/src/components/preview-link/local/JamPreview.tsx +1 -1
  204. package/src/components/preview-link/local/WelcomePreview.tsx +45 -0
  205. package/src/components/profile/Avatar.tsx +6 -2
  206. package/src/components/profile/ProfileFromId.tsx +1 -5
  207. package/src/components/resources/ResourceCard.tsx +68 -11
  208. package/src/components/resources/ResourceLibrary.tsx +2 -2
  209. package/src/contexts/openpeeps/hooks/accounts.ts +1 -3
  210. package/src/contexts/openpeeps/hooks/admin.ts +11 -3
  211. package/src/contexts/openpeeps/hooks/other.ts +9 -12
  212. package/src/contexts/openpeeps/hooks/streaming.ts +3 -3
  213. package/src/css.d.ts +4 -0
  214. package/src/hooks/admin/useCanAccessAdminSection.ts +27 -0
  215. package/src/hooks/events/useEventRsvp.ts +69 -13
  216. package/src/hooks/groups/useNewGroup.ts +28 -3
  217. package/src/hooks/index.ts +8 -1
  218. package/src/hooks/jams/useCanDiagnoseLivekit.ts +5 -0
  219. package/src/hooks/posts/useResourceComposer.ts +165 -39
  220. package/src/hooks/posts/useShareMenu.ts +9 -0
  221. package/src/hooks/resources/useResourceLibrary.ts +6 -2
  222. package/src/hooks/useWelcomePreview.ts +61 -0
  223. package/src/i18n/I18nProvider.tsx +1 -4
  224. package/src/lib/groupFormErrors.ts +9 -2
  225. package/src/lib/threadHelpers.ts +1 -5
  226. package/src/navigation/menuItems.ts +16 -0
  227. package/src/navigation/targets.ts +2 -0
  228. package/src/pages/admin/ConfigurationCommunity.tsx +5 -0
  229. package/src/pages/admin/Diagnostics.tsx +4 -0
  230. package/src/pages/admin/DiagnosticsLivekit.tsx +147 -0
  231. package/src/pages/admin/Invites.tsx +23 -1
  232. package/src/pages/admin/Media.tsx +290 -0
  233. package/src/pages/admin/community/CommunityForbiddenUsernames.tsx +223 -0
  234. package/src/pages/admin/community/CommunityMarkdownPage.tsx +5 -1
  235. package/src/pages/admin/community/CommunityRoles.tsx +2 -2
  236. package/src/pages/admin/components/EditInviteLinkModal.tsx +263 -0
  237. package/src/pages/auth/Register.tsx +45 -4
  238. package/src/pages/conversations/Show.tsx +11 -0
  239. package/src/pages/index.ts +3 -0
  240. package/src/pages/jams/Index.tsx +2 -6
  241. package/src/pages/resources/Edit.tsx +3 -2
  242. package/src/pages/resources/New.tsx +6 -1
  243. package/src/pages/settings/Account.tsx +51 -1
  244. package/src/pages/settings/PublicProfile.tsx +20 -2
  245. package/src/pwa/sw.ts +6 -3
  246. package/src/pwa/useNotificationBadgeSync.ts +3 -1
  247. package/src/react-native.ts +1 -0
  248. package/src/stores/newPosts.ts +6 -1
  249. package/src/streaming.ts +3 -3
  250. package/dist/setupTests.d.ts +0 -1
  251. package/dist/setupTests.js +0 -5
@@ -2,15 +2,24 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { Calendar, Copy, Repeat2, Send, Share } from 'lucide-react';
3
3
  import { PopupMenu, PopupMenuButton, PopupSection, PopupSeparator, } from '@openpeepshq/react-ui';
4
4
  import { useT } from '../../../i18n/index.js';
5
- import { useShareMenu } from '../../../hooks/posts/useShareMenu.js';
5
+ import { postPublicPath, useShareMenu, } from '../../../hooks/posts/useShareMenu.js';
6
6
  import { useCreateNewConversation } from '../../conversations/CreateNewConversationContext.js';
7
- export function ShareMenu({ post, menuButton }) {
7
+ import { useToast } from '../../layout/ToastProvider.js';
8
+ const absolutePostUrl = (post) => {
9
+ const path = postPublicPath(post);
10
+ return typeof window !== 'undefined'
11
+ ? `${window.location.origin}${path}`
12
+ : path;
13
+ };
14
+ export function ShareMenu({ post, menuButton, variant = 'outline', className, text, }) {
8
15
  const t = useT();
16
+ const { success, error: toastError } = useToast();
9
17
  const { openCreateConversation } = useCreateNewConversation();
10
- const postUrl = typeof window !== 'undefined'
11
- ? `${window.location.origin}/posts/${post.id}`
12
- : `/posts/${post.id}`;
18
+ const postUrl = absolutePostUrl(post);
13
19
  const { signedIn, isEvent, repost, eventIcsFile } = useShareMenu(post, postUrl);
20
+ // Feature-detect. Desktop browsers often have no Web Share API; copy stays
21
+ // in the menu either way.
22
+ const canSystemShare = typeof navigator !== 'undefined' && typeof navigator.share === 'function';
14
23
  const downloadEventIcs = () => {
15
24
  const file = eventIcsFile();
16
25
  if (!file)
@@ -25,7 +34,27 @@ export function ShareMenu({ post, menuButton }) {
25
34
  a.click();
26
35
  URL.revokeObjectURL(href);
27
36
  };
28
- return (_jsxs(PopupMenu, { menuButton: menuButton ?? _jsx(Share, { className: "size-4" }), title: t('posts.shareMenu.title', { defaultValue: 'Share' }), variant: "outline", children: [signedIn ? (_jsxs(_Fragment, { children: [_jsx(PopupSection, { title: t('posts.shareMenu.shareOnCommunity', {
37
+ const copyLink = async () => {
38
+ try {
39
+ await navigator.clipboard.writeText(postUrl);
40
+ success(t('posts.shareMenu.linkCopied', { defaultValue: 'Link copied' }));
41
+ }
42
+ catch {
43
+ toastError(t('posts.shareMenu.copyFailed', {
44
+ defaultValue: "Couldn't copy the link",
45
+ }));
46
+ }
47
+ };
48
+ const systemShare = async () => {
49
+ try {
50
+ await navigator.share({ url: postUrl });
51
+ }
52
+ catch (err) {
53
+ if (err instanceof DOMException && err.name === 'AbortError')
54
+ return;
55
+ }
56
+ };
57
+ return (_jsxs(PopupMenu, { menuButton: menuButton ?? _jsx(Share, { className: "size-4" }), title: t('posts.shareMenu.title', { defaultValue: 'Share' }), variant: variant === 'unstyled' ? undefined : variant, className: className, text: text, children: [signedIn ? (_jsxs(_Fragment, { children: [_jsx(PopupSection, { title: t('posts.shareMenu.shareOnCommunity', {
29
58
  defaultValue: 'Share on community',
30
59
  }) }), _jsx(PopupMenuButton, { title: t('posts.shareMenu.repostToFeed', {
31
60
  defaultValue: 'Repost',
@@ -39,5 +68,9 @@ export function ShareMenu({ post, menuButton }) {
39
68
  defaultValue: 'Download calendar file',
40
69
  }), text: t('posts.shareMenu.downloadCalendarIcs', {
41
70
  defaultValue: 'Add to calendar (.ics)',
42
- }), icon: Calendar, action: downloadEventIcs })) : null, _jsx(PopupMenuButton, { title: t('posts.shareMenu.copyLink', { defaultValue: 'Copy link' }), text: t('posts.shareMenu.copyLink', { defaultValue: 'Copy link' }), icon: Copy, action: () => void navigator.clipboard.writeText(postUrl) })] }));
71
+ }), icon: Calendar, action: downloadEventIcs })) : null, canSystemShare ? (_jsx(PopupMenuButton, { title: t('posts.shareMenu.systemShare', {
72
+ defaultValue: 'Share via…',
73
+ }), text: t('posts.shareMenu.systemShare', {
74
+ defaultValue: 'Share via…',
75
+ }), icon: Share, action: () => void systemShare() })) : null, _jsx(PopupMenuButton, { title: t('posts.shareMenu.copyLink', { defaultValue: 'Copy link' }), text: t('posts.shareMenu.copyLink', { defaultValue: 'Copy link' }), icon: Copy, action: () => void copyLink() })] }));
43
76
  }
@@ -23,7 +23,7 @@ export function ArticleForm({ postData, onChange, isEdit = false, }) {
23
23
  const setAudience = (settings) => onChange(applyAudienceSetting(postData, settings, me));
24
24
  return (_jsxs("div", { children: [_jsx(ImageInput, { usage: "article-header-image", url: article.image, onChange: (image) => patchArticle({ image }), className: "h-96", showSelectAspectRatio: true, showFullImage: true, text: t('articles.form.uploadCover', {
25
25
  defaultValue: 'Upload your cover image',
26
- }), showAltInput: false }), _jsxs("div", { className: "mt-4 flex flex-col gap-4 px-3", children: [_jsx("h2", { className: "text-lg", children: t('articles.form.title', { defaultValue: 'New Article' }) }), _jsx(Label, { title: t('articles.form.title', { defaultValue: 'New Article' }), htmlFor: "article-title", children: _jsx(Input, { id: "article-title", value: article.title ?? '', onChange: (e) => patchArticle({ title: e.target.value }) }) }), _jsx(OpenpeepsMarkdownInput, { rows: 16, maxLength: 10000, value: article.content ?? '', onChange: (content) => patchArticle({ content }), placeholder: t('articles.form.contentPlaceholder', {
26
+ }), showAltInput: false }), _jsxs("div", { className: "mt-4 flex flex-col gap-4 px-3", children: [_jsx("h2", { className: "text-lg", children: t('articles.form.title', { defaultValue: 'New Article' }) }), _jsx(Label, { title: t('articles.form.titleInput', { defaultValue: 'Title' }), htmlFor: "article-title", children: _jsx(Input, { id: "article-title", value: article.title ?? '', onChange: (e) => patchArticle({ title: e.target.value }) }) }), _jsx(OpenpeepsMarkdownInput, { rows: 16, maxLength: 10000, value: article.content ?? '', onChange: (content) => patchArticle({ content }), placeholder: t('articles.form.contentPlaceholder', {
27
27
  defaultValue: 'Write your content here. User markdown for formatting',
28
28
  }) }), _jsx(ComposePreviewLinks, { content: article.content }), _jsx(Label, { title: t('articles.form.visibility', {
29
29
  defaultValue: 'Who can see this (Required)',
@@ -1,7 +1,7 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { X } from 'lucide-react';
4
- import { EVENT_HEADER_ASPECT_RATIO, parseEventMaxAttendeesInput, utcIsoToZonedDateTime, zonedDateTimeToUtcIso, } from '@openpeepshq/common/lib';
4
+ import { EVENT_HEADER_ASPECT_RATIO, parseEventMaxAttendeesInput, parseEventWaitlistOfferMinutesInput, utcIsoToZonedDateTime, zonedDateTimeToUtcIso, } from '@openpeepshq/common/lib';
5
5
  import { Input, Label } from '@openpeepshq/react-ui';
6
6
  import { useT } from '../../../i18n/index.js';
7
7
  import { EVENT_WEEKDAYS, useEventForm, } from '../../../hooks/events/useEventForm.js';
@@ -19,6 +19,7 @@ const TIMEZONES = typeof Intl !== 'undefined' && 'supportedValuesOf' in Intl
19
19
  export const EventForm = ({ postData, onChange, isEdit = false, occurrenceEdit = false, }) => {
20
20
  const t = useT();
21
21
  const [audienceOpen, setAudienceOpen] = useState(false);
22
+ const [endBeforeStart, setEndBeforeStart] = useState(false);
22
23
  const { event, eventTimeZone, showEndDate, repeatFreq, repeatEnd, preview, patchEvent, setEvent, setAudience, applyFreq, toggleWeekday, applyRepeatEnd, setRepeatUntil, setRepeatCount, toggleEndDate, setTimeZone, } = useEventForm(postData, onChange);
23
24
  return (_jsxs("div", { "data-testid": "events-form-basic-details", children: [_jsx(ImageInput, { usage: "event-header-image", url: event.image, onChange: (image) => patchEvent({ image }), aspectRatio: EVENT_HEADER_ASPECT_RATIO, className: "aspect-video !h-auto", text: t('events.form.imageDescription', {
24
25
  defaultValue: 'Upload an image for your event',
@@ -32,11 +33,30 @@ export const EventForm = ({ postData, onChange, isEdit = false, occurrenceEdit =
32
33
  defaultValue: 'Date and Time',
33
34
  }) }), _jsx(Label, { title: t('events.form.startDate', { defaultValue: 'Start Date' }), htmlFor: "event-start", children: _jsx(Input, { id: "event-start", type: "datetime-local", step: 60, value: dateToInputValue(event.start, eventTimeZone), onChange: (e) => {
34
35
  const start = toIso(e.target.value, eventTimeZone);
35
- if (start)
36
+ if (start) {
37
+ if (event.end && new Date(event.end) <= new Date(start)) {
38
+ setEndBeforeStart(true);
39
+ }
40
+ else {
41
+ setEndBeforeStart(false);
42
+ }
36
43
  patchEvent({ start });
44
+ }
37
45
  }, "data-testid": "events-start-input" }) }), _jsx(Label, { description: t('events.form.addEndDate', {
38
46
  defaultValue: 'Add end date and time',
39
- }), forCheckbox: true, children: _jsx("input", { type: "checkbox", checked: showEndDate, onChange: (e) => toggleEndDate(e.target.checked) }) }), showEndDate ? (_jsx(Label, { title: t('events.form.endDate', { defaultValue: 'End Date' }), htmlFor: "event-end", children: _jsx(Input, { id: "event-end", type: "datetime-local", step: 60, value: dateToInputValue(event.end, eventTimeZone), onChange: (e) => patchEvent({ end: toIso(e.target.value, eventTimeZone) }) }) })) : null, _jsx(Label, { title: t('events.form.timezone', { defaultValue: 'Timezone' }), htmlFor: "event-timezone", children: _jsx("select", { id: "event-timezone", className: "bg-background w-full rounded-md border px-3 py-2 text-sm", value: eventTimeZone, onChange: (e) => setTimeZone(e.target.value), children: TIMEZONES.map((tz) => (_jsx("option", { value: tz, children: tz }, tz))) }) }), !occurrenceEdit ? (_jsxs(_Fragment, { children: [_jsx(Label, { title: t('events.form.repeat.title', { defaultValue: 'Repeat' }), htmlFor: "event-repeat", children: _jsxs("select", { id: "event-repeat", className: "bg-background w-full rounded-md border px-3 py-2 text-sm", value: repeatFreq, onChange: (e) => applyFreq(e.target.value), "data-testid": "events-repeat-input", children: [_jsx("option", { value: "none", children: t('events.form.repeat.none', {
47
+ }), forCheckbox: true, children: _jsx("input", { type: "checkbox", checked: showEndDate, onChange: (e) => toggleEndDate(e.target.checked) }) }), showEndDate ? (_jsxs(_Fragment, { children: [_jsx(Label, { title: t('events.form.endDate', { defaultValue: 'End Date' }), htmlFor: "event-end", children: _jsx(Input, { id: "event-end", type: "datetime-local", step: 60, value: dateToInputValue(event.end, eventTimeZone), onChange: (e) => {
48
+ const newEnd = toIso(e.target.value, eventTimeZone);
49
+ if (newEnd &&
50
+ event.start &&
51
+ new Date(newEnd) <= new Date(event.start)) {
52
+ setEndBeforeStart(true);
53
+ return;
54
+ }
55
+ setEndBeforeStart(false);
56
+ patchEvent({ end: newEnd });
57
+ } }) }), endBeforeStart ? (_jsx("p", { className: "text-destructive text-sm", children: t('events.form.endBeforeStart', {
58
+ defaultValue: 'The end date and time must be after the start date and time.',
59
+ }) })) : null] })) : null, _jsx(Label, { title: t('events.form.timezone', { defaultValue: 'Timezone' }), htmlFor: "event-timezone", children: _jsx("select", { id: "event-timezone", className: "bg-background w-full rounded-md border px-3 py-2 text-sm", value: eventTimeZone, onChange: (e) => setTimeZone(e.target.value), children: TIMEZONES.map((tz) => (_jsx("option", { value: tz, children: tz }, tz))) }) }), !occurrenceEdit ? (_jsxs(_Fragment, { children: [_jsx(Label, { title: t('events.form.repeat.title', { defaultValue: 'Repeat' }), htmlFor: "event-repeat", children: _jsxs("select", { id: "event-repeat", className: "bg-background w-full rounded-md border px-3 py-2 text-sm", value: repeatFreq, onChange: (e) => applyFreq(e.target.value), "data-testid": "events-repeat-input", children: [_jsx("option", { value: "none", children: t('events.form.repeat.none', {
40
60
  defaultValue: 'Does not repeat',
41
61
  }) }), _jsx("option", { value: "DAILY", children: t('events.form.repeat.daily', { defaultValue: 'Daily' }) }), _jsx("option", { value: "WEEKLY", children: t('events.form.repeat.weekly', { defaultValue: 'Weekly' }) }), _jsx("option", { value: "MONTHLY", children: t('events.form.repeat.monthly', { defaultValue: 'Monthly' }) })] }) }), event.recurrence?.freq === 'WEEKLY' ? (_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm", children: t('events.form.repeat.weekdays', {
42
62
  defaultValue: 'Repeat on',
@@ -80,5 +100,13 @@ export const EventForm = ({ postData, onChange, isEdit = false, occurrenceEdit =
80
100
  });
81
101
  } }), event.maxAttendees != null ? (_jsx("button", { type: "button", className: "op-input-group-shim hover:bg-surface/80", title: t('events.form.clearMaxAttendees', {
82
102
  defaultValue: 'Remove capacity limit',
83
- }), onClick: () => patchEvent({ maxAttendees: undefined }), children: _jsx(X, { className: "size-4" }) })) : null] }) })] }), !isEdit ? (_jsx(PostAudienceSelector, { open: audienceOpen, onClose: () => setAudienceOpen(false), type: "event", visibility: postData.visibility, groupId: postData.groupId ?? undefined, audience: postData.audience ?? [], showDirect: true, onConfirm: setAudience })) : null] }));
103
+ }), onClick: () => patchEvent({ maxAttendees: undefined }), children: _jsx(X, { className: "size-4" }) })) : null] }) }), event.maxAttendees != null ? (_jsx(Label, { title: t('events.form.waitlistOfferMinutes', {
104
+ defaultValue: 'Waitlist response window (minutes)',
105
+ }), description: t('events.form.waitlistOfferMinutesDescription', {
106
+ defaultValue: 'How long the next person on the waitlist has to claim a freed spot. Leave empty for 60 minutes.',
107
+ }), children: _jsx(Input, { type: "number", min: 1, max: 10080, value: event.waitlistOfferMinutes ?? '', onChange: (e) => {
108
+ patchEvent({
109
+ waitlistOfferMinutes: parseEventWaitlistOfferMinutesInput(e.target.value),
110
+ });
111
+ } }) })) : null] }), !isEdit ? (_jsx(PostAudienceSelector, { open: audienceOpen, onClose: () => setAudienceOpen(false), type: "event", visibility: postData.visibility, groupId: postData.groupId ?? undefined, audience: postData.audience ?? [], showDirect: true, onConfirm: setAudience })) : null] }));
84
112
  };
@@ -3,5 +3,7 @@ export interface ResourceFormProps {
3
3
  postData: PostCreationData;
4
4
  onChange: (data: PostCreationData) => void;
5
5
  isEdit?: boolean;
6
+ /** Member can post this resource only to a group. */
7
+ groupOnly?: boolean;
6
8
  }
7
- export declare const ResourceForm: ({ postData, onChange, isEdit, }: ResourceFormProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const ResourceForm: ({ postData, onChange, isEdit, groupOnly, }: ResourceFormProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from 'react';
3
- import { RESOURCE_KINDS, normalizeResourceTags } from '@openpeepshq/common/lib';
3
+ import { RESOURCE_KINDS, RESOURCE_TITLE_MAX_LENGTH, normalizeResourceTags, resourceFormIssues, } from '@openpeepshq/common/lib';
4
4
  import { Button, Input, Label } from '@openpeepshq/react-ui';
5
5
  import { useT } from '../../../i18n/index.js';
6
6
  import { useCurrentProfile } from '../../layout/IdentityContext.js';
@@ -11,13 +11,13 @@ import { OpenpeepsMarkdownInput } from './OpenpeepsMarkdownInput.js';
11
11
  import { PostAudienceSelector } from './PostAudienceSelector.js';
12
12
  import { VisibilitySelector } from './VisibilitySelector.js';
13
13
  import { useComposeAttachments } from './ComposeAttachments.js';
14
- export const ResourceForm = ({ postData, onChange, isEdit = false, }) => {
14
+ export const ResourceForm = ({ postData, onChange, isEdit = false, groupOnly = false, }) => {
15
15
  const t = useT();
16
16
  const me = useCurrentProfile();
17
17
  const resource = postData.data;
18
18
  const [audienceOpen, setAudienceOpen] = useState(false);
19
19
  const [tagDraft, setTagDraft] = useState('');
20
- const library = useResourceLibrary(postData.groupId ?? undefined);
20
+ const library = useResourceLibrary(postData.groupId ?? undefined, !postData.groupId);
21
21
  const attachments = useComposeAttachments({
22
22
  attachments: resource.attachments ?? [],
23
23
  onChange: (next) => patchResource({ attachments: next }),
@@ -43,6 +43,25 @@ export const ResourceForm = ({ postData, onChange, isEdit = false, }) => {
43
43
  addTag();
44
44
  }
45
45
  };
46
+ const issues = resourceFormIssues({
47
+ title: resource.title,
48
+ resourceKind: resource.resourceKind,
49
+ url: resource.url,
50
+ attachments: resource.attachments,
51
+ visibility: postData.visibility,
52
+ audience: postData.audience,
53
+ groupId: postData.groupId,
54
+ });
55
+ const titleMissing = issues.includes('title');
56
+ const titleTooLong = issues.includes('titleLength');
57
+ const urlIssue = issues.includes('url');
58
+ const urlInvalid = urlIssue && Boolean(resource.url?.trim());
59
+ const mediaMissing = issues.includes('media');
60
+ const audienceMissing = issues.includes('audience');
61
+ const groupMissing = issues.includes('group');
62
+ const urlMessage = t('resources.validation.url', {
63
+ defaultValue: 'Enter a real link, like https://example.com',
64
+ });
46
65
  const kindActions = useMemo(() => ({
47
66
  gallery: attachments.openImagePicker,
48
67
  video: attachments.openImagePicker,
@@ -50,9 +69,25 @@ export const ResourceForm = ({ postData, onChange, isEdit = false, }) => {
50
69
  file: attachments.openDocumentPicker,
51
70
  link: undefined,
52
71
  }), [attachments]);
53
- return (_jsxs("div", { children: [_jsxs("div", { className: "mt-4 flex flex-col gap-4 px-3", children: [_jsx("h2", { className: "text-lg", children: t('resources.form.title', { defaultValue: 'New resource' }) }), _jsx(Label, { title: t('resources.form.name', { defaultValue: 'Title' }), htmlFor: "resource-title", children: _jsx(Input, { id: "resource-title", "data-testid": "resources-title", value: resource.title, onChange: (event) => patchResource({ title: event.target.value }) }) }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: t('resources.form.kind', { defaultValue: 'Type' }) }), _jsx("div", { className: "flex flex-wrap gap-2", children: RESOURCE_KINDS.map((kind) => (_jsx(Button, { variant: resource.resourceKind === kind ? 'default' : 'outline', compact: true, "data-testid": `resources-kind-${kind}`, action: () => patchResource({ resourceKind: kind }), children: t(`resources.kinds.${kind}`, { defaultValue: kind }) }, kind))) })] }), resource.resourceKind === 'link' ? (_jsx(Label, { title: t('resources.form.url', { defaultValue: 'URL' }), htmlFor: "resource-url", children: _jsx(Input, { id: "resource-url", "data-testid": "resources-url", value: resource.url ?? '', onChange: (event) => patchResource({ url: event.target.value }) }) })) : (_jsxs("div", { className: "space-y-2", children: [_jsx(Button, { variant: "outline", action: kindActions[resource.resourceKind], children: t('resources.form.addMedia', {
72
+ return (_jsxs("div", { children: [_jsxs("div", { className: "mt-4 flex flex-col gap-4 px-3", children: [_jsx("h2", { className: "text-lg", children: t('resources.form.title', { defaultValue: 'New resource' }) }), _jsxs(Label, { title: t('resources.form.nameRequired', {
73
+ defaultValue: 'Title (Required)',
74
+ }), htmlFor: "resource-title", children: [_jsx(Input, { id: "resource-title", "data-testid": "resources-title", value: resource.title, maxLength: RESOURCE_TITLE_MAX_LENGTH, "aria-invalid": titleMissing || titleTooLong, "aria-describedby": titleMissing
75
+ ? 'resource-title-error resource-title-count'
76
+ : 'resource-title-count', onChange: (event) => patchResource({ title: event.target.value }) }), titleMissing ? (_jsx("span", { id: "resource-title-error", role: "status", className: "text-muted-foreground mt-1 text-sm", children: t('resources.validation.titleRequired', {
77
+ defaultValue: 'Title is required',
78
+ }) })) : null, titleTooLong ? (_jsx("span", { role: "alert", className: "text-destructive mt-1 text-sm", children: t('resources.validation.titleTooLong', {
79
+ defaultValue: 'Title must be 200 characters or fewer',
80
+ }) })) : null, _jsxs("span", { id: "resource-title-count", className: "block w-full px-2 text-right text-sm", children: [_jsx("span", { className: titleTooLong ? 'text-error' : undefined, children: resource.title.length }), ' ', "/ ", RESOURCE_TITLE_MAX_LENGTH] })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: t('resources.form.kind', { defaultValue: 'Type' }) }), _jsx("div", { className: "flex flex-wrap gap-2", children: RESOURCE_KINDS.map((kind) => (_jsx(Button, { variant: resource.resourceKind === kind ? 'default' : 'outline', compact: true, "data-testid": `resources-kind-${kind}`, action: () => patchResource({ resourceKind: kind }), children: t(`resources.kinds.${kind}`, { defaultValue: kind }) }, kind))) })] }), resource.resourceKind === 'link' ? (_jsxs(Label, { title: t('resources.form.urlRequired', {
81
+ defaultValue: 'URL (Required)',
82
+ }), htmlFor: "resource-url", children: [_jsx(Input, { id: "resource-url", "data-testid": "resources-url", value: resource.url ?? '', placeholder: t('resources.form.urlPlaceholder', {
83
+ defaultValue: 'https://example.com',
84
+ }), inputMode: "url", spellCheck: false, error: urlInvalid, "aria-invalid": urlIssue, "aria-describedby": urlIssue ? 'resource-url-error' : undefined, onChange: (event) => patchResource({ url: event.target.value }) }), urlIssue ? (_jsx("span", { id: "resource-url-error", role: urlInvalid ? 'alert' : 'status', "data-testid": "resources-url-error", className: urlInvalid
85
+ ? 'text-destructive mt-1 text-sm'
86
+ : 'text-muted-foreground mt-1 text-sm', children: urlMessage })) : null] })) : (_jsxs("div", { className: "space-y-2", children: [_jsx(Button, { variant: "outline", action: kindActions[resource.resourceKind], children: t('resources.form.addMedia', {
54
87
  defaultValue: 'Add files',
55
- }) }), attachments.previews, attachments.inputs] })), _jsx(OpenpeepsMarkdownInput, { rows: 8, maxLength: 4000, value: resource.content ?? '', onChange: (content) => patchResource({ content }), placeholder: t('resources.form.descriptionPlaceholder', {
88
+ }) }), attachments.previews, attachments.inputs, mediaMissing ? (_jsx("p", { role: "status", className: "text-muted-foreground text-sm", children: t('resources.validation.mediaRequired', {
89
+ defaultValue: 'Add the media or link this resource needs',
90
+ }) })) : null] })), _jsx(OpenpeepsMarkdownInput, { rows: 8, maxLength: 4000, value: resource.content ?? '', onChange: (content) => patchResource({ content }), placeholder: t('resources.form.descriptionPlaceholder', {
56
91
  defaultValue: 'Describe this resource',
57
92
  }) }), _jsx(Label, { title: t('resources.form.tags', { defaultValue: 'Tags' }), htmlFor: "resource-tags", children: _jsx(Input, { id: "resource-tags", value: tagDraft, onChange: (event) => setTagDraft(event.target.value), onKeyDown: onTagKey, onBlur: addTag, placeholder: t('resources.form.tagsPlaceholder', {
58
93
  defaultValue: 'Add tags, then press Enter',
@@ -60,9 +95,15 @@ export const ResourceForm = ({ postData, onChange, isEdit = false, }) => {
60
95
  tags: (resource.tags ?? []).filter((value) => value.toLowerCase() !== tag),
61
96
  }), children: ["#", tag] }, tag))) })) : null, _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: t('resources.form.hierarchy', {
62
97
  defaultValue: 'Place in the library',
63
- }) }), _jsx(CategoryPathPicker, { path: resource.categoryPath ?? [], tree: library.tree, onChange: (categoryPath) => patchResource({ categoryPath }) })] }), _jsx(Label, { title: t('resources.form.visibility', {
98
+ }) }), _jsx(CategoryPathPicker, { path: resource.categoryPath ?? [], tree: library.tree, onChange: (categoryPath) => patchResource({ categoryPath }) })] }), _jsxs(Label, { title: t('resources.form.visibility', {
64
99
  defaultValue: 'Who can see this (Required)',
65
100
  }), description: t('resources.form.visibilityNotChangeable', {
66
101
  defaultValue: "Once you post your resource, you can't change the visibility",
67
- }), children: _jsx(VisibilitySelector, { postData: postData, onClick: () => setAudienceOpen(true), disabled: isEdit, showDirect: true }) })] }), !isEdit ? (_jsx(PostAudienceSelector, { open: audienceOpen, onClose: () => setAudienceOpen(false), type: "resource", visibility: postData.visibility, groupId: postData.groupId ?? undefined, audience: postData.audience ?? [], showDirect: true, onConfirm: setAudience })) : null] }));
102
+ }), children: [_jsx(VisibilitySelector, { postData: postData, onClick: () => setAudienceOpen(true), disabled: isEdit, showDirect: true }), !isEdit && groupOnly ? (_jsx("span", { role: "status", className: "text-muted-foreground mt-1 text-sm", children: t('resources.form.groupOnly', {
103
+ defaultValue: 'You can only share resources with a group.',
104
+ }) })) : null, groupMissing ? (_jsx("span", { id: "resource-group-error", role: "status", className: "text-muted-foreground mt-1 text-sm", children: t('resources.validation.groupRequired', {
105
+ defaultValue: 'Choose a group before creating this resource.',
106
+ }) })) : null, audienceMissing ? (_jsx("span", { id: "resource-audience-error", role: "status", className: "text-muted-foreground mt-1 text-sm", children: t('resources.validation.directAudience', {
107
+ defaultValue: 'Choose at least one recipient for a direct resource.',
108
+ }) })) : null] })] }), !isEdit ? (_jsx(PostAudienceSelector, { open: audienceOpen, onClose: () => setAudienceOpen(false), type: "resource", visibility: postData.visibility, groupId: postData.groupId ?? undefined, audience: postData.audience ?? [], showDirect: true, onConfirm: setAudience })) : null] }));
68
109
  };
@@ -19,15 +19,21 @@ export const VisibilitySelector = ({ postData, onClick, disabled = false, showDi
19
19
  }), [postData.type, authData, t, serverInfo.publicContent, showDirect]);
20
20
  const selectedGroup = useMemo(() => me?.memberships?.find((m) => m.group.id === postData.groupId)?.group, [me?.memberships, postData.groupId]);
21
21
  const description = (visibility) => audienceChoices.find((c) => c.value === visibility)?.description ?? '';
22
+ const choiceLabel = (visibility) => description(visibility) ||
23
+ (audienceChoices.length > 0
24
+ ? t('posts.form.chooseAudience', {
25
+ defaultValue: 'Choose who can see this',
26
+ })
27
+ : '');
22
28
  const content = () => {
23
29
  if (postData.visibility === 'group') {
24
- return (_jsxs("span", { className: "flex min-w-0 items-center gap-1 text-sm font-normal", children: [_jsx("span", { className: "shrink-0 pr-2", children: description('group') }), selectedGroup ? (_jsxs("span", { className: "flex min-w-0 items-center gap-1 truncate", children: [_jsx(GroupAvatar, { group: selectedGroup, size: 1.5, borderless: true }), _jsx("span", { className: "truncate", children: groupName(selectedGroup) })] })) : null] }));
30
+ return (_jsxs("span", { className: "flex min-w-0 items-center gap-1 text-sm font-normal", children: [_jsx("span", { className: "shrink-0 pr-2", children: choiceLabel('group') }), selectedGroup ? (_jsxs("span", { className: "flex min-w-0 items-center gap-1 truncate", children: [_jsx(GroupAvatar, { group: selectedGroup, size: 1.5, borderless: true }), _jsx("span", { className: "truncate", children: groupName(selectedGroup) })] })) : null] }));
25
31
  }
26
32
  if (postData.visibility === 'direct') {
27
33
  const audience = postData.audience ?? [];
28
- return (_jsxs("span", { className: "flex min-w-0 items-center gap-1 text-sm font-light", children: [_jsx("span", { className: "shrink-0 pr-2", children: description('direct') }), audience.length ? (_jsx("span", { className: "flex min-w-0 flex-wrap items-center gap-1", children: audience.map((profile) => (_jsx(ProfileBadge, { profile: profile }, profile.id))) })) : null] }));
34
+ return (_jsxs("span", { className: "flex min-w-0 items-center gap-1 text-sm font-light", children: [_jsx("span", { className: "shrink-0 pr-2", children: choiceLabel('direct') }), audience.length ? (_jsx("span", { className: "flex min-w-0 flex-wrap items-center gap-1", children: audience.map((profile) => (_jsx(ProfileBadge, { profile: profile }, profile.id))) })) : null] }));
29
35
  }
30
- return (_jsx("span", { className: "text-sm font-light", children: description(postData.visibility) }));
36
+ return (_jsx("span", { className: "text-sm font-light", children: choiceLabel(postData.visibility) }));
31
37
  };
32
38
  return (_jsxs("div", { className: "op-input-group grid grid-cols-[auto_1fr_auto]", children: [_jsx("div", { className: "op-input-group-shim", children: _jsx(Eye, { className: "size-4" }) }), _jsx("button", { type: "button", title: t('posts.form.changeAudience', {
33
39
  defaultValue: 'Change audience',
@@ -2,8 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ArrowRight } from 'lucide-react';
3
3
  import { useT } from '../../../i18n/index.js';
4
4
  import { resolveStaticUrl, useStaticRender } from '../../markdown/staticRender.js';
5
- import { PostMarkdown } from '../Markdown.js';
6
- import { OPENPEEPS_POST_CAPTION_CLASS } from '../../markdown/classes.js';
5
+ import { TruncatedMarkdown } from '../TruncatedMarkdown.js';
7
6
  import { firstNWords } from '../helpers.js';
8
7
  import { minutesToRead } from '@openpeepshq/common/lib';
9
8
  export function FeedArticle({ post }) {
@@ -13,5 +12,5 @@ export function FeedArticle({ post }) {
13
12
  const previewContent = firstNWords(article.content, 50);
14
13
  const minutes = minutesToRead(article.content);
15
14
  const showReadMore = !!article.content && previewContent.length < article.content.length;
16
- return (_jsxs("div", { className: "flex w-full min-w-0 flex-col gap-2", children: [article.image && (_jsx("img", { src: article.image, className: "w-full object-cover", alt: `image for ${article.title ?? 'article'}` })), _jsxs("div", { className: "prose-sm", children: [_jsx("h3", { children: article.title }), minutes > 0 && (_jsx("p", { className: "text-muted-foreground text-xs", children: t('posts.article.minutesToRead', { count: minutes }) }))] }), _jsx(PostMarkdown, { source: `${previewContent}${showReadMore ? '...' : ''}`, className: OPENPEEPS_POST_CAPTION_CLASS }), showReadMore && (_jsx("div", { className: "flex justify-end", children: _jsxs("a", { href: resolveStaticUrl(`/posts/${post.id}`, staticRender ? baseUrl : undefined), className: "text-primary inline-flex items-center gap-1 text-sm hover:underline", children: [t('posts.article.readMore', { defaultValue: 'Read more' }), _jsx(ArrowRight, { className: "inline-block size-4" })] }) }))] }));
15
+ return (_jsxs("div", { className: "flex w-full min-w-0 flex-col gap-2", children: [article.image && (_jsx("img", { src: article.image, className: "w-full object-cover", alt: `image for ${article.title ?? 'article'}` })), _jsxs("div", { className: "prose-sm", children: [_jsx("h3", { className: "text-foreground", children: article.title }), minutes > 0 && (_jsx("p", { className: "text-muted-foreground text-xs", children: t('posts.article.minutesToRead', { count: minutes }) }))] }), _jsx(TruncatedMarkdown, { source: article.content ?? '', snippet: previewContent, interactive: false }), showReadMore && (_jsx("div", { className: "flex justify-end", children: _jsxs("a", { href: resolveStaticUrl(`/posts/${post.id}`, staticRender ? baseUrl : undefined), className: "text-primary inline-flex items-center gap-1 text-sm hover:underline", children: [t('posts.article.readMore', { defaultValue: 'Read more' }), _jsx(ArrowRight, { className: "inline-block size-4" })] }) }))] }));
17
16
  }
@@ -26,5 +26,14 @@ export function FeedEvent({ post }) {
26
26
  allDay: event.wholeDay,
27
27
  })
28
28
  : fmtRange(start, end);
29
- return (_jsxs("div", { className: "flex w-full flex-col gap-2", children: [event.image && (_jsx("span", { className: "aspect-video w-full overflow-hidden", children: _jsx("img", { src: event.image, className: "h-full w-full object-cover", alt: `image for ${event.name ?? 'event'}` }) })), _jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("span", { className: "text-destructive text-sm", children: [when, ' ', staticRender ? null : (_jsx("span", { className: "text-muted-foreground", children: "(your local time)" }))] }), _jsx(Button, { action: resolveStaticUrl(`/posts/${post.id}`, staticRender ? baseUrl : undefined), variant: "outline", compact: true, className: "shrink-0", children: t('posts.event.viewEvent', { defaultValue: 'View Event' }) })] }), _jsx("div", { className: "text-lg font-medium", children: event.name }), event.recurrence ? (_jsx("p", { className: "text-muted-foreground text-sm", children: formatEventRecurrence(event.recurrence, t, event.start) })) : null, _jsx(EventLocation, { post: post })] }));
29
+ const viewEventHref = resolveStaticUrl(`/posts/${post.id}`, staticRender ? baseUrl : undefined);
30
+ if (staticRender) {
31
+ return (_jsx("table", { role: "presentation", width: "100%", cellPadding: 0, cellSpacing: 0, style: { width: '100%', borderCollapse: 'collapse' }, children: _jsxs("tbody", { children: [event.image ? (_jsx("tr", { children: _jsx("td", { style: { paddingBottom: '8px' }, children: _jsx("img", { src: event.image, alt: `image for ${event.name ?? 'event'}`, width: "100%", style: {
32
+ display: 'block',
33
+ width: '100%',
34
+ maxWidth: '100%',
35
+ height: 'auto',
36
+ } }) }) })) : null, _jsx("tr", { children: _jsx("td", { className: "text-destructive pb-2 text-sm", children: when }) }), _jsx("tr", { children: _jsx("td", { className: "pb-2 text-lg font-medium", children: event.name }) }), event.recurrence ? (_jsx("tr", { children: _jsx("td", { className: "text-muted-foreground pb-2 text-sm", children: formatEventRecurrence(event.recurrence, t, event.start) }) })) : null, event.physicalLocation || event.jam || event.url ? (_jsx("tr", { children: _jsx("td", { className: "pb-2", children: _jsx(EventLocation, { post: post }) }) })) : null, _jsx("tr", { children: _jsx("td", { children: _jsx("a", { href: viewEventHref, className: "text-primary text-sm underline", children: t('posts.event.viewEvent', { defaultValue: 'View Event' }) }) }) })] }) }));
37
+ }
38
+ return (_jsxs("div", { className: "flex w-full flex-col gap-2", children: [event.image && (_jsx("span", { className: "aspect-video w-full overflow-hidden", children: _jsx("img", { src: event.image, className: "h-full w-full object-cover", alt: `image for ${event.name ?? 'event'}` }) })), _jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("span", { className: "text-destructive text-sm", children: [when, ' ', _jsx("span", { className: "text-muted-foreground", children: "(your local time)" })] }), _jsx(Button, { action: viewEventHref, variant: "outline", compact: true, className: "shrink-0", children: t('posts.event.viewEvent', { defaultValue: 'View Event' }) })] }), _jsx("div", { className: "text-lg font-medium", children: event.name }), event.recurrence ? (_jsx("p", { className: "text-muted-foreground text-sm", children: formatEventRecurrence(event.recurrence, t, event.start) })) : null, _jsx(EventLocation, { post: post })] }));
30
39
  }
@@ -8,5 +8,5 @@ export function FullArticle({ post }) {
8
8
  const t = useT();
9
9
  const article = post.data;
10
10
  const minutes = minutesToRead(article.content);
11
- return (_jsx(FullPostLayout, { post: post, deleteCallback: () => window.history.back(), children: _jsx(FeedPost, { post: post, noReactionHeader: true, deleteCallback: () => window.history.back(), content: _jsxs("div", { className: "flex w-full min-w-0 flex-col gap-2", children: [article.image ? (_jsx("img", { src: article.image, className: "w-full object-cover", alt: article.title ? `image for ${article.title}` : 'Article' })) : null, _jsxs("div", { className: "prose mb-6", children: [_jsx("h1", { children: article.title }), minutes > 0 && (_jsx("p", { className: "text-muted-foreground text-sm", children: t('posts.article.minutesToRead', { count: minutes }) }))] }), _jsx(PostMarkdown, { source: article.content ?? '' })] }) }) }));
11
+ return (_jsx(FullPostLayout, { post: post, deleteCallback: () => window.history.back(), children: _jsx(FeedPost, { post: post, noReactionHeader: true, deleteCallback: () => window.history.back(), content: _jsxs("div", { className: "flex w-full min-w-0 flex-col gap-2", children: [article.image ? (_jsx("img", { src: article.image, className: "w-full object-cover", alt: article.title ? `image for ${article.title}` : 'Article' })) : null, _jsxs("div", { className: "prose dark:prose-invert mb-6", children: [_jsx("h1", { className: "text-foreground", children: article.title }), minutes > 0 && (_jsx("p", { className: "text-muted-foreground text-sm", children: t('posts.article.minutesToRead', { count: minutes }) }))] }), _jsx(PostMarkdown, { source: article.content ?? '' })] }) }) }));
12
12
  }
@@ -8,6 +8,7 @@ import { useServerInfo } from '../../../server-data/index.js';
8
8
  import { usePostViewRef } from '../../../../lib/postViewCounter.js';
9
9
  import { EventLocation } from '../../pieces/EventLocation.js';
10
10
  import { ParticipantsCard } from '../../pieces/ParticipantsCard.js';
11
+ import { ShareMenu } from '../../pieces/ShareMenu.js';
11
12
  import { ProfileEventRelationship } from './ProfileEventRelationship.js';
12
13
  function formatEventTimespan(event, startIso, endIso) {
13
14
  const startValue = startIso ?? event.start;
@@ -45,7 +46,7 @@ export function CardEvent({ post, showEventDate = true }) {
45
46
  const postLink = occurrenceId
46
47
  ? `/posts/${post.id}?occurrence=${encodeURIComponent(occurrenceId)}`
47
48
  : `/posts/${post.id}`;
48
- return (_jsxs("article", { ref: postViewRef, className: "hover:bg-surface mb-6 w-full overflow-hidden rounded-lg border", children: [_jsx("a", { href: postLink, className: "block", children: _jsx("div", { className: "aspect-video w-full overflow-hidden", children: _jsx("img", { src: event.image || '/img/event-default.png', alt: event.name ? `image for ${event.name}` : 'Event', className: "h-full w-full object-cover" }) }) }), _jsxs("div", { className: "grid gap-y-4 p-4", children: [_jsxs("a", { href: postLink, className: "block text-inherit no-underline", children: [showEventDate ? (_jsx("p", { className: "text-muted-foreground text-sm", children: formatEventTimespan(event, post.occurrenceStart, post.occurrenceEnd) })) : null, _jsx("h3", { className: "text-xl font-semibold", children: truncateText(event.name, 100) || '-' })] }), event.recurrence ? (_jsx("p", { className: "text-muted-foreground text-sm", children: formatEventRecurrence(event.recurrence, t, event.start) })) : null, _jsxs("div", { className: "flex flex-wrap gap-x-2 gap-y-1", children: [_jsx(EventLocation, { post: post, truncate: true, occurrence: occurrenceId }), _jsx(ProfileEventRelationship, { post: post })] }), jam && me && livekitEnabled ? (jamState?.active ? (_jsxs("div", { className: "text-muted-foreground flex items-center justify-start gap-2 text-xs", children: [_jsx("span", { className: "w-12", children: _jsx(ParticipantsCard, { jamState: jamState }) }), _jsxs("span", { children: [attendeesLength, ' ', attendeesLength === 1
49
+ return (_jsxs("article", { ref: postViewRef, className: "hover:bg-surface mb-6 w-full overflow-hidden rounded-lg border", children: [_jsx("a", { href: postLink, className: "block", children: _jsx("div", { className: "aspect-video w-full overflow-hidden", children: _jsx("img", { src: event.image || '/img/event-default.png', alt: event.name ? `image for ${event.name}` : 'Event', className: "h-full w-full object-cover" }) }) }), _jsxs("div", { className: "grid gap-y-4 p-4", children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsxs("a", { href: postLink, className: "block min-w-0 flex-1 text-inherit no-underline", children: [showEventDate ? (_jsx("p", { className: "text-muted-foreground text-sm", children: formatEventTimespan(event, post.occurrenceStart, post.occurrenceEnd) })) : null, _jsx("h3", { className: "text-xl font-semibold", children: truncateText(event.name, 100) || '-' })] }), _jsx(ShareMenu, { post: post, variant: "ghost", className: "shrink-0", text: t('posts.footer.share', { defaultValue: 'Share' }) })] }), event.recurrence ? (_jsx("p", { className: "text-muted-foreground text-sm", children: formatEventRecurrence(event.recurrence, t, event.start) })) : null, _jsxs("div", { className: "flex flex-wrap gap-x-2 gap-y-1", children: [_jsx(EventLocation, { post: post, truncate: true, occurrence: occurrenceId }), _jsx(ProfileEventRelationship, { post: post })] }), jam && me && livekitEnabled ? (jamState?.active ? (_jsxs("div", { className: "text-muted-foreground flex items-center justify-start gap-2 text-xs", children: [_jsx("span", { className: "w-12", children: _jsx(ParticipantsCard, { jamState: jamState }) }), _jsxs("span", { children: [attendeesLength, ' ', attendeesLength === 1
49
50
  ? t('events.jam.attendee', { defaultValue: 'attendee' })
50
51
  : t('events.jam.attendees', { defaultValue: 'attendees' })] }), _jsx(Button, { action: jamLink, variant: "default", compact: true, children: t('jam.join.submit', { defaultValue: 'Join Jam' }) })] })) : jam.moderators.includes(me.id) ? (_jsx("div", { children: _jsx(Button, { action: jamLink, variant: "default", children: t('jam.start.submit', { defaultValue: 'Start Jam' }) }) })) : null) : null] })] }));
51
52
  }
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Download, EyeOff, MoreHorizontal, Share, Trash2 } from 'lucide-react';
3
3
  import { useCallback, useMemo, useState } from 'react';
4
- import { buildThreads, canAccessJamRecordings, canManageEventRsvps, canModerateJam, canViewJamAttendees, countYesRsvps, defaultRsvpRecurrenceId, effectiveEventTimes, eventTimeZoneOptions, formatEventClockTime, formatEventRecurrence, getJamUrl, groupName, isCapacityEvent, parseOccurrenceQuery, listRsvpOccurrences, profileName, } from '@openpeepshq/common/lib';
4
+ import { buildThreads, canAccessJamRecordings, canManageEventRsvps, canModerateJam, canViewJamAttendees, availableSpots, effectiveEventTimes, eventTimeZoneOptions, formatEventClockTime, formatEventRecurrence, getJamUrl, groupName, parseOccurrenceQuery, listRsvpOccurrences, profileName, rsvpExportFilename, } from '@openpeepshq/common/lib';
5
5
  import { Button, Dialog, DialogActions, DialogContent, DialogHeader, DialogTitle, LoadingSpinner, UpdatingDate, } from '@openpeepshq/react-ui';
6
6
  import { useOpenpeeps } from '../../../../contexts/openpeeps/index.js';
7
7
  import { useT } from '../../../../i18n/index.js';
@@ -47,13 +47,8 @@ export function FullEvent({ post, occurrence }) {
47
47
  const myEvent = post.profile?.id === profile?.id;
48
48
  const iAmModerator = canModerateJam(profile, post);
49
49
  const canManageRsvps = canManageEventRsvps(profile, post);
50
- const slotsLeft = isCapacityEvent(event) &&
51
- event.maxAttendees !== undefined &&
52
- (!event.recurrence || occurrenceId)
53
- ? event.maxAttendees - countYesRsvps(post, occurrenceId)
54
- : null;
55
- const times = effectiveEventTimes(event, occurrenceId ??
56
- (event.recurrence ? defaultRsvpRecurrenceId(event) : undefined));
50
+ const slotsLeft = availableSpots(post, occurrenceId) ?? null;
51
+ const times = effectiveEventTimes(event, occurrenceId);
57
52
  const recurrenceLabel = event.recurrence
58
53
  ? formatEventRecurrence(event.recurrence, t, event.start)
59
54
  : '';
@@ -74,6 +69,20 @@ export function FullEvent({ post, occurrence }) {
74
69
  }));
75
70
  }
76
71
  }, [client, post.id, t, toastError]);
72
+ const exportRsvps = useCallback(async () => {
73
+ try {
74
+ const csv = await client.posts.exportRsvps({
75
+ id: post.id,
76
+ occurrence: occurrenceId,
77
+ });
78
+ downloadCsv(csv, rsvpExportFilename(event.name, new Date()));
79
+ }
80
+ catch {
81
+ toastError(t('events.exportRsvpsError', {
82
+ defaultValue: 'Failed to export RSVPs',
83
+ }));
84
+ }
85
+ }, [client, event.name, occurrenceId, post.id, t, toastError]);
77
86
  const descendentThreads = useMemo(() => (contextQuery.data && buildThreads(contextQuery.data.descendants)) || [], [contextQuery.data]);
78
87
  const eventScope = useMemo(() => {
79
88
  if (post.visibility === 'public')
@@ -92,15 +101,15 @@ export function FullEvent({ post, occurrence }) {
92
101
  : t('events.slotsLeft', {
93
102
  defaultValue: '{{count}} slots left',
94
103
  count: slotsLeft,
95
- }) })) : null] }), post.groupId && group ? (_jsx("a", { href: `/groups/@${group.handle}`, className: "text-muted-foreground block text-sm hover:underline", children: groupName(group) })) : null] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ShareMenu, { post: post, menuButton: _jsx("span", { className: "flex size-10 items-center justify-center rounded-md", children: _jsx(Share, { className: "size-4" }) }) }), myEvent ? (_jsx(EventMenu, { post: post, occurrence: occurrenceId, menuButton: _jsx("span", { className: "border-input flex size-10 items-center justify-center rounded-md border", children: _jsx(MoreHorizontal, { className: "size-4" }) }) })) : null] })] }), _jsx("h1", { className: "text-2xl font-bold", children: event.name }), _jsxs("div", { className: "mt-2 flex items-center gap-x-2", children: [_jsx(Avatar, { profile: post.profile, size: 2 }), _jsx("a", { href: `/@${post.profile.handle}`, className: "hover:text-primary text-sm hover:underline", children: t('events.hostedBy', {
104
+ }) })) : null] }), post.groupId && group ? (_jsx("a", { href: `/groups/@${group.handle}`, className: "text-muted-foreground block text-sm hover:underline", children: groupName(group) })) : null] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ShareMenu, { post: post, text: t('posts.footer.share', { defaultValue: 'Share' }), menuButton: _jsx(Share, { className: "size-4" }) }), myEvent ? (_jsx(EventMenu, { post: post, occurrence: occurrenceId, menuButton: _jsx("span", { className: "border-input flex size-10 items-center justify-center rounded-md border", children: _jsx(MoreHorizontal, { className: "size-4" }) }) })) : null] })] }), _jsx("h1", { className: "text-2xl font-bold", children: event.name }), _jsxs("div", { className: "mt-2 flex items-center gap-x-2", children: [_jsx(Avatar, { profile: post.profile, size: 2 }), _jsx("a", { href: `/@${post.profile.handle}`, className: "hover:text-primary text-sm hover:underline", children: t('events.hostedBy', {
96
105
  defaultValue: 'Hosted by {{profileName}}',
97
106
  profileName: `${profileName(post.profile)}${myEvent ? ' · You' : ''}`,
98
107
  }) })] }), times.start ? (_jsx(EventWhenBlock, { iso: times.start, label: t('events.startDate', { defaultValue: 'Starts' }), timeZone: event.timeZone })) : null, times.end ? (_jsx(EventWhenBlock, { iso: times.end, label: t('events.endDate', { defaultValue: 'Ends' }), timeZone: event.timeZone })) : null, _jsx(EventLocation, { post: post, preview: false, occurrence: occurrenceId }), event.recurrence ? (_jsx(EventOccurrenceList, { post: post, postId: post.id, occurrences: upcomingOccurrences, currentOccurrenceId: occurrenceId, recurrenceLabel: recurrenceLabel })) : null, _jsx(EventRsvpButton, { post: post, recurrenceId: occurrenceId }), event.jam && (myEvent || iAmModerator) ? (livekitEnabled ? (jamState?.active ? (_jsx(Button, { variant: "default", className: "mt-2 w-full", action: jamLink, children: t('jam.join.submit', { defaultValue: 'Join Jam' }) })) : (_jsx(Button, { variant: "default", className: "mt-2 w-full", action: jamLink, children: t('events.jam.start', { defaultValue: 'Start jam' }) }))) : (_jsx("p", { role: "status", className: "text-destructive mt-2 text-sm", children: t('jams.unavailable.message', {
99
108
  defaultValue: 'Jams are unavailable because LiveKit is not connected.',
100
- }) }))) : null, _jsxs("nav", { "aria-label": t('events.tabs.label', { defaultValue: 'Event sections' }), className: "mt-4 flex flex-wrap gap-2 border-b", children: [event.content ? (_jsx(TabButton, { active: tab === 'description', onClick: () => setTab('description'), children: t('events.tabs.description', { defaultValue: 'Description' }) })) : null, _jsx(TabButton, { active: tab === 'replies', onClick: () => setTab('replies'), children: t('events.tabs.discussion', { defaultValue: 'Discussion' }) }), _jsx(TabButton, { active: tab === 'rsvps', onClick: () => setTab('rsvps'), children: t('events.tabs.rsvps', { defaultValue: 'RSVPs' }) }), showJamAttendeesTab ? (_jsx(TabButton, { active: tab === 'attendees', onClick: () => setTab('attendees'), children: t('events.tabs.jamAttendees', { defaultValue: 'Jam attendees' }) })) : null, event.jam ? (_jsx(TabButton, { active: tab === 'recordings', onClick: () => setTab('recordings'), children: t('events.tabs.recordings', { defaultValue: 'Recordings' }) })) : null] }), tab === 'description' && event.content ? (_jsx(OpenpeepsMarkdown, { source: event.content, mentions: post.mentions })) : null, tab === 'replies' ? (_jsxs(_Fragment, { children: [_jsx(ReplyBox, { post: post }), contextQuery.isLoading ? (_jsx("div", { className: "text-muted-foreground py-4 text-sm", children: _jsx(LoadingSpinner, {}) })) : (descendentThreads.map((thread) => (_jsx(ThreadedFeed, { thread: thread }, thread.id))))] })) : null, tab === 'rsvps' ? (_jsx(EventRsvpList, { post: post, occurrenceId: occurrenceId, occurrences: upcomingOccurrences, currentProfile: profile, canManageRsvps: canManageRsvps, onMessage: (target) => openCreateConversation({
101
- profiles: [target],
102
- skipProfileSelection: true,
103
- }), onManage: (response, profileId, recurrenceId) => rsvpManage({ response, recurrenceId }, { id: post.id, profileId }) })) : null, tab === 'attendees' && showJamAttendeesTab ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex justify-end py-2", children: _jsxs(Button, { variant: "outline", compact: true, action: exportAttendees, children: [_jsx(Download, { className: "mr-1 h-4 w-4" }), t('events.exportAttendees', {
109
+ }) }))) : null, _jsxs("nav", { "aria-label": t('events.tabs.label', { defaultValue: 'Event sections' }), className: "mt-4 flex flex-wrap gap-2 border-b", children: [event.content ? (_jsx(TabButton, { active: tab === 'description', onClick: () => setTab('description'), children: t('events.tabs.description', { defaultValue: 'Description' }) })) : null, _jsx(TabButton, { active: tab === 'replies', onClick: () => setTab('replies'), children: t('events.tabs.discussion', { defaultValue: 'Discussion' }) }), _jsx(TabButton, { active: tab === 'rsvps', onClick: () => setTab('rsvps'), children: t('events.tabs.rsvps', { defaultValue: 'RSVPs' }) }), showJamAttendeesTab ? (_jsx(TabButton, { active: tab === 'attendees', onClick: () => setTab('attendees'), children: t('events.tabs.jamAttendees', { defaultValue: 'Jam attendees' }) })) : null, event.jam ? (_jsx(TabButton, { active: tab === 'recordings', onClick: () => setTab('recordings'), children: t('events.tabs.recordings', { defaultValue: 'Recordings' }) })) : null] }), tab === 'description' && event.content ? (_jsx(OpenpeepsMarkdown, { source: event.content, mentions: post.mentions })) : null, tab === 'replies' ? (_jsxs(_Fragment, { children: [_jsx(ReplyBox, { post: post }), contextQuery.isLoading ? (_jsx("div", { className: "text-muted-foreground py-4 text-sm", children: _jsx(LoadingSpinner, {}) })) : (descendentThreads.map((thread) => (_jsx(ThreadedFeed, { thread: thread }, thread.id))))] })) : null, tab === 'rsvps' ? (_jsxs(_Fragment, { children: [canManageRsvps ? (_jsx("div", { className: "flex justify-end py-2", children: _jsxs(Button, { variant: "outline", compact: true, action: exportRsvps, children: [_jsx(Download, { className: "mr-1 h-4 w-4" }), t('events.exportRsvps', { defaultValue: 'Export RSVPs' })] }) })) : null, _jsx(EventRsvpList, { post: post, occurrenceId: occurrenceId, occurrences: upcomingOccurrences, currentProfile: profile, canManageRsvps: canManageRsvps, onMessage: (target) => openCreateConversation({
110
+ profiles: [target],
111
+ skipProfileSelection: true,
112
+ }), onManage: (response, profileId, recurrenceId) => rsvpManage({ response, recurrenceId }, { id: post.id, profileId }) })] })) : null, tab === 'attendees' && showJamAttendeesTab ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex justify-end py-2", children: _jsxs(Button, { variant: "outline", compact: true, action: exportAttendees, children: [_jsx(Download, { className: "mr-1 h-4 w-4" }), t('events.exportAttendees', {
104
113
  defaultValue: 'Export attendees',
105
114
  })] }) }), jamAttendeesQuery.data?.length ? (jamAttendeesQuery.data.map((attendee) => (_jsx(ProfileFromId, { profileId: attendee.profileId, action: _jsx(UpdatingDate, { date: attendee.createdAt }) }, attendee.id)))) : (_jsx("p", { className: "text-muted-foreground py-4 text-sm", children: t('events.noAttendees', { defaultValue: 'No attendees yet.' }) }))] })) : null, tab === 'recordings' && event.jam ? (!canViewRecordings ? (_jsxs("div", { role: "status", className: "flex flex-col items-center justify-center gap-2 py-6", children: [_jsx(EyeOff, { className: "size-12" }), _jsx("p", { className: "text-center text-sm", children: recordingsForbiddenMessage })] })) : recordingsQuery.isLoading ? (_jsx("div", { className: "text-muted-foreground py-4 text-sm", children: _jsx(LoadingSpinner, {}) })) : recordingsQuery.isError ? (_jsx(AccessDenied, { queries: [recordingsQuery], message: recordingsForbiddenMessage })) : recordingsQuery.data?.length ? (recordingsQuery.data.map((recording) => (_jsx(JamRecordingItem, { post: post, recording: recording, canManage: canViewRecordings }, recording.id)))) : (_jsx("p", { className: "text-muted-foreground py-4 text-sm", children: t('events.noRecordings', { defaultValue: 'No recordings yet.' }) }))) : null, _jsx("div", { className: "h-[40vh]" })] }));
106
115
  }
@@ -43,6 +43,14 @@ export const ProfileEventRelationship = ({ post, }) => {
43
43
  variant: 'outline',
44
44
  };
45
45
  }
46
+ if (myRsvp?.response === 'waitlist') {
47
+ return {
48
+ status: t('events.profileRelationship.waitlisted', {
49
+ defaultValue: 'Waitlisted',
50
+ }),
51
+ variant: 'outline',
52
+ };
53
+ }
46
54
  return null;
47
55
  })();
48
56
  if (!badge)
@@ -83,17 +83,17 @@ export const FullResource = ({ post }) => {
83
83
  if (resource.resourceKind === 'video' && playerVisible) {
84
84
  const videoAtt = resource.attachments?.find((a) => attachmentMediaKind(a) === 'video');
85
85
  if (videoAtt) {
86
- return (_jsx(ResourceCard, { post: post, preview: _jsx(VideoPlayer, { attachment: videoAtt, className: "max-h-[600px] w-full" }) }));
86
+ return (_jsx(ResourceCard, { post: post, showDescription: false, inGroup: !!post.group, preview: _jsx(VideoPlayer, { attachment: videoAtt, className: "max-h-[600px] w-full" }) }));
87
87
  }
88
88
  }
89
89
  if (resource.resourceKind === 'audio' && playerVisible) {
90
90
  const audioAtt = resource.attachments?.find((a) => attachmentMediaKind(a) === 'audio');
91
91
  if (audioAtt?.url) {
92
- return (_jsx(ResourceCard, { post: post, preview: _jsx(AudioAttachment, { src: audioAtt.url, label: audioAtt.filename ?? audioAtt.description, size: audioAtt.meta?.size }) }));
92
+ return (_jsx(ResourceCard, { post: post, showDescription: false, inGroup: !!post.group, preview: _jsx(AudioAttachment, { src: audioAtt.url, label: audioAtt.filename ?? audioAtt.description, size: audioAtt.meta?.size }) }));
93
93
  }
94
94
  }
95
95
  // All kinds: ResourceCard with click overlay
96
- return (_jsxs("div", { className: "relative", children: [_jsx(ResourceCard, { post: post }), _jsx("div", { className: "pointer-events-none absolute left-0 right-0 top-0 flex h-48 items-center justify-center", children: _jsx("div", { className: "pointer-events-auto flex size-20 cursor-pointer items-center justify-center rounded-full bg-black/60 text-white", onClick: handlePreviewClick, role: "button", "aria-label": previewLabel(), children: previewIcon() }) })] }));
96
+ return (_jsxs("div", { className: "relative", children: [_jsx(ResourceCard, { post: post, showDescription: false, inGroup: !!post.group }), _jsx("div", { className: "pointer-events-none absolute left-0 right-0 top-0 flex h-48 items-center justify-center", children: _jsx("div", { className: "pointer-events-auto flex size-20 cursor-pointer items-center justify-center rounded-full bg-black/60 text-white", onClick: handlePreviewClick, role: "button", "aria-label": previewLabel(), children: previewIcon() }) })] }));
97
97
  };
98
98
  return (_jsx(FullPostLayout, { post: post, deleteCallback: () => window.history.back(), children: _jsxs("article", { className: "bg-background border-border relative min-w-0 border-b p-4", children: [_jsx(PostInfoHeader, { post: post, showMenu: true, deleteCallback: () => window.history.back() }), _jsxs("div", { className: "flex w-full min-w-0 flex-col gap-3", children: [renderMedia(), galleryIndex !== null ? (_jsx(GalleryModal, { attachments: resource.attachments ?? [], initialIndex: galleryIndex, onClose: () => setGalleryIndex(null) })) : null, resource?.content ? (_jsx(PostMarkdown, { source: resource.content })) : null] })] }) }));
99
99
  };
@@ -1,12 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { isGroupPath, isJamPath, isPostPath } from './helpers.js';
2
+ import { isGroupPath, isJamPath, isPostPath, isWelcomePath } from './helpers.js';
3
3
  import { GroupPreview } from './local/GroupPreview.js';
4
4
  import { PostPreview } from './local/PostPreview.js';
5
5
  import { JamPreview } from './local/JamPreview.js';
6
+ import { WelcomePreview } from './local/WelcomePreview.js';
6
7
  export function LocalPreviewLink({ url }) {
7
8
  const path = new URL(url).pathname;
8
9
  const isPost = isPostPath(path);
9
10
  const isJam = isJamPath(path);
10
11
  const isGroup = isGroupPath(path);
11
- return (_jsxs("a", { href: url, className: "hover:bg-surface mb-2 block w-full min-w-0 max-w-full overflow-hidden rounded-md border p-3 no-underline", onClick: (e) => e.stopPropagation(), children: [isPost ? _jsx(PostPreview, { path: path }) : null, isGroup ? _jsx(GroupPreview, { path: path }) : null, isJam ? _jsx(JamPreview, { path: path }) : null] }));
12
+ const isWelcome = isWelcomePath(path);
13
+ return (_jsxs("a", { href: url, className: "hover:bg-surface mb-2 block w-full min-w-0 max-w-full overflow-hidden rounded-md border p-3 no-underline", onClick: (e) => e.stopPropagation(), children: [isPost ? _jsx(PostPreview, { path: path }) : null, isGroup ? _jsx(GroupPreview, { path: path }) : null, isJam ? _jsx(JamPreview, { path: path }) : null, isWelcome ? _jsx(WelcomePreview, {}) : null] }));
12
14
  }
@@ -7,5 +7,5 @@ export function PreviewLink({ url = '' }) {
7
7
  return null;
8
8
  const origin = typeof window !== 'undefined' ? window.location.origin : '';
9
9
  const local = isLocalLink(url, origin);
10
- return (_jsx("div", { className: "min-w-0 max-w-full overflow-hidden", children: local ? (_jsx(LocalPreviewLink, { url: url })) : (_jsx(RemotePreviewLink, { url: url })) }));
10
+ return (_jsx("div", { className: "min-w-0 max-w-full overflow-hidden", children: local ? _jsx(LocalPreviewLink, { url: url }) : _jsx(RemotePreviewLink, { url: url }) }));
11
11
  }
@@ -1,7 +1,12 @@
1
1
  export declare const isPostPath: (path: string) => boolean;
2
2
  export declare const isJamPath: (path: string) => boolean;
3
3
  export declare const isGroupPath: (path: string) => boolean;
4
+ export declare const isWelcomePath: (path: string) => path is "/welcome" | "/welcome/";
4
5
  export declare const isLocalLink: (url: string, origin: string) => boolean;
6
+ /** Plain-text clip of the welcome page, without image markup. */
7
+ export declare const welcomePreviewExcerpt: (markdown?: string) => string;
8
+ /** First content image on the welcome page, ignoring inline data URLs. */
9
+ export declare const firstMarkdownImage: (markdown?: string) => string | undefined;
5
10
  export declare const isValidUrl: (url?: string) => boolean;
6
11
  export declare const isEmail: (url: string) => boolean;
7
12
  export declare const extractUrlsFromText: (text?: string) => [] | RegExpMatchArray;