@openpeepshq/react 0.9.23 → 0.11.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 (272) hide show
  1. package/dist/components/RelationCapabilitiesEditor.js +3 -3
  2. package/dist/components/RoleCapabilityMatrix.js +2 -2
  3. package/dist/components/accounts/SignUpLoginModal.js +1 -1
  4. package/dist/components/configuration/ConfigurationList.js +2 -2
  5. package/dist/components/conversations/ConversationMessageBubble.js +8 -1
  6. package/dist/components/conversations/CreateNewConversation.js +34 -17
  7. package/dist/components/form/ImageEditModal.js +2 -2
  8. package/dist/components/groups/ChangeGroupRolesModal.js +1 -1
  9. package/dist/components/groups/ConfirmGroupExitModal.js +1 -1
  10. package/dist/components/groups/ConfirmMemberRemovalModal.js +1 -1
  11. package/dist/components/groups/DeleteGroupModal.js +1 -1
  12. package/dist/components/groups/GroupForm.js +2 -2
  13. package/dist/components/groups/GroupNotificationSettingsModal.js +2 -2
  14. package/dist/components/jams/JamCallParticipant.js +4 -3
  15. package/dist/components/jams/JamGuestForm.js +1 -1
  16. package/dist/components/jams/jamEventActions.d.ts +10 -0
  17. package/dist/components/jams/jamEventActions.js +13 -0
  18. package/dist/components/navigation/ContentHeader.js +1 -1
  19. package/dist/components/navigation/FooterMobile.js +1 -1
  20. package/dist/components/navigation/SideBar.js +3 -3
  21. package/dist/components/post/FullPostLayout.js +1 -1
  22. package/dist/components/post/index.d.ts +1 -0
  23. package/dist/components/post/index.js +1 -0
  24. package/dist/components/post/pieces/EventRsvpList.js +1 -1
  25. package/dist/components/post/pieces/EventRsvpScopeDialog.js +2 -2
  26. package/dist/components/post/pieces/EventWaitlistJoinDialog.js +1 -1
  27. package/dist/components/post/pieces/GalleryModal.js +1 -1
  28. package/dist/components/post/pieces/modals/DeletePostModal.js +2 -2
  29. package/dist/components/post/post-form/ComposeAttachments.d.ts +2 -0
  30. package/dist/components/post/post-form/ComposeAttachments.js +8 -0
  31. package/dist/components/post/post-form/DescriptionEditModal.js +1 -1
  32. package/dist/components/post/post-form/EditPostModal.js +2 -2
  33. package/dist/components/post/post-form/EventForm.js +4 -26
  34. package/dist/components/post/post-form/PostAudienceSelector.js +2 -2
  35. package/dist/components/post/post-form/ReplyModal.js +1 -1
  36. package/dist/components/post/types/event/FullEvent.js +3 -3
  37. package/dist/components/post/types/resource/FullResource.js +2 -1
  38. package/dist/components/preview-link/RemotePreviewLink.js +32 -4
  39. package/dist/components/preview-link/RemotePreviewLink.test.d.ts +1 -0
  40. package/dist/components/preview-link/RemotePreviewLink.test.js +118 -0
  41. package/dist/components/profile/ProfileActivitySummary.js +4 -4
  42. package/dist/components/profile/ProfileBadge.js +1 -1
  43. package/dist/components/profile/ProfilePageAction.js +1 -1
  44. package/dist/components/profile/ProfilePostsAndReplies.js +1 -1
  45. package/dist/components/profile/ProfileSelector.js +1 -1
  46. package/dist/components/profile/ReportProfileOrPostModal.js +4 -2
  47. package/dist/components/resources/CategoryPathPicker.js +1 -1
  48. package/dist/components/resources/ResourceCard.js +5 -3
  49. package/dist/components/resources/ResourceLibrary.js +61 -8
  50. package/dist/components/resources/ResourceLibrary.test.d.ts +1 -0
  51. package/dist/components/resources/ResourceLibrary.test.js +122 -0
  52. package/dist/components/server-data/context.d.ts +25 -16
  53. package/dist/contexts/openpeeps/hooks/admin.d.ts +2 -2
  54. package/dist/contexts/openpeeps/hooks/auth.d.ts +1 -1
  55. package/dist/contexts/openpeeps/hooks/other.d.ts +1 -0
  56. package/dist/contexts/router/index.d.ts +8 -0
  57. package/dist/contexts/router/index.js +27 -2
  58. package/dist/hooks/conversations/dmMessage.d.ts +15 -0
  59. package/dist/hooks/conversations/dmMessage.js +12 -0
  60. package/dist/hooks/conversations/useCreateConversation.d.ts +40 -0
  61. package/dist/hooks/conversations/useCreateConversation.js +6 -0
  62. package/dist/hooks/events/useEventForm.d.ts +3 -0
  63. package/dist/hooks/events/useEventForm.js +31 -2
  64. package/dist/hooks/events/useEventForm.test.d.ts +1 -0
  65. package/dist/hooks/events/useEventForm.test.js +107 -0
  66. package/dist/hooks/index.d.ts +3 -1
  67. package/dist/hooks/index.js +3 -1
  68. package/dist/hooks/posts/useFeedPostActions.js +4 -15
  69. package/dist/hooks/posts/usePostReactionToggle.d.ts +14 -0
  70. package/dist/hooks/posts/usePostReactionToggle.js +46 -0
  71. package/dist/hooks/resources/useResourceLibrary.d.ts +8 -1
  72. package/dist/hooks/resources/useResourceLibrary.js +5 -5
  73. package/dist/hooks/settings/useAccessTokens.d.ts +3 -3
  74. package/dist/hooks/settings/useAccessTokens.js +1 -0
  75. package/dist/lib/downloadUrl.d.ts +6 -0
  76. package/dist/lib/downloadUrl.js +6 -0
  77. package/dist/navigation/menuItems.js +4 -4
  78. package/dist/pages/Explore.js +1 -1
  79. package/dist/pages/admin/ApiKeys.js +3 -3
  80. package/dist/pages/admin/ConfigEditor.js +1 -1
  81. package/dist/pages/admin/ConfigurationCommunityFeed.js +2 -2
  82. package/dist/pages/admin/ConfigurationCommunityLanguage.js +2 -2
  83. package/dist/pages/admin/ConfigurationCommunityTimezone.js +2 -2
  84. package/dist/pages/admin/ConfigurationEmail.js +2 -2
  85. package/dist/pages/admin/ConfigurationI18n.js +1 -1
  86. package/dist/pages/admin/ConfigurationSso.js +1 -1
  87. package/dist/pages/admin/ConfigurationSsoNew.js +1 -1
  88. package/dist/pages/admin/Dashboard.js +1 -1
  89. package/dist/pages/admin/Db.js +4 -4
  90. package/dist/pages/admin/DiagnosticsEmail.js +3 -3
  91. package/dist/pages/admin/DiagnosticsJob.js +2 -2
  92. package/dist/pages/admin/DiagnosticsLivekit.js +1 -1
  93. package/dist/pages/admin/DiagnosticsLogs.js +2 -2
  94. package/dist/pages/admin/DiagnosticsPerformance.js +1 -1
  95. package/dist/pages/admin/GroupMembers.js +5 -5
  96. package/dist/pages/admin/Groups.js +2 -2
  97. package/dist/pages/admin/Invites.js +3 -3
  98. package/dist/pages/admin/Media.js +2 -2
  99. package/dist/pages/admin/MemberDetail.js +7 -7
  100. package/dist/pages/admin/Members.js +2 -2
  101. package/dist/pages/admin/analytics/AnalyticsLayout.js +3 -1
  102. package/dist/pages/admin/analytics/Content.js +1 -1
  103. package/dist/pages/admin/analytics/Engagement.js +1 -1
  104. package/dist/pages/admin/analytics/Groups.js +1 -1
  105. package/dist/pages/admin/analytics/ReportSettings.js +1 -1
  106. package/dist/pages/admin/community/CommunityAccess.js +1 -1
  107. package/dist/pages/admin/community/CommunityFavicons.js +1 -1
  108. package/dist/pages/admin/community/CommunityForbiddenUsernames.js +2 -2
  109. package/dist/pages/admin/community/CommunityInfo.js +1 -1
  110. package/dist/pages/admin/community/CommunityLinks.js +7 -3
  111. package/dist/pages/admin/community/CommunityMarkdownPage.js +1 -1
  112. package/dist/pages/admin/community/CommunityProfileFields.js +2 -2
  113. package/dist/pages/admin/community/CommunityRoles.js +7 -7
  114. package/dist/pages/admin/community/CommunityTheme.js +3 -2
  115. package/dist/pages/admin/community/ThemeColorPreview.d.ts +8 -0
  116. package/dist/pages/admin/community/ThemeColorPreview.js +46 -0
  117. package/dist/pages/admin/community/ThemeColorPreview.test.d.ts +1 -0
  118. package/dist/pages/admin/community/ThemeColorPreview.test.js +49 -0
  119. package/dist/pages/admin/community/useCommunityConfig.d.ts +2 -0
  120. package/dist/pages/admin/components/AdminGroupCard.js +1 -1
  121. package/dist/pages/admin/components/EditInviteLinkModal.js +1 -1
  122. package/dist/pages/admin/components/InviteWithEmailModal.js +2 -2
  123. package/dist/pages/admin/components/InviteWithLinkModal.js +3 -3
  124. package/dist/pages/admin/components/ProfileRowActions.js +4 -4
  125. package/dist/pages/admin/components/RestoreBackupModal.js +2 -2
  126. package/dist/pages/admin/components/RestoreTestBackupModal.js +1 -1
  127. package/dist/pages/auth/Login.js +1 -1
  128. package/dist/pages/auth/Register.js +3 -3
  129. package/dist/pages/auth/RequestResetPassword.js +1 -1
  130. package/dist/pages/conversations/Info.js +1 -1
  131. package/dist/pages/conversations/Show.js +45 -15
  132. package/dist/pages/events/Index.js +1 -1
  133. package/dist/pages/feeds/Bookmarks.js +1 -1
  134. package/dist/pages/groups/EditInfo.js +1 -1
  135. package/dist/pages/groups/EditRoles.js +1 -1
  136. package/dist/pages/groups/Index.js +1 -1
  137. package/dist/pages/groups/Members.js +2 -2
  138. package/dist/pages/groups/New.js +1 -1
  139. package/dist/pages/groups/Show.js +2 -2
  140. package/dist/pages/settings/AccessTokens.js +4 -4
  141. package/dist/pages/settings/Account.js +1 -1
  142. package/dist/pages/settings/Feed.js +1 -1
  143. package/dist/pages/settings/Language.js +1 -1
  144. package/dist/pages/settings/PublicProfile.js +3 -3
  145. package/dist/pages/settings/PushEnabledDevices.js +1 -1
  146. package/dist/pages/settings/Theme.js +1 -1
  147. package/dist/pages/settings/Timezone.js +1 -1
  148. package/dist/react-native.d.ts +1 -1
  149. package/dist/react-native.js +1 -1
  150. package/package.json +9 -9
  151. package/src/components/RelationCapabilitiesEditor.tsx +3 -3
  152. package/src/components/RoleCapabilityMatrix.tsx +2 -2
  153. package/src/components/accounts/SignUpLoginModal.tsx +1 -1
  154. package/src/components/configuration/ConfigurationList.tsx +2 -2
  155. package/src/components/conversations/ConversationMessageBubble.tsx +24 -0
  156. package/src/components/conversations/CreateNewConversation.tsx +114 -78
  157. package/src/components/form/ImageEditModal.tsx +2 -2
  158. package/src/components/groups/ChangeGroupRolesModal.tsx +1 -1
  159. package/src/components/groups/ConfirmGroupExitModal.tsx +1 -1
  160. package/src/components/groups/ConfirmMemberRemovalModal.tsx +2 -2
  161. package/src/components/groups/DeleteGroupModal.tsx +2 -2
  162. package/src/components/groups/GroupForm.tsx +2 -2
  163. package/src/components/groups/GroupNotificationSettingsModal.tsx +2 -2
  164. package/src/components/jams/JamCallParticipant.tsx +4 -3
  165. package/src/components/jams/JamGuestForm.tsx +1 -1
  166. package/src/components/jams/jamEventActions.ts +21 -0
  167. package/src/components/navigation/ContentHeader.tsx +3 -3
  168. package/src/components/navigation/FooterMobile.tsx +1 -1
  169. package/src/components/navigation/SideBar.tsx +19 -5
  170. package/src/components/post/FullPostLayout.tsx +1 -1
  171. package/src/components/post/index.ts +1 -0
  172. package/src/components/post/pieces/EventRsvpList.tsx +1 -1
  173. package/src/components/post/pieces/EventRsvpScopeDialog.tsx +2 -2
  174. package/src/components/post/pieces/EventWaitlistJoinDialog.tsx +1 -1
  175. package/src/components/post/pieces/GalleryModal.tsx +1 -1
  176. package/src/components/post/pieces/modals/DeletePostModal.tsx +2 -2
  177. package/src/components/post/post-form/ComposeAttachments.tsx +10 -0
  178. package/src/components/post/post-form/DescriptionEditModal.tsx +1 -1
  179. package/src/components/post/post-form/EditPostModal.tsx +2 -2
  180. package/src/components/post/post-form/EventForm.tsx +8 -26
  181. package/src/components/post/post-form/PostAudienceSelector.tsx +2 -2
  182. package/src/components/post/post-form/ReplyModal.tsx +1 -1
  183. package/src/components/post/types/event/FullEvent.tsx +3 -3
  184. package/src/components/post/types/resource/FullResource.tsx +2 -1
  185. package/src/components/preview-link/RemotePreviewLink.tsx +92 -25
  186. package/src/components/profile/ProfileActivitySummary.tsx +4 -4
  187. package/src/components/profile/ProfileBadge.tsx +1 -1
  188. package/src/components/profile/ProfilePageAction.tsx +1 -1
  189. package/src/components/profile/ProfilePostsAndReplies.tsx +2 -2
  190. package/src/components/profile/ProfileSelector.tsx +1 -1
  191. package/src/components/profile/ReportProfileOrPostModal.tsx +4 -2
  192. package/src/components/resources/CategoryPathPicker.tsx +1 -1
  193. package/src/components/resources/ResourceCard.tsx +5 -3
  194. package/src/components/resources/ResourceLibrary.tsx +79 -4
  195. package/src/contexts/router/index.tsx +40 -1
  196. package/src/hooks/conversations/dmMessage.ts +26 -0
  197. package/src/hooks/conversations/useCreateConversation.ts +7 -0
  198. package/src/hooks/events/useEventForm.ts +32 -1
  199. package/src/hooks/index.ts +10 -1
  200. package/src/hooks/posts/useFeedPostActions.ts +4 -18
  201. package/src/hooks/posts/usePostReactionToggle.ts +60 -0
  202. package/src/hooks/resources/useResourceLibrary.ts +20 -5
  203. package/src/hooks/settings/useAccessTokens.ts +1 -0
  204. package/src/lib/downloadUrl.ts +7 -0
  205. package/src/navigation/menuItems.ts +4 -4
  206. package/src/pages/Explore.tsx +4 -4
  207. package/src/pages/admin/ApiKeys.tsx +4 -4
  208. package/src/pages/admin/ConfigEditor.tsx +1 -1
  209. package/src/pages/admin/ConfigurationCommunityFeed.tsx +2 -2
  210. package/src/pages/admin/ConfigurationCommunityLanguage.tsx +2 -2
  211. package/src/pages/admin/ConfigurationCommunityTimezone.tsx +2 -2
  212. package/src/pages/admin/ConfigurationEmail.tsx +2 -2
  213. package/src/pages/admin/ConfigurationI18n.tsx +1 -1
  214. package/src/pages/admin/ConfigurationSso.tsx +1 -1
  215. package/src/pages/admin/ConfigurationSsoNew.tsx +1 -1
  216. package/src/pages/admin/Dashboard.tsx +1 -1
  217. package/src/pages/admin/Db.tsx +6 -6
  218. package/src/pages/admin/DiagnosticsEmail.tsx +5 -5
  219. package/src/pages/admin/DiagnosticsJob.tsx +2 -2
  220. package/src/pages/admin/DiagnosticsLivekit.tsx +3 -3
  221. package/src/pages/admin/DiagnosticsLogs.tsx +4 -4
  222. package/src/pages/admin/DiagnosticsPerformance.tsx +1 -1
  223. package/src/pages/admin/GroupMembers.tsx +6 -6
  224. package/src/pages/admin/Groups.tsx +2 -2
  225. package/src/pages/admin/Invites.tsx +4 -4
  226. package/src/pages/admin/Media.tsx +2 -2
  227. package/src/pages/admin/MemberDetail.tsx +7 -7
  228. package/src/pages/admin/Members.tsx +2 -2
  229. package/src/pages/admin/analytics/AnalyticsLayout.tsx +5 -1
  230. package/src/pages/admin/analytics/Content.tsx +1 -1
  231. package/src/pages/admin/analytics/Engagement.tsx +1 -1
  232. package/src/pages/admin/analytics/Groups.tsx +1 -1
  233. package/src/pages/admin/analytics/ReportSettings.tsx +1 -1
  234. package/src/pages/admin/community/CommunityAccess.tsx +1 -1
  235. package/src/pages/admin/community/CommunityFavicons.tsx +1 -1
  236. package/src/pages/admin/community/CommunityForbiddenUsernames.tsx +2 -2
  237. package/src/pages/admin/community/CommunityInfo.tsx +1 -1
  238. package/src/pages/admin/community/CommunityLinks.tsx +30 -1
  239. package/src/pages/admin/community/CommunityMarkdownPage.tsx +1 -1
  240. package/src/pages/admin/community/CommunityProfileFields.tsx +5 -5
  241. package/src/pages/admin/community/CommunityRoles.tsx +9 -9
  242. package/src/pages/admin/community/CommunityTheme.tsx +26 -23
  243. package/src/pages/admin/community/ThemeColorPreview.tsx +141 -0
  244. package/src/pages/admin/components/AdminGroupCard.tsx +2 -2
  245. package/src/pages/admin/components/EditInviteLinkModal.tsx +2 -2
  246. package/src/pages/admin/components/InviteWithEmailModal.tsx +2 -2
  247. package/src/pages/admin/components/InviteWithLinkModal.tsx +3 -3
  248. package/src/pages/admin/components/ProfileRowActions.tsx +6 -6
  249. package/src/pages/admin/components/RestoreBackupModal.tsx +2 -2
  250. package/src/pages/admin/components/RestoreTestBackupModal.tsx +1 -1
  251. package/src/pages/auth/Login.tsx +1 -1
  252. package/src/pages/auth/Register.tsx +3 -3
  253. package/src/pages/auth/RequestResetPassword.tsx +1 -1
  254. package/src/pages/conversations/Info.tsx +1 -1
  255. package/src/pages/conversations/Show.tsx +94 -33
  256. package/src/pages/events/Index.tsx +1 -1
  257. package/src/pages/feeds/Bookmarks.tsx +3 -1
  258. package/src/pages/groups/EditInfo.tsx +1 -1
  259. package/src/pages/groups/EditRoles.tsx +1 -1
  260. package/src/pages/groups/Index.tsx +1 -1
  261. package/src/pages/groups/Members.tsx +2 -2
  262. package/src/pages/groups/New.tsx +1 -1
  263. package/src/pages/groups/Show.tsx +4 -4
  264. package/src/pages/settings/AccessTokens.tsx +4 -4
  265. package/src/pages/settings/Account.tsx +1 -1
  266. package/src/pages/settings/Feed.tsx +1 -1
  267. package/src/pages/settings/Language.tsx +1 -1
  268. package/src/pages/settings/PublicProfile.tsx +3 -3
  269. package/src/pages/settings/PushEnabledDevices.tsx +3 -6
  270. package/src/pages/settings/Theme.tsx +1 -1
  271. package/src/pages/settings/Timezone.tsx +1 -1
  272. package/src/react-native.ts +1 -0
@@ -36,7 +36,7 @@ export function FullPostLayout({
36
36
  if (isLoading) {
37
37
  return (
38
38
  <div className="text-muted-foreground flex h-32 items-center justify-center text-sm">
39
- {t('common.loading', { defaultValue: 'Loading…' })}
39
+ {t('common.states.loading', { defaultValue: 'Loading…' })}
40
40
  </div>
41
41
  );
42
42
  }
@@ -20,6 +20,7 @@ export { DeletePostModal } from './pieces/modals/DeletePostModal';
20
20
  export { EditPostModal } from './post-form/EditPostModal';
21
21
  export { useEditPostModal } from './post-form/EditPostModalContext';
22
22
  export { ComposeAttachments } from './post-form/ComposeAttachments';
23
+ export { useComposeAttachments } from './post-form/ComposeAttachments';
23
24
  export { DescriptionEditModal } from './post-form/DescriptionEditModal';
24
25
  export type { DescriptionEditModalProps } from './post-form/DescriptionEditModal';
25
26
  export { OpenpeepsMarkdownInput } from './post-form/OpenpeepsMarkdownInput';
@@ -428,7 +428,7 @@ const EventRsvpRow = ({
428
428
  variant="outline"
429
429
  action={() => onManage('removed', rsvp.profile.id, recurrenceId)}
430
430
  >
431
- {t('events.rsvp.removeAttendee', {
431
+ {t('common.actions.remove', {
432
432
  defaultValue: 'Remove',
433
433
  })}
434
434
  </Button>
@@ -227,7 +227,7 @@ export const EventRsvpScopeDialog = ({
227
227
  ) : null}
228
228
  {error ? <p className="text-error text-sm">{error}</p> : null}
229
229
  <DialogActions
230
- cancelLabel={t('events.rsvp.scope.cancel', {
230
+ cancelLabel={t('common.actions.cancel', {
231
231
  defaultValue: 'Cancel',
232
232
  })}
233
233
  onCancel={onClose}
@@ -236,7 +236,7 @@ export const EventRsvpScopeDialog = ({
236
236
  ? t('events.rsvp.joinWaitlist', {
237
237
  defaultValue: 'Join waitlist',
238
238
  })
239
- : t('events.rsvp.scope.confirm', {
239
+ : t('common.actions.confirm', {
240
240
  defaultValue: 'Confirm',
241
241
  })
242
242
  }
@@ -61,7 +61,7 @@ export const EventWaitlistJoinDialog = ({
61
61
  </p>
62
62
  {error ? <p className="text-error text-sm">{error}</p> : null}
63
63
  <DialogActions
64
- cancelLabel={t('events.rsvp.scope.cancel', {
64
+ cancelLabel={t('common.actions.cancel', {
65
65
  defaultValue: 'Cancel',
66
66
  })}
67
67
  onCancel={onClose}
@@ -37,7 +37,7 @@ export function GalleryModal({
37
37
 
38
38
  const prevLabel = t('posts.gallery.previous', { defaultValue: 'Previous' });
39
39
  const nextLabel = t('posts.gallery.next', { defaultValue: 'Next' });
40
- const closeLabel = t('posts.gallery.close', { defaultValue: 'Close' });
40
+ const closeLabel = t('common.actions.close', { defaultValue: 'Close' });
41
41
 
42
42
  const prev = (e: MouseEvent) => {
43
43
  stop(e);
@@ -54,11 +54,11 @@ export function DeletePostModal({
54
54
  </article>
55
55
  </div>
56
56
  <DialogActions
57
- cancelLabel={t('posts.deleteModal.cancel', {
57
+ cancelLabel={t('common.actions.cancel', {
58
58
  defaultValue: 'Cancel',
59
59
  })}
60
60
  onCancel={onClose}
61
- actionLabel={t('posts.deleteModal.delete', {
61
+ actionLabel={t('common.actions.delete', {
62
62
  defaultValue: 'Delete',
63
63
  })}
64
64
  onAction={handleDelete}
@@ -45,6 +45,8 @@ export interface ComposeAttachmentsApi {
45
45
  openImagePicker: () => void;
46
46
  openAudioPicker: () => void;
47
47
  openDocumentPicker: () => void;
48
+ /** Drop in-flight and ready items. Used after a message is sent. */
49
+ clear: () => void;
48
50
  /** True while any attachment is still uploading or processing. */
49
51
  pending: boolean;
50
52
  /** Attachment cards — render where the previews should appear. */
@@ -280,6 +282,14 @@ export function useComposeAttachments({
280
282
  openImagePicker: () => imageInputRef.current?.click(),
281
283
  openAudioPicker: () => audioInputRef.current?.click(),
282
284
  openDocumentPicker: () => documentInputRef.current?.click(),
285
+ clear: () => {
286
+ items.forEach((item) => {
287
+ if (item.previewUrl && isBlobUrl(item.previewUrl)) {
288
+ revokeBlobUrl(item.previewUrl);
289
+ }
290
+ });
291
+ setItems([]);
292
+ },
283
293
  pending,
284
294
  previews,
285
295
  inputs,
@@ -64,7 +64,7 @@ export function DescriptionEditModal({
64
64
  </div>
65
65
 
66
66
  <DialogActions
67
- cancelLabel={t('common.back', { defaultValue: 'Back' })}
67
+ cancelLabel={t('common.actions.back', { defaultValue: 'Back' })}
68
68
  onCancel={onClose}
69
69
  actionLabel={t('common.done', { defaultValue: 'Done' })}
70
70
  onAction={saveAndClose}
@@ -179,12 +179,12 @@ export function EditPostModal({ post, onClose }: EditPostModalProps) {
179
179
  {error ? <p className="text-error text-sm">{error}</p> : null}
180
180
 
181
181
  <DialogActions
182
- cancelLabel={t('common.cancel', { defaultValue: 'Cancel' })}
182
+ cancelLabel={t('common.actions.cancel', { defaultValue: 'Cancel' })}
183
183
  onCancel={onClose}
184
184
  actionLabel={
185
185
  submitting
186
186
  ? t('common.saving', { defaultValue: 'Saving…' })
187
- : t('common.save', { defaultValue: 'Save' })
187
+ : t('common.actions.save', { defaultValue: 'Save' })
188
188
  }
189
189
  onAction={publish}
190
190
  disabled={submitting || !canSave}
@@ -57,7 +57,6 @@ export const EventForm = ({
57
57
  }: EventFormProps) => {
58
58
  const t = useT();
59
59
  const [audienceOpen, setAudienceOpen] = useState(false);
60
- const [endBeforeStart, setEndBeforeStart] = useState(false);
61
60
  const {
62
61
  event,
63
62
  eventTimeZone,
@@ -65,6 +64,9 @@ export const EventForm = ({
65
64
  repeatFreq,
66
65
  repeatEnd,
67
66
  preview,
67
+ endBeforeStart,
68
+ changeStart,
69
+ changeEnd,
68
70
  patchEvent,
69
71
  setEvent,
70
72
  setAudience,
@@ -145,17 +147,7 @@ export const EventForm = ({
145
147
  type="datetime-local"
146
148
  step={60}
147
149
  value={dateToInputValue(event.start, eventTimeZone)}
148
- onChange={(e) => {
149
- const start = toIso(e.target.value, eventTimeZone);
150
- if (start) {
151
- if (event.end && new Date(event.end) <= new Date(start)) {
152
- setEndBeforeStart(true);
153
- } else {
154
- setEndBeforeStart(false);
155
- }
156
- patchEvent({ start });
157
- }
158
- }}
150
+ onChange={(e) => changeStart(toIso(e.target.value, eventTimeZone))}
159
151
  data-testid="events-start-input"
160
152
  />
161
153
  </Label>
@@ -184,19 +176,9 @@ export const EventForm = ({
184
176
  type="datetime-local"
185
177
  step={60}
186
178
  value={dateToInputValue(event.end, eventTimeZone)}
187
- onChange={(e) => {
188
- const newEnd = toIso(e.target.value, eventTimeZone);
189
- if (
190
- newEnd &&
191
- event.start &&
192
- new Date(newEnd) <= new Date(event.start)
193
- ) {
194
- setEndBeforeStart(true);
195
- return;
196
- }
197
- setEndBeforeStart(false);
198
- patchEvent({ end: newEnd });
199
- }}
179
+ onChange={(e) =>
180
+ changeEnd(toIso(e.target.value, eventTimeZone))
181
+ }
200
182
  />
201
183
  </Label>
202
184
  {endBeforeStart ? (
@@ -394,7 +376,7 @@ export const EventForm = ({
394
376
  </h2>
395
377
 
396
378
  <Label
397
- title={t('events.form.visibility', { defaultValue: 'Visibility' })}
379
+ title={t('common.labels.visibility', { defaultValue: 'Visibility' })}
398
380
  description={t('events.form.visibilityNotChangeable', {
399
381
  defaultValue:
400
382
  "Note: The event visibility cannot be changed once the event is published. Make sure you're adding the right people or group.",
@@ -205,8 +205,8 @@ export const PostAudienceSelector = ({
205
205
  <DialogActions
206
206
  cancelLabel={
207
207
  view !== 'main'
208
- ? t('navigation.back', { defaultValue: 'Back' })
209
- : t('common.cancel', { defaultValue: 'Cancel' })
208
+ ? t('common.actions.back', { defaultValue: 'Back' })
209
+ : t('common.actions.cancel', { defaultValue: 'Cancel' })
210
210
  }
211
211
  onCancel={view !== 'main' ? () => setView('main') : onClose}
212
212
  actionLabel={t('common.done', { defaultValue: 'Done' })}
@@ -330,7 +330,7 @@ export function ReplyModal({ post, onClose }: ReplyModalProps) {
330
330
  </div>
331
331
  <div className="flex gap-2">
332
332
  <Button variant="ghost" action={onClose}>
333
- {t('common.cancel', { defaultValue: 'Cancel' })}
333
+ {t('common.actions.cancel', { defaultValue: 'Cancel' })}
334
334
  </Button>
335
335
  <Button
336
336
  variant="default"
@@ -289,7 +289,7 @@ export function FullEvent({ post, occurrence }: FullEventProps) {
289
289
  active={tab === 'description'}
290
290
  onClick={() => setTab('description')}
291
291
  >
292
- {t('events.tabs.description', { defaultValue: 'Description' })}
292
+ {t('common.labels.description', { defaultValue: 'Description' })}
293
293
  </TabButton>
294
294
  ) : null}
295
295
  <TabButton active={tab === 'replies'} onClick={() => setTab('replies')}>
@@ -571,11 +571,11 @@ function JamRecordingItem({
571
571
  })}
572
572
  </p>
573
573
  <DialogActions
574
- cancelLabel={t('posts.deleteModal.cancel', {
574
+ cancelLabel={t('common.actions.cancel', {
575
575
  defaultValue: 'Cancel',
576
576
  })}
577
577
  onCancel={() => setConfirmOpen(false)}
578
- actionLabel={t('posts.deleteModal.delete', {
578
+ actionLabel={t('common.actions.delete', {
579
579
  defaultValue: 'Delete',
580
580
  })}
581
581
  onAction={handleDelete}
@@ -10,6 +10,7 @@ import { ResourceCard } from '../../../resources/ResourceCard';
10
10
  import { VideoPlayer } from '../../pieces/VideoPlayer';
11
11
  import { AudioAttachment } from '../../pieces/AudioAttachment';
12
12
  import { GalleryModal } from '../../pieces/GalleryModal';
13
+ import { asDownloadUrl } from '../../../../lib/downloadUrl';
13
14
 
14
15
  export interface FullResourceProps {
15
16
  post: PublicPost;
@@ -36,7 +37,7 @@ export const FullResource = ({ post }: FullResourceProps) => {
36
37
  const att = resource.attachments?.find(
37
38
  (a) => attachmentMediaKind(a) === 'file',
38
39
  );
39
- if (att?.url) window.open(att.url, '_blank');
40
+ if (att?.url) window.location.assign(asDownloadUrl(att.url));
40
41
  break;
41
42
  }
42
43
  case 'link':
@@ -1,4 +1,8 @@
1
+ import { useState } from 'react';
2
+ import { Play } from 'lucide-react';
3
+ import { videoEmbedForUrl } from '@openpeepshq/common/lib';
1
4
  import { LoadingSpinner } from '@openpeepshq/react-ui';
5
+ import { useT } from '../../i18n';
2
6
  import { useOpenpeeps } from '../../contexts/openpeeps';
3
7
  import { recordOutboundClick } from '../../lib/analyticsClicks';
4
8
 
@@ -6,10 +10,40 @@ export interface RemotePreviewLinkProps {
6
10
  url: string;
7
11
  }
8
12
 
13
+ // Same safety set as the markdown iframe path (see
14
+ // injectIframeSafetyAttrs in @openpeepshq/common/lib); `allow` is trimmed
15
+ // to what video players need.
16
+ const EMBED_SANDBOX =
17
+ 'allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-presentation';
18
+ const EMBED_ALLOW = 'autoplay; encrypted-media; picture-in-picture; fullscreen';
19
+
9
20
  export function RemotePreviewLink({ url }: RemotePreviewLinkProps) {
21
+ const t = useT();
10
22
  const { openpeepsApi } = useOpenpeeps();
23
+ const embed = videoEmbedForUrl(url);
24
+ // Click-to-load: the server-fetched OG card (no third-party request) is
25
+ // the default view; the player mounts only after an explicit action.
26
+ const [loadedUrl, setLoadedUrl] = useState<string | null>(null);
11
27
  const previewQuery = openpeepsApi.usePreviewLink(url);
12
28
 
29
+ if (embed && loadedUrl === url) {
30
+ return (
31
+ <div className="mb-2 w-full">
32
+ <iframe
33
+ src={embed.embedUrl}
34
+ title={t('previewLink.embeddedVideo', {
35
+ defaultValue: 'Embedded video',
36
+ })}
37
+ className="aspect-video w-full rounded-md border-0"
38
+ sandbox={EMBED_SANDBOX}
39
+ allow={EMBED_ALLOW}
40
+ allowFullScreen
41
+ referrerPolicy="no-referrer"
42
+ />
43
+ </div>
44
+ );
45
+ }
46
+
13
47
  if (previewQuery.isLoading) {
14
48
  return (
15
49
  <div className="text-muted-foreground py-2 text-sm">
@@ -28,39 +62,72 @@ export function RemotePreviewLink({ url }: RemotePreviewLinkProps) {
28
62
  /* keep url */
29
63
  }
30
64
 
31
- return (
32
- <a
33
- href={url}
34
- target="_blank"
35
- rel="noreferrer"
36
- className="hover:bg-surface mb-2 block w-full min-w-0 max-w-full overflow-hidden rounded-md border no-underline"
37
- onClick={(e) => {
38
- e.stopPropagation();
39
- recordOutboundClick(url);
40
- }}
41
- >
42
- <div className="flex w-full min-w-0 flex-row items-center gap-4 p-2">
43
- {data.image ? (
44
- <div className="flex h-24 w-24 shrink-0 items-center justify-center">
65
+ const card = (
66
+ <div className="flex w-full min-w-0 flex-row items-center gap-4 p-2">
67
+ {data.image || embed ? (
68
+ <div className="relative flex h-24 w-24 shrink-0 items-center justify-center">
69
+ {data.image ? (
45
70
  <img
46
71
  src={data.image}
47
72
  alt={data.title ?? ''}
48
73
  className="h-full w-full rounded-md object-cover"
49
74
  />
50
- </div>
51
- ) : null}
52
- <div className="flex min-w-0 flex-1 flex-col gap-1">
53
- <p className="text-muted-foreground truncate text-xs">{hostname}</p>
54
- {data.title ? (
55
- <p className="truncate font-semibold">{data.title}</p>
56
75
  ) : null}
57
- {data.description ? (
58
- <p className="text-muted-foreground truncate text-sm">
59
- {data.description}
60
- </p>
76
+ {embed ? (
77
+ <div className="absolute inset-0 flex items-center justify-center">
78
+ <div className="flex size-10 items-center justify-center rounded-full bg-black/60">
79
+ <Play className="size-5 text-white" aria-hidden />
80
+ </div>
81
+ </div>
61
82
  ) : null}
62
83
  </div>
84
+ ) : null}
85
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
86
+ <p className="text-muted-foreground truncate text-xs">{hostname}</p>
87
+ {data.title ? (
88
+ <p className="truncate font-semibold">{data.title}</p>
89
+ ) : null}
90
+ {data.description ? (
91
+ <p className="text-muted-foreground truncate text-sm">
92
+ {data.description}
93
+ </p>
94
+ ) : null}
63
95
  </div>
64
- </a>
96
+ </div>
97
+ );
98
+
99
+ if (!embed) {
100
+ return (
101
+ <a
102
+ href={url}
103
+ target="_blank"
104
+ rel="noreferrer"
105
+ className="hover:bg-surface mb-2 block w-full min-w-0 max-w-full overflow-hidden rounded-md border no-underline"
106
+ onClick={(e) => {
107
+ e.stopPropagation();
108
+ recordOutboundClick(url);
109
+ }}
110
+ >
111
+ {card}
112
+ </a>
113
+ );
114
+ }
115
+
116
+ return (
117
+ <div
118
+ role="button"
119
+ tabIndex={0}
120
+ aria-label={t('previewLink.playVideo', { defaultValue: 'Play video' })}
121
+ className="hover:bg-surface mb-2 block w-full min-w-0 max-w-full cursor-pointer overflow-hidden rounded-md border"
122
+ onClick={() => setLoadedUrl(url)}
123
+ onKeyDown={(e) => {
124
+ if (e.key === 'Enter' || e.key === ' ') {
125
+ e.preventDefault();
126
+ setLoadedUrl(url);
127
+ }
128
+ }}
129
+ >
130
+ {card}
131
+ </div>
65
132
  );
66
133
  }
@@ -58,7 +58,7 @@ const SummaryBody = ({ summary }: { summary: ProfileActivitySummaryData }) => {
58
58
  >
59
59
  <CountCard
60
60
  value={summary.postsCount}
61
- label={t('profile.activity.postsCount', { defaultValue: 'Posts' })}
61
+ label={t('common.entities.posts', { defaultValue: 'Posts' })}
62
62
  testId="profile-activity-posts-count"
63
63
  />
64
64
  <CountCard
@@ -70,7 +70,7 @@ const SummaryBody = ({ summary }: { summary: ProfileActivitySummaryData }) => {
70
70
  />
71
71
  <CountCard
72
72
  value={summary.eventsCount}
73
- label={t('profile.activity.eventsCount', { defaultValue: 'Events' })}
73
+ label={t('common.entities.events', { defaultValue: 'Events' })}
74
74
  testId="profile-activity-events-count"
75
75
  />
76
76
  </CountSection>
@@ -101,14 +101,14 @@ const SummaryBody = ({ summary }: { summary: ProfileActivitySummaryData }) => {
101
101
  />
102
102
  <CountCard
103
103
  value={summary.bookmarksCount}
104
- label={t('profile.activity.bookmarksCount', {
104
+ label={t('common.entities.bookmarks', {
105
105
  defaultValue: 'Bookmarks',
106
106
  })}
107
107
  testId="profile-activity-bookmarks-count"
108
108
  />
109
109
  <CountCard
110
110
  value={summary.groupsCount}
111
- label={t('profile.activity.groupsCount', { defaultValue: 'Groups' })}
111
+ label={t('common.entities.groups', { defaultValue: 'Groups' })}
112
112
  testId="profile-activity-groups-count"
113
113
  />
114
114
  </CountSection>
@@ -29,7 +29,7 @@ export const ProfileBadge = ({
29
29
  <button
30
30
  type="button"
31
31
  className="hover:bg-secondary ml-0.5 rounded-full p-0.5 transition-colors"
32
- title={t('profile.selector.remove', { defaultValue: 'Remove' })}
32
+ title={t('common.actions.remove', { defaultValue: 'Remove' })}
33
33
  onClick={(e) => {
34
34
  e.stopPropagation();
35
35
  onRemove();
@@ -181,7 +181,7 @@ export function ProfilePageAction({
181
181
  })}
182
182
  </p>
183
183
  <DialogActions
184
- cancelLabel={t('common.cancel', { defaultValue: 'Cancel' })}
184
+ cancelLabel={t('common.actions.cancel', { defaultValue: 'Cancel' })}
185
185
  onCancel={() => setBlockOpen(false)}
186
186
  actionLabel={t('profile.block.confirm', { defaultValue: 'Block' })}
187
187
  onAction={() => void confirmBlock()}
@@ -49,7 +49,7 @@ export function ProfilePostsAndReplies({
49
49
  className={`flex-1 px-4 py-3 text-sm font-medium ${activeTab === 'posts' ? 'border-primary border-b-2' : 'text-muted-foreground'}`}
50
50
  onClick={() => setTab('posts')}
51
51
  >
52
- {t('profile.posts', { defaultValue: 'Posts' })}
52
+ {t('common.entities.posts', { defaultValue: 'Posts' })}
53
53
  </button>
54
54
  {isCurrentProfile ? (
55
55
  <button
@@ -66,7 +66,7 @@ export function ProfilePostsAndReplies({
66
66
  className={`flex-1 px-4 py-3 text-sm font-medium ${activeTab === 'groups' ? 'border-primary border-b-2' : 'text-muted-foreground'}`}
67
67
  onClick={() => setTab('groups')}
68
68
  >
69
- {t('profile.groups.tabName', { defaultValue: 'Groups' })}
69
+ {t('common.entities.groups', { defaultValue: 'Groups' })}
70
70
  </button>
71
71
  </nav>
72
72
 
@@ -194,7 +194,7 @@ export const ProfileSelector = ({
194
194
 
195
195
  {mode === 'multiple' ? (
196
196
  <DialogActions
197
- cancelLabel={t('common.cancel', { defaultValue: 'Cancel' })}
197
+ cancelLabel={t('common.actions.cancel', { defaultValue: 'Cancel' })}
198
198
  onCancel={() => onOpenChange(false)}
199
199
  actionLabel={t('profile.selector.confirm', { defaultValue: 'OK' })}
200
200
  onAction={confirmMultiple}
@@ -129,7 +129,9 @@ export function ReportProfileOrPostModal({
129
129
  })}
130
130
  />
131
131
  <DialogActions
132
- cancelLabel={t('common.cancel', { defaultValue: 'Cancel' })}
132
+ cancelLabel={t('common.actions.cancel', {
133
+ defaultValue: 'Cancel',
134
+ })}
133
135
  onCancel={onClose}
134
136
  actionLabel={t(`reports.create.${reportType}.continue`, {
135
137
  defaultValue: 'Continue',
@@ -156,7 +158,7 @@ export function ReportProfileOrPostModal({
156
158
  </p>
157
159
  ) : null}
158
160
  <DialogActions
159
- cancelLabel={t('reports.create.back', { defaultValue: 'Back' })}
161
+ cancelLabel={t('common.actions.back', { defaultValue: 'Back' })}
160
162
  onCancel={() => setStep(1)}
161
163
  actionLabel={t('reports.create.sendReport', {
162
164
  defaultValue: 'Send report',
@@ -82,7 +82,7 @@ export const CategoryPathPicker = ({
82
82
  setLevel('');
83
83
  }}
84
84
  >
85
- {t('resources.form.addLevelAction', { defaultValue: 'Add' })}
85
+ {t('common.actions.add', { defaultValue: 'Add' })}
86
86
  </Button>
87
87
  {path.length ? (
88
88
  <Button variant="ghost" action={() => onChange([])}>
@@ -26,6 +26,7 @@ import { useOpenpeeps } from '../../contexts/openpeeps';
26
26
  import { useCurrentProfile } from '../layout/IdentityContext';
27
27
  import { VideoPlayOverlay } from '../post/VideoPlayOverlay';
28
28
  import { TruncatedMarkdown } from '../post/TruncatedMarkdown';
29
+ import { asDownloadUrl } from '../../lib/downloadUrl';
29
30
 
30
31
  export interface ResourceCardProps {
31
32
  post: PublicPost;
@@ -107,7 +108,7 @@ const ResourceSaveButton = ({
107
108
  title={
108
109
  isBookmarked
109
110
  ? t('resources.actions.saved', { defaultValue: 'Saved' })
110
- : t('resources.actions.save', { defaultValue: 'Save' })
111
+ : t('common.actions.save', { defaultValue: 'Save' })
111
112
  }
112
113
  >
113
114
  {isBookmarked ? (
@@ -272,10 +273,11 @@ export const ResourceCard = ({
272
273
 
273
274
  if (!resource) return null;
274
275
 
275
- const downloadUrl =
276
+ const fileUrl =
276
277
  resource.resourceKind === 'file'
277
278
  ? attachments.find((att) => attachmentMediaKind(att) === 'file')?.url
278
- : null;
279
+ : undefined;
280
+ const downloadUrl = fileUrl ? asDownloadUrl(fileUrl) : null;
279
281
 
280
282
  const renderSaveButton = (className: string) =>
281
283
  staticRender ? null : (