@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.
- package/dist/components/accounts/SignUpLoginModal.js +2 -2
- package/dist/components/configuration/ConfigMenuButton.d.ts +10 -0
- package/dist/components/configuration/ConfigMenuButton.js +12 -0
- package/dist/components/configuration/ConfigurationTree.js +1 -1
- package/dist/components/configuration/index.d.ts +2 -0
- package/dist/components/configuration/index.js +1 -0
- package/dist/components/conversations/ConversationMessageBubble.d.ts +2 -1
- package/dist/components/conversations/ConversationMessageBubble.js +4 -5
- package/dist/components/conversations/CreateNewConversation.js +10 -42
- package/dist/components/conversations/DirectMessagesHeaderActions.js +1 -1
- package/dist/components/conversations/MessageInThread.js +1 -2
- package/dist/components/form/ImageEditModal.js +2 -4
- package/dist/components/form/ImageInput.js +13 -8
- package/dist/components/form/LocationInput.js +1 -1
- package/dist/components/groups/AddGroupMembersButton.d.ts +1 -1
- package/dist/components/groups/AddGroupMembersButton.js +2 -2
- package/dist/components/groups/ChangeGroupRolesModal.js +1 -1
- package/dist/components/groups/ConfirmGroupExitModal.js +2 -2
- package/dist/components/groups/ConfirmMemberRemovalModal.js +1 -1
- package/dist/components/groups/DeleteGroupModal.js +1 -1
- package/dist/components/groups/GroupAvatar.js +4 -4
- package/dist/components/groups/GroupCard.js +3 -3
- package/dist/components/groups/GroupHeader.js +1 -1
- package/dist/components/groups/GroupMembersList.js +2 -3
- package/dist/components/groups/GroupOptionsMenu.js +12 -6
- package/dist/components/groups/JoinGroupButton.js +3 -20
- package/dist/components/jams/CreateNewJam.js +4 -4
- package/dist/components/jams/JamCallParticipant.js +17 -7
- package/dist/components/jams/JamCapacityGate.js +1 -1
- package/dist/components/jams/JamChatDrawer.js +2 -2
- package/dist/components/jams/JamConference.js +1 -1
- package/dist/components/jams/JamContext.d.ts +4 -0
- package/dist/components/jams/JamContext.js +17 -2
- package/dist/components/jams/JamDetailsDrawer.js +1 -1
- package/dist/components/jams/JamDeviceSelectors.d.ts +15 -0
- package/dist/components/jams/JamDeviceSelectors.js +4 -3
- package/dist/components/jams/JamFooter.js +15 -16
- package/dist/components/jams/JamGuestForm.js +2 -2
- package/dist/components/jams/JamLobby.js +9 -19
- package/dist/components/jams/JamObserverShell.js +1 -1
- package/dist/components/jams/JamParticipantConference.js +1 -1
- package/dist/components/jams/JamPeopleDrawer.js +17 -13
- package/dist/components/jams/JamReactionMenu.js +1 -1
- package/dist/components/jams/JamRequestJoin.js +1 -1
- package/dist/components/jams/JamRoom.js +84 -4
- package/dist/components/jams/JamToolbarButton.d.ts +21 -0
- package/dist/components/jams/JamToolbarButton.js +19 -0
- package/dist/components/jams/JamVideoCall.js +8 -3
- package/dist/components/jams/JamVideoLayout.js +16 -5
- package/dist/components/jams/LeaveCloseButton.js +9 -44
- package/dist/components/jams/LiveJamsSection.js +1 -1
- package/dist/components/jams/constants.js +4 -0
- package/dist/components/jams/useParticipantConnection.d.ts +7 -0
- package/dist/components/jams/useParticipantConnection.js +11 -0
- package/dist/components/layout/Auth.js +1 -1
- package/dist/components/layout/Infos.js +2 -2
- package/dist/components/layout/OpenpeepsContextProvider.js +4 -3
- package/dist/components/layout/OpenpeepsThemeProvider.d.ts +3 -4
- package/dist/components/layout/OpenpeepsThemeProvider.js +23 -9
- package/dist/components/layout/Root.js +1 -1
- package/dist/components/markdown/CompiledMarkdown.js +15 -1
- package/dist/components/markdown/classes.d.ts +2 -0
- package/dist/components/markdown/classes.js +2 -0
- package/dist/components/markdown/index.d.ts +1 -1
- package/dist/components/markdown/index.js +1 -1
- package/dist/components/navigation/ContentHeader.js +1 -1
- package/dist/components/navigation/FooterMobile.js +5 -1
- package/dist/components/navigation/HeaderMobile.js +1 -1
- package/dist/components/navigation/MobileMenuItem.js +1 -1
- package/dist/components/navigation/PageHeaderAction.js +1 -1
- package/dist/components/navigation/PlusButton.js +1 -1
- package/dist/components/navigation/SideBar.js +6 -1
- package/dist/components/navigation/breadcrumbs/Breadcrumbs.js +5 -1
- package/dist/components/navigation/sideBarNavLinkClass.js +1 -1
- package/dist/components/notifications/NotificationHeaderActions.js +2 -2
- package/dist/components/notifications/NotificationWrapper.js +1 -1
- package/dist/components/notifications/NotificationsList.js +3 -3
- package/dist/components/notifications/TypedNotification.js +3 -3
- package/dist/components/post/Feed.js +3 -3
- package/dist/components/post/FeedPost.d.ts +2 -1
- package/dist/components/post/FeedPost.js +11 -6
- package/dist/components/post/FeedPostContent.js +1 -1
- package/dist/components/post/FullPostLayout.js +11 -4
- package/dist/components/post/NewEventButton.js +1 -1
- package/dist/components/post/NewNoteButton.js +1 -1
- package/dist/components/post/PinnedPost.js +1 -1
- package/dist/components/post/ReplyBox.js +1 -1
- package/dist/components/post/feed/events/EventsFeed.js +3 -3
- package/dist/components/post/feed/threaded/ThreadPost.js +1 -1
- package/dist/components/post/feed/threaded/ThreadedFeed.d.ts +3 -1
- package/dist/components/post/feed/threaded/ThreadedFeed.js +3 -3
- package/dist/components/post/pieces/Attachments.js +3 -3
- package/dist/components/post/pieces/EventMenu.js +1 -1
- package/dist/components/post/pieces/EventRsvpButton.js +3 -3
- package/dist/components/post/pieces/FeedPostStats.js +2 -2
- package/dist/components/post/pieces/GalleryModal.js +36 -5
- package/dist/components/post/pieces/PollContent.js +33 -14
- package/dist/components/post/pieces/PostActions.js +6 -45
- package/dist/components/post/pieces/PostInfoHeader.js +1 -1
- package/dist/components/post/pieces/PostMenu.js +35 -9
- package/dist/components/post/pieces/PostReactionHeader.js +1 -1
- package/dist/components/post/pieces/ShareMenu.js +4 -2
- package/dist/components/post/pieces/UnreadPostIndicator.d.ts +5 -3
- package/dist/components/post/pieces/UnreadPostIndicator.js +4 -3
- package/dist/components/post/pieces/modals/DeletePostModal.js +1 -1
- package/dist/components/post/pieces/modals/RepostModal.d.ts +5 -3
- package/dist/components/post/pieces/modals/RepostModal.js +8 -7
- package/dist/components/post/post-form/AttachmentCard.js +2 -2
- package/dist/components/post/post-form/ComposeAttachments.js +1 -1
- package/dist/components/post/post-form/DescriptionEditModal.js +1 -1
- package/dist/components/post/post-form/EditPostModal.js +22 -12
- package/dist/components/post/post-form/EventForm.js +2 -2
- package/dist/components/post/post-form/EventTypeSwitcher.js +1 -1
- package/dist/components/post/post-form/NewPostModal.d.ts +1 -1
- package/dist/components/post/post-form/NewPostModal.js +10 -10
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.js +2 -2
- package/dist/components/post/post-form/PollComposerFields.d.ts +2 -0
- package/dist/components/post/post-form/PollComposerFields.js +12 -8
- package/dist/components/post/post-form/PostAudienceSelector.js +3 -3
- package/dist/components/post/post-form/PostTypeSwitcher.js +1 -1
- package/dist/components/post/post-form/ReplyModal.js +9 -8
- package/dist/components/post/post-form/VisibilitySelector.js +1 -1
- package/dist/components/post/types/Article.js +2 -1
- package/dist/components/post/types/Event.js +1 -1
- package/dist/components/post/types/Note.js +2 -1
- package/dist/components/post/types/Poll.js +2 -1
- package/dist/components/post/types/event/CardEvent.js +2 -2
- package/dist/components/post/types/event/FullEvent.js +8 -8
- package/dist/components/post/types/event/ProfileEventRelationship.d.ts +1 -1
- package/dist/components/post/types/event/ProfileEventRelationship.js +38 -18
- package/dist/components/preview-link/LocalPreviewLink.js +1 -1
- package/dist/components/preview-link/RemotePreviewLink.js +5 -1
- package/dist/components/profile/Avatar.js +3 -2
- package/dist/components/profile/FollowUnfollowButton.js +2 -2
- package/dist/components/profile/ProfileBadge.js +1 -1
- package/dist/components/profile/ProfileCard.js +1 -1
- package/dist/components/profile/ProfileHeader.js +1 -1
- package/dist/components/profile/ProfilePageAction.js +3 -3
- package/dist/components/profile/ProfilePostsAndReplies.js +3 -1
- package/dist/components/profile/ProfileSelector.js +3 -3
- package/dist/components/profile/ProfilesInput.js +1 -1
- package/dist/components/profile/ReportProfileOrPostModal.js +6 -4
- package/dist/components/server-data/context.d.ts +8 -0
- package/dist/contexts/openpeeps/hooks/admin.d.ts +63 -16774
- package/dist/contexts/openpeeps/hooks/admin.js +34 -14
- package/dist/contexts/openpeeps/hooks/conversations.d.ts +330 -0
- package/dist/contexts/openpeeps/hooks/jams.d.ts +110 -0
- package/dist/contexts/openpeeps/hooks/jams.js +1 -1
- package/dist/contexts/openpeeps/hooks/other.d.ts +8 -0
- package/dist/contexts/openpeeps/hooks/posts.d.ts +933 -53
- package/dist/contexts/openpeeps/hooks/profiles.d.ts +220 -0
- package/dist/contexts/openpeeps/hooks/search.d.ts +330 -0
- package/dist/contexts/openpeeps/index.d.ts +1 -1
- package/dist/contexts/openpeeps/index.js +10 -2
- package/dist/contexts/router/index.d.ts +8 -3
- package/dist/contexts/router/index.js +7 -3
- package/dist/hooks/conversations/useCreateConversation.d.ts +124 -0
- package/dist/hooks/conversations/useCreateConversation.js +56 -0
- package/dist/hooks/groups/useJoinGroup.d.ts +8 -0
- package/dist/hooks/groups/useJoinGroup.js +23 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/jams/useLeaveCloseJam.d.ts +20 -0
- package/dist/hooks/jams/useLeaveCloseJam.js +59 -0
- package/dist/hooks/posts/useFeedPostActions.d.ts +18 -0
- package/dist/hooks/posts/useFeedPostActions.js +51 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/lib/Markdown.d.ts +14 -0
- package/dist/lib/Markdown.js +16 -0
- package/dist/lib/analyticsClicks.d.ts +12 -0
- package/dist/lib/analyticsClicks.js +64 -0
- package/dist/lib/auth.d.ts +8 -0
- package/dist/lib/auth.js +27 -0
- package/dist/lib/canvasUtils.d.ts +6 -0
- package/dist/lib/canvasUtils.js +62 -1
- package/dist/lib/groupCapabilityHelpers.d.ts +1 -1
- package/dist/lib/passwordStrength.d.ts +6 -0
- package/dist/lib/passwordStrength.js +26 -0
- package/dist/lib/postUnread.d.ts +7 -0
- package/dist/lib/postUnread.js +7 -0
- package/dist/lib/postViewCounter.d.ts +1 -1
- package/dist/lib/postViewCounter.js +3 -1
- package/dist/lib/routeHandles.d.ts +2 -0
- package/dist/lib/routeHandles.js +2 -0
- package/dist/lib/svgCover.d.ts +2 -0
- package/dist/lib/svgCover.js +18 -0
- package/dist/navigation/index.d.ts +11 -0
- package/dist/navigation/index.js +2 -0
- package/dist/navigation/menuItems.d.ts +8 -0
- package/dist/navigation/menuItems.js +83 -0
- package/dist/navigation/targets.d.ts +94 -0
- package/dist/navigation/targets.js +12 -0
- package/dist/pages/About.d.ts +1 -0
- package/dist/pages/About.js +19 -0
- package/dist/pages/CodeOfConduct.d.ts +1 -0
- package/dist/pages/CodeOfConduct.js +14 -0
- package/dist/pages/Explore.d.ts +1 -0
- package/dist/pages/Explore.js +132 -0
- package/dist/pages/Home.d.ts +6 -0
- package/dist/pages/Home.js +31 -0
- package/dist/pages/Members.d.ts +1 -0
- package/dist/pages/Members.js +35 -0
- package/dist/pages/NotFound.d.ts +1 -0
- package/dist/pages/NotFound.js +9 -0
- package/dist/pages/Notifications.d.ts +1 -0
- package/dist/pages/Notifications.js +8 -0
- package/dist/pages/PostDetail.d.ts +1 -0
- package/dist/pages/PostDetail.js +27 -0
- package/dist/pages/Profile.d.ts +1 -0
- package/dist/pages/Profile.js +20 -0
- package/dist/pages/Tags.d.ts +1 -0
- package/dist/pages/Tags.js +14 -0
- package/dist/pages/Welcome.d.ts +1 -0
- package/dist/pages/Welcome.js +89 -0
- package/dist/pages/admin/Analytics.d.ts +11 -0
- package/dist/pages/admin/Analytics.js +11 -0
- package/dist/pages/admin/ApiKeys.d.ts +1 -0
- package/dist/pages/admin/ApiKeys.js +141 -0
- package/dist/pages/admin/Backups.d.ts +1 -0
- package/dist/pages/admin/Backups.js +39 -0
- package/dist/pages/admin/ConfigEditor.d.ts +14 -0
- package/dist/pages/admin/ConfigEditor.js +91 -0
- package/dist/pages/admin/Configuration.d.ts +1 -0
- package/dist/pages/admin/Configuration.js +8 -0
- package/dist/pages/admin/ConfigurationCommunity.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunity.js +7 -0
- package/dist/pages/admin/ConfigurationCommunityLanguage.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunityLanguage.js +71 -0
- package/dist/pages/admin/ConfigurationEmail.d.ts +1 -0
- package/dist/pages/admin/ConfigurationEmail.js +97 -0
- package/dist/pages/admin/ConfigurationI18n.d.ts +1 -0
- package/dist/pages/admin/ConfigurationI18n.js +51 -0
- package/dist/pages/admin/Dashboard.d.ts +1 -0
- package/dist/pages/admin/Dashboard.js +40 -0
- package/dist/pages/admin/Db.d.ts +1 -0
- package/dist/pages/admin/Db.js +238 -0
- package/dist/pages/admin/Diagnostics.d.ts +1 -0
- package/dist/pages/admin/Diagnostics.js +8 -0
- package/dist/pages/admin/DiagnosticsEmail.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsEmail.js +65 -0
- package/dist/pages/admin/DiagnosticsJob.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsJob.js +51 -0
- package/dist/pages/admin/DiagnosticsLogs.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsLogs.js +62 -0
- package/dist/pages/admin/DiagnosticsPerformance.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsPerformance.js +34 -0
- package/dist/pages/admin/GroupMembers.d.ts +1 -0
- package/dist/pages/admin/GroupMembers.js +109 -0
- package/dist/pages/admin/Groups.d.ts +1 -0
- package/dist/pages/admin/Groups.js +61 -0
- package/dist/pages/admin/Invites.d.ts +1 -0
- package/dist/pages/admin/Invites.js +72 -0
- package/dist/pages/admin/Members.d.ts +1 -0
- package/dist/pages/admin/Members.js +49 -0
- package/dist/pages/admin/Moderation.d.ts +1 -0
- package/dist/pages/admin/Moderation.js +62 -0
- package/dist/pages/admin/Reports.d.ts +1 -0
- package/dist/pages/admin/Reports.js +178 -0
- package/dist/pages/admin/analytics/AnalyticsLayout.d.ts +14 -0
- package/dist/pages/admin/analytics/AnalyticsLayout.js +104 -0
- package/dist/pages/admin/analytics/AnalyticsRangeContext.d.ts +9 -0
- package/dist/pages/admin/analytics/AnalyticsRangeContext.js +9 -0
- package/dist/pages/admin/analytics/Content.d.ts +1 -0
- package/dist/pages/admin/analytics/Content.js +117 -0
- package/dist/pages/admin/analytics/Engagement.d.ts +1 -0
- package/dist/pages/admin/analytics/Engagement.js +220 -0
- package/dist/pages/admin/analytics/Groups.d.ts +1 -0
- package/dist/pages/admin/analytics/Groups.js +139 -0
- package/dist/pages/admin/analytics/Members.d.ts +1 -0
- package/dist/pages/admin/analytics/Members.js +96 -0
- package/dist/pages/admin/analytics/Overview.d.ts +1 -0
- package/dist/pages/admin/analytics/Overview.js +165 -0
- package/dist/pages/admin/analytics/ReportSettings.d.ts +1 -0
- package/dist/pages/admin/analytics/ReportSettings.js +62 -0
- package/dist/pages/admin/analytics/analyticsInfo.d.ts +3 -0
- package/dist/pages/admin/analytics/analyticsInfo.js +4 -0
- package/dist/pages/admin/analytics/downloadCsv.d.ts +2 -0
- package/dist/pages/admin/analytics/downloadCsv.js +20 -0
- package/dist/pages/admin/community/CommunityFavicons.d.ts +1 -0
- package/dist/pages/admin/community/CommunityFavicons.js +47 -0
- package/dist/pages/admin/community/CommunityInfo.d.ts +1 -0
- package/dist/pages/admin/community/CommunityInfo.js +35 -0
- package/dist/pages/admin/community/CommunityLinks.d.ts +1 -0
- package/dist/pages/admin/community/CommunityLinks.js +35 -0
- package/dist/pages/admin/community/CommunityMarkdownPage.d.ts +8 -0
- package/dist/pages/admin/community/CommunityMarkdownPage.js +35 -0
- package/dist/pages/admin/community/CommunityProfileFields.d.ts +1 -0
- package/dist/pages/admin/community/CommunityProfileFields.js +50 -0
- package/dist/pages/admin/community/CommunityRoles.d.ts +1 -0
- package/dist/pages/admin/community/CommunityRoles.js +109 -0
- package/dist/pages/admin/community/CommunityTheme.d.ts +1 -0
- package/dist/pages/admin/community/CommunityTheme.js +56 -0
- package/dist/pages/admin/community/useCommunityConfig.d.ts +168 -0
- package/dist/pages/admin/community/useCommunityConfig.js +28 -0
- package/dist/pages/admin/components/AdminCharts.d.ts +22 -0
- package/dist/pages/admin/components/AdminCharts.js +29 -0
- package/dist/pages/admin/components/AdminGroupCard.d.ts +6 -0
- package/dist/pages/admin/components/AdminGroupCard.js +42 -0
- package/dist/pages/admin/components/AdminInviteActions.d.ts +1 -0
- package/dist/pages/admin/components/AdminInviteActions.js +23 -0
- package/dist/pages/admin/components/InviteWithEmailModal.d.ts +3 -0
- package/dist/pages/admin/components/InviteWithEmailModal.js +82 -0
- package/dist/pages/admin/components/InviteWithLinkModal.d.ts +22 -0
- package/dist/pages/admin/components/InviteWithLinkModal.js +98 -0
- package/dist/pages/admin/components/ProfileRowActions.d.ts +5 -0
- package/dist/pages/admin/components/ProfileRowActions.js +131 -0
- package/dist/pages/admin/components/RestoreBackupModal.d.ts +4 -0
- package/dist/pages/admin/components/RestoreBackupModal.js +33 -0
- package/dist/pages/admin/components/RestoreTestBackupModal.d.ts +4 -0
- package/dist/pages/admin/components/RestoreTestBackupModal.js +36 -0
- package/dist/pages/articles/Edit.d.ts +1 -0
- package/dist/pages/articles/Edit.js +60 -0
- package/dist/pages/articles/Index.d.ts +1 -0
- package/dist/pages/articles/Index.js +18 -0
- package/dist/pages/articles/New.d.ts +1 -0
- package/dist/pages/articles/New.js +48 -0
- package/dist/pages/auth/Closed.d.ts +1 -0
- package/dist/pages/auth/Closed.js +14 -0
- package/dist/pages/auth/Login.d.ts +1 -0
- package/dist/pages/auth/Login.js +74 -0
- package/dist/pages/auth/OidcCallback.d.ts +5 -0
- package/dist/pages/auth/OidcCallback.js +31 -0
- package/dist/pages/auth/OidcPending.d.ts +5 -0
- package/dist/pages/auth/OidcPending.js +39 -0
- package/dist/pages/auth/Register.d.ts +4 -0
- package/dist/pages/auth/Register.js +124 -0
- package/dist/pages/auth/RegisterInvitation.d.ts +1 -0
- package/dist/pages/auth/RegisterInvitation.js +5 -0
- package/dist/pages/auth/RequestResetPassword.d.ts +1 -0
- package/dist/pages/auth/RequestResetPassword.js +50 -0
- package/dist/pages/auth/ResetPassword.d.ts +1 -0
- package/dist/pages/auth/ResetPassword.js +40 -0
- package/dist/pages/auth/SsoCallback.d.ts +1 -0
- package/dist/pages/auth/SsoCallback.js +34 -0
- package/dist/pages/auth/ValidateEmail.d.ts +6 -0
- package/dist/pages/auth/ValidateEmail.js +64 -0
- package/dist/pages/conversations/Index.d.ts +1 -0
- package/dist/pages/conversations/Index.js +58 -0
- package/dist/pages/conversations/Info.d.ts +1 -0
- package/dist/pages/conversations/Info.js +26 -0
- package/dist/pages/conversations/New.d.ts +1 -0
- package/dist/pages/conversations/New.js +8 -0
- package/dist/pages/conversations/Show.d.ts +1 -0
- package/dist/pages/conversations/Show.js +100 -0
- package/dist/pages/events/Edit.d.ts +1 -0
- package/dist/pages/events/Edit.js +69 -0
- package/dist/pages/events/Index.d.ts +1 -0
- package/dist/pages/events/Index.js +23 -0
- package/dist/pages/events/My.d.ts +1 -0
- package/dist/pages/events/My.js +24 -0
- package/dist/pages/events/New.d.ts +1 -0
- package/dist/pages/events/New.js +66 -0
- package/dist/pages/feeds/Bookmarks.d.ts +1 -0
- package/dist/pages/feeds/Bookmarks.js +10 -0
- package/dist/pages/feeds/Local.d.ts +1 -0
- package/dist/pages/feeds/Local.js +14 -0
- package/dist/pages/feeds/My.d.ts +1 -0
- package/dist/pages/feeds/My.js +12 -0
- package/dist/pages/groups/Edit.d.ts +1 -0
- package/dist/pages/groups/Edit.js +57 -0
- package/dist/pages/groups/Index.d.ts +1 -0
- package/dist/pages/groups/Index.js +50 -0
- package/dist/pages/groups/Info.d.ts +1 -0
- package/dist/pages/groups/Info.js +21 -0
- package/dist/pages/groups/Members.d.ts +1 -0
- package/dist/pages/groups/Members.js +28 -0
- package/dist/pages/groups/New.d.ts +1 -0
- package/dist/pages/groups/New.js +68 -0
- package/dist/pages/groups/Show.d.ts +1 -0
- package/dist/pages/groups/Show.js +64 -0
- package/dist/pages/index.d.ts +94 -0
- package/dist/pages/index.js +94 -0
- package/dist/pages/jams/Event.d.ts +8 -0
- package/dist/pages/jams/Event.js +57 -0
- package/dist/pages/jams/Index.d.ts +6 -0
- package/dist/pages/jams/Index.js +44 -0
- package/dist/pages/payment/Success.d.ts +1 -0
- package/dist/pages/payment/Success.js +30 -0
- package/dist/pages/plugins/Index.d.ts +1 -0
- package/dist/pages/plugins/Index.js +69 -0
- package/dist/pages/profile/Followers.d.ts +6 -0
- package/dist/pages/profile/Followers.js +28 -0
- package/dist/pages/settings/AccessTokens.d.ts +1 -0
- package/dist/pages/settings/AccessTokens.js +149 -0
- package/dist/pages/settings/Account.d.ts +1 -0
- package/dist/pages/settings/Account.js +81 -0
- package/dist/pages/settings/Billing.d.ts +1 -0
- package/dist/pages/settings/Billing.js +82 -0
- package/dist/pages/settings/Index.d.ts +1 -0
- package/dist/pages/settings/Index.js +13 -0
- package/dist/pages/settings/Language.d.ts +1 -0
- package/dist/pages/settings/Language.js +54 -0
- package/dist/pages/settings/NotificationPreferences.d.ts +1 -0
- package/dist/pages/settings/NotificationPreferences.js +180 -0
- package/dist/pages/settings/Notifications.d.ts +1 -0
- package/dist/pages/settings/Notifications.js +10 -0
- package/dist/pages/settings/PublicProfile.d.ts +1 -0
- package/dist/pages/settings/PublicProfile.js +135 -0
- package/dist/pages/settings/PushEnabledDevices.d.ts +1 -0
- package/dist/pages/settings/PushEnabledDevices.js +67 -0
- package/dist/pages/settings/Theme.d.ts +1 -0
- package/dist/pages/settings/Theme.js +37 -0
- package/dist/pages/test/Error.d.ts +1 -0
- package/dist/pages/test/Error.js +10 -0
- package/dist/pages/test/Markdown.d.ts +1 -0
- package/dist/pages/test/Markdown.js +32 -0
- package/dist/pwa/InstallPrompt.js +1 -1
- package/dist/pwa/NotificationPermissionPrompt.js +2 -2
- package/dist/pwa/UpdatePrompt.js +1 -1
- package/dist/react-native.d.ts +1 -0
- package/dist/react-native.js +1 -0
- package/dist/session/useSessionEvents.d.ts +3 -0
- package/dist/session/useSessionEvents.js +64 -0
- package/dist/stores/newPosts.d.ts +8 -8
- package/package.json +14 -9
- package/dist/components/jams/useJamLiveKitTheme.d.ts +0 -3
- 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 {
|
|
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 {
|
|
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 =
|
|
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
|
|
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:
|
|
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(
|
|
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
|
|
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({
|
|
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)
|
|
46
|
-
|
|
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: "
|
|
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', {
|
|
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', {
|
|
70
|
-
|
|
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: "
|
|
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', {
|
|
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
|
-
*
|
|
7
|
-
*
|
|
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
|
-
*
|
|
4
|
-
*
|
|
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-
|
|
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: "
|
|
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 {
|
|
1
|
+
import type { RepostWithPublicProfile } from '@openpeepshq/common/types';
|
|
2
2
|
export interface RepostModalProps {
|
|
3
|
-
|
|
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({
|
|
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,
|
|
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({
|
|
5
|
+
export function RepostModal({ reposts, repostCount, open, onClose, }) {
|
|
7
6
|
const t = useT();
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
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-
|
|
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-
|
|
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
|
|
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: "
|
|
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
|
-
|
|
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 = (
|
|
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 &&
|
|
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,
|
|
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: "
|
|
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-
|
|
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-
|
|
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-
|
|
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,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
|
|
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 &&
|
|
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
|
-
|
|
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:
|
|
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-
|
|
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-
|
|
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
|
|
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
|
|
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-
|
|
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-
|
|
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;
|