@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
@@ -3,6 +3,7 @@ import { useT } from '../../../i18n';
3
3
  import { Button } from '@openpeepshq/react-ui';
4
4
  import { useEventRsvp } from '../../../hooks/events/useEventRsvp';
5
5
  import { EventRsvpScopeDialog } from './EventRsvpScopeDialog';
6
+ import { EventWaitlistJoinDialog } from './EventWaitlistJoinDialog';
6
7
 
7
8
  export interface EventRsvpButtonProps {
8
9
  post: PublicPost;
@@ -22,16 +23,24 @@ export const EventRsvpButton = ({
22
23
  myRsvp,
23
24
  canRsvp,
24
25
  rsvpClosed,
26
+ hideRsvpButton,
25
27
  recurring,
26
28
  defaultId,
27
29
  occurrences,
28
30
  capacityEvent,
29
31
  full,
32
+ onWaitlist,
33
+ offerExpiresAt,
30
34
  error,
31
35
  pending,
32
36
  setPending,
37
+ confirmingWaitlist,
38
+ setConfirmingWaitlist,
33
39
  submitting,
34
40
  requestRespond,
41
+ requestJoinWaitlist,
42
+ confirmJoinWaitlist,
43
+ claimSpot,
35
44
  confirmScope,
36
45
  } = useEventRsvp({ post, recurrenceId, lockToOccurrence });
37
46
 
@@ -57,9 +66,13 @@ export const EventRsvpButton = ({
57
66
  ? t('posts.rsvp.attendingMessage', {
58
67
  defaultValue: 'You are attending.',
59
68
  })
60
- : t('posts.rsvp.maybeMessage', {
61
- defaultValue: 'You responded maybe.',
62
- })}
69
+ : myRsvp.response === 'waitlist'
70
+ ? t('events.rsvp.onWaitlist', {
71
+ defaultValue: 'You are on the waitlist.',
72
+ })
73
+ : t('posts.rsvp.maybeMessage', {
74
+ defaultValue: 'You responded maybe.',
75
+ })}
63
76
  </p>
64
77
  ) : null}
65
78
  <p className="text-muted-foreground mt-2 text-center text-sm">
@@ -71,6 +84,8 @@ export const EventRsvpButton = ({
71
84
  );
72
85
  }
73
86
 
87
+ if (hideRsvpButton) return null;
88
+
74
89
  const scopeDialog =
75
90
  pending && recurring && !lockToOccurrence ? (
76
91
  <EventRsvpScopeDialog
@@ -90,6 +105,86 @@ export const EventRsvpButton = ({
90
105
  />
91
106
  ) : null;
92
107
 
108
+ const waitlistDialog = (
109
+ <EventWaitlistJoinDialog
110
+ open={confirmingWaitlist}
111
+ post={post}
112
+ error={error}
113
+ submitting={submitting}
114
+ onClose={() => {
115
+ if (!submitting) setConfirmingWaitlist(false);
116
+ }}
117
+ onConfirm={async () => {
118
+ await confirmJoinWaitlist();
119
+ }}
120
+ />
121
+ );
122
+
123
+ if (offerExpiresAt) {
124
+ return (
125
+ <div className="mt-4 w-full">
126
+ <p className="text-center text-sm">
127
+ {t('events.rsvp.offerOpen', {
128
+ defaultValue: 'A spot is open for you until {{until}}.',
129
+ until: new Date(offerExpiresAt).toLocaleString(),
130
+ })}
131
+ </p>
132
+ <Button
133
+ variant="default"
134
+ className="mt-2 w-full"
135
+ disabled={submitting}
136
+ action={claimSpot}
137
+ >
138
+ {t('events.rsvp.claimSpot', { defaultValue: 'Claim spot' })}
139
+ </Button>
140
+ <Button
141
+ variant="outline"
142
+ className="text-error mt-2 w-full"
143
+ disabled={submitting}
144
+ action={() => requestRespond('no')}
145
+ >
146
+ {t('events.rsvp.leaveWaitlist', {
147
+ defaultValue: 'Leave waitlist',
148
+ })}
149
+ </Button>
150
+ {error ? (
151
+ <p className="text-error mt-2 text-center text-sm">{error}</p>
152
+ ) : null}
153
+ </div>
154
+ );
155
+ }
156
+
157
+ if (onWaitlist) {
158
+ return (
159
+ <div className="mt-4 w-full">
160
+ <p className="text-center text-sm">
161
+ {t('events.rsvp.onWaitlist', {
162
+ defaultValue: 'You are on the waitlist.',
163
+ })}
164
+ </p>
165
+ <p className="text-muted-foreground mt-1 text-center text-sm">
166
+ {t('events.rsvp.atCapacity', {
167
+ defaultValue: 'This event is at capacity.',
168
+ })}
169
+ </p>
170
+ <Button
171
+ variant="outline"
172
+ className="text-error mt-2 w-full"
173
+ disabled={submitting}
174
+ action={() => requestRespond('no')}
175
+ >
176
+ {t('events.rsvp.leaveWaitlist', {
177
+ defaultValue: 'Leave waitlist',
178
+ })}
179
+ </Button>
180
+ {error && !pending ? (
181
+ <p className="text-error mt-2 text-center text-sm">{error}</p>
182
+ ) : null}
183
+ {scopeDialog}
184
+ </div>
185
+ );
186
+ }
187
+
93
188
  if (myRsvp && myRsvp.response !== 'no') {
94
189
  return (
95
190
  <div className="w-full">
@@ -122,15 +217,22 @@ export const EventRsvpButton = ({
122
217
 
123
218
  return (
124
219
  <div className="mt-4 w-full">
220
+ {full ? (
221
+ <p className="text-muted-foreground mb-2 text-center text-sm">
222
+ {t('events.rsvp.atCapacity', {
223
+ defaultValue: 'This event is at capacity.',
224
+ })}
225
+ </p>
226
+ ) : null}
125
227
  <div className="flex w-full gap-x-2">
126
228
  <Button
127
229
  variant="default"
128
230
  className="w-[70%]"
129
- disabled={full || submitting}
130
- action={() => requestRespond('yes')}
231
+ disabled={submitting}
232
+ action={() => (full ? requestJoinWaitlist() : requestRespond('yes'))}
131
233
  >
132
234
  {full
133
- ? t('events.rsvp.full', { defaultValue: 'Event is full' })
235
+ ? t('events.rsvp.joinWaitlist', { defaultValue: 'Join waitlist' })
134
236
  : t('posts.rsvp.register', { defaultValue: 'Register' })}
135
237
  </Button>
136
238
  {!capacityEvent ? (
@@ -150,10 +252,11 @@ export const EventRsvpButton = ({
150
252
  {t('posts.rsvp.no', { defaultValue: 'No' })}
151
253
  </Button>
152
254
  </div>
153
- {error && !pending ? (
255
+ {error && !pending && !confirmingWaitlist ? (
154
256
  <p className="text-error mt-2 text-center text-sm">{error}</p>
155
257
  ) : null}
156
258
  {scopeDialog}
259
+ {waitlistDialog}
157
260
  </div>
158
261
  );
159
262
  };
@@ -14,6 +14,8 @@ import {
14
14
  isRecurringEvent,
15
15
  listedRsvps,
16
16
  listRsvpCancellations,
17
+ offerStillOpen,
18
+ orderedWaitlist,
17
19
  profileName,
18
20
  rsvpCancelWhenLabels,
19
21
  sameRecurrenceId,
@@ -126,6 +128,9 @@ export const EventRsvpList = ({
126
128
  onMessage={onMessage}
127
129
  onManage={onManage}
128
130
  />
131
+ {canManageRsvps ? (
132
+ <WaitlistSection post={post} recurrenceId={occurrenceId} />
133
+ ) : null}
129
134
  {history}
130
135
  </>
131
136
  );
@@ -168,6 +173,9 @@ export const EventRsvpList = ({
168
173
  onMessage={onMessage}
169
174
  onManage={onManage}
170
175
  />
176
+ {canManageRsvps ? (
177
+ <WaitlistSection post={post} recurrenceId={key} />
178
+ ) : null}
171
179
  </RsvpPanel>
172
180
  );
173
181
  })}
@@ -176,6 +184,62 @@ export const EventRsvpList = ({
176
184
  );
177
185
  };
178
186
 
187
+ const WaitlistSection = ({
188
+ post,
189
+ recurrenceId,
190
+ }: {
191
+ post: PublicPost;
192
+ recurrenceId?: string;
193
+ }) => {
194
+ const t = useT();
195
+ const waiting = orderedWaitlist(post, recurrenceId);
196
+ if (!waiting.length) return null;
197
+ const profiles = new Map(
198
+ (post.rsvps ?? []).map((rsvp) => [rsvp.profile.id, rsvp.profile]),
199
+ );
200
+ return (
201
+ <div className="mt-4 border-t pt-3">
202
+ <h3 className="mb-2 text-sm font-semibold">
203
+ {t('events.rsvp.waitlistTitle', { defaultValue: 'Waitlist' })}
204
+ </h3>
205
+ <ol className="flex flex-col gap-2">
206
+ {waiting.map((member, index) => {
207
+ const profile = profiles.get(member.profileId);
208
+ if (!profile) return null;
209
+ const until = member.offerExpiresAt;
210
+ const offered = !!until && offerStillOpen({ offerExpiresAt: until });
211
+ return (
212
+ <li key={member.profileId} className="text-sm">
213
+ <span className="text-muted-foreground">{index + 1}. </span>
214
+ <span className="font-medium">{profileName(profile)}</span>
215
+ {offered ? (
216
+ <span className="text-muted-foreground">
217
+ {' '}
218
+ —{' '}
219
+ {t('events.rsvp.waitlistOffered', {
220
+ defaultValue: 'offered until {{until}}',
221
+ until: new Date(until ?? '').toLocaleString(),
222
+ })}
223
+ </span>
224
+ ) : null}
225
+ {profile.type === 'federated' ? (
226
+ <span className="text-muted-foreground">
227
+ {' '}
228
+ —{' '}
229
+ {t('events.rsvp.waitlistRemote', {
230
+ defaultValue:
231
+ 'Remote member, not offered a spot automatically',
232
+ })}
233
+ </span>
234
+ ) : null}
235
+ </li>
236
+ );
237
+ })}
238
+ </ol>
239
+ </div>
240
+ );
241
+ };
242
+
179
243
  const RsvpCancellationHistory = ({ post }: { post: PublicPost }) => {
180
244
  const t = useT();
181
245
  const cancellations = listRsvpCancellations(post);
@@ -2,10 +2,9 @@ import { useEffect, useState } from 'react';
2
2
  import type { PublicPost } from '@openpeepshq/common/types';
3
3
  import type { ExpandedOccurrence } from '@openpeepshq/common/lib';
4
4
  import {
5
- countYesRsvps,
6
- getEffectiveRsvp,
7
- isCapacityEvent,
8
- seriesYesBlockedByCapacity,
5
+ canClaimYesRsvp,
6
+ canJoinWaitlist,
7
+ seriesClaimBlocked,
9
8
  } from '@openpeepshq/common/lib';
10
9
  import type { RsvpScopeChoice } from '../../../hooks/events/useEventRsvp';
11
10
  import {
@@ -27,7 +26,7 @@ export type { RsvpScopeChoice };
27
26
  export type EventRsvpScopeDialogProps = {
28
27
  open: boolean;
29
28
  post: PublicPost;
30
- response: 'yes' | 'tentative' | 'no';
29
+ response: 'yes' | 'tentative' | 'no' | 'waitlist';
31
30
  defaultRecurrenceId?: string;
32
31
  occurrences: ExpandedOccurrence[];
33
32
  error?: string | null;
@@ -60,19 +59,16 @@ export const EventRsvpScopeDialog = ({
60
59
  }: EventRsvpScopeDialogProps) => {
61
60
  const t = useT();
62
61
  const profile = useCurrentProfile();
63
- const event = post.data?.type === 'event' ? post.data : undefined;
64
- const capacityEvent = event ? isCapacityEvent(event) : false;
62
+ const joiningWaitlist = response === 'waitlist';
65
63
  const seriesFull =
66
- response === 'yes' &&
67
- !!profile &&
68
- seriesYesBlockedByCapacity(post, profile.id);
69
- const occurrenceIsFull = (recurrenceId: string) =>
70
- response === 'yes' &&
71
- capacityEvent &&
72
- event?.maxAttendees !== undefined &&
73
- getEffectiveRsvp(post, profile?.id ?? '', recurrenceId)?.response !==
74
- 'yes' &&
75
- countYesRsvps(post, recurrenceId) >= event.maxAttendees;
64
+ response === 'yes' && !!profile && seriesClaimBlocked(post, profile.id);
65
+ const occurrenceIsFull = (recurrenceId: string) => {
66
+ if (!profile) return false;
67
+ if (joiningWaitlist)
68
+ return !canJoinWaitlist(post, profile.id, recurrenceId);
69
+ if (response !== 'yes') return false;
70
+ return !canClaimYesRsvp(post, profile.id, recurrenceId);
71
+ };
76
72
  const currentFull =
77
73
  !!defaultRecurrenceId && occurrenceIsFull(defaultRecurrenceId);
78
74
  const initialScope: ScopeKind = currentFull
@@ -130,9 +126,13 @@ export const EventRsvpScopeDialog = ({
130
126
  <DialogContent className="max-h-[85vh] max-w-md overflow-y-auto">
131
127
  <DialogHeader>
132
128
  <DialogTitle>
133
- {t('events.rsvp.scope.title', {
134
- defaultValue: 'Which dates?',
135
- })}
129
+ {joiningWaitlist
130
+ ? t('events.rsvp.scope.waitlistTitle', {
131
+ defaultValue: 'Join the waitlist for which dates?',
132
+ })
133
+ : t('events.rsvp.scope.title', {
134
+ defaultValue: 'Which dates?',
135
+ })}
136
136
  </DialogTitle>
137
137
  </DialogHeader>
138
138
  <RadioGroup
@@ -157,7 +157,7 @@ export const EventRsvpScopeDialog = ({
157
157
  })}
158
158
  </label>
159
159
  ) : null}
160
- {currentFull ? null : (
160
+ {currentFull || joiningWaitlist ? null : (
161
161
  <label className="flex items-start gap-2 text-sm">
162
162
  <RadioGroupItem value="series" disabled={seriesFull} />
163
163
  <span>
@@ -200,9 +200,15 @@ export const EventRsvpScopeDialog = ({
200
200
  <span className={full ? 'text-muted-foreground' : ''}>
201
201
  {formatOccurrenceStart(occurrence.start)}
202
202
  {full
203
- ? ` — ${t('events.rsvp.full', {
204
- defaultValue: 'Event is full',
205
- })}`
203
+ ? ` — ${
204
+ joiningWaitlist
205
+ ? t('events.rsvp.spotsOpen', {
206
+ defaultValue: 'Spots still open',
207
+ })
208
+ : t('events.rsvp.full', {
209
+ defaultValue: 'Event is full',
210
+ })
211
+ }`
206
212
  : ''}
207
213
  </span>
208
214
  </label>
@@ -225,9 +231,15 @@ export const EventRsvpScopeDialog = ({
225
231
  defaultValue: 'Cancel',
226
232
  })}
227
233
  onCancel={onClose}
228
- actionLabel={t('events.rsvp.scope.confirm', {
229
- defaultValue: 'Confirm',
230
- })}
234
+ actionLabel={
235
+ joiningWaitlist
236
+ ? t('events.rsvp.joinWaitlist', {
237
+ defaultValue: 'Join waitlist',
238
+ })
239
+ : t('events.rsvp.scope.confirm', {
240
+ defaultValue: 'Confirm',
241
+ })
242
+ }
231
243
  onAction={confirm}
232
244
  disabled={confirmDisabled}
233
245
  />
@@ -0,0 +1,77 @@
1
+ import type { PublicPost } from '@openpeepshq/common/types';
2
+ import { waitlistOfferWindowMs } from '@openpeepshq/common/lib';
3
+ import {
4
+ Dialog,
5
+ DialogActions,
6
+ DialogContent,
7
+ DialogHeader,
8
+ DialogTitle,
9
+ } from '@openpeepshq/react-ui';
10
+ import { useT } from '../../../i18n';
11
+
12
+ export type EventWaitlistJoinDialogProps = {
13
+ open: boolean;
14
+ post: PublicPost;
15
+ error?: string | null;
16
+ submitting?: boolean;
17
+ onClose: () => void;
18
+ onConfirm: () => void | Promise<void>;
19
+ };
20
+
21
+ export const EventWaitlistJoinDialog = ({
22
+ open,
23
+ post,
24
+ error,
25
+ submitting,
26
+ onClose,
27
+ onConfirm,
28
+ }: EventWaitlistJoinDialogProps) => {
29
+ const t = useT();
30
+ const event = post.data?.type === 'event' ? post.data : undefined;
31
+ const minutes = event
32
+ ? Math.round(waitlistOfferWindowMs(event) / 60_000)
33
+ : 60;
34
+
35
+ return (
36
+ <Dialog
37
+ open={open}
38
+ onOpenChange={(next) => {
39
+ if (!next && !submitting) onClose();
40
+ }}
41
+ >
42
+ <DialogContent className="max-w-md">
43
+ <DialogHeader>
44
+ <DialogTitle>
45
+ {t('events.rsvp.waitlistConfirmTitle', {
46
+ defaultValue: 'Join the waitlist?',
47
+ })}
48
+ </DialogTitle>
49
+ </DialogHeader>
50
+ <p className="text-sm">
51
+ {t('events.rsvp.atCapacity', {
52
+ defaultValue: 'This event is at capacity.',
53
+ })}
54
+ </p>
55
+ <p className="text-muted-foreground text-sm">
56
+ {t('events.rsvp.waitlistConfirmBody', {
57
+ defaultValue:
58
+ 'If a spot opens, you will have {{minutes}} minutes to claim it.',
59
+ minutes,
60
+ })}
61
+ </p>
62
+ {error ? <p className="text-error text-sm">{error}</p> : null}
63
+ <DialogActions
64
+ cancelLabel={t('events.rsvp.scope.cancel', {
65
+ defaultValue: 'Cancel',
66
+ })}
67
+ onCancel={onClose}
68
+ actionLabel={t('events.rsvp.joinWaitlist', {
69
+ defaultValue: 'Join waitlist',
70
+ })}
71
+ onAction={onConfirm}
72
+ disabled={submitting}
73
+ />
74
+ </DialogContent>
75
+ </Dialog>
76
+ );
77
+ };
@@ -22,7 +22,10 @@ function ParticipantAvatar({ id, size }: { id: string; size: number }) {
22
22
 
23
23
  /** Overlapping avatar stack of the first jam participants. Mirrors the Svelte
24
24
  * `ParticipantsCard`. */
25
- export function ParticipantsCard({ jamState, size = 1.5 }: ParticipantsCardProps) {
25
+ export function ParticipantsCard({
26
+ jamState,
27
+ size = 1.5,
28
+ }: ParticipantsCardProps) {
26
29
  return (
27
30
  <div className="flex w-full items-center justify-between gap-4">
28
31
  <div className="flex items-center">
@@ -247,13 +247,19 @@ export function PollContent({ post }: PollContentProps) {
247
247
 
248
248
  <div className="text-muted-foreground mt-4 flex flex-wrap items-center gap-3 text-sm">
249
249
  <span>
250
- {votes.length || 0} {t('posts.vote.count', { defaultValue: 'votes' })}
250
+ {t('posts.vote.count', {
251
+ count: votes.length || 0,
252
+ defaultValue: 'votes',
253
+ })}
251
254
  </span>
252
255
  {pollData.expiresAt ? (
253
256
  <span>
254
257
  {hasPollEnded
255
258
  ? t('posts.poll.ended', { defaultValue: 'Poll ended' })
256
- : `${formatDistanceToNow(pollData.expiresAt)} ${t('posts.poll.timeLeft', { defaultValue: 'left' })}`}
259
+ : t('posts.poll.timeLeft', {
260
+ time: formatDistanceToNow(pollData.expiresAt),
261
+ defaultValue: '{{time}} left',
262
+ })}
257
263
  </span>
258
264
  ) : null}
259
265
  {hasVoted && !hasPollEnded ? (
@@ -1,9 +1,10 @@
1
- import { Reply, Repeat2, ThumbsUp } from 'lucide-react';
1
+ import { Reply, Repeat2, Share, ThumbsUp } from 'lucide-react';
2
2
  import type { PublicPost } from '@openpeepshq/common/types';
3
- import { Button } from '@openpeepshq/react-ui';
3
+ import { Button, cn } from '@openpeepshq/react-ui';
4
4
  import { useT } from '../../../i18n';
5
5
  import { useFeedPostActions } from '../../../hooks/posts/useFeedPostActions';
6
6
  import { postReactionStats } from '../helpers';
7
+ import { ShareMenu } from './ShareMenu';
7
8
 
8
9
  export interface PostActionsProps {
9
10
  post: PublicPost;
@@ -30,18 +31,31 @@ export function PostActions({
30
31
  toggleReaction,
31
32
  } = useFeedPostActions(post);
32
33
 
33
- if (!me) return null;
34
+ const replyActive = !previewMode && canReply;
35
+ const repostActive = !previewMode && canRepost;
36
+ const reactActive = !previewMode && canReact;
37
+ const shareActive = !previewMode;
34
38
 
35
- const actionClass =
36
- 'hover:bg-surface rounded-button flex gap-2 p-2 text-sm disabled:opacity-60';
39
+ // Unstyled buttons skip the shared disabled treatment. Mute them, and let
40
+ // presses fall through to this row so a feed link does not open the post.
41
+ const actionClass = (active: boolean) =>
42
+ cn(
43
+ 'rounded-button flex gap-2 p-2 text-sm',
44
+ active
45
+ ? 'cursor-pointer hover:bg-surface'
46
+ : 'pointer-events-none cursor-default text-muted-foreground disabled:text-muted-foreground',
47
+ );
37
48
 
38
49
  const replyLabel = t('posts.footer.reply', { defaultValue: 'Reply' });
39
50
  const repostLabel = t('posts.footer.repost', { defaultValue: 'Repost' });
40
51
  const likeLabel = t('posts.footer.like', { defaultValue: 'Like' });
52
+ const shareLabel = t('posts.footer.share', { defaultValue: 'Share' });
41
53
 
42
54
  return (
43
55
  <div
44
- className="mx-auto grid w-full grid-cols-3 items-center p-2"
56
+ className={`mx-auto flex w-full cursor-default items-center p-2 ${
57
+ me ? 'justify-between' : 'justify-end'
58
+ }`}
45
59
  onClick={(e) => {
46
60
  e.preventDefault();
47
61
  e.stopPropagation();
@@ -49,43 +63,60 @@ export function PostActions({
49
63
  onKeyDown={(e) => e.stopPropagation()}
50
64
  role="presentation"
51
65
  >
52
- <Button
66
+ {me ? (
67
+ <>
68
+ <Button
69
+ variant="unstyled"
70
+ className={actionClass(replyActive)}
71
+ title={t('posts.actions.reply', { defaultValue: 'Reply' })}
72
+ action={reply}
73
+ disabled={!replyActive}
74
+ >
75
+ <Reply className="h-4 w-4" />
76
+ {compact ? post.replyCount || null : replyLabel}
77
+ </Button>
78
+ <Button
79
+ variant="unstyled"
80
+ className={cn(
81
+ actionClass(repostActive),
82
+ myRepost && repostActive && 'text-primary',
83
+ )}
84
+ title={t('posts.actions.repost', { defaultValue: 'Repost' })}
85
+ action={toggleRepost}
86
+ disabled={!repostActive}
87
+ spinnerOnlyOnLoading
88
+ data-testid="posts-repost-button"
89
+ >
90
+ <Repeat2 className="h-4 w-4" />
91
+ {compact ? post.repostCount || null : repostLabel}
92
+ </Button>
93
+ <Button
94
+ variant="unstyled"
95
+ className={cn(
96
+ actionClass(reactActive),
97
+ iReacted && reactActive && 'text-primary',
98
+ )}
99
+ title={t('posts.actions.react', { defaultValue: 'React' })}
100
+ action={toggleReaction}
101
+ disabled={!reactActive}
102
+ spinnerOnlyOnLoading
103
+ >
104
+ <ThumbsUp className="h-4 w-4" />
105
+ {compact
106
+ ? post.reactions?.length
107
+ ? ` · ${postReactionStats(post)}`
108
+ : null
109
+ : likeLabel}
110
+ </Button>
111
+ </>
112
+ ) : null}
113
+ <ShareMenu
114
+ post={post}
53
115
  variant="unstyled"
54
- className={`${actionClass} justify-self-start`}
55
- title={t('posts.actions.reply', { defaultValue: 'Reply' })}
56
- action={reply}
57
- disabled={previewMode || !canReply}
58
- >
59
- <Reply className="h-4 w-4" />
60
- {compact ? post.replyCount || null : replyLabel}
61
- </Button>
62
- <Button
63
- variant="unstyled"
64
- className={`${actionClass} justify-self-center ${myRepost ? 'text-primary' : ''}`}
65
- title={t('posts.actions.repost', { defaultValue: 'Repost' })}
66
- action={toggleRepost}
67
- disabled={previewMode || !canRepost}
68
- spinnerOnlyOnLoading
69
- data-testid="posts-repost-button"
70
- >
71
- <Repeat2 className="h-4 w-4" />
72
- {compact ? post.repostCount || null : repostLabel}
73
- </Button>
74
- <Button
75
- variant="unstyled"
76
- className={`${actionClass} justify-self-end ${iReacted ? 'text-primary' : ''}`}
77
- title={t('posts.actions.react', { defaultValue: 'React' })}
78
- action={toggleReaction}
79
- disabled={previewMode || !canReact}
80
- spinnerOnlyOnLoading
81
- >
82
- <ThumbsUp className="h-4 w-4" />
83
- {compact
84
- ? post.reactions?.length
85
- ? ` · ${postReactionStats(post)}`
86
- : null
87
- : likeLabel}
88
- </Button>
116
+ className={actionClass(shareActive)}
117
+ text={compact ? undefined : shareLabel}
118
+ menuButton={<Share className="h-4 w-4" />}
119
+ />
89
120
  </div>
90
121
  );
91
122
  }