@openpeepshq/react 0.2.3 → 0.2.5

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 (418) hide show
  1. package/dist/components/accounts/SignUpLoginModal.js +2 -2
  2. package/dist/components/configuration/ConfigMenuButton.d.ts +10 -0
  3. package/dist/components/configuration/ConfigMenuButton.js +12 -0
  4. package/dist/components/configuration/ConfigurationTree.js +1 -1
  5. package/dist/components/configuration/index.d.ts +2 -0
  6. package/dist/components/configuration/index.js +1 -0
  7. package/dist/components/conversations/ConversationMessageBubble.d.ts +2 -1
  8. package/dist/components/conversations/ConversationMessageBubble.js +4 -5
  9. package/dist/components/conversations/CreateNewConversation.js +10 -42
  10. package/dist/components/conversations/DirectMessagesHeaderActions.js +1 -1
  11. package/dist/components/conversations/MessageInThread.js +1 -2
  12. package/dist/components/form/ImageEditModal.js +2 -4
  13. package/dist/components/form/ImageInput.js +13 -8
  14. package/dist/components/form/LocationInput.js +1 -1
  15. package/dist/components/groups/AddGroupMembersButton.d.ts +1 -1
  16. package/dist/components/groups/AddGroupMembersButton.js +2 -2
  17. package/dist/components/groups/ChangeGroupRolesModal.js +1 -1
  18. package/dist/components/groups/ConfirmGroupExitModal.js +2 -2
  19. package/dist/components/groups/ConfirmMemberRemovalModal.js +1 -1
  20. package/dist/components/groups/DeleteGroupModal.js +1 -1
  21. package/dist/components/groups/GroupAvatar.js +4 -4
  22. package/dist/components/groups/GroupCard.js +3 -3
  23. package/dist/components/groups/GroupHeader.js +1 -1
  24. package/dist/components/groups/GroupMembersList.js +2 -3
  25. package/dist/components/groups/GroupOptionsMenu.js +12 -6
  26. package/dist/components/groups/JoinGroupButton.js +3 -20
  27. package/dist/components/jams/CreateNewJam.js +4 -4
  28. package/dist/components/jams/JamCallParticipant.js +17 -7
  29. package/dist/components/jams/JamCapacityGate.js +1 -1
  30. package/dist/components/jams/JamChatDrawer.js +2 -2
  31. package/dist/components/jams/JamConference.js +1 -1
  32. package/dist/components/jams/JamContext.d.ts +4 -0
  33. package/dist/components/jams/JamContext.js +17 -2
  34. package/dist/components/jams/JamDetailsDrawer.js +1 -1
  35. package/dist/components/jams/JamDeviceSelectors.d.ts +15 -0
  36. package/dist/components/jams/JamDeviceSelectors.js +4 -3
  37. package/dist/components/jams/JamFooter.js +15 -16
  38. package/dist/components/jams/JamGuestForm.js +2 -2
  39. package/dist/components/jams/JamLobby.js +9 -19
  40. package/dist/components/jams/JamObserverShell.js +1 -1
  41. package/dist/components/jams/JamParticipantConference.js +1 -1
  42. package/dist/components/jams/JamPeopleDrawer.js +17 -13
  43. package/dist/components/jams/JamReactionMenu.js +1 -1
  44. package/dist/components/jams/JamRequestJoin.js +1 -1
  45. package/dist/components/jams/JamRoom.js +84 -4
  46. package/dist/components/jams/JamToolbarButton.d.ts +21 -0
  47. package/dist/components/jams/JamToolbarButton.js +19 -0
  48. package/dist/components/jams/JamVideoCall.js +8 -3
  49. package/dist/components/jams/JamVideoLayout.js +16 -5
  50. package/dist/components/jams/LeaveCloseButton.js +9 -44
  51. package/dist/components/jams/LiveJamsSection.js +1 -1
  52. package/dist/components/jams/constants.js +4 -0
  53. package/dist/components/jams/useParticipantConnection.d.ts +7 -0
  54. package/dist/components/jams/useParticipantConnection.js +11 -0
  55. package/dist/components/layout/Auth.js +1 -1
  56. package/dist/components/layout/Infos.js +2 -2
  57. package/dist/components/layout/OpenpeepsContextProvider.js +4 -3
  58. package/dist/components/layout/OpenpeepsThemeProvider.d.ts +3 -4
  59. package/dist/components/layout/OpenpeepsThemeProvider.js +23 -9
  60. package/dist/components/layout/Root.js +1 -1
  61. package/dist/components/markdown/CompiledMarkdown.js +15 -1
  62. package/dist/components/markdown/classes.d.ts +2 -0
  63. package/dist/components/markdown/classes.js +2 -0
  64. package/dist/components/markdown/index.d.ts +1 -1
  65. package/dist/components/markdown/index.js +1 -1
  66. package/dist/components/navigation/ContentHeader.js +1 -1
  67. package/dist/components/navigation/FooterMobile.js +5 -1
  68. package/dist/components/navigation/HeaderMobile.js +1 -1
  69. package/dist/components/navigation/MobileMenuItem.js +1 -1
  70. package/dist/components/navigation/PageHeaderAction.js +1 -1
  71. package/dist/components/navigation/PlusButton.js +1 -1
  72. package/dist/components/navigation/SideBar.js +6 -1
  73. package/dist/components/navigation/breadcrumbs/Breadcrumbs.js +5 -1
  74. package/dist/components/navigation/sideBarNavLinkClass.js +1 -1
  75. package/dist/components/notifications/NotificationHeaderActions.js +2 -2
  76. package/dist/components/notifications/NotificationWrapper.js +1 -1
  77. package/dist/components/notifications/NotificationsList.js +3 -3
  78. package/dist/components/notifications/TypedNotification.js +3 -3
  79. package/dist/components/post/Feed.js +3 -3
  80. package/dist/components/post/FeedPost.d.ts +2 -1
  81. package/dist/components/post/FeedPost.js +11 -6
  82. package/dist/components/post/FeedPostContent.js +1 -1
  83. package/dist/components/post/FullPostLayout.js +11 -4
  84. package/dist/components/post/NewEventButton.js +1 -1
  85. package/dist/components/post/NewNoteButton.js +1 -1
  86. package/dist/components/post/PinnedPost.js +1 -1
  87. package/dist/components/post/ReplyBox.js +1 -1
  88. package/dist/components/post/feed/events/EventsFeed.js +3 -3
  89. package/dist/components/post/feed/threaded/ThreadPost.js +1 -1
  90. package/dist/components/post/feed/threaded/ThreadedFeed.d.ts +3 -1
  91. package/dist/components/post/feed/threaded/ThreadedFeed.js +3 -3
  92. package/dist/components/post/pieces/Attachments.js +3 -3
  93. package/dist/components/post/pieces/EventMenu.js +1 -1
  94. package/dist/components/post/pieces/EventRsvpButton.js +3 -3
  95. package/dist/components/post/pieces/FeedPostStats.js +2 -2
  96. package/dist/components/post/pieces/GalleryModal.js +36 -5
  97. package/dist/components/post/pieces/PollContent.js +33 -14
  98. package/dist/components/post/pieces/PostActions.js +6 -45
  99. package/dist/components/post/pieces/PostInfoHeader.js +1 -1
  100. package/dist/components/post/pieces/PostMenu.js +35 -9
  101. package/dist/components/post/pieces/PostReactionHeader.js +1 -1
  102. package/dist/components/post/pieces/ShareMenu.js +4 -2
  103. package/dist/components/post/pieces/UnreadPostIndicator.d.ts +5 -3
  104. package/dist/components/post/pieces/UnreadPostIndicator.js +4 -3
  105. package/dist/components/post/pieces/modals/DeletePostModal.js +1 -1
  106. package/dist/components/post/pieces/modals/RepostModal.d.ts +5 -3
  107. package/dist/components/post/pieces/modals/RepostModal.js +8 -7
  108. package/dist/components/post/post-form/AttachmentCard.js +2 -2
  109. package/dist/components/post/post-form/ComposeAttachments.js +1 -1
  110. package/dist/components/post/post-form/DescriptionEditModal.js +1 -1
  111. package/dist/components/post/post-form/EditPostModal.js +22 -12
  112. package/dist/components/post/post-form/EventForm.js +2 -2
  113. package/dist/components/post/post-form/EventTypeSwitcher.js +1 -1
  114. package/dist/components/post/post-form/NewPostModal.d.ts +1 -1
  115. package/dist/components/post/post-form/NewPostModal.js +10 -10
  116. package/dist/components/post/post-form/OpenpeepsMarkdownInput.js +2 -2
  117. package/dist/components/post/post-form/PollComposerFields.d.ts +2 -0
  118. package/dist/components/post/post-form/PollComposerFields.js +12 -8
  119. package/dist/components/post/post-form/PostAudienceSelector.js +3 -3
  120. package/dist/components/post/post-form/PostTypeSwitcher.js +1 -1
  121. package/dist/components/post/post-form/ReplyModal.js +9 -8
  122. package/dist/components/post/post-form/VisibilitySelector.js +1 -1
  123. package/dist/components/post/types/Article.js +2 -1
  124. package/dist/components/post/types/Event.js +1 -1
  125. package/dist/components/post/types/Note.js +2 -1
  126. package/dist/components/post/types/Poll.js +2 -1
  127. package/dist/components/post/types/event/CardEvent.js +2 -2
  128. package/dist/components/post/types/event/FullEvent.js +8 -8
  129. package/dist/components/post/types/event/ProfileEventRelationship.d.ts +1 -1
  130. package/dist/components/post/types/event/ProfileEventRelationship.js +38 -18
  131. package/dist/components/preview-link/LocalPreviewLink.js +1 -1
  132. package/dist/components/preview-link/RemotePreviewLink.js +5 -1
  133. package/dist/components/profile/Avatar.js +3 -2
  134. package/dist/components/profile/FollowUnfollowButton.js +2 -2
  135. package/dist/components/profile/ProfileBadge.js +1 -1
  136. package/dist/components/profile/ProfileCard.js +1 -1
  137. package/dist/components/profile/ProfileHeader.js +1 -1
  138. package/dist/components/profile/ProfilePageAction.js +3 -3
  139. package/dist/components/profile/ProfilePostsAndReplies.js +3 -1
  140. package/dist/components/profile/ProfileSelector.js +3 -3
  141. package/dist/components/profile/ProfilesInput.js +1 -1
  142. package/dist/components/profile/ReportProfileOrPostModal.js +6 -4
  143. package/dist/components/server-data/context.d.ts +8 -0
  144. package/dist/contexts/openpeeps/hooks/admin.d.ts +63 -16774
  145. package/dist/contexts/openpeeps/hooks/admin.js +34 -14
  146. package/dist/contexts/openpeeps/hooks/conversations.d.ts +330 -0
  147. package/dist/contexts/openpeeps/hooks/jams.d.ts +110 -0
  148. package/dist/contexts/openpeeps/hooks/jams.js +1 -1
  149. package/dist/contexts/openpeeps/hooks/other.d.ts +8 -0
  150. package/dist/contexts/openpeeps/hooks/posts.d.ts +933 -53
  151. package/dist/contexts/openpeeps/hooks/profiles.d.ts +220 -0
  152. package/dist/contexts/openpeeps/hooks/search.d.ts +330 -0
  153. package/dist/contexts/openpeeps/index.d.ts +1 -1
  154. package/dist/contexts/openpeeps/index.js +10 -2
  155. package/dist/contexts/router/index.d.ts +8 -3
  156. package/dist/contexts/router/index.js +7 -3
  157. package/dist/hooks/conversations/useCreateConversation.d.ts +124 -0
  158. package/dist/hooks/conversations/useCreateConversation.js +56 -0
  159. package/dist/hooks/groups/useJoinGroup.d.ts +8 -0
  160. package/dist/hooks/groups/useJoinGroup.js +23 -0
  161. package/dist/hooks/index.d.ts +6 -0
  162. package/dist/hooks/index.js +4 -0
  163. package/dist/hooks/jams/useLeaveCloseJam.d.ts +20 -0
  164. package/dist/hooks/jams/useLeaveCloseJam.js +59 -0
  165. package/dist/hooks/posts/useFeedPostActions.d.ts +18 -0
  166. package/dist/hooks/posts/useFeedPostActions.js +51 -0
  167. package/dist/index.d.ts +3 -0
  168. package/dist/index.js +3 -0
  169. package/dist/lib/Markdown.d.ts +14 -0
  170. package/dist/lib/Markdown.js +16 -0
  171. package/dist/lib/analyticsClicks.d.ts +12 -0
  172. package/dist/lib/analyticsClicks.js +64 -0
  173. package/dist/lib/auth.d.ts +8 -0
  174. package/dist/lib/auth.js +27 -0
  175. package/dist/lib/canvasUtils.d.ts +6 -0
  176. package/dist/lib/canvasUtils.js +62 -1
  177. package/dist/lib/groupCapabilityHelpers.d.ts +1 -1
  178. package/dist/lib/passwordStrength.d.ts +6 -0
  179. package/dist/lib/passwordStrength.js +26 -0
  180. package/dist/lib/postUnread.d.ts +7 -0
  181. package/dist/lib/postUnread.js +7 -0
  182. package/dist/lib/postViewCounter.d.ts +1 -1
  183. package/dist/lib/postViewCounter.js +3 -1
  184. package/dist/lib/routeHandles.d.ts +2 -0
  185. package/dist/lib/routeHandles.js +2 -0
  186. package/dist/lib/svgCover.d.ts +2 -0
  187. package/dist/lib/svgCover.js +18 -0
  188. package/dist/navigation/index.d.ts +11 -0
  189. package/dist/navigation/index.js +2 -0
  190. package/dist/navigation/menuItems.d.ts +8 -0
  191. package/dist/navigation/menuItems.js +83 -0
  192. package/dist/navigation/targets.d.ts +94 -0
  193. package/dist/navigation/targets.js +12 -0
  194. package/dist/pages/About.d.ts +1 -0
  195. package/dist/pages/About.js +19 -0
  196. package/dist/pages/CodeOfConduct.d.ts +1 -0
  197. package/dist/pages/CodeOfConduct.js +14 -0
  198. package/dist/pages/Explore.d.ts +1 -0
  199. package/dist/pages/Explore.js +132 -0
  200. package/dist/pages/Home.d.ts +6 -0
  201. package/dist/pages/Home.js +31 -0
  202. package/dist/pages/Members.d.ts +1 -0
  203. package/dist/pages/Members.js +35 -0
  204. package/dist/pages/NotFound.d.ts +1 -0
  205. package/dist/pages/NotFound.js +9 -0
  206. package/dist/pages/Notifications.d.ts +1 -0
  207. package/dist/pages/Notifications.js +8 -0
  208. package/dist/pages/PostDetail.d.ts +1 -0
  209. package/dist/pages/PostDetail.js +27 -0
  210. package/dist/pages/Profile.d.ts +1 -0
  211. package/dist/pages/Profile.js +20 -0
  212. package/dist/pages/Tags.d.ts +1 -0
  213. package/dist/pages/Tags.js +14 -0
  214. package/dist/pages/Welcome.d.ts +1 -0
  215. package/dist/pages/Welcome.js +89 -0
  216. package/dist/pages/admin/Analytics.d.ts +11 -0
  217. package/dist/pages/admin/Analytics.js +11 -0
  218. package/dist/pages/admin/ApiKeys.d.ts +1 -0
  219. package/dist/pages/admin/ApiKeys.js +141 -0
  220. package/dist/pages/admin/Backups.d.ts +1 -0
  221. package/dist/pages/admin/Backups.js +39 -0
  222. package/dist/pages/admin/ConfigEditor.d.ts +14 -0
  223. package/dist/pages/admin/ConfigEditor.js +91 -0
  224. package/dist/pages/admin/Configuration.d.ts +1 -0
  225. package/dist/pages/admin/Configuration.js +8 -0
  226. package/dist/pages/admin/ConfigurationCommunity.d.ts +1 -0
  227. package/dist/pages/admin/ConfigurationCommunity.js +7 -0
  228. package/dist/pages/admin/ConfigurationCommunityLanguage.d.ts +1 -0
  229. package/dist/pages/admin/ConfigurationCommunityLanguage.js +71 -0
  230. package/dist/pages/admin/ConfigurationEmail.d.ts +1 -0
  231. package/dist/pages/admin/ConfigurationEmail.js +97 -0
  232. package/dist/pages/admin/ConfigurationI18n.d.ts +1 -0
  233. package/dist/pages/admin/ConfigurationI18n.js +51 -0
  234. package/dist/pages/admin/Dashboard.d.ts +1 -0
  235. package/dist/pages/admin/Dashboard.js +40 -0
  236. package/dist/pages/admin/Db.d.ts +1 -0
  237. package/dist/pages/admin/Db.js +238 -0
  238. package/dist/pages/admin/Diagnostics.d.ts +1 -0
  239. package/dist/pages/admin/Diagnostics.js +8 -0
  240. package/dist/pages/admin/DiagnosticsEmail.d.ts +1 -0
  241. package/dist/pages/admin/DiagnosticsEmail.js +65 -0
  242. package/dist/pages/admin/DiagnosticsJob.d.ts +1 -0
  243. package/dist/pages/admin/DiagnosticsJob.js +51 -0
  244. package/dist/pages/admin/DiagnosticsLogs.d.ts +1 -0
  245. package/dist/pages/admin/DiagnosticsLogs.js +62 -0
  246. package/dist/pages/admin/DiagnosticsPerformance.d.ts +1 -0
  247. package/dist/pages/admin/DiagnosticsPerformance.js +34 -0
  248. package/dist/pages/admin/GroupMembers.d.ts +1 -0
  249. package/dist/pages/admin/GroupMembers.js +109 -0
  250. package/dist/pages/admin/Groups.d.ts +1 -0
  251. package/dist/pages/admin/Groups.js +61 -0
  252. package/dist/pages/admin/Invites.d.ts +1 -0
  253. package/dist/pages/admin/Invites.js +72 -0
  254. package/dist/pages/admin/Members.d.ts +1 -0
  255. package/dist/pages/admin/Members.js +49 -0
  256. package/dist/pages/admin/Moderation.d.ts +1 -0
  257. package/dist/pages/admin/Moderation.js +62 -0
  258. package/dist/pages/admin/Reports.d.ts +1 -0
  259. package/dist/pages/admin/Reports.js +178 -0
  260. package/dist/pages/admin/analytics/AnalyticsLayout.d.ts +14 -0
  261. package/dist/pages/admin/analytics/AnalyticsLayout.js +104 -0
  262. package/dist/pages/admin/analytics/AnalyticsRangeContext.d.ts +9 -0
  263. package/dist/pages/admin/analytics/AnalyticsRangeContext.js +9 -0
  264. package/dist/pages/admin/analytics/Content.d.ts +1 -0
  265. package/dist/pages/admin/analytics/Content.js +117 -0
  266. package/dist/pages/admin/analytics/Engagement.d.ts +1 -0
  267. package/dist/pages/admin/analytics/Engagement.js +220 -0
  268. package/dist/pages/admin/analytics/Groups.d.ts +1 -0
  269. package/dist/pages/admin/analytics/Groups.js +139 -0
  270. package/dist/pages/admin/analytics/Members.d.ts +1 -0
  271. package/dist/pages/admin/analytics/Members.js +96 -0
  272. package/dist/pages/admin/analytics/Overview.d.ts +1 -0
  273. package/dist/pages/admin/analytics/Overview.js +165 -0
  274. package/dist/pages/admin/analytics/ReportSettings.d.ts +1 -0
  275. package/dist/pages/admin/analytics/ReportSettings.js +62 -0
  276. package/dist/pages/admin/analytics/analyticsInfo.d.ts +3 -0
  277. package/dist/pages/admin/analytics/analyticsInfo.js +4 -0
  278. package/dist/pages/admin/analytics/downloadCsv.d.ts +2 -0
  279. package/dist/pages/admin/analytics/downloadCsv.js +20 -0
  280. package/dist/pages/admin/community/CommunityFavicons.d.ts +1 -0
  281. package/dist/pages/admin/community/CommunityFavicons.js +47 -0
  282. package/dist/pages/admin/community/CommunityInfo.d.ts +1 -0
  283. package/dist/pages/admin/community/CommunityInfo.js +35 -0
  284. package/dist/pages/admin/community/CommunityLinks.d.ts +1 -0
  285. package/dist/pages/admin/community/CommunityLinks.js +35 -0
  286. package/dist/pages/admin/community/CommunityMarkdownPage.d.ts +8 -0
  287. package/dist/pages/admin/community/CommunityMarkdownPage.js +35 -0
  288. package/dist/pages/admin/community/CommunityProfileFields.d.ts +1 -0
  289. package/dist/pages/admin/community/CommunityProfileFields.js +50 -0
  290. package/dist/pages/admin/community/CommunityRoles.d.ts +1 -0
  291. package/dist/pages/admin/community/CommunityRoles.js +109 -0
  292. package/dist/pages/admin/community/CommunityTheme.d.ts +1 -0
  293. package/dist/pages/admin/community/CommunityTheme.js +56 -0
  294. package/dist/pages/admin/community/useCommunityConfig.d.ts +168 -0
  295. package/dist/pages/admin/community/useCommunityConfig.js +28 -0
  296. package/dist/pages/admin/components/AdminCharts.d.ts +22 -0
  297. package/dist/pages/admin/components/AdminCharts.js +29 -0
  298. package/dist/pages/admin/components/AdminGroupCard.d.ts +6 -0
  299. package/dist/pages/admin/components/AdminGroupCard.js +42 -0
  300. package/dist/pages/admin/components/AdminInviteActions.d.ts +1 -0
  301. package/dist/pages/admin/components/AdminInviteActions.js +23 -0
  302. package/dist/pages/admin/components/InviteWithEmailModal.d.ts +3 -0
  303. package/dist/pages/admin/components/InviteWithEmailModal.js +82 -0
  304. package/dist/pages/admin/components/InviteWithLinkModal.d.ts +22 -0
  305. package/dist/pages/admin/components/InviteWithLinkModal.js +98 -0
  306. package/dist/pages/admin/components/ProfileRowActions.d.ts +5 -0
  307. package/dist/pages/admin/components/ProfileRowActions.js +131 -0
  308. package/dist/pages/admin/components/RestoreBackupModal.d.ts +4 -0
  309. package/dist/pages/admin/components/RestoreBackupModal.js +33 -0
  310. package/dist/pages/admin/components/RestoreTestBackupModal.d.ts +4 -0
  311. package/dist/pages/admin/components/RestoreTestBackupModal.js +36 -0
  312. package/dist/pages/articles/Edit.d.ts +1 -0
  313. package/dist/pages/articles/Edit.js +60 -0
  314. package/dist/pages/articles/Index.d.ts +1 -0
  315. package/dist/pages/articles/Index.js +18 -0
  316. package/dist/pages/articles/New.d.ts +1 -0
  317. package/dist/pages/articles/New.js +48 -0
  318. package/dist/pages/auth/Closed.d.ts +1 -0
  319. package/dist/pages/auth/Closed.js +14 -0
  320. package/dist/pages/auth/Login.d.ts +1 -0
  321. package/dist/pages/auth/Login.js +74 -0
  322. package/dist/pages/auth/OidcCallback.d.ts +5 -0
  323. package/dist/pages/auth/OidcCallback.js +31 -0
  324. package/dist/pages/auth/OidcPending.d.ts +5 -0
  325. package/dist/pages/auth/OidcPending.js +39 -0
  326. package/dist/pages/auth/Register.d.ts +4 -0
  327. package/dist/pages/auth/Register.js +124 -0
  328. package/dist/pages/auth/RegisterInvitation.d.ts +1 -0
  329. package/dist/pages/auth/RegisterInvitation.js +5 -0
  330. package/dist/pages/auth/RequestResetPassword.d.ts +1 -0
  331. package/dist/pages/auth/RequestResetPassword.js +50 -0
  332. package/dist/pages/auth/ResetPassword.d.ts +1 -0
  333. package/dist/pages/auth/ResetPassword.js +40 -0
  334. package/dist/pages/auth/SsoCallback.d.ts +1 -0
  335. package/dist/pages/auth/SsoCallback.js +34 -0
  336. package/dist/pages/auth/ValidateEmail.d.ts +6 -0
  337. package/dist/pages/auth/ValidateEmail.js +64 -0
  338. package/dist/pages/conversations/Index.d.ts +1 -0
  339. package/dist/pages/conversations/Index.js +58 -0
  340. package/dist/pages/conversations/Info.d.ts +1 -0
  341. package/dist/pages/conversations/Info.js +26 -0
  342. package/dist/pages/conversations/New.d.ts +1 -0
  343. package/dist/pages/conversations/New.js +8 -0
  344. package/dist/pages/conversations/Show.d.ts +1 -0
  345. package/dist/pages/conversations/Show.js +100 -0
  346. package/dist/pages/events/Edit.d.ts +1 -0
  347. package/dist/pages/events/Edit.js +69 -0
  348. package/dist/pages/events/Index.d.ts +1 -0
  349. package/dist/pages/events/Index.js +23 -0
  350. package/dist/pages/events/My.d.ts +1 -0
  351. package/dist/pages/events/My.js +24 -0
  352. package/dist/pages/events/New.d.ts +1 -0
  353. package/dist/pages/events/New.js +66 -0
  354. package/dist/pages/feeds/Bookmarks.d.ts +1 -0
  355. package/dist/pages/feeds/Bookmarks.js +10 -0
  356. package/dist/pages/feeds/Local.d.ts +1 -0
  357. package/dist/pages/feeds/Local.js +14 -0
  358. package/dist/pages/feeds/My.d.ts +1 -0
  359. package/dist/pages/feeds/My.js +12 -0
  360. package/dist/pages/groups/Edit.d.ts +1 -0
  361. package/dist/pages/groups/Edit.js +57 -0
  362. package/dist/pages/groups/Index.d.ts +1 -0
  363. package/dist/pages/groups/Index.js +50 -0
  364. package/dist/pages/groups/Info.d.ts +1 -0
  365. package/dist/pages/groups/Info.js +21 -0
  366. package/dist/pages/groups/Members.d.ts +1 -0
  367. package/dist/pages/groups/Members.js +28 -0
  368. package/dist/pages/groups/New.d.ts +1 -0
  369. package/dist/pages/groups/New.js +68 -0
  370. package/dist/pages/groups/Show.d.ts +1 -0
  371. package/dist/pages/groups/Show.js +64 -0
  372. package/dist/pages/index.d.ts +94 -0
  373. package/dist/pages/index.js +94 -0
  374. package/dist/pages/jams/Event.d.ts +8 -0
  375. package/dist/pages/jams/Event.js +57 -0
  376. package/dist/pages/jams/Index.d.ts +6 -0
  377. package/dist/pages/jams/Index.js +44 -0
  378. package/dist/pages/payment/Success.d.ts +1 -0
  379. package/dist/pages/payment/Success.js +30 -0
  380. package/dist/pages/plugins/Index.d.ts +1 -0
  381. package/dist/pages/plugins/Index.js +69 -0
  382. package/dist/pages/profile/Followers.d.ts +6 -0
  383. package/dist/pages/profile/Followers.js +28 -0
  384. package/dist/pages/settings/AccessTokens.d.ts +1 -0
  385. package/dist/pages/settings/AccessTokens.js +149 -0
  386. package/dist/pages/settings/Account.d.ts +1 -0
  387. package/dist/pages/settings/Account.js +81 -0
  388. package/dist/pages/settings/Billing.d.ts +1 -0
  389. package/dist/pages/settings/Billing.js +82 -0
  390. package/dist/pages/settings/Index.d.ts +1 -0
  391. package/dist/pages/settings/Index.js +13 -0
  392. package/dist/pages/settings/Language.d.ts +1 -0
  393. package/dist/pages/settings/Language.js +54 -0
  394. package/dist/pages/settings/NotificationPreferences.d.ts +1 -0
  395. package/dist/pages/settings/NotificationPreferences.js +180 -0
  396. package/dist/pages/settings/Notifications.d.ts +1 -0
  397. package/dist/pages/settings/Notifications.js +10 -0
  398. package/dist/pages/settings/PublicProfile.d.ts +1 -0
  399. package/dist/pages/settings/PublicProfile.js +135 -0
  400. package/dist/pages/settings/PushEnabledDevices.d.ts +1 -0
  401. package/dist/pages/settings/PushEnabledDevices.js +67 -0
  402. package/dist/pages/settings/Theme.d.ts +1 -0
  403. package/dist/pages/settings/Theme.js +37 -0
  404. package/dist/pages/test/Error.d.ts +1 -0
  405. package/dist/pages/test/Error.js +10 -0
  406. package/dist/pages/test/Markdown.d.ts +1 -0
  407. package/dist/pages/test/Markdown.js +32 -0
  408. package/dist/pwa/InstallPrompt.js +1 -1
  409. package/dist/pwa/NotificationPermissionPrompt.js +2 -2
  410. package/dist/pwa/UpdatePrompt.js +1 -1
  411. package/dist/react-native.d.ts +1 -0
  412. package/dist/react-native.js +1 -0
  413. package/dist/session/useSessionEvents.d.ts +3 -0
  414. package/dist/session/useSessionEvents.js +64 -0
  415. package/dist/stores/newPosts.d.ts +8 -8
  416. package/package.json +14 -9
  417. package/dist/components/jams/useJamLiveKitTheme.d.ts +0 -3
  418. package/dist/components/jams/useJamLiveKitTheme.js +0 -10
@@ -1,61 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
3
- import { MessageCircle, Repeat2, ThumbsUp } from 'lucide-react';
2
+ import { Reply, Repeat2, ThumbsUp } from 'lucide-react';
4
3
  import { Button } from '@openpeepshq/react-ui';
5
- import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
6
4
  import { useT } from '../../../i18n/index.js';
7
- import { useCurrentProfile } from '../../layout/IdentityContext.js';
5
+ import { useFeedPostActions } from '../../../hooks/posts/useFeedPostActions.js';
8
6
  import { postReactionStats } from '../helpers.js';
9
- import { useReplyModal } from '../post-form/ReplyModalContext.js';
10
7
  export function PostActions({ post, compact = false }) {
11
8
  const t = useT();
12
- const me = useCurrentProfile();
13
- const { openpeepsApi } = useOpenpeeps();
14
- const { openReply } = useReplyModal();
15
- const repostsQuery = openpeepsApi.useCurrentProfileReposts();
16
- const reactToPost = openpeepsApi.reactToPostAction({ id: post.id });
17
- const retractReaction = openpeepsApi.retractPostReactionAction({
18
- id: post.id,
19
- });
20
- const repostPost = openpeepsApi.repostPostAction({ id: post.id });
21
- const deletePost = openpeepsApi.deletePostAction({ id: post.id });
22
- const myRepost = useMemo(() => repostsQuery.data?.find((p) => p.repost?.id === post.id), [repostsQuery.data, post.id]);
23
- const iReacted = useMemo(() => !!post.reactions?.some((r) => r.profile.id === me?.id), [post.reactions, me?.id]);
9
+ const { me, myRepost, iReacted, disabledForGroup, reply, toggleRepost, toggleReaction, } = useFeedPostActions(post);
24
10
  if (!me)
25
11
  return null;
26
- const isGroupPost = !!post.groupId;
27
- const membershipExists = !!me.memberships?.some((m) => m.group.id === post.group?.id);
28
- const disabledForGroup = isGroupPost && !membershipExists;
29
- const stop = (handler) => (e) => {
30
- e.preventDefault();
31
- e.stopPropagation();
32
- handler();
33
- };
34
- const handleReply = () => openReply(post);
35
- const handleRepost = async () => {
36
- if (myRepost) {
37
- await deletePost({ id: myRepost.id });
38
- }
39
- else {
40
- await repostPost(undefined);
41
- }
42
- await repostsQuery.refetch();
43
- };
44
- const handleReaction = async () => {
45
- if (iReacted) {
46
- await retractReaction(undefined);
47
- }
48
- else {
49
- await reactToPost({ reaction: '👍' });
50
- }
51
- };
12
+ const actionClass = 'hover:bg-surface rounded-button flex gap-2 p-2 text-sm disabled:opacity-60';
52
13
  const replyLabel = t('posts.footer.reply', { defaultValue: 'Reply' });
53
14
  const repostLabel = t('posts.footer.repost', { defaultValue: 'Repost' });
54
15
  const likeLabel = t('posts.footer.like', { defaultValue: 'Like' });
55
- return (_jsxs("div", { className: `mx-auto grid w-full grid-cols-3 items-center p-2 ${compact ? '' : 'border-t'}`, onClick: (e) => {
16
+ return (_jsxs("div", { className: "mx-auto grid w-full grid-cols-3 items-center p-2", onClick: (e) => {
56
17
  e.preventDefault();
57
18
  e.stopPropagation();
58
- }, onKeyDown: (e) => e.stopPropagation(), role: "presentation", children: [_jsxs("button", { type: "button", className: "hover:bg-surface-200 flex gap-2 justify-self-start rounded-md p-2 text-sm disabled:opacity-60", title: t('posts.actions.reply', { defaultValue: 'Reply' }), onClick: stop(handleReply), disabled: disabledForGroup, children: [_jsx(MessageCircle, { className: "h-4 w-4" }), compact ? post.replyCount || null : replyLabel] }), _jsxs(Button, { type: "button", className: `hover:bg-surface-200 flex gap-2 justify-self-center rounded-md p-2 text-sm disabled:opacity-60 ${myRepost ? 'text-primary' : ''}`, title: t('posts.actions.repost', { defaultValue: 'Repost' }), action: handleRepost, disabled: disabledForGroup, spinnerOnlyOnLoading: true, "data-testid": "posts-repost-button", children: [_jsx(Repeat2, { className: "h-4 w-4" }), compact ? post.repostCount || null : repostLabel] }), _jsxs(Button, { type: "button", className: `hover:bg-surface-200 flex gap-2 justify-self-end rounded-md p-2 text-sm disabled:opacity-60 ${iReacted ? 'text-primary' : ''}`, title: t('posts.actions.react', { defaultValue: 'React' }), action: handleReaction, disabled: disabledForGroup, spinnerOnlyOnLoading: true, children: [_jsx(ThumbsUp, { className: "h-4 w-4" }), compact
19
+ }, onKeyDown: (e) => e.stopPropagation(), role: "presentation", children: [_jsxs(Button, { variant: "unstyled", className: `${actionClass} justify-self-start`, title: t('posts.actions.reply', { defaultValue: 'Reply' }), action: reply, disabled: disabledForGroup, children: [_jsx(Reply, { className: "h-4 w-4" }), compact ? post.replyCount || null : replyLabel] }), _jsxs(Button, { variant: "unstyled", className: `${actionClass} justify-self-center ${myRepost ? 'text-primary' : ''}`, title: t('posts.actions.repost', { defaultValue: 'Repost' }), action: toggleRepost, disabled: disabledForGroup, spinnerOnlyOnLoading: true, "data-testid": "posts-repost-button", children: [_jsx(Repeat2, { className: "h-4 w-4" }), compact ? post.repostCount || null : repostLabel] }), _jsxs(Button, { variant: "unstyled", className: `${actionClass} justify-self-end ${iReacted ? 'text-primary' : ''}`, title: t('posts.actions.react', { defaultValue: 'React' }), action: toggleReaction, disabled: disabledForGroup, spinnerOnlyOnLoading: true, children: [_jsx(ThumbsUp, { className: "h-4 w-4" }), compact
59
20
  ? post.reactions?.length
60
21
  ? ` · ${postReactionStats(post)}`
61
22
  : null
@@ -4,5 +4,5 @@ import { UpdatingDate } from '@openpeepshq/react-ui';
4
4
  import { PostMenu } from './PostMenu.js';
5
5
  export function PostInfoHeader({ post, showMenu = false, deleteCallback, }) {
6
6
  const { profile } = post;
7
- return (_jsxs("div", { className: "flex justify-between py-2", children: [_jsxs("div", { className: "flex w-fit space-x-2", children: [_jsx(ProfileLink, { profile: profile, children: _jsx(Avatar, { profile: profile, size: 3 }) }), _jsxs("div", { className: "flex flex-col flex-wrap", children: [_jsx(ProfileLink, { profile: profile, className: "text-sm font-semibold hover:underline", children: profile.displayName || `@${profile.handle}` }), _jsxs("span", { className: "text-muted-foreground text-xs", children: ["@", profile.handle] }), _jsx("span", { className: "text-xs font-extralight", children: _jsx(UpdatingDate, { date: post.createdAt }) })] })] }), showMenu && 'id' in post ? (_jsx(PostMenu, { post: post, deleteCallback: deleteCallback })) : null] }));
7
+ return (_jsxs("div", { className: "flex justify-between py-2", children: [_jsxs("div", { className: "flex w-fit gap-2", children: [_jsx(ProfileLink, { profile: profile, children: _jsx(Avatar, { profile: profile, size: 3, borderless: true }) }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(ProfileLink, { profile: profile, className: "text-sm font-semibold hover:underline", children: profile.displayName || `@${profile.handle}` }), _jsxs("span", { className: "text-muted-foreground flex items-center gap-1 text-xs", children: ["@", profile.handle, _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx(UpdatingDate, { date: post.createdAt })] })] })] }), showMenu && 'id' in post ? (_jsx(PostMenu, { post: post, deleteCallback: deleteCallback })) : null] }));
8
8
  }
@@ -22,7 +22,9 @@ export function PostMenu({ post, deleteCallback }) {
22
22
  const { openEditPost } = useEditPostModal();
23
23
  const [modal, setModal] = useState(null);
24
24
  const bookmarkedIdsQuery = openpeepsApi.useCurrentProfileBookmarkedIds();
25
- const followProfile = openpeepsApi.followProfileAction({ id: post.profile.id });
25
+ const followProfile = openpeepsApi.followProfileAction({
26
+ id: post.profile.id,
27
+ });
26
28
  const unfollowProfile = openpeepsApi.unfollowProfileAction({
27
29
  id: post.profile.id,
28
30
  });
@@ -42,10 +44,12 @@ export function PostMenu({ post, deleteCallback }) {
42
44
  const canPinGlobally = useMemo(() => ['public', 'local'].includes(post.visibility) &&
43
45
  !!me &&
44
46
  checkRoleCapabilities(me.roles ?? [], ['core-config-update']).success, [me, post.visibility]);
45
- const canDeletePost = useMemo(() => checkPostCapabilities(authData, ['core-posts-delete'], post, capabilities).success, [authData, post, capabilities]);
46
- const canReportPost = useMemo(() => !!me &&
47
- checkRoleCapabilities(me.roles ?? [], ['core-reports-create']).success, [me]);
47
+ const canDeletePost = useMemo(() => checkPostCapabilities(authData, ['core-posts-delete'], post, capabilities)
48
+ .success, [authData, post, capabilities]);
48
49
  const isPostOwner = postProfile?.id === me?.id;
50
+ const canReportPost = useMemo(() => !!me &&
51
+ !isPostOwner &&
52
+ checkRoleCapabilities(me.roles ?? [], ['core-reports-create']).success, [me, isPostOwner]);
49
53
  if (!me)
50
54
  return null;
51
55
  const handleEditPost = () => {
@@ -59,19 +63,41 @@ export function PostMenu({ post, deleteCallback }) {
59
63
  }
60
64
  openEditPost(post);
61
65
  };
62
- return (_jsxs(_Fragment, { children: [_jsxs(PopupMenu, { className: "hover:bg-surface-200 h-max rounded-full p-2", title: t('posts.menu.title', { defaultValue: 'Post menu' }), children: [postProfile.id !== me.id ? (isFollowing ? (_jsx(PopupMenuButton, { title: t('profile.actions.unfollow', { defaultValue: 'Unfollow' }), text: t('profile.actions.unfollow', { defaultValue: 'Unfollow' }), action: () => unfollowProfile(undefined) })) : (_jsx(PopupMenuButton, { title: t('profile.actions.follow', { defaultValue: 'Follow' }), text: t('profile.actions.follow', { defaultValue: 'Follow' }), action: () => followProfile({ reblogs: true, notify: true }) }))) : null, _jsx(PopupMenuButton, { title: t('posts.menu.reposts', { defaultValue: 'Reposts' }), text: t('posts.menu.reposts', { defaultValue: 'Reposts' }), icon: Repeat2, action: () => setModal('reposts') }), _jsx(PopupMenuButton, { title: t('posts.menu.reactions', { defaultValue: 'Reactions' }), text: t('posts.menu.reactions', { defaultValue: 'Reactions' }), icon: ThumbsUp, action: () => setModal('reactions') }), isBookmarked ? (_jsx(PopupMenuButton, { title: t('posts.unbookmark.title', { defaultValue: 'Remove bookmark' }), text: t('posts.unbookmark.title', { defaultValue: 'Remove bookmark' }), icon: BookmarkMinus, action: async () => {
66
+ return (_jsxs(_Fragment, { children: [_jsxs(PopupMenu, { className: "h-max rounded-lg p-2 hover:opacity-80", title: t('posts.menu.title', { defaultValue: 'Post menu' }), children: [postProfile.id !== me.id ? (isFollowing ? (_jsx(PopupMenuButton, { title: t('profile.actions.unfollow', {
67
+ defaultValue: 'Unfollow',
68
+ }), text: t('profile.actions.unfollow', { defaultValue: 'Unfollow' }), action: () => unfollowProfile(undefined) })) : (_jsx(PopupMenuButton, { title: t('profile.actions.follow', { defaultValue: 'Follow' }), text: t('profile.actions.follow', { defaultValue: 'Follow' }), action: () => followProfile({ reblogs: true, notify: true }) }))) : null, _jsx(PopupMenuButton, { title: t('posts.menu.reposts', { defaultValue: 'Reposts' }), text: t('posts.menu.reposts', { defaultValue: 'Reposts' }), icon: Repeat2, action: () => setModal('reposts') }), _jsx(PopupMenuButton, { title: t('posts.menu.reactions', { defaultValue: 'Reactions' }), text: t('posts.menu.reactions', { defaultValue: 'Reactions' }), icon: ThumbsUp, action: () => setModal('reactions') }), isBookmarked ? (_jsx(PopupMenuButton, { title: t('posts.unbookmark.title', {
69
+ defaultValue: 'Remove bookmark',
70
+ }), text: t('posts.unbookmark.title', {
71
+ defaultValue: 'Remove bookmark',
72
+ }), icon: BookmarkMinus, action: async () => {
63
73
  await unbookmarkPost(undefined);
64
74
  } })) : (_jsx(PopupMenuButton, { title: t('posts.bookmark.title', { defaultValue: 'Bookmark' }), text: t('posts.bookmark.title', { defaultValue: 'Bookmark' }), icon: BookmarkPlus, action: async () => {
65
75
  await bookmarkPost(undefined);
66
76
  } })), canPinGlobally ? (_jsx(PopupMenuButton, { title: pinnedGlobally
67
- ? t('posts.unpinGlobally.title', { defaultValue: 'Unpin globally' })
77
+ ? t('posts.unpinGlobally.title', {
78
+ defaultValue: 'Unpin globally',
79
+ })
68
80
  : t('posts.pinGlobally.title', { defaultValue: 'Pin globally' }), text: pinnedGlobally
69
- ? t('posts.unpinGlobally.title', { defaultValue: 'Unpin globally' })
70
- : t('posts.pinGlobally.title', { defaultValue: 'Pin globally' }), icon: Pin, action: () => pinGloballyMutation({ postId: pinnedGlobally ? '' : post.id }) })) : null, canPinToGroup && post.group ? (pinnedInGroup ? (_jsx(PopupMenuButton, { title: t('posts.unpinInGroup.title', { defaultValue: 'Unpin in group' }), text: t('posts.unpinInGroup.title', { defaultValue: 'Unpin in group' }), icon: Pin, action: () => updateGroup({ ...post.group, pinnedPostId: '' }) })) : (_jsx(PopupMenuButton, { title: t('posts.pinInGroup.title', { defaultValue: 'Pin in group' }), text: t('posts.pinInGroup.title', { defaultValue: 'Pin in group' }), icon: Pin, action: () => updateGroup({ ...post.group, pinnedPostId: post.id }) }))) : null, isPostOwner ? (_jsxs(_Fragment, { children: [_jsx(PopupSeparator, {}), _jsx(PopupMenuButton, { title: t('common.actions.edit', { defaultValue: 'Edit' }), text: t('common.actions.edit', { defaultValue: 'Edit' }), icon: Pencil, action: handleEditPost })] })) : null, canDeletePost ? (_jsx(PopupMenuButton, { title: t('common.actions.delete', { defaultValue: 'Delete' }), text: t('common.actions.delete', { defaultValue: 'Delete' }), icon: Trash, danger: true, action: () => setModal('delete') })) : null, canReportPost ? (_jsxs(_Fragment, { children: [_jsx(PopupMenuButton, { title: t('common.actions.reportPost', { defaultValue: 'Report post' }), text: t('common.actions.reportPost', { defaultValue: 'Report post' }), icon: FlagIcon, danger: true, action: () => setModal('reportPost') }), _jsx(PopupMenuButton, { title: t('common.actions.reportProfile', {
81
+ ? t('posts.unpinGlobally.title', {
82
+ defaultValue: 'Unpin globally',
83
+ })
84
+ : t('posts.pinGlobally.title', { defaultValue: 'Pin globally' }), icon: Pin, action: () => pinGloballyMutation({ postId: pinnedGlobally ? '' : post.id }) })) : null, canPinToGroup && post.group ? (pinnedInGroup ? (_jsx(PopupMenuButton, { title: t('posts.unpinInGroup.title', {
85
+ defaultValue: 'Unpin in group',
86
+ }), text: t('posts.unpinInGroup.title', {
87
+ defaultValue: 'Unpin in group',
88
+ }), icon: Pin, action: () => updateGroup({ ...post.group, pinnedPostId: '' }) })) : (_jsx(PopupMenuButton, { title: t('posts.pinInGroup.title', {
89
+ defaultValue: 'Pin in group',
90
+ }), text: t('posts.pinInGroup.title', {
91
+ defaultValue: 'Pin in group',
92
+ }), icon: Pin, action: () => updateGroup({ ...post.group, pinnedPostId: post.id }) }))) : null, isPostOwner ? (_jsxs(_Fragment, { children: [_jsx(PopupSeparator, {}), _jsx(PopupMenuButton, { title: t('common.actions.edit', { defaultValue: 'Edit' }), text: t('common.actions.edit', { defaultValue: 'Edit' }), icon: Pencil, action: handleEditPost })] })) : null, canDeletePost ? (_jsx(PopupMenuButton, { title: t('common.actions.delete', { defaultValue: 'Delete' }), text: t('common.actions.delete', { defaultValue: 'Delete' }), icon: Trash, danger: true, action: () => setModal('delete') })) : null, canReportPost ? (_jsxs(_Fragment, { children: [_jsx(PopupMenuButton, { title: t('common.actions.reportPost', {
93
+ defaultValue: 'Report post',
94
+ }), text: t('common.actions.reportPost', {
95
+ defaultValue: 'Report post',
96
+ }), icon: FlagIcon, danger: true, action: () => setModal('reportPost') }), _jsx(PopupMenuButton, { title: t('common.actions.reportProfile', {
71
97
  defaultValue: 'Report @{{handle}}',
72
98
  handle: post.profile.handle,
73
99
  }), text: t('common.actions.reportProfile', {
74
100
  defaultValue: 'Report @{{handle}}',
75
101
  handle: post.profile.handle,
76
- }), icon: FlagIcon, danger: true, action: () => setModal('reportProfile') })] })) : null] }), _jsx(ReactionsModal, { reactions: post.reactions ?? [], open: modal === 'reactions', onClose: () => setModal(null) }), _jsx(RepostModal, { post: post, open: modal === 'reposts', onClose: () => setModal(null) }), _jsx(DeletePostModal, { post: post, open: modal === 'delete', onClose: () => setModal(null), deleteCallback: deleteCallback }), _jsx(ReportProfileOrPostModal, { reportType: "post", post: post, open: modal === 'reportPost', onClose: () => setModal(null) }), _jsx(ReportProfileOrPostModal, { reportType: "profile", profile: post.profile, open: modal === 'reportProfile', onClose: () => setModal(null) })] }));
102
+ }), icon: FlagIcon, danger: true, action: () => setModal('reportProfile') })] })) : null] }), _jsx(ReactionsModal, { reactions: post.reactions ?? [], open: modal === 'reactions', onClose: () => setModal(null) }), _jsx(RepostModal, { reposts: post.reposts ?? [], repostCount: post.repostCount ?? 0, open: modal === 'reposts', onClose: () => setModal(null) }), _jsx(DeletePostModal, { post: post, open: modal === 'delete', onClose: () => setModal(null), deleteCallback: deleteCallback }), _jsx(ReportProfileOrPostModal, { reportType: "post", post: post, open: modal === 'reportPost', onClose: () => setModal(null) }), _jsx(ReportProfileOrPostModal, { reportType: "profile", profile: post.profile, open: modal === 'reportProfile', onClose: () => setModal(null) })] }));
77
103
  }
@@ -27,5 +27,5 @@ export function PostReactionHeader({ post, inGroup = false, deleteCallback, }) {
27
27
  return null;
28
28
  }
29
29
  const menuPost = post.repost ?? post;
30
- return (_jsxs("div", { className: "flex items-center justify-between gap-2 border-b py-2 text-sm", children: [_jsx("div", { className: "flex w-5/6 flex-1 items-center gap-2", children: showGroup ? (_jsxs(_Fragment, { children: [isRepost ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(Avatar, { profile: post.profile, size: 2.25 }) }), _jsx("span", { className: "font-light", children: t('posts.reposted', { defaultValue: 'reposted' }) })] })) : isReply && replyPost?.profile ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("a", { className: "w-max", href: `/posts/${post.inReplyToId}`, children: t('posts.replyTo', { defaultValue: 'replied to' }) }), _jsx(ProfileLink, { className: "w-max", profile: replyPost.profile, children: _jsx(AvatarWithName, { profile: replyPost.profile }) }), _jsx("span", { className: "font-light", children: "in" })] })) : (_jsx("span", { className: "font-light", children: "Posted in" })), _jsx("a", { href: `/groups/@${post.group?.handle}`, className: "text-primary flex-1 truncate font-semibold", children: post.group?.displayName })] })) : isRepost ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("span", { className: "font-light", children: t('posts.reposted', { defaultValue: 'reposted' }) })] })) : isReply && replyPost?.profile ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("a", { href: `/posts/${post.inReplyToId}`, className: "text-sm", children: t('posts.replyTo', { defaultValue: 'replied to' }) }), _jsx(ProfileLink, { profile: replyPost.profile, children: _jsx(AvatarWithName, { profile: replyPost.profile }) })] })) : null }), _jsx(PostMenu, { post: menuPost, deleteCallback: deleteCallback })] }));
30
+ return (_jsxs("div", { className: "border-border flex items-center justify-between gap-2 border-b py-2 text-sm", children: [_jsx("div", { className: "flex w-5/6 flex-1 items-center gap-2", children: showGroup ? (_jsxs(_Fragment, { children: [isRepost ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(Avatar, { profile: post.profile, size: 2.25 }) }), _jsx("span", { className: "font-light", children: t('posts.reposted', { defaultValue: 'reposted' }) })] })) : isReply && replyPost?.profile ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("a", { className: "w-max", href: `/posts/${post.inReplyToId}`, children: t('posts.replyTo', { defaultValue: 'replied to' }) }), _jsx(ProfileLink, { className: "w-max", profile: replyPost.profile, children: _jsx(AvatarWithName, { profile: replyPost.profile }) }), _jsx("span", { className: "font-light", children: "in" })] })) : (_jsx("span", { className: "font-light", children: "Posted in" })), _jsx("a", { href: `/groups/@${post.group?.handle}`, className: "text-primary flex-1 truncate font-semibold", children: post.group?.displayName })] })) : isRepost ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("span", { className: "font-light", children: t('posts.reposted', { defaultValue: 'reposted' }) })] })) : isReply && replyPost?.profile ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("a", { href: `/posts/${post.inReplyToId}`, className: "text-sm", children: t('posts.replyTo', { defaultValue: 'replied to' }) }), _jsx(ProfileLink, { profile: replyPost.profile, children: _jsx(AvatarWithName, { profile: replyPost.profile }) })] })) : null }), _jsx(PostMenu, { post: menuPost, deleteCallback: deleteCallback })] }));
31
31
  }
@@ -30,9 +30,11 @@ export function ShareMenu({ post, menuButton }) {
30
30
  a.click();
31
31
  URL.revokeObjectURL(href);
32
32
  };
33
- return (_jsxs(PopupMenu, { menuButton: menuButton ?? _jsx(Share, { className: "size-4" }), title: t('posts.shareMenu.title', { defaultValue: 'Share' }), variant: "variant-ringed-primary", children: [me ? (_jsxs(_Fragment, { children: [_jsx(PopupSection, { title: t('posts.shareMenu.shareOnCommunity', {
33
+ return (_jsxs(PopupMenu, { menuButton: menuButton ?? _jsx(Share, { className: "size-4" }), title: t('posts.shareMenu.title', { defaultValue: 'Share' }), variant: "outline", children: [me ? (_jsxs(_Fragment, { children: [_jsx(PopupSection, { title: t('posts.shareMenu.shareOnCommunity', {
34
34
  defaultValue: 'Share on community',
35
- }) }), _jsx(PopupMenuButton, { title: t('posts.shareMenu.repostToFeed', { defaultValue: 'Repost' }), text: t('posts.shareMenu.repostToFeed', { defaultValue: 'Repost' }), icon: Repeat2, action: () => repostPost(undefined) }), _jsx(PopupMenuButton, { title: t('posts.shareMenu.sendInMessage', {
35
+ }) }), _jsx(PopupMenuButton, { title: t('posts.shareMenu.repostToFeed', {
36
+ defaultValue: 'Repost',
37
+ }), text: t('posts.shareMenu.repostToFeed', { defaultValue: 'Repost' }), icon: Repeat2, action: () => repostPost(undefined) }), _jsx(PopupMenuButton, { title: t('posts.shareMenu.sendInMessage', {
36
38
  defaultValue: 'Send in message',
37
39
  }), text: t('posts.shareMenu.sendInMessage', {
38
40
  defaultValue: 'Send in message',
@@ -1,9 +1,11 @@
1
1
  export interface UnreadPostIndicatorProps {
2
2
  show: boolean;
3
3
  className?: string;
4
+ /** `corner` is a top-left fold on feed cards; `dot` is the in-flow / margin mark. */
5
+ variant?: 'dot' | 'corner';
4
6
  }
5
7
  /**
6
- * Subtle unread marker positioned in the host's left margin.
7
- * Absolutely positioned so visibility changes never shift layout.
8
+ * Unread marker. `dot` is a small circle (conversations, thread rows).
9
+ * `corner` is a surface-colored triangle in the host's top-left corner.
8
10
  */
9
- export declare const UnreadPostIndicator: ({ show, className, }: UnreadPostIndicatorProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const UnreadPostIndicator: ({ show, className, variant, }: UnreadPostIndicatorProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from '@openpeepshq/react-ui';
2
3
  /**
3
- * Subtle unread marker positioned in the host's left margin.
4
- * Absolutely positioned so visibility changes never shift layout.
4
+ * Unread marker. `dot` is a small circle (conversations, thread rows).
5
+ * `corner` is a surface-colored triangle in the host's top-left corner.
5
6
  */
6
- export const UnreadPostIndicator = ({ show, className = 'left-1.5 top-6', }) => (_jsx("span", { "aria-hidden": !show, className: `pointer-events-none absolute size-1.5 rounded-full ${className} ${show ? 'bg-muted-foreground/45' : 'opacity-0'}` }));
7
+ export const UnreadPostIndicator = ({ show, className, variant = 'dot', }) => variant === 'corner' ? (_jsx("span", { "aria-hidden": !show, className: cn('pointer-events-none absolute left-0 top-0 h-0 w-0 border-r-[12px] border-t-[12px] border-solid border-r-transparent', show ? 'border-t-surface' : 'opacity-0', className) })) : (_jsx("span", { "aria-hidden": !show, className: cn('pointer-events-none absolute size-1.5 rounded-full', show ? 'bg-muted-foreground/45' : 'opacity-0', className ?? 'left-1.5 top-6') }));
@@ -16,5 +16,5 @@ export function DeletePostModal({ post, open, onClose, deleteCallback, }) {
16
16
  defaultValue: 'Delete post',
17
17
  }) }) }), _jsxs("article", { className: "min-w-0 overflow-x-hidden", children: [_jsx(FeedPost, { post: post, noReactionHeader: true }), _jsx("p", { className: "my-4 text-sm", children: t('posts.delete.confirm', {
18
18
  defaultValue: 'Are you sure you want to delete this post?',
19
- }) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-filled-error", action: handleDelete, children: t('posts.deleteModal.delete', { defaultValue: 'Delete' }) }), _jsx(Button, { variant: "variant-ringed-surface", action: onClose, children: t('posts.deleteModal.cancel', { defaultValue: 'Cancel' }) })] })] }) }));
19
+ }) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "destructive", action: handleDelete, children: t('posts.deleteModal.delete', { defaultValue: 'Delete' }) }), _jsx(Button, { variant: "outline", action: onClose, children: t('posts.deleteModal.cancel', { defaultValue: 'Cancel' }) })] })] }) }));
20
20
  }
@@ -1,7 +1,9 @@
1
- import type { PublicPost } from '@openpeepshq/common/types';
1
+ import type { RepostWithPublicProfile } from '@openpeepshq/common/types';
2
2
  export interface RepostModalProps {
3
- post: PublicPost;
3
+ reposts: RepostWithPublicProfile[];
4
+ /** Authoritative total; may exceed `reposts.length` when the list is capped. */
5
+ repostCount: number;
4
6
  open: boolean;
5
7
  onClose: () => void;
6
8
  }
7
- export declare function RepostModal({ post, open, onClose }: RepostModalProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function RepostModal({ reposts, repostCount, open, onClose, }: RepostModalProps): import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Dialog, DialogContent, DialogHeader, DialogTitle, LoadingSpinner, } from '@openpeepshq/react-ui';
3
- import { useOpenpeeps } from '../../../../contexts/openpeeps/index.js';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Dialog, DialogContent, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
4
3
  import { useT } from '../../../../i18n/index.js';
5
4
  import { ProfileWithActionCard } from '../../../profile/ProfileWithActionCard.js';
6
- export function RepostModal({ post, open, onClose }) {
5
+ export function RepostModal({ reposts, repostCount, open, onClose, }) {
7
6
  const t = useT();
8
- const { openpeepsApi } = useOpenpeeps();
9
- const repostsQuery = openpeepsApi.usePostReposts(post.id);
10
- return (_jsx(Dialog, { open: open, onOpenChange: (next) => !next && onClose(), children: _jsxs(DialogContent, { className: "max-h-[80vh] max-w-md overflow-y-auto", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('posts.repostModal.title', { defaultValue: 'Reposters' }) }) }), _jsx("article", { className: "pb-3", children: repostsQuery.isLoading ? (_jsx("div", { className: "p-5 text-center text-sm text-muted-foreground", children: _jsx(LoadingSpinner, {}) })) : repostsQuery.data?.length ? (repostsQuery.data.map((repost) => (_jsx(ProfileWithActionCard, { profile: repost.profile }, repost.profile.id)))) : (_jsx("p", { className: "p-5 text-center text-sm text-muted-foreground", children: t('posts.repostModal.empty', {
7
+ const moreCount = Math.max(0, repostCount - reposts.length);
8
+ return (_jsx(Dialog, { open: open, onOpenChange: (next) => !next && onClose(), children: _jsxs(DialogContent, { className: "max-h-[80vh] max-w-md overflow-y-auto", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('posts.repostModal.title', { defaultValue: 'Reposters' }) }) }), _jsx("article", { className: "pb-3", children: reposts.length ? (_jsxs(_Fragment, { children: [reposts.map((repost) => (_jsx(ProfileWithActionCard, { profile: repost.profile }, repost.profile.id))), moreCount > 0 ? (_jsx("p", { className: "text-muted-foreground px-5 pt-2 text-center text-sm", children: t('posts.repostModal.andMore', {
9
+ defaultValue: 'and {{count}} more',
10
+ count: moreCount,
11
+ }) })) : null] })) : (_jsx("p", { className: "text-muted-foreground p-5 text-center text-sm", children: t('posts.repostModal.empty', {
11
12
  defaultValue: 'No reposters yet',
12
13
  }) })) })] }) }));
13
14
  }
@@ -114,7 +114,7 @@ export function AttachmentCard({ item, onUploaded, onProcessed, onFailed, onRemo
114
114
  defaultValue: 'Edit description',
115
115
  }), onClick: () => setEditing(true), className: "bg-background/80 rounded-full p-1", children: _jsx(Pencil, { className: "size-4" }) })) : null, _jsx("button", { type: "button", title: t('posts.attachments.deleteTitle', {
116
116
  defaultValue: 'Delete attachment',
117
- }), onClick: remove, className: "bg-background/80 rounded-full p-1", children: _jsx(X, { className: "size-4" }) })] })) : null, showEdit && att ? (_jsx(DescriptionEditModal, { attachment: att, open: editing, onClose: () => setEditing(false), onSave: (description) => onUpdate(item.key, { ...att, description }) })) : null, showOverlay ? (_jsxs("div", { "data-testid": "attachment-progress", className: "bg-surface-700 absolute inset-0 z-10 flex flex-col items-center justify-center gap-1 text-white", children: [_jsxs("svg", { viewBox: "0 0 36 36", className: "h-16 w-16", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(piePercent), children: [_jsx("circle", { cx: PIE.cx, cy: PIE.cy, r: PIE.r, fill: "rgba(255,255,255,0.25)" }), piePath(piePercent) ? (_jsx("path", { d: piePath(piePercent), fill: "white" })) : null, _jsxs("text", { x: PIE.cx, y: PIE.cy + 1, textAnchor: "middle", dominantBaseline: "middle", fontSize: "8", fontWeight: "600", fill: "rgb(30 41 59)", children: [Math.round(piePercent), "%"] })] }), _jsx("span", { className: "text-xs font-medium uppercase tracking-wide", children: phaseLabel }), etaMs !== undefined && etaMs > 1000 ? (_jsxs("span", { className: "text-xs opacity-80", children: ["~", formatRemaining(etaMs)] })) : null] })) : null, failed ? (_jsxs("div", { "data-testid": "attachment-failed", className: "bg-error absolute inset-0 z-30 flex flex-col items-center justify-center gap-2 text-white", children: [_jsx("span", { className: "text-sm font-semibold", children: t('posts.attachments.failed', { defaultValue: 'Upload failed' }) }), _jsx("button", { type: "button", onClick: remove, title: t('posts.attachments.deleteTitle', {
117
+ }), onClick: remove, className: "bg-background/80 rounded-full p-1", children: _jsx(X, { className: "size-4" }) })] })) : null, showEdit && att ? (_jsx(DescriptionEditModal, { attachment: att, open: editing, onClose: () => setEditing(false), onSave: (description) => onUpdate(item.key, { ...att, description }) })) : null, showOverlay ? (_jsxs("div", { "data-testid": "attachment-progress", className: "bg-foreground absolute inset-0 z-10 flex flex-col items-center justify-center gap-1 text-white", children: [_jsxs("svg", { viewBox: "0 0 36 36", className: "h-16 w-16", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(piePercent), children: [_jsx("circle", { cx: PIE.cx, cy: PIE.cy, r: PIE.r, fill: "rgba(255,255,255,0.25)" }), piePath(piePercent) ? (_jsx("path", { d: piePath(piePercent), fill: "white" })) : null, _jsxs("text", { x: PIE.cx, y: PIE.cy + 1, textAnchor: "middle", dominantBaseline: "middle", fontSize: "8", fontWeight: "600", fill: "rgb(30 41 59)", children: [Math.round(piePercent), "%"] })] }), _jsx("span", { className: "text-xs font-medium uppercase tracking-wide", children: phaseLabel }), etaMs !== undefined && etaMs > 1000 ? (_jsxs("span", { className: "text-xs opacity-80", children: ["~", formatRemaining(etaMs)] })) : null] })) : null, failed ? (_jsxs("div", { "data-testid": "attachment-failed", className: "bg-error absolute inset-0 z-30 flex flex-col items-center justify-center gap-2 text-white", children: [_jsx("span", { className: "text-sm font-semibold", children: t('posts.attachments.failed', { defaultValue: 'Upload failed' }) }), _jsx("button", { type: "button", onClick: remove, title: t('posts.attachments.deleteTitle', {
118
118
  defaultValue: 'Delete attachment',
119
- }), className: "bg-surface-50 text-error-700 hover:bg-surface-200 rounded-full p-3", children: _jsx(X, { className: "size-8" }) })] })) : null, showOverlay || failed ? (_jsx("div", { className: "bg-surface-200 h-full w-full" })) : isImage || isVideo ? (_jsxs("div", { className: "relative h-full w-full", children: [_jsx("img", { src: previewUrl, alt: att?.description ?? '', className: "h-full w-full object-cover" }), _jsx(VideoPlayOverlay, { video: isVideo })] })) : (_jsx("div", { className: "flex h-full w-full items-center justify-center p-2", children: _jsx("p", { className: "truncate text-xs", children: att?.filename ?? item.file?.name ?? 'File' }) }))] }));
119
+ }), className: "bg-background text-destructive hover:bg-surface rounded-full p-3", children: _jsx(X, { className: "size-8" }) })] })) : null, showOverlay || failed ? (_jsx("div", { className: "bg-surface-2 h-full w-full" })) : isImage || isVideo ? (_jsxs("div", { className: "relative h-full w-full", children: [_jsx("img", { src: previewUrl, alt: att?.description ?? '', className: "h-full w-full object-cover" }), _jsx(VideoPlayOverlay, { video: isVideo })] })) : (_jsx("div", { className: "flex h-full w-full items-center justify-center p-2", children: _jsx("p", { className: "truncate text-xs", children: att?.filename ?? item.file?.name ?? 'File' }) }))] }));
120
120
  }
@@ -133,5 +133,5 @@ export function ComposeAttachments(props) {
133
133
  const { openImagePicker, openDocumentPicker, previews, inputs } = useComposeAttachments(props);
134
134
  return (_jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("button", { type: "button", title: t('posts.form.addImage', {
135
135
  defaultValue: 'Add image or video',
136
- }), onClick: openImagePicker, className: "hover:bg-surface-200 rounded-md p-2", children: _jsx(Image, { className: "size-5" }) }), _jsx("button", { type: "button", title: t('posts.form.addDocument', { defaultValue: 'Add document' }), onClick: openDocumentPicker, className: "hover:bg-surface-200 rounded-md p-2", children: _jsx(Paperclip, { className: "size-5" }) })] }), previews, inputs] }));
136
+ }), onClick: openImagePicker, className: "hover:bg-surface rounded-button p-2", children: _jsx(Image, { className: "size-5" }) }), _jsx("button", { type: "button", title: t('posts.form.addDocument', { defaultValue: 'Add document' }), onClick: openDocumentPicker, className: "hover:bg-surface rounded-button p-2", children: _jsx(Paperclip, { className: "size-5" }) })] }), previews, inputs] }));
137
137
  }
@@ -18,5 +18,5 @@ export function DescriptionEditModal({ attachment, open, onClose, onSave, }) {
18
18
  defaultValue: 'Edit description',
19
19
  }) }) }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "attachment-description", children: t('common.media.altText', { defaultValue: 'Alt text' }) }), _jsx(Textarea, { id: "attachment-description", rows: 3, value: description, onChange: (e) => setDescription(e.target.value), placeholder: t('form.uploadEditModal.description.placeholder', {
20
20
  defaultValue: 'Describe this attachment for accessibility',
21
- }) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-ringed-primary", action: onClose, children: t('common.back', { defaultValue: 'Back' }) }), _jsx(Button, { variant: "variant-filled-primary", action: saveAndClose, children: t('common.done', { defaultValue: 'Done' }) })] })] }) }));
21
+ }) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", action: onClose, children: t('common.back', { defaultValue: 'Back' }) }), _jsx(Button, { variant: "default", action: saveAndClose, children: t('common.done', { defaultValue: 'Done' }) })] })] }) }));
22
22
  }
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from 'react';
3
+ import { resolvePollOptionContents } from '@openpeepshq/common';
3
4
  import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
4
5
  import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
5
6
  import { useT } from '../../../i18n/index.js';
@@ -7,7 +8,7 @@ import { OpenpeepsMarkdown } from '../../markdown/OpenpeepsMarkdown.js';
7
8
  import { ComposeAttachments } from './ComposeAttachments.js';
8
9
  import { ComposePreviewLinks } from './ComposePreviewLinks.js';
9
10
  import { OpenpeepsMarkdownInput } from './OpenpeepsMarkdownInput.js';
10
- import { PollComposerFields } from './PollComposerFields.js';
11
+ import { PollComposerFields, pollOptionLabel } from './PollComposerFields.js';
11
12
  const toDatetimeLocal = (iso) => {
12
13
  if (!iso)
13
14
  return '';
@@ -24,11 +25,25 @@ export function EditPostModal({ post, onClose }) {
24
25
  const [data, setData] = useState(post.data);
25
26
  const [submitting, setSubmitting] = useState(false);
26
27
  const [error, setError] = useState(null);
28
+ const content = data.type === 'note' || data.type === 'question'
29
+ ? (data.content ?? '')
30
+ : '';
31
+ const pollOptions = data.type === 'question' ? data.options.map((o) => o.content) : [];
32
+ const resolvedPollOptions = resolvePollOptionContents(pollOptions, (index) => pollOptionLabel(index, t));
27
33
  const publish = async () => {
28
34
  setError(null);
29
35
  setSubmitting(true);
30
36
  try {
31
- await updatePost(data);
37
+ const payload = data.type === 'question'
38
+ ? {
39
+ ...data,
40
+ options: resolvedPollOptions.map((optionContent) => ({
41
+ type: 'note',
42
+ content: optionContent,
43
+ })),
44
+ }
45
+ : data;
46
+ await updatePost(payload);
32
47
  onClose();
33
48
  }
34
49
  catch (err) {
@@ -38,9 +53,9 @@ export function EditPostModal({ post, onClose }) {
38
53
  setSubmitting(false);
39
54
  }
40
55
  };
41
- const setContent = (content) => {
56
+ const setContent = (nextContent) => {
42
57
  if (data.type === 'note' || data.type === 'question') {
43
- setData({ ...data, content });
58
+ setData({ ...data, content: nextContent });
44
59
  }
45
60
  };
46
61
  const setAttachments = (attachments) => {
@@ -48,20 +63,15 @@ export function EditPostModal({ post, onClose }) {
48
63
  setData({ ...data, attachments });
49
64
  }
50
65
  };
51
- const content = data.type === 'note' || data.type === 'question'
52
- ? (data.content ?? '')
53
- : '';
54
- const pollOptions = data.type === 'question' ? data.options.map((o) => o.content) : [];
55
- const validPollOptions = pollOptions.map((o) => o.trim()).filter(Boolean);
56
66
  const canSave = useMemo(() => {
57
67
  if (data.type === 'question') {
58
- return content.trim().length > 0 && validPollOptions.length >= 2;
68
+ return content.trim().length > 0 && resolvedPollOptions.length >= 2;
59
69
  }
60
70
  if (data.type === 'note') {
61
71
  return content.trim().length > 0 || (data.attachments?.length ?? 0) > 0;
62
72
  }
63
73
  return true;
64
- }, [content, data, validPollOptions.length]);
74
+ }, [content, data, resolvedPollOptions.length]);
65
75
  return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-h-[90vh] max-w-xl overflow-y-auto", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('posts.edit.title', { defaultValue: 'Edit post' }) }) }), data.type === 'question' ? (_jsxs(_Fragment, { children: [_jsx(OpenpeepsMarkdownInput, { rows: 3, value: content, onChange: setContent }), _jsx(ComposePreviewLinks, { content: content }), _jsx(PollComposerFields, { options: pollOptions, onOptionsChange: (options) => setData({
66
76
  ...data,
67
77
  options: options.map((text) => ({
@@ -75,7 +85,7 @@ export function EditPostModal({ post, onClose }) {
75
85
  ? data.content
76
86
  : data.type === 'event'
77
87
  ? data.content
78
- : '', mentions: post.mentions })), error ? _jsx("p", { className: "text-error text-sm", children: error }) : null, _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-ghost-primary", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "variant-filled-primary", action: publish, disabled: submitting || !canSave, children: submitting
88
+ : '', mentions: post.mentions })), error ? _jsx("p", { className: "text-error text-sm", children: error }) : null, _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "ghost", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "default", action: publish, disabled: submitting || !canSave, children: submitting
79
89
  ? t('common.saving', { defaultValue: 'Saving…' })
80
90
  : t('common.save', { defaultValue: 'Save' }) })] })] }) }));
81
91
  }
@@ -63,7 +63,7 @@ export function EventForm({ postData, onChange, isEdit = false, }) {
63
63
  defaultValue: 'Upload an image for your event',
64
64
  }), specsText: t('events.form.imageSpecs', {
65
65
  defaultValue: 'Your image should be at least 800 pixels wide with a 16x9 aspect ratio.',
66
- }), showAltInput: false }), _jsxs("div", { className: "mt-4 flex flex-col gap-4 px-3", children: [_jsx("h2", { className: "text-lg", children: t('events.form.title', { defaultValue: 'Basic Details' }) }), _jsx(Label, { title: t('events.form.name', { defaultValue: 'Event name' }), htmlFor: "event-name", children: _jsx(Input, { id: "event-name", value: event.name ?? '', onChange: (e) => patchEvent({ name: e.target.value }), "data-testid": "events-name-input" }) }), _jsx("p", { className: "text-surface-500 text-sm", children: t('events.form.description', {
66
+ }), showAltInput: false }), _jsxs("div", { className: "mt-4 flex flex-col gap-4 px-3", children: [_jsx("h2", { className: "text-lg", children: t('events.form.title', { defaultValue: 'Basic Details' }) }), _jsx(Label, { title: t('events.form.name', { defaultValue: 'Event name' }), htmlFor: "event-name", children: _jsx(Input, { id: "event-name", value: event.name ?? '', onChange: (e) => patchEvent({ name: e.target.value }), "data-testid": "events-name-input" }) }), _jsx("p", { className: "text-muted-foreground text-sm", children: t('events.form.description', {
67
67
  defaultValue: 'Give your event a clear, descriptive name',
68
68
  }) }), _jsx(OpenpeepsMarkdownInput, { rows: 6, maxLength: 5000, value: event.content ?? '', onChange: (content) => patchEvent({ content }), testId: "events-description-input", placeholder: t('events.form.descriptionPlaceholder', {
69
69
  defaultValue: 'Describe your event',
@@ -98,7 +98,7 @@ export function EventForm({ postData, onChange, isEdit = false, }) {
98
98
  patchEvent({
99
99
  maxAttendees: parseEventMaxAttendeesInput(e.target.value),
100
100
  });
101
- } }), event.maxAttendees != null ? (_jsx("button", { type: "button", className: "op-input-group-shim hover:bg-muted/80", title: t('events.form.clearMaxAttendees', {
101
+ } }), event.maxAttendees != null ? (_jsx("button", { type: "button", className: "op-input-group-shim hover:bg-surface/80", title: t('events.form.clearMaxAttendees', {
102
102
  defaultValue: 'Remove capacity limit',
103
103
  }), onClick: () => patchEvent({ maxAttendees: undefined }), children: _jsx(X, { className: "size-4" }) })) : null] }) })] }), !isEdit ? (_jsx(PostAudienceSelector, { open: audienceOpen, onClose: () => setAudienceOpen(false), type: "event", visibility: postData.visibility, groupId: postData.groupId ?? undefined, audience: postData.audience ?? [], showDirect: true, onConfirm: setAudience })) : null] }));
104
104
  }
@@ -41,7 +41,7 @@ function SimpleLocationInput({ value, onChange, }) {
41
41
  setText(e.target.value);
42
42
  onChange({ text: e.target.value });
43
43
  search(e.target.value);
44
- } })] }), suggestions.length > 0 ? (_jsx("div", { className: "bg-card absolute z-10 mt-1 max-h-40 w-full overflow-y-auto rounded-md border shadow-md", children: suggestions.map((item) => (_jsx("button", { type: "button", className: "hover:bg-surface-100 w-full px-3 py-2 text-left text-sm", onClick: () => {
44
+ } })] }), suggestions.length > 0 ? (_jsx("div", { className: "bg-surface absolute z-10 mt-1 max-h-40 w-full overflow-y-auto rounded-md border shadow-md", children: suggestions.map((item) => (_jsx("button", { type: "button", className: "hover:bg-surface w-full px-3 py-2 text-left text-sm", onClick: () => {
45
45
  setText(item.name);
46
46
  onChange({
47
47
  text: item.name,
@@ -1,4 +1,4 @@
1
- import type { GroupWithMeta, VisibilityType } from '@openpeepshq/common';
1
+ import { type GroupWithMeta, type VisibilityType } from '@openpeepshq/common';
2
2
  export interface NewPostToast {
3
3
  type: 'success' | 'error';
4
4
  message: string;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useState } from 'react';
3
3
  import { ChevronDown, Image, Megaphone, Paperclip } from 'lucide-react';
4
- import { checkRoleCapabilities } from '@openpeepshq/common';
4
+ import { checkRoleCapabilities, resolvePollOptionContents, } from '@openpeepshq/common';
5
5
  import { Dialog, DialogContent, DialogHeader, DialogTitle, ModalFooter, Button, } from '@openpeepshq/react-ui';
6
6
  import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
7
7
  import { useT } from '../../../i18n/index.js';
@@ -12,7 +12,7 @@ import { defaultNewNote, defaultNewQuestion, useNewPostStores, } from '../../../
12
12
  import { useComposeAttachments } from './ComposeAttachments.js';
13
13
  import { ComposePreviewLinks } from './ComposePreviewLinks.js';
14
14
  import { OpenpeepsMarkdownInput } from './OpenpeepsMarkdownInput.js';
15
- import { PollComposerFields } from './PollComposerFields.js';
15
+ import { PollComposerFields, pollOptionLabel } from './PollComposerFields.js';
16
16
  import { PostAudienceSelector } from './PostAudienceSelector.js';
17
17
  import { PostTypeSwitcher } from './PostTypeSwitcher.js';
18
18
  import { audienceSummary } from './audienceChoices.js';
@@ -143,7 +143,7 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
143
143
  }
144
144
  }, [serverInfo.publicContent, visibility]);
145
145
  const trimmedContent = content.trim();
146
- const validPollOptions = pollOptions.map((o) => o.trim()).filter(Boolean);
146
+ const resolvedPollOptions = resolvePollOptionContents(pollOptions, (index) => pollOptionLabel(index, t));
147
147
  // Mirrors the Svelte `isPostFormSubmittable`: block while uploading, and
148
148
  // require enough content for the active composer type.
149
149
  const canSubmit = useMemo(() => {
@@ -154,7 +154,7 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
154
154
  if (visibility === 'group' && !group?.id && !groupId)
155
155
  return false;
156
156
  if (composerType === 'question') {
157
- return trimmedContent.length > 0 && validPollOptions.length >= 2;
157
+ return trimmedContent.length > 0 && resolvedPollOptions.length >= 2;
158
158
  }
159
159
  return ((trimmedContent.length > 0 && trimmedContent.length <= 500) ||
160
160
  attachments.length > 0);
@@ -167,7 +167,7 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
167
167
  groupId,
168
168
  composerType,
169
169
  trimmedContent,
170
- validPollOptions.length,
170
+ resolvedPollOptions.length,
171
171
  attachments.length,
172
172
  ]);
173
173
  const publish = async () => {
@@ -186,7 +186,7 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
186
186
  data: {
187
187
  type: 'question',
188
188
  content: trimmedContent,
189
- options: validPollOptions.map((text) => ({
189
+ options: resolvedPollOptions.map((text) => ({
190
190
  type: 'note',
191
191
  content: text,
192
192
  })),
@@ -250,7 +250,7 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
250
250
  const showNotify = canNotify && (visibility === 'public' || visibility === 'local');
251
251
  return (_jsxs(_Fragment, { children: [_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "flex max-h-[90vh] max-w-xl flex-col gap-0 overflow-hidden p-0", children: [_jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-6 pb-4 pt-6", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('posts.newPost.title', { defaultValue: 'New post' }) }) }), !group && me ? (_jsxs("button", { type: "button", title: t('posts.form.changeAudience', {
252
252
  defaultValue: 'Change audience',
253
- }), className: "hover:bg-surface-100 flex w-full items-center gap-3 rounded-md border p-3 text-left", onClick: () => setAudienceOpen(true), children: [_jsx(Avatar, { profile: me, size: 3, borderless: true }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsxs("span", { className: "flex items-center gap-1 font-medium capitalize", children: [me.displayName ?? me.handle, _jsx(ChevronDown, { className: "text-muted-foreground size-4" })] }), _jsx("span", { className: "text-muted-foreground text-sm", children: visibility === 'direct' && audience.length > 0 ? (_jsx("span", { className: "flex flex-wrap gap-1", children: audience.map((profile) => (_jsx(ProfileBadge, { profile: profile }, profile.id))) })) : (audienceSummary(visibility, t, selectedGroupName, audience.length)) })] })] })) : null, _jsx(OpenpeepsMarkdownInput, { rows: 5, value: content, onChange: setContent, testId: "posts-composer-content", placeholder: composerType === 'question'
253
+ }), className: "hover:bg-surface rounded-button flex w-full items-center gap-3 border p-3 text-left", onClick: () => setAudienceOpen(true), children: [_jsx(Avatar, { profile: me, size: 3, borderless: true }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsxs("span", { className: "flex items-center gap-1 font-medium capitalize", children: [me.displayName ?? me.handle, _jsx(ChevronDown, { className: "text-muted-foreground size-4" })] }), _jsx("span", { className: "text-muted-foreground text-sm", children: visibility === 'direct' && audience.length > 0 ? (_jsx("span", { className: "flex flex-wrap gap-1", children: audience.map((profile) => (_jsx(ProfileBadge, { profile: profile }, profile.id))) })) : (audienceSummary(visibility, t, selectedGroupName, audience.length)) })] })] })) : null, _jsx(OpenpeepsMarkdownInput, { rows: 5, value: content, onChange: setContent, testId: "posts-composer-content", placeholder: composerType === 'question'
254
254
  ? t('posts.form.poll.question', {
255
255
  defaultValue: 'Poll question…',
256
256
  })
@@ -258,11 +258,11 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
258
258
  defaultValue: 'What is on your mind?',
259
259
  }) }), _jsx(ComposePreviewLinks, { content: content }), composerType === 'note' ? composeAttachments.previews : null, composerType === 'question' ? (_jsx(PollComposerFields, { options: pollOptions, onOptionsChange: setPollOptions, expiresAt: expiresAt, onExpiresAtChange: setExpiresAt, multiple: multiple, onMultipleChange: setMultiple, votersVisible: votersVisible, onVotersVisibleChange: setVotersVisible })) : null, showNotify ? (_jsxs("div", { className: "flex w-full items-center justify-between py-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Megaphone, { className: "size-5" }), _jsx("p", { className: "text-base", children: t('posts.form.notifyEveryone', {
260
260
  defaultValue: 'Notify everyone',
261
- }) })] }), _jsx("button", { type: "button", role: "switch", "aria-checked": notify, onClick: () => setNotify((v) => !v), className: `relative h-5 w-9 rounded-full transition ${notify ? 'bg-primary' : 'bg-surface-300'}`, children: _jsx("span", { className: `absolute top-0.5 size-4 rounded-full bg-white transition ${notify ? 'left-4' : 'left-0.5'}` }) })] })) : null] }), _jsxs(ModalFooter, { className: "flex-col items-stretch border-t-0 px-6 py-4", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-x-2", children: [_jsx("button", { type: "button", title: t('posts.form.addImage', {
261
+ }) })] }), _jsx("button", { type: "button", role: "switch", "aria-checked": notify, onClick: () => setNotify((v) => !v), className: `relative h-5 w-9 rounded-full transition ${notify ? 'bg-primary' : 'bg-input'}`, children: _jsx("span", { className: `absolute top-0.5 size-4 rounded-full bg-white transition ${notify ? 'left-4' : 'left-0.5'}` }) })] })) : null] }), _jsxs(ModalFooter, { className: "flex-col items-stretch border-t-0 px-6 py-4", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-x-2", children: [_jsx("button", { type: "button", title: t('posts.form.addImage', {
262
262
  defaultValue: 'Add Media',
263
- }), onClick: composeAttachments.openImagePicker, className: "hover:bg-surface-200 rounded-md p-2", children: _jsx(Image, { className: "size-5" }) }), _jsx("button", { type: "button", title: t('posts.form.addDocument', {
263
+ }), onClick: composeAttachments.openImagePicker, className: "hover:bg-surface rounded-button p-2", children: _jsx(Image, { className: "size-5" }) }), _jsx("button", { type: "button", title: t('posts.form.addDocument', {
264
264
  defaultValue: 'Add Document',
265
- }), onClick: composeAttachments.openDocumentPicker, className: "hover:bg-surface-200 rounded-md p-2", children: _jsx(Paperclip, { className: "size-5" }) })] }), _jsx(PostTypeSwitcher, { type: composerType, onSelect: selectComposerType, onClose: onClose })] }), _jsx("div", { className: "border-surface-400 my-2 w-full border-t" }), _jsx("div", { className: "flex items-center justify-end gap-x-2", children: _jsx(Button, { variant: "variant-filled-primary", action: publish, disabled: !canSubmit, "data-testid": "posts-composer-publish", children: submitting
265
+ }), onClick: composeAttachments.openDocumentPicker, className: "hover:bg-surface rounded-button p-2", children: _jsx(Paperclip, { className: "size-5" }) })] }), _jsx(PostTypeSwitcher, { type: composerType, onSelect: selectComposerType, onClose: onClose })] }), _jsx("div", { className: "border-border-2 my-2 w-full border-t" }), _jsx("div", { className: "flex items-center justify-end gap-x-2", children: _jsx(Button, { variant: "default", action: publish, disabled: !canSubmit, "data-testid": "posts-composer-publish", children: submitting
266
266
  ? t('common.posting', { defaultValue: 'Posting…' })
267
267
  : t('posts.create.submit', { defaultValue: 'Post' }) }) })] })] }) }), composeAttachments.inputs, !group ? (_jsx(PostAudienceSelector, { open: audienceOpen, onClose: () => setAudienceOpen(false), type: composerType, visibility: visibility, groupId: groupId, audience: audience, onConfirm: (settings) => {
268
268
  setVisibility(settings.visibility);
@@ -52,13 +52,13 @@ export function OpenpeepsMarkdownInput({ value, onChange, maxLength = 500, place
52
52
  setQuery('');
53
53
  };
54
54
  const overLimit = value.length > maxLength;
55
- return (_jsxs("div", { className: "relative w-full", children: [showPreview ? (_jsxs("div", { className: "bg-surface-50 border-surface-200 absolute inset-0 z-10 overflow-y-auto rounded-md border p-4 pt-16", children: [_jsx(Button, { compact: true, variant: "variant-ringed-surface", className: "absolute left-2 top-2", action: () => setShowPreview(false), children: t('form.edit', { defaultValue: 'Back to Editing' }) }), _jsx(OpenpeepsMarkdown, { source: value, linkPreviewMode: "none" })] })) : null, previewButton ? (_jsx("div", { className: "w-full pb-2", children: _jsx(Button, { compact: true, variant: "variant-ringed-surface", action: () => setShowPreview(true), children: t('form.preview', { defaultValue: 'Preview' }) }) })) : null, _jsxs(Popover, { open: showMentions, modal: false, children: [_jsx(PopoverAnchor, { asChild: true, children: _jsx("div", { ref: anchorRef, className: "w-full", children: _jsx(Textarea, { ref: textareaRef, rows: rows, value: value, maxLength: maxLength, placeholder: placeholder ?? t('posts.form.content'), onChange: (e) => handleChange(e.target.value), "data-testid": testId, className: cn('resize-y', className) }) }) }), _jsx(PopoverContent, { align: "start", side: "bottom", sideOffset: 4, onOpenAutoFocus: (e) => e.preventDefault(), onCloseAutoFocus: (e) => e.preventDefault(),
55
+ return (_jsxs("div", { className: "relative w-full", children: [showPreview ? (_jsxs("div", { className: "bg-background border-border absolute inset-0 z-10 overflow-y-auto rounded-md border p-4 pt-16", children: [_jsx(Button, { compact: true, variant: "outline", className: "absolute left-2 top-2", action: () => setShowPreview(false), children: t('form.edit', { defaultValue: 'Back to Editing' }) }), _jsx(OpenpeepsMarkdown, { source: value, linkPreviewMode: "none" })] })) : null, previewButton ? (_jsx("div", { className: "w-full pb-2", children: _jsx(Button, { compact: true, variant: "outline", action: () => setShowPreview(true), children: t('form.preview', { defaultValue: 'Preview' }) }) })) : null, _jsxs(Popover, { open: showMentions, modal: false, children: [_jsx(PopoverAnchor, { asChild: true, children: _jsx("div", { ref: anchorRef, className: "w-full", children: _jsx(Textarea, { ref: textareaRef, rows: rows, value: value, maxLength: maxLength, placeholder: placeholder ?? t('posts.form.content'), onChange: (e) => handleChange(e.target.value), "data-testid": testId, className: cn('resize-y', className) }) }) }), _jsx(PopoverContent, { align: "start", side: "bottom", sideOffset: 4, onOpenAutoFocus: (e) => e.preventDefault(), onCloseAutoFocus: (e) => e.preventDefault(),
56
56
  // Keep the list open while the user keeps typing in the anchored field.
57
57
  onPointerDownOutside: (e) => {
58
58
  if (anchorRef.current?.contains(e.target)) {
59
59
  e.preventDefault();
60
60
  }
61
- }, className: "bg-card z-[100] max-h-48 w-[var(--radix-popover-trigger-width)] overflow-y-auto p-0 shadow-md", children: profiles.map((profile) => (_jsx("button", { type: "button", className: "hover:bg-surface-100 w-full text-left", onMouseDown: (e) => {
61
+ }, className: "bg-surface z-[100] max-h-48 w-[var(--radix-popover-trigger-width)] overflow-y-auto p-0 shadow-md", children: profiles.map((profile) => (_jsx("button", { type: "button", className: "hover:bg-surface w-full text-left", onMouseDown: (e) => {
62
62
  e.preventDefault();
63
63
  insertMention(profile);
64
64
  }, children: _jsx(ProfileCard, { profile: profile, showAction: false }) }, profile.id))) })] }), _jsxs("div", { className: "w-full px-2 text-right text-sm", children: [_jsx("span", { className: overLimit ? 'text-error' : undefined, children: value.length }), ' ', "/ ", maxLength] })] }));
@@ -1,3 +1,4 @@
1
+ import type { TFunction } from 'i18next';
1
2
  export interface PollComposerFieldsProps {
2
3
  options: string[];
3
4
  onOptionsChange: (options: string[]) => void;
@@ -8,5 +9,6 @@ export interface PollComposerFieldsProps {
8
9
  votersVisible?: boolean;
9
10
  onVotersVisibleChange?: (value: boolean) => void;
10
11
  }
12
+ export declare const pollOptionLabel: (index: number, t: TFunction) => string;
11
13
  /** Shared poll option + settings fields used in compose and edit flows. */
12
14
  export declare function PollComposerFields({ options, onOptionsChange, expiresAt, onExpiresAtChange, multiple, onMultipleChange, votersVisible, onVotersVisibleChange, }: PollComposerFieldsProps): import("react/jsx-runtime").JSX.Element;