@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
@@ -12,6 +12,7 @@ import { useServerInfo } from '../../../server-data';
12
12
  import { usePostViewRef } from '../../../../lib/postViewCounter';
13
13
  import { EventLocation } from '../../pieces/EventLocation';
14
14
  import { ParticipantsCard } from '../../pieces/ParticipantsCard';
15
+ import { ShareMenu } from '../../pieces/ShareMenu';
15
16
  import { ProfileEventRelationship } from './ProfileEventRelationship';
16
17
 
17
18
  export interface CardEventProps {
@@ -78,20 +79,31 @@ export function CardEvent({ post, showEventDate = true }: CardEventProps) {
78
79
  </div>
79
80
  </a>
80
81
  <div className="grid gap-y-4 p-4">
81
- <a href={postLink} className="block text-inherit no-underline">
82
- {showEventDate ? (
83
- <p className="text-muted-foreground text-sm">
84
- {formatEventTimespan(
85
- event,
86
- post.occurrenceStart,
87
- post.occurrenceEnd,
88
- )}
89
- </p>
90
- ) : null}
91
- <h3 className="text-xl font-semibold">
92
- {truncateText(event.name, 100) || '-'}
93
- </h3>
94
- </a>
82
+ <div className="flex items-start gap-2">
83
+ <a
84
+ href={postLink}
85
+ className="block min-w-0 flex-1 text-inherit no-underline"
86
+ >
87
+ {showEventDate ? (
88
+ <p className="text-muted-foreground text-sm">
89
+ {formatEventTimespan(
90
+ event,
91
+ post.occurrenceStart,
92
+ post.occurrenceEnd,
93
+ )}
94
+ </p>
95
+ ) : null}
96
+ <h3 className="text-xl font-semibold">
97
+ {truncateText(event.name, 100) || '-'}
98
+ </h3>
99
+ </a>
100
+ <ShareMenu
101
+ post={post}
102
+ variant="ghost"
103
+ className="shrink-0"
104
+ text={t('posts.footer.share', { defaultValue: 'Share' })}
105
+ />
106
+ </div>
95
107
  {event.recurrence ? (
96
108
  <p className="text-muted-foreground text-sm">
97
109
  {formatEventRecurrence(event.recurrence, t, event.start)}
@@ -12,18 +12,17 @@ import {
12
12
  canManageEventRsvps,
13
13
  canModerateJam,
14
14
  canViewJamAttendees,
15
- countYesRsvps,
16
- defaultRsvpRecurrenceId,
15
+ availableSpots,
17
16
  effectiveEventTimes,
18
17
  eventTimeZoneOptions,
19
18
  formatEventClockTime,
20
19
  formatEventRecurrence,
21
20
  getJamUrl,
22
21
  groupName,
23
- isCapacityEvent,
24
22
  parseOccurrenceQuery,
25
23
  listRsvpOccurrences,
26
24
  profileName,
25
+ rsvpExportFilename,
27
26
  } from '@openpeepshq/common/lib';
28
27
  import {
29
28
  Button,
@@ -99,17 +98,8 @@ export function FullEvent({ post, occurrence }: FullEventProps) {
99
98
  const myEvent = post.profile?.id === profile?.id;
100
99
  const iAmModerator = canModerateJam(profile, post);
101
100
  const canManageRsvps = canManageEventRsvps(profile, post);
102
- const slotsLeft =
103
- isCapacityEvent(event) &&
104
- event.maxAttendees !== undefined &&
105
- (!event.recurrence || occurrenceId)
106
- ? event.maxAttendees - countYesRsvps(post, occurrenceId)
107
- : null;
108
- const times = effectiveEventTimes(
109
- event,
110
- occurrenceId ??
111
- (event.recurrence ? defaultRsvpRecurrenceId(event) : undefined),
112
- );
101
+ const slotsLeft = availableSpots(post, occurrenceId) ?? null;
102
+ const times = effectiveEventTimes(event, occurrenceId);
113
103
  const recurrenceLabel = event.recurrence
114
104
  ? formatEventRecurrence(event.recurrence, t, event.start)
115
105
  : '';
@@ -133,6 +123,22 @@ export function FullEvent({ post, occurrence }: FullEventProps) {
133
123
  }
134
124
  }, [client, post.id, t, toastError]);
135
125
 
126
+ const exportRsvps = useCallback(async () => {
127
+ try {
128
+ const csv = await client.posts.exportRsvps({
129
+ id: post.id,
130
+ occurrence: occurrenceId,
131
+ });
132
+ downloadCsv(csv, rsvpExportFilename(event.name, new Date()));
133
+ } catch {
134
+ toastError(
135
+ t('events.exportRsvpsError', {
136
+ defaultValue: 'Failed to export RSVPs',
137
+ }),
138
+ );
139
+ }
140
+ }, [client, event.name, occurrenceId, post.id, t, toastError]);
141
+
136
142
  const descendentThreads = useMemo(
137
143
  () =>
138
144
  (contextQuery.data && buildThreads(contextQuery.data.descendants)) || [],
@@ -193,11 +199,8 @@ export function FullEvent({ post, occurrence }: FullEventProps) {
193
199
  <div className="flex items-center gap-2">
194
200
  <ShareMenu
195
201
  post={post}
196
- menuButton={
197
- <span className="flex size-10 items-center justify-center rounded-md">
198
- <Share className="size-4" />
199
- </span>
200
- }
202
+ text={t('posts.footer.share', { defaultValue: 'Share' })}
203
+ menuButton={<Share className="size-4" />}
201
204
  />
202
205
  {myEvent ? (
203
206
  <EventMenu
@@ -333,22 +336,32 @@ export function FullEvent({ post, occurrence }: FullEventProps) {
333
336
  ) : null}
334
337
 
335
338
  {tab === 'rsvps' ? (
336
- <EventRsvpList
337
- post={post}
338
- occurrenceId={occurrenceId}
339
- occurrences={upcomingOccurrences}
340
- currentProfile={profile}
341
- canManageRsvps={canManageRsvps}
342
- onMessage={(target) =>
343
- openCreateConversation({
344
- profiles: [target],
345
- skipProfileSelection: true,
346
- })
347
- }
348
- onManage={(response, profileId, recurrenceId) =>
349
- rsvpManage({ response, recurrenceId }, { id: post.id, profileId })
350
- }
351
- />
339
+ <>
340
+ {canManageRsvps ? (
341
+ <div className="flex justify-end py-2">
342
+ <Button variant="outline" compact action={exportRsvps}>
343
+ <Download className="mr-1 h-4 w-4" />
344
+ {t('events.exportRsvps', { defaultValue: 'Export RSVPs' })}
345
+ </Button>
346
+ </div>
347
+ ) : null}
348
+ <EventRsvpList
349
+ post={post}
350
+ occurrenceId={occurrenceId}
351
+ occurrences={upcomingOccurrences}
352
+ currentProfile={profile}
353
+ canManageRsvps={canManageRsvps}
354
+ onMessage={(target) =>
355
+ openCreateConversation({
356
+ profiles: [target],
357
+ skipProfileSelection: true,
358
+ })
359
+ }
360
+ onManage={(response, profileId, recurrenceId) =>
361
+ rsvpManage({ response, recurrenceId }, { id: post.id, profileId })
362
+ }
363
+ />
364
+ </>
352
365
  ) : null}
353
366
 
354
367
  {tab === 'attendees' && showJamAttendeesTab ? (
@@ -58,6 +58,14 @@ export const ProfileEventRelationship = ({
58
58
  variant: 'outline',
59
59
  };
60
60
  }
61
+ if (myRsvp?.response === 'waitlist') {
62
+ return {
63
+ status: t('events.profileRelationship.waitlisted', {
64
+ defaultValue: 'Waitlisted',
65
+ }),
66
+ variant: 'outline',
67
+ };
68
+ }
61
69
  return null;
62
70
  })();
63
71
 
@@ -7,9 +7,6 @@ export interface FullNoteProps {
7
7
 
8
8
  export function FullNote({ post }: FullNoteProps) {
9
9
  return (
10
- <FullPostLayout
11
- post={post}
12
- deleteCallback={() => window.history.back()}
13
- />
10
+ <FullPostLayout post={post} deleteCallback={() => window.history.back()} />
14
11
  );
15
12
  }
@@ -9,10 +9,7 @@ export interface FullPollProps {
9
9
 
10
10
  export function FullPoll({ post }: FullPollProps) {
11
11
  return (
12
- <FullPostLayout
13
- post={post}
14
- deleteCallback={() => window.history.back()}
15
- >
12
+ <FullPostLayout post={post} deleteCallback={() => window.history.back()}>
16
13
  <FeedPost
17
14
  post={post}
18
15
  noReactionHeader
@@ -97,6 +97,8 @@ export const FullResource = ({ post }: FullResourceProps) => {
97
97
  return (
98
98
  <ResourceCard
99
99
  post={post}
100
+ showDescription={false}
101
+ inGroup={!!post.group}
100
102
  preview={
101
103
  <VideoPlayer
102
104
  attachment={videoAtt}
@@ -116,6 +118,8 @@ export const FullResource = ({ post }: FullResourceProps) => {
116
118
  return (
117
119
  <ResourceCard
118
120
  post={post}
121
+ showDescription={false}
122
+ inGroup={!!post.group}
119
123
  preview={
120
124
  <AudioAttachment
121
125
  src={audioAtt.url}
@@ -131,7 +135,11 @@ export const FullResource = ({ post }: FullResourceProps) => {
131
135
  // All kinds: ResourceCard with click overlay
132
136
  return (
133
137
  <div className="relative">
134
- <ResourceCard post={post} />
138
+ <ResourceCard
139
+ post={post}
140
+ showDescription={false}
141
+ inGroup={!!post.group}
142
+ />
135
143
  <div className="pointer-events-none absolute left-0 right-0 top-0 flex h-48 items-center justify-center">
136
144
  <div
137
145
  className="pointer-events-auto flex size-20 cursor-pointer items-center justify-center rounded-full bg-black/60 text-white"
@@ -1,7 +1,8 @@
1
- import { isGroupPath, isJamPath, isPostPath } from './helpers';
1
+ import { isGroupPath, isJamPath, isPostPath, isWelcomePath } from './helpers';
2
2
  import { GroupPreview } from './local/GroupPreview';
3
3
  import { PostPreview } from './local/PostPreview';
4
4
  import { JamPreview } from './local/JamPreview';
5
+ import { WelcomePreview } from './local/WelcomePreview';
5
6
 
6
7
  export interface LocalPreviewLinkProps {
7
8
  url: string;
@@ -12,6 +13,7 @@ export function LocalPreviewLink({ url }: LocalPreviewLinkProps) {
12
13
  const isPost = isPostPath(path);
13
14
  const isJam = isJamPath(path);
14
15
  const isGroup = isGroupPath(path);
16
+ const isWelcome = isWelcomePath(path);
15
17
 
16
18
  return (
17
19
  <a
@@ -22,6 +24,7 @@ export function LocalPreviewLink({ url }: LocalPreviewLinkProps) {
22
24
  {isPost ? <PostPreview path={path} /> : null}
23
25
  {isGroup ? <GroupPreview path={path} /> : null}
24
26
  {isJam ? <JamPreview path={path} /> : null}
27
+ {isWelcome ? <WelcomePreview /> : null}
25
28
  </a>
26
29
  );
27
30
  }
@@ -9,17 +9,12 @@ export interface PreviewLinkProps {
9
9
  export function PreviewLink({ url = '' }: PreviewLinkProps) {
10
10
  if (!isValidUrl(url)) return null;
11
11
 
12
- const origin =
13
- typeof window !== 'undefined' ? window.location.origin : '';
12
+ const origin = typeof window !== 'undefined' ? window.location.origin : '';
14
13
  const local = isLocalLink(url, origin);
15
14
 
16
15
  return (
17
16
  <div className="min-w-0 max-w-full overflow-hidden">
18
- {local ? (
19
- <LocalPreviewLink url={url} />
20
- ) : (
21
- <RemotePreviewLink url={url} />
22
- )}
17
+ {local ? <LocalPreviewLink url={url} /> : <RemotePreviewLink url={url} />}
23
18
  </div>
24
19
  );
25
20
  }
@@ -1,6 +1,10 @@
1
+ import { markdownPlainText } from '@openpeepshq/common';
2
+
1
3
  const UUID_RE =
2
4
  /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3
5
 
6
+ const EXCERPT_MAX = 180;
7
+
4
8
  export const isPostPath = (path: string) =>
5
9
  path.startsWith('/posts/') && UUID_RE.test(path.substring(7));
6
10
 
@@ -11,6 +15,9 @@ export const isJamPath = (path: string) =>
11
15
 
12
16
  export const isGroupPath = (path: string) => path.startsWith('/groups/@');
13
17
 
18
+ export const isWelcomePath = (path: string) =>
19
+ path === '/welcome' || path === '/welcome/';
20
+
14
21
  export const isLocalLink = (url: string, origin: string) => {
15
22
  try {
16
23
  const urlObj = new URL(url);
@@ -18,13 +25,37 @@ export const isLocalLink = (url: string, origin: string) => {
18
25
  urlObj.origin === origin &&
19
26
  (isPostPath(urlObj.pathname) ||
20
27
  isJamPath(urlObj.pathname) ||
21
- isGroupPath(urlObj.pathname))
28
+ isGroupPath(urlObj.pathname) ||
29
+ isWelcomePath(urlObj.pathname))
22
30
  );
23
31
  } catch {
24
32
  return false;
25
33
  }
26
34
  };
27
35
 
36
+ /** Plain-text clip of the welcome page, without image markup. */
37
+ export const welcomePreviewExcerpt = (markdown?: string) => {
38
+ const plain = markdownPlainText(
39
+ (markdown ?? '').replace(/!\[[^\]]*]\([^)]*\)/g, ' '),
40
+ );
41
+ if (plain.length <= EXCERPT_MAX) return plain;
42
+ const cut = plain.slice(0, EXCERPT_MAX);
43
+ const lastSpace = cut.lastIndexOf(' ');
44
+ const clipped = lastSpace > 80 ? cut.slice(0, lastSpace) : cut;
45
+ return `${clipped.trimEnd()}…`;
46
+ };
47
+
48
+ /** First content image on the welcome page, ignoring inline data URLs. */
49
+ export const firstMarkdownImage = (markdown?: string) => {
50
+ if (!markdown) return undefined;
51
+ const pattern = /!\[[^\]]*]\(\s*(<([^>]+)>|([^\s)]+))/g;
52
+ for (const match of markdown.matchAll(pattern)) {
53
+ const src = (match[2] ?? match[3])?.trim();
54
+ if (src && !src.startsWith('data:')) return src;
55
+ }
56
+ return undefined;
57
+ };
58
+
28
59
  export const isValidUrl = (url?: string) => {
29
60
  if (!url) return false;
30
61
  try {
@@ -14,7 +14,7 @@ export function GroupPreview({ path }: GroupPreviewProps) {
14
14
  if (groupQuery.isLoading) {
15
15
  return (
16
16
  <div className="text-muted-foreground text-sm">
17
- <LoadingSpinner />
17
+ <LoadingSpinner />
18
18
  </div>
19
19
  );
20
20
  }
@@ -19,7 +19,7 @@ export function JamPreview({ path }: JamPreviewProps) {
19
19
  if (postQuery.isLoading) {
20
20
  return (
21
21
  <div className="text-muted-foreground text-sm">
22
- <LoadingSpinner />
22
+ <LoadingSpinner />
23
23
  </div>
24
24
  );
25
25
  }
@@ -0,0 +1,45 @@
1
+ import { useWelcomePreview } from '../../../hooks/useWelcomePreview';
2
+ import { truncateMarkdown, stripMarkdownImages } from '@openpeepshq/common/lib';
3
+ import { TruncatedMarkdown } from '../../post/TruncatedMarkdown';
4
+
5
+ export const WelcomePreview = () => {
6
+ const { eyebrow, title, description, markdown, imageUrl, imageFit } =
7
+ useWelcomePreview();
8
+
9
+ return (
10
+ <div
11
+ data-testid="welcome-preview-card"
12
+ className="flex w-full min-w-0 flex-row items-center gap-4"
13
+ >
14
+ {imageUrl ? (
15
+ <div className="flex h-24 w-24 shrink-0 items-center justify-center overflow-hidden rounded-md">
16
+ <img
17
+ src={imageUrl}
18
+ alt=""
19
+ className={`h-full w-full ${
20
+ imageFit === 'cover' ? 'object-cover' : 'object-contain'
21
+ }`}
22
+ />
23
+ </div>
24
+ ) : null}
25
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
26
+ {eyebrow ? (
27
+ <p className="text-muted-foreground truncate text-xs">{eyebrow}</p>
28
+ ) : null}
29
+ <p className="line-clamp-2 font-semibold">{title}</p>
30
+ {markdown ? (
31
+ <TruncatedMarkdown
32
+ source={markdown}
33
+ snippet={truncateMarkdown(stripMarkdownImages(markdown), 2, 240)}
34
+ maxLines={2}
35
+ className="break-words text-sm text-muted-foreground"
36
+ />
37
+ ) : description ? (
38
+ <p className="text-muted-foreground line-clamp-3 break-words text-sm">
39
+ {description}
40
+ </p>
41
+ ) : null}
42
+ </div>
43
+ </div>
44
+ );
45
+ };
@@ -1,5 +1,9 @@
1
1
  import type { PublicProfile } from '@openpeepshq/common/types';
2
- import { getTheme, isDeletedProfile } from '@openpeepshq/common';
2
+ import {
3
+ DELETED_AUTHOR_DISPLAY_NAME,
4
+ getTheme,
5
+ isDeletedProfile,
6
+ } from '@openpeepshq/common';
3
7
  import { UserX } from 'lucide-react';
4
8
 
5
9
  import { useServerInfo } from '../server-data';
@@ -62,7 +66,7 @@ export function Avatar({
62
66
  >
63
67
  {deleted ? (
64
68
  <UserX
65
- aria-label={profile?.displayName || 'Deleted author'}
69
+ aria-label={profile?.displayName || DELETED_AUTHOR_DISPLAY_NAME}
66
70
  className="text-muted-foreground"
67
71
  size={iconSize}
68
72
  />
@@ -18,11 +18,7 @@ export function ProfileFromId({
18
18
  const profile = profileQuery.data;
19
19
 
20
20
  if (profileQuery.isLoading) {
21
- return (
22
- <div className="text-muted-foreground py-2 text-sm">
23
- Loading…
24
- </div>
25
- );
21
+ return <div className="text-muted-foreground py-2 text-sm">Loading…</div>;
26
22
  }
27
23
 
28
24
  if (!profile) return null;
@@ -13,19 +13,26 @@ import type {
13
13
  } from '@openpeepshq/common/types';
14
14
  import {
15
15
  attachmentMediaKind,
16
- normalizeResourceTags,
17
- truncateMarkdown,
18
16
  formatSize,
17
+ groupName,
18
+ normalizeResourceTags,
19
19
  } from '@openpeepshq/common/lib';
20
+ import { useHrefOf } from '../../contexts/router';
20
21
  import { useT } from '../../i18n';
21
22
  import { useOpenpeeps } from '../../contexts/openpeeps';
22
23
  import { useCurrentProfile } from '../layout/IdentityContext';
23
24
  import { VideoPlayOverlay } from '../post/VideoPlayOverlay';
25
+ import { TruncatedMarkdown } from '../post/TruncatedMarkdown';
26
+ import { useNavigate } from '../../contexts/router';
24
27
 
25
28
  export interface ResourceCardProps {
26
29
  post: PublicPost;
27
30
  layout?: 'card' | 'list';
28
31
  preview?: ReactNode;
32
+ /** Set false when the full description is rendered by the surrounding layout (e.g. the post detail page). */
33
+ showDescription?: boolean;
34
+ /** When true, hides the group label (already shown by the group context). */
35
+ inGroup?: boolean;
29
36
  }
30
37
 
31
38
  const visualAttachments = (attachments: MediaAttachmentData[]) =>
@@ -87,7 +94,6 @@ const MediaPreview = ({
87
94
 
88
95
  return (
89
96
  <>
90
- {/* eslint-disable-next-line jsx-a11y/img-has-alt -- handled by alt attribute */}
91
97
  <img
92
98
  src={src}
93
99
  alt={alt}
@@ -108,15 +114,18 @@ export const ResourceCard = ({
108
114
  post,
109
115
  layout = 'card',
110
116
  preview,
117
+ showDescription = true,
118
+ inGroup = false,
111
119
  }: ResourceCardProps) => {
112
120
  const t = useT();
121
+ const navigate = useNavigate();
122
+ const hrefOf = useHrefOf();
113
123
  const { openpeepsApi } = useOpenpeeps();
114
124
  const me = useCurrentProfile();
115
125
  if (post.data?.type !== 'resource') return null;
116
126
  const resource = post.data;
117
127
  const attachments = resource.attachments ?? [];
118
128
  const visuals = visualAttachments(attachments);
119
- const excerpt = truncateMarkdown(resource.content, 2, 240);
120
129
  const tags = normalizeResourceTags(resource.tags);
121
130
  const isGallery = resource.resourceKind === 'gallery' && visuals.length > 1;
122
131
  const tiles = isGallery ? visuals.slice(0, 4) : visuals.slice(0, 1);
@@ -125,6 +134,9 @@ export const ResourceCard = ({
125
134
  const thumbnail = visuals[0];
126
135
  const thumbSrc = thumbnail ? previewSrc(thumbnail) : null;
127
136
 
137
+ const group = post.group;
138
+ const groupLabel = group ? groupName(group) : null;
139
+
128
140
  const metaText = useMemo(() => {
129
141
  if (resource.resourceKind === 'gallery' && visuals.length > 1) {
130
142
  return t('resources.meta.imagesCount', {
@@ -186,6 +198,31 @@ export const ResourceCard = ({
186
198
  </button>
187
199
  );
188
200
 
201
+ const renderGroupLabel = () => {
202
+ if (!group || !groupLabel || inGroup) return null;
203
+ const groupHref = hrefOf({ type: 'group', handle: group.handle });
204
+ return (
205
+ <a
206
+ href={groupHref}
207
+ onClick={(e) => {
208
+ e.stopPropagation();
209
+ }}
210
+ className="text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs"
211
+ title={t('resources.group.inGroup', {
212
+ defaultValue: 'in {{groupName}}',
213
+ groupName: groupLabel,
214
+ })}
215
+ >
216
+ <span className="bg-muted rounded-full px-2 py-0.5 text-xs">
217
+ {t('resources.group.inGroup', {
218
+ defaultValue: 'in {{groupName}}',
219
+ groupName: groupLabel,
220
+ })}
221
+ </span>
222
+ </a>
223
+ );
224
+ };
225
+
189
226
  const renderThumbnail = () => {
190
227
  if (thumbSrc) {
191
228
  return (
@@ -220,8 +257,15 @@ export const ResourceCard = ({
220
257
  {resource.categoryPath.join(' / ')}
221
258
  </p>
222
259
  ) : null}
223
- {excerpt ? (
224
- <p className="text-muted-foreground text-sm">{excerpt}</p>
260
+ {renderGroupLabel()}
261
+ {showDescription ? (
262
+ <TruncatedMarkdown
263
+ source={resource.content ?? ''}
264
+ maxBlocks={2}
265
+ maxChars={240}
266
+ maxLines={2}
267
+ className="text-sm text-muted-foreground"
268
+ />
225
269
  ) : null}
226
270
  {metaText ? (
227
271
  <p className="text-muted-foreground text-xs">{metaText}</p>
@@ -307,8 +351,15 @@ export const ResourceCard = ({
307
351
  {resource.categoryPath.join(' / ')}
308
352
  </p>
309
353
  ) : null}
310
- {excerpt ? (
311
- <p className="text-muted-foreground text-sm">{excerpt}</p>
354
+ {renderGroupLabel()}
355
+ {showDescription ? (
356
+ <TruncatedMarkdown
357
+ source={resource.content ?? ''}
358
+ maxBlocks={2}
359
+ maxChars={240}
360
+ maxLines={2}
361
+ className="text-sm text-muted-foreground"
362
+ />
312
363
  ) : null}
313
364
  {metaText ? (
314
365
  <p className="text-muted-foreground text-xs">{metaText}</p>
@@ -316,12 +367,18 @@ export const ResourceCard = ({
316
367
  {tags.length ? (
317
368
  <div className="flex flex-wrap gap-1">
318
369
  {tags.map((value) => (
319
- <span
370
+ <button
320
371
  key={value}
321
- className="bg-muted text-muted-foreground rounded-full px-2 py-0.5 text-xs"
372
+ type="button"
373
+ className="bg-muted text-muted-foreground hover:text-foreground rounded-full px-2 py-0.5 text-xs"
374
+ onClick={(e) => {
375
+ e.preventDefault();
376
+ e.stopPropagation();
377
+ navigate({ type: 'tags', hashtag: value });
378
+ }}
322
379
  >
323
380
  #{value}
324
- </span>
381
+ </button>
325
382
  ))}
326
383
  </div>
327
384
  ) : null}
@@ -352,7 +352,7 @@ export const ResourceLibrary = ({ groupId }: ResourceLibraryProps) => {
352
352
  href={hrefOf({ type: 'post', id: post.id })}
353
353
  className="block"
354
354
  >
355
- <ResourceCard post={post} layout="list" />
355
+ <ResourceCard post={post} layout="list" inGroup={!!groupId} />
356
356
  </a>
357
357
  ))}
358
358
  </div>
@@ -364,7 +364,7 @@ export const ResourceLibrary = ({ groupId }: ResourceLibraryProps) => {
364
364
  href={hrefOf({ type: 'post', id: post.id })}
365
365
  className="block"
366
366
  >
367
- <ResourceCard post={post} layout="card" />
367
+ <ResourceCard post={post} layout="card" inGroup={!!groupId} />
368
368
  </a>
369
369
  ))}
370
370
  </div>
@@ -19,9 +19,7 @@ const useHasAccountJwt = (): boolean => {
19
19
  const refresh = async () => {
20
20
  const token = (await credentialsStore.get())?.token;
21
21
  const next =
22
- !!token &&
23
- !isAccountlessJwt(token) &&
24
- !isServiceOnlyJwt(token);
22
+ !!token && !isAccountlessJwt(token) && !isServiceOnlyJwt(token);
25
23
  if (!cancelled) setHasAccount(next);
26
24
  };
27
25