@openpeepshq/react 0.2.3
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/LICENSE.md +21 -0
- package/README.md +1 -0
- package/dist/auth/credentials/index.d.ts +11 -0
- package/dist/auth/credentials/index.js +57 -0
- package/dist/auth/credentials/types.d.ts +6 -0
- package/dist/auth/credentials/types.js +1 -0
- package/dist/components/accounts/SignUpLoginModal.d.ts +9 -0
- package/dist/components/accounts/SignUpLoginModal.js +19 -0
- package/dist/components/accounts/SignUpLoginModalContext.d.ts +10 -0
- package/dist/components/accounts/SignUpLoginModalContext.js +16 -0
- package/dist/components/accounts/index.d.ts +3 -0
- package/dist/components/accounts/index.js +2 -0
- package/dist/components/configuration/ConfigurationCategory.d.ts +12 -0
- package/dist/components/configuration/ConfigurationCategory.js +61 -0
- package/dist/components/configuration/ConfigurationList.d.ts +10 -0
- package/dist/components/configuration/ConfigurationList.js +30 -0
- package/dist/components/configuration/ConfigurationTree.d.ts +8 -0
- package/dist/components/configuration/ConfigurationTree.js +20 -0
- package/dist/components/configuration/ConfigurationValueEditor.d.ts +11 -0
- package/dist/components/configuration/ConfigurationValueEditor.js +45 -0
- package/dist/components/configuration/index.d.ts +4 -0
- package/dist/components/configuration/index.js +4 -0
- package/dist/components/conversations/ConversationMessageBubble.d.ts +4 -0
- package/dist/components/conversations/ConversationMessageBubble.js +10 -0
- package/dist/components/conversations/CreateNewConversation.d.ts +8 -0
- package/dist/components/conversations/CreateNewConversation.js +62 -0
- package/dist/components/conversations/CreateNewConversationContext.d.ts +15 -0
- package/dist/components/conversations/CreateNewConversationContext.js +18 -0
- package/dist/components/conversations/DirectMessagesHeaderActions.d.ts +1 -0
- package/dist/components/conversations/DirectMessagesHeaderActions.js +10 -0
- package/dist/components/conversations/MessageInThread.d.ts +13 -0
- package/dist/components/conversations/MessageInThread.js +41 -0
- package/dist/components/conversations/index.d.ts +8 -0
- package/dist/components/conversations/index.js +5 -0
- package/dist/components/form/HeaderAvatarInput.d.ts +13 -0
- package/dist/components/form/HeaderAvatarInput.js +16 -0
- package/dist/components/form/ImageEditModal.d.ts +23 -0
- package/dist/components/form/ImageEditModal.js +75 -0
- package/dist/components/form/ImageInput.d.ts +32 -0
- package/dist/components/form/ImageInput.js +65 -0
- package/dist/components/form/LocationInput.d.ts +20 -0
- package/dist/components/form/LocationInput.js +59 -0
- package/dist/components/form/index.d.ts +8 -0
- package/dist/components/form/index.js +4 -0
- package/dist/components/groups/AddGroupMemberModal.d.ts +6 -0
- package/dist/components/groups/AddGroupMemberModal.js +40 -0
- package/dist/components/groups/AddGroupMembersButton.d.ts +5 -0
- package/dist/components/groups/AddGroupMembersButton.js +17 -0
- package/dist/components/groups/ChangeGroupRolesModal.d.ts +7 -0
- package/dist/components/groups/ChangeGroupRolesModal.js +45 -0
- package/dist/components/groups/ConfirmGroupExitModal.d.ts +6 -0
- package/dist/components/groups/ConfirmGroupExitModal.js +35 -0
- package/dist/components/groups/ConfirmMemberRemovalModal.d.ts +7 -0
- package/dist/components/groups/ConfirmMemberRemovalModal.js +33 -0
- package/dist/components/groups/DeleteGroupModal.d.ts +6 -0
- package/dist/components/groups/DeleteGroupModal.js +34 -0
- package/dist/components/groups/GroupAvatar.d.ts +14 -0
- package/dist/components/groups/GroupAvatar.js +32 -0
- package/dist/components/groups/GroupCard.d.ts +19 -0
- package/dist/components/groups/GroupCard.js +12 -0
- package/dist/components/groups/GroupFeed.d.ts +9 -0
- package/dist/components/groups/GroupFeed.js +14 -0
- package/dist/components/groups/GroupForm.d.ts +7 -0
- package/dist/components/groups/GroupForm.js +73 -0
- package/dist/components/groups/GroupHeader.d.ts +5 -0
- package/dist/components/groups/GroupHeader.js +14 -0
- package/dist/components/groups/GroupMembersList.d.ts +5 -0
- package/dist/components/groups/GroupMembersList.js +38 -0
- package/dist/components/groups/GroupOptionsMenu.d.ts +5 -0
- package/dist/components/groups/GroupOptionsMenu.js +61 -0
- package/dist/components/groups/GroupShareMenu.d.ts +5 -0
- package/dist/components/groups/GroupShareMenu.js +29 -0
- package/dist/components/groups/JoinGroupButton.d.ts +6 -0
- package/dist/components/groups/JoinGroupButton.js +28 -0
- package/dist/components/groups/index.d.ts +30 -0
- package/dist/components/groups/index.js +15 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/index.js +15 -0
- package/dist/components/jams/CreateNewJam.d.ts +4 -0
- package/dist/components/jams/CreateNewJam.js +138 -0
- package/dist/components/jams/CreateNewJamContext.d.ts +9 -0
- package/dist/components/jams/CreateNewJamContext.js +16 -0
- package/dist/components/jams/JamAnimatedEmoji.d.ts +4 -0
- package/dist/components/jams/JamAnimatedEmoji.js +12 -0
- package/dist/components/jams/JamCallParticipant.d.ts +15 -0
- package/dist/components/jams/JamCallParticipant.js +101 -0
- package/dist/components/jams/JamCapacityGate.d.ts +7 -0
- package/dist/components/jams/JamCapacityGate.js +30 -0
- package/dist/components/jams/JamChatDrawer.d.ts +6 -0
- package/dist/components/jams/JamChatDrawer.js +88 -0
- package/dist/components/jams/JamChatMessage.d.ts +5 -0
- package/dist/components/jams/JamChatMessage.js +35 -0
- package/dist/components/jams/JamConference.d.ts +8 -0
- package/dist/components/jams/JamConference.js +38 -0
- package/dist/components/jams/JamContext.d.ts +20 -0
- package/dist/components/jams/JamContext.js +24 -0
- package/dist/components/jams/JamDetailsDrawer.d.ts +9 -0
- package/dist/components/jams/JamDetailsDrawer.js +39 -0
- package/dist/components/jams/JamDeviceSelectors.d.ts +12 -0
- package/dist/components/jams/JamDeviceSelectors.js +71 -0
- package/dist/components/jams/JamEventsContext.d.ts +14 -0
- package/dist/components/jams/JamEventsContext.js +143 -0
- package/dist/components/jams/JamFooter.d.ts +18 -0
- package/dist/components/jams/JamFooter.js +171 -0
- package/dist/components/jams/JamGuestForm.d.ts +1 -0
- package/dist/components/jams/JamGuestForm.js +55 -0
- package/dist/components/jams/JamLobby.d.ts +17 -0
- package/dist/components/jams/JamLobby.js +159 -0
- package/dist/components/jams/JamObserverShell.d.ts +6 -0
- package/dist/components/jams/JamObserverShell.js +11 -0
- package/dist/components/jams/JamParticipantConference.d.ts +7 -0
- package/dist/components/jams/JamParticipantConference.js +80 -0
- package/dist/components/jams/JamPeopleDrawer.d.ts +10 -0
- package/dist/components/jams/JamPeopleDrawer.js +76 -0
- package/dist/components/jams/JamReactionMenu.d.ts +12 -0
- package/dist/components/jams/JamReactionMenu.js +79 -0
- package/dist/components/jams/JamRequestJoin.d.ts +9 -0
- package/dist/components/jams/JamRequestJoin.js +34 -0
- package/dist/components/jams/JamRoom.d.ts +21 -0
- package/dist/components/jams/JamRoom.js +166 -0
- package/dist/components/jams/JamRoomIndicators.d.ts +10 -0
- package/dist/components/jams/JamRoomIndicators.js +39 -0
- package/dist/components/jams/JamVideoCall.d.ts +15 -0
- package/dist/components/jams/JamVideoCall.js +18 -0
- package/dist/components/jams/JamVideoLayout.d.ts +13 -0
- package/dist/components/jams/JamVideoLayout.js +68 -0
- package/dist/components/jams/LeaveCloseButton.d.ts +6 -0
- package/dist/components/jams/LeaveCloseButton.js +58 -0
- package/dist/components/jams/LiveJamsSection.d.ts +1 -0
- package/dist/components/jams/LiveJamsSection.js +16 -0
- package/dist/components/jams/animateEmoji.d.ts +1 -0
- package/dist/components/jams/animateEmoji.js +48 -0
- package/dist/components/jams/blurProcessor.d.ts +8 -0
- package/dist/components/jams/blurProcessor.js +28 -0
- package/dist/components/jams/constants.d.ts +10 -0
- package/dist/components/jams/constants.js +44 -0
- package/dist/components/jams/index.d.ts +24 -0
- package/dist/components/jams/index.js +19 -0
- package/dist/components/jams/jamEventActions.d.ts +26 -0
- package/dist/components/jams/jamEventActions.js +76 -0
- package/dist/components/jams/jamLocalSettings.d.ts +17 -0
- package/dist/components/jams/jamLocalSettings.js +53 -0
- package/dist/components/jams/jamReactionPreferences.d.ts +15 -0
- package/dist/components/jams/jamReactionPreferences.js +53 -0
- package/dist/components/jams/jamRecordingState.d.ts +10 -0
- package/dist/components/jams/jamRecordingState.js +25 -0
- package/dist/components/jams/reactionEmojis.d.ts +30 -0
- package/dist/components/jams/reactionEmojis.js +73 -0
- package/dist/components/jams/useJamHands.d.ts +7 -0
- package/dist/components/jams/useJamHands.js +39 -0
- package/dist/components/jams/useJamLiveKitTheme.d.ts +3 -0
- package/dist/components/jams/useJamLiveKitTheme.js +10 -0
- package/dist/components/layout/AccessDenied.d.ts +14 -0
- package/dist/components/layout/AccessDenied.js +28 -0
- package/dist/components/layout/AccessDeniedLoader.d.ts +16 -0
- package/dist/components/layout/AccessDeniedLoader.js +12 -0
- package/dist/components/layout/Auth.d.ts +22 -0
- package/dist/components/layout/Auth.js +82 -0
- package/dist/components/layout/IdentityContext.d.ts +17 -0
- package/dist/components/layout/IdentityContext.js +38 -0
- package/dist/components/layout/Infos.d.ts +5 -0
- package/dist/components/layout/Infos.js +42 -0
- package/dist/components/layout/OpenpeepsContextProvider.d.ts +10 -0
- package/dist/components/layout/OpenpeepsContextProvider.js +63 -0
- package/dist/components/layout/OpenpeepsThemeProvider.d.ts +11 -0
- package/dist/components/layout/OpenpeepsThemeProvider.js +47 -0
- package/dist/components/layout/ProfileGuard.d.ts +14 -0
- package/dist/components/layout/ProfileGuard.js +38 -0
- package/dist/components/layout/ProfileProvider.d.ts +10 -0
- package/dist/components/layout/ProfileProvider.js +60 -0
- package/dist/components/layout/Root.d.ts +16 -0
- package/dist/components/layout/Root.js +36 -0
- package/dist/components/layout/ToastProvider.d.ts +22 -0
- package/dist/components/layout/ToastProvider.js +37 -0
- package/dist/components/layout/index.d.ts +21 -0
- package/dist/components/layout/index.js +11 -0
- package/dist/components/markdown/CompiledMarkdown.d.ts +5 -0
- package/dist/components/markdown/CompiledMarkdown.js +3 -0
- package/dist/components/markdown/OpenpeepsMarkdown.d.ts +16 -0
- package/dist/components/markdown/OpenpeepsMarkdown.js +66 -0
- package/dist/components/markdown/classes.d.ts +2 -0
- package/dist/components/markdown/classes.js +2 -0
- package/dist/components/markdown/compileMarkdown.d.ts +5 -0
- package/dist/components/markdown/compileMarkdown.js +36 -0
- package/dist/components/markdown/index.d.ts +11 -0
- package/dist/components/markdown/index.js +7 -0
- package/dist/components/markdown/linkTargets.d.ts +3 -0
- package/dist/components/markdown/linkTargets.js +27 -0
- package/dist/components/markdown/staticRender.d.ts +16 -0
- package/dist/components/markdown/staticRender.js +17 -0
- package/dist/components/navigation/ContentHeader.d.ts +1 -0
- package/dist/components/navigation/ContentHeader.js +18 -0
- package/dist/components/navigation/FooterMobile.d.ts +5 -0
- package/dist/components/navigation/FooterMobile.js +8 -0
- package/dist/components/navigation/HeaderMobile.d.ts +11 -0
- package/dist/components/navigation/HeaderMobile.js +26 -0
- package/dist/components/navigation/MobileMenuItem.d.ts +7 -0
- package/dist/components/navigation/MobileMenuItem.js +13 -0
- package/dist/components/navigation/PageHeaderAction.d.ts +5 -0
- package/dist/components/navigation/PageHeaderAction.js +7 -0
- package/dist/components/navigation/PlusButton.d.ts +1 -0
- package/dist/components/navigation/PlusButton.js +11 -0
- package/dist/components/navigation/SideBar.d.ts +16 -0
- package/dist/components/navigation/SideBar.js +24 -0
- package/dist/components/navigation/SidebarNavContext.d.ts +3 -0
- package/dist/components/navigation/SidebarNavContext.js +4 -0
- package/dist/components/navigation/breadcrumbs/Breadcrumbs.d.ts +1 -0
- package/dist/components/navigation/breadcrumbs/Breadcrumbs.js +10 -0
- package/dist/components/navigation/breadcrumbs/Crumb.d.ts +5 -0
- package/dist/components/navigation/breadcrumbs/Crumb.js +4 -0
- package/dist/components/navigation/index.d.ts +17 -0
- package/dist/components/navigation/index.js +11 -0
- package/dist/components/navigation/sideBarNavLinkClass.d.ts +4 -0
- package/dist/components/navigation/sideBarNavLinkClass.js +3 -0
- package/dist/components/notifications/NotificationErrorBoundary.d.ts +16 -0
- package/dist/components/notifications/NotificationErrorBoundary.js +21 -0
- package/dist/components/notifications/NotificationHeaderActions.d.ts +6 -0
- package/dist/components/notifications/NotificationHeaderActions.js +35 -0
- package/dist/components/notifications/NotificationItem.d.ts +5 -0
- package/dist/components/notifications/NotificationItem.js +6 -0
- package/dist/components/notifications/NotificationWrapper.d.ts +10 -0
- package/dist/components/notifications/NotificationWrapper.js +6 -0
- package/dist/components/notifications/NotificationsList.d.ts +12 -0
- package/dist/components/notifications/NotificationsList.js +88 -0
- package/dist/components/notifications/TypedNotification.d.ts +4 -0
- package/dist/components/notifications/TypedNotification.js +201 -0
- package/dist/components/notifications/index.d.ts +7 -0
- package/dist/components/notifications/index.js +5 -0
- package/dist/components/post/Feed.d.ts +20 -0
- package/dist/components/post/Feed.js +63 -0
- package/dist/components/post/FeedPost.d.ts +17 -0
- package/dist/components/post/FeedPost.js +31 -0
- package/dist/components/post/FeedPostContent.d.ts +5 -0
- package/dist/components/post/FeedPostContent.js +22 -0
- package/dist/components/post/FullPostLayout.d.ts +7 -0
- package/dist/components/post/FullPostLayout.js +23 -0
- package/dist/components/post/Markdown.d.ts +2 -0
- package/dist/components/post/Markdown.js +1 -0
- package/dist/components/post/NewEventButton.d.ts +14 -0
- package/dist/components/post/NewEventButton.js +39 -0
- package/dist/components/post/NewNoteButton.d.ts +14 -0
- package/dist/components/post/NewNoteButton.js +38 -0
- package/dist/components/post/PinnedPost.d.ts +5 -0
- package/dist/components/post/PinnedPost.js +15 -0
- package/dist/components/post/PostDetail.d.ts +4 -0
- package/dist/components/post/PostDetail.js +31 -0
- package/dist/components/post/ReplyBox.d.ts +5 -0
- package/dist/components/post/ReplyBox.js +30 -0
- package/dist/components/post/VideoPlayOverlay.d.ts +5 -0
- package/dist/components/post/VideoPlayOverlay.js +8 -0
- package/dist/components/post/attachmentPreview.d.ts +5 -0
- package/dist/components/post/attachmentPreview.js +14 -0
- package/dist/components/post/feed/events/EventsFeed.d.ts +7 -0
- package/dist/components/post/feed/events/EventsFeed.js +44 -0
- package/dist/components/post/feed/threaded/ThreadPost.d.ts +9 -0
- package/dist/components/post/feed/threaded/ThreadPost.js +19 -0
- package/dist/components/post/feed/threaded/ThreadedFeed.d.ts +10 -0
- package/dist/components/post/feed/threaded/ThreadedFeed.js +8 -0
- package/dist/components/post/helpers.d.ts +6 -0
- package/dist/components/post/helpers.js +24 -0
- package/dist/components/post/index.d.ts +78 -0
- package/dist/components/post/index.js +57 -0
- package/dist/components/post/pieces/Attachments.d.ts +5 -0
- package/dist/components/post/pieces/Attachments.js +44 -0
- package/dist/components/post/pieces/EventLocation.d.ts +7 -0
- package/dist/components/post/pieces/EventLocation.js +28 -0
- package/dist/components/post/pieces/EventMenu.d.ts +6 -0
- package/dist/components/post/pieces/EventMenu.js +35 -0
- package/dist/components/post/pieces/EventRsvpButton.d.ts +5 -0
- package/dist/components/post/pieces/EventRsvpButton.js +60 -0
- package/dist/components/post/pieces/FeedPostStats.d.ts +5 -0
- package/dist/components/post/pieces/FeedPostStats.js +27 -0
- package/dist/components/post/pieces/GalleryModal.d.ts +7 -0
- package/dist/components/post/pieces/GalleryModal.js +16 -0
- package/dist/components/post/pieces/ParticipantsCard.d.ts +8 -0
- package/dist/components/post/pieces/ParticipantsCard.js +13 -0
- package/dist/components/post/pieces/PollContent.d.ts +5 -0
- package/dist/components/post/pieces/PollContent.js +109 -0
- package/dist/components/post/pieces/PostActions.d.ts +6 -0
- package/dist/components/post/pieces/PostActions.js +63 -0
- package/dist/components/post/pieces/PostInfoHeader.d.ts +7 -0
- package/dist/components/post/pieces/PostInfoHeader.js +8 -0
- package/dist/components/post/pieces/PostMenu.d.ts +6 -0
- package/dist/components/post/pieces/PostMenu.js +77 -0
- package/dist/components/post/pieces/PostReactionHeader.d.ts +12 -0
- package/dist/components/post/pieces/PostReactionHeader.js +31 -0
- package/dist/components/post/pieces/ShareMenu.d.ts +6 -0
- package/dist/components/post/pieces/ShareMenu.js +46 -0
- package/dist/components/post/pieces/UnreadPostIndicator.d.ts +9 -0
- package/dist/components/post/pieces/UnreadPostIndicator.js +6 -0
- package/dist/components/post/pieces/VideoPlayer.d.ts +16 -0
- package/dist/components/post/pieces/VideoPlayer.js +127 -0
- package/dist/components/post/pieces/modals/DeletePostModal.d.ts +8 -0
- package/dist/components/post/pieces/modals/DeletePostModal.js +20 -0
- package/dist/components/post/pieces/modals/ReactionsModal.d.ts +7 -0
- package/dist/components/post/pieces/modals/ReactionsModal.js +11 -0
- package/dist/components/post/pieces/modals/RepostModal.d.ts +7 -0
- package/dist/components/post/pieces/modals/RepostModal.js +13 -0
- package/dist/components/post/post-form/ArticleForm.d.ts +7 -0
- package/dist/components/post/post-form/ArticleForm.js +45 -0
- package/dist/components/post/post-form/AttachmentCard.d.ts +29 -0
- package/dist/components/post/post-form/AttachmentCard.js +120 -0
- package/dist/components/post/post-form/ComposeAttachments.d.ts +25 -0
- package/dist/components/post/post-form/ComposeAttachments.js +137 -0
- package/dist/components/post/post-form/ComposePreviewLinks.d.ts +4 -0
- package/dist/components/post/post-form/ComposePreviewLinks.js +9 -0
- package/dist/components/post/post-form/DescriptionEditModal.d.ts +13 -0
- package/dist/components/post/post-form/DescriptionEditModal.js +22 -0
- package/dist/components/post/post-form/EditPostModal.d.ts +6 -0
- package/dist/components/post/post-form/EditPostModal.js +81 -0
- package/dist/components/post/post-form/EditPostModalContext.d.ts +10 -0
- package/dist/components/post/post-form/EditPostModalContext.js +18 -0
- package/dist/components/post/post-form/EventForm.d.ts +7 -0
- package/dist/components/post/post-form/EventForm.js +104 -0
- package/dist/components/post/post-form/EventTypeSwitcher.d.ts +8 -0
- package/dist/components/post/post-form/EventTypeSwitcher.js +165 -0
- package/dist/components/post/post-form/NewPostModal.d.ts +13 -0
- package/dist/components/post/post-form/NewPostModal.js +272 -0
- package/dist/components/post/post-form/NewPostModalContext.d.ts +15 -0
- package/dist/components/post/post-form/NewPostModalContext.js +20 -0
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.d.ts +19 -0
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.js +65 -0
- package/dist/components/post/post-form/PollComposerFields.d.ts +12 -0
- package/dist/components/post/post-form/PollComposerFields.js +19 -0
- package/dist/components/post/post-form/PostAudienceSelector.d.ts +12 -0
- package/dist/components/post/post-form/PostAudienceSelector.js +83 -0
- package/dist/components/post/post-form/PostTypeSwitcher.d.ts +16 -0
- package/dist/components/post/post-form/PostTypeSwitcher.js +22 -0
- package/dist/components/post/post-form/ReplyModal.d.ts +6 -0
- package/dist/components/post/post-form/ReplyModal.js +202 -0
- package/dist/components/post/post-form/ReplyModalContext.d.ts +10 -0
- package/dist/components/post/post-form/ReplyModalContext.js +18 -0
- package/dist/components/post/post-form/VisibilitySelector.d.ts +8 -0
- package/dist/components/post/post-form/VisibilitySelector.js +35 -0
- package/dist/components/post/post-form/audienceChoices.d.ts +14 -0
- package/dist/components/post/post-form/audienceChoices.js +66 -0
- package/dist/components/post/types/Article.d.ts +5 -0
- package/dist/components/post/types/Article.js +14 -0
- package/dist/components/post/types/Event.d.ts +5 -0
- package/dist/components/post/types/Event.js +19 -0
- package/dist/components/post/types/Note.d.ts +5 -0
- package/dist/components/post/types/Note.js +10 -0
- package/dist/components/post/types/Poll.d.ts +7 -0
- package/dist/components/post/types/Poll.js +11 -0
- package/dist/components/post/types/article/FullArticle.d.ts +5 -0
- package/dist/components/post/types/article/FullArticle.js +8 -0
- package/dist/components/post/types/event/CardEvent.d.ts +5 -0
- package/dist/components/post/types/event/CardEvent.js +45 -0
- package/dist/components/post/types/event/FullEvent.d.ts +5 -0
- package/dist/components/post/types/event/FullEvent.js +161 -0
- package/dist/components/post/types/event/ProfileEventRelationship.d.ts +5 -0
- package/dist/components/post/types/event/ProfileEventRelationship.js +31 -0
- package/dist/components/post/types/note/FullNote.d.ts +5 -0
- package/dist/components/post/types/note/FullNote.js +5 -0
- package/dist/components/post/types/poll/FullPoll.d.ts +5 -0
- package/dist/components/post/types/poll/FullPoll.js +7 -0
- package/dist/components/post/visibility.d.ts +7 -0
- package/dist/components/post/visibility.js +10 -0
- package/dist/components/preview-link/LocalPreviewLink.d.ts +4 -0
- package/dist/components/preview-link/LocalPreviewLink.js +12 -0
- package/dist/components/preview-link/PreviewLink.d.ts +4 -0
- package/dist/components/preview-link/PreviewLink.js +11 -0
- package/dist/components/preview-link/RemotePreviewLink.d.ts +4 -0
- package/dist/components/preview-link/RemotePreviewLink.js +21 -0
- package/dist/components/preview-link/helpers.d.ts +7 -0
- package/dist/components/preview-link/helpers.js +31 -0
- package/dist/components/preview-link/index.d.ts +3 -0
- package/dist/components/preview-link/index.js +2 -0
- package/dist/components/preview-link/local/GroupPreview.d.ts +4 -0
- package/dist/components/preview-link/local/GroupPreview.js +15 -0
- package/dist/components/preview-link/local/JamPreview.d.ts +9 -0
- package/dist/components/preview-link/local/JamPreview.js +20 -0
- package/dist/components/preview-link/local/PostPreview.d.ts +4 -0
- package/dist/components/preview-link/local/PostPreview.js +15 -0
- package/dist/components/profile/Avatar.d.ts +17 -0
- package/dist/components/profile/Avatar.js +36 -0
- package/dist/components/profile/AvatarWithName.d.ts +5 -0
- package/dist/components/profile/AvatarWithName.js +5 -0
- package/dist/components/profile/FollowUnfollowButton.d.ts +8 -0
- package/dist/components/profile/FollowUnfollowButton.js +27 -0
- package/dist/components/profile/ProfileBadge.d.ts +7 -0
- package/dist/components/profile/ProfileBadge.js +12 -0
- package/dist/components/profile/ProfileCard.d.ts +24 -0
- package/dist/components/profile/ProfileCard.js +12 -0
- package/dist/components/profile/ProfileFromId.d.ts +6 -0
- package/dist/components/profile/ProfileFromId.js +15 -0
- package/dist/components/profile/ProfileHeader.d.ts +10 -0
- package/dist/components/profile/ProfileHeader.js +16 -0
- package/dist/components/profile/ProfileLink.d.ts +9 -0
- package/dist/components/profile/ProfileLink.js +9 -0
- package/dist/components/profile/ProfilePageAction.d.ts +6 -0
- package/dist/components/profile/ProfilePageAction.js +35 -0
- package/dist/components/profile/ProfilePostsAndReplies.d.ts +9 -0
- package/dist/components/profile/ProfilePostsAndReplies.js +24 -0
- package/dist/components/profile/ProfileSelector.d.ts +14 -0
- package/dist/components/profile/ProfileSelector.js +72 -0
- package/dist/components/profile/ProfileStats.d.ts +5 -0
- package/dist/components/profile/ProfileStats.js +6 -0
- package/dist/components/profile/ProfileWithActionCard.d.ts +5 -0
- package/dist/components/profile/ProfileWithActionCard.js +6 -0
- package/dist/components/profile/ProfilesInput.d.ts +15 -0
- package/dist/components/profile/ProfilesInput.js +31 -0
- package/dist/components/profile/ReportProfileOrPostModal.d.ts +9 -0
- package/dist/components/profile/ReportProfileOrPostModal.js +75 -0
- package/dist/components/profile/index.d.ts +30 -0
- package/dist/components/profile/index.js +15 -0
- package/dist/components/registry/ErrorComponent.d.ts +6 -0
- package/dist/components/registry/ErrorComponent.js +7 -0
- package/dist/components/registry/PluginLoader.d.ts +3 -0
- package/dist/components/registry/PluginLoader.js +51 -0
- package/dist/components/registry/PluginRegistryProvider.d.ts +23 -0
- package/dist/components/registry/PluginRegistryProvider.js +57 -0
- package/dist/components/registry/PluginSlot.d.ts +7 -0
- package/dist/components/registry/PluginSlot.js +31 -0
- package/dist/components/registry/index.d.ts +10 -0
- package/dist/components/registry/index.js +16 -0
- package/dist/components/server-data/ServerDataProvider.d.ts +8 -0
- package/dist/components/server-data/ServerDataProvider.js +30 -0
- package/dist/components/server-data/context.d.ts +121 -0
- package/dist/components/server-data/context.js +10 -0
- package/dist/components/server-data/index.d.ts +4 -0
- package/dist/components/server-data/index.js +2 -0
- package/dist/components/server-data/types.d.ts +5 -0
- package/dist/components/server-data/types.js +1 -0
- package/dist/contexts/credentialsStore/index.d.ts +8 -0
- package/dist/contexts/credentialsStore/index.js +13 -0
- package/dist/contexts/credentialsStore/types.d.ts +4 -0
- package/dist/contexts/credentialsStore/types.js +1 -0
- package/dist/contexts/index.d.ts +3 -0
- package/dist/contexts/index.js +3 -0
- package/dist/contexts/openpeeps/helpers.d.ts +93 -0
- package/dist/contexts/openpeeps/helpers.js +311 -0
- package/dist/contexts/openpeeps/hooks/accounts.d.ts +302 -0
- package/dist/contexts/openpeeps/hooks/accounts.js +17 -0
- package/dist/contexts/openpeeps/hooks/admin.d.ts +17177 -0
- package/dist/contexts/openpeeps/hooks/admin.js +115 -0
- package/dist/contexts/openpeeps/hooks/auth.d.ts +55 -0
- package/dist/contexts/openpeeps/hooks/auth.js +22 -0
- package/dist/contexts/openpeeps/hooks/conversations.d.ts +9815 -0
- package/dist/contexts/openpeeps/hooks/conversations.js +6 -0
- package/dist/contexts/openpeeps/hooks/groups.d.ts +319 -0
- package/dist/contexts/openpeeps/hooks/groups.js +31 -0
- package/dist/contexts/openpeeps/hooks/index.d.ts +18 -0
- package/dist/contexts/openpeeps/hooks/index.js +26 -0
- package/dist/contexts/openpeeps/hooks/jams.d.ts +3318 -0
- package/dist/contexts/openpeeps/hooks/jams.js +32 -0
- package/dist/contexts/openpeeps/hooks/other.d.ts +239 -0
- package/dist/contexts/openpeeps/hooks/other.js +89 -0
- package/dist/contexts/openpeeps/hooks/payments.d.ts +36 -0
- package/dist/contexts/openpeeps/hooks/payments.js +10 -0
- package/dist/contexts/openpeeps/hooks/posts.d.ts +26001 -0
- package/dist/contexts/openpeeps/hooks/posts.js +139 -0
- package/dist/contexts/openpeeps/hooks/profiles.d.ts +6896 -0
- package/dist/contexts/openpeeps/hooks/profiles.js +43 -0
- package/dist/contexts/openpeeps/hooks/search.d.ts +9620 -0
- package/dist/contexts/openpeeps/hooks/search.js +24 -0
- package/dist/contexts/openpeeps/hooks/streaming.d.ts +26 -0
- package/dist/contexts/openpeeps/hooks/streaming.js +10 -0
- package/dist/contexts/openpeeps/hooks/useHasAuthToken.d.ts +2 -0
- package/dist/contexts/openpeeps/hooks/useHasAuthToken.js +35 -0
- package/dist/contexts/openpeeps/index.d.ts +21 -0
- package/dist/contexts/openpeeps/index.js +180 -0
- package/dist/contexts/openpeeps/types.d.ts +11 -0
- package/dist/contexts/openpeeps/types.js +1 -0
- package/dist/contexts/router/index.d.ts +28 -0
- package/dist/contexts/router/index.js +69 -0
- package/dist/email/index.d.ts +13 -0
- package/dist/email/index.js +10 -0
- package/dist/i18n/I18nProvider.d.ts +19 -0
- package/dist/i18n/I18nProvider.js +33 -0
- package/dist/i18n/context.d.ts +8 -0
- package/dist/i18n/context.js +10 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.js +23 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/lib/apiErrorMessage.d.ts +3 -0
- package/dist/lib/apiErrorMessage.js +14 -0
- package/dist/lib/canvasUtils.d.ts +12 -0
- package/dist/lib/canvasUtils.js +104 -0
- package/dist/lib/configuration/helpers.d.ts +7 -0
- package/dist/lib/configuration/helpers.js +83 -0
- package/dist/lib/configuration/resolveSchema.d.ts +3 -0
- package/dist/lib/configuration/resolveSchema.js +8 -0
- package/dist/lib/groupCapabilityHelpers.d.ts +24 -0
- package/dist/lib/groupCapabilityHelpers.js +119 -0
- package/dist/lib/notificationBadge.d.ts +5 -0
- package/dist/lib/notificationBadge.js +25 -0
- package/dist/lib/postUnread.d.ts +2 -0
- package/dist/lib/postUnread.js +1 -0
- package/dist/lib/postViewCounter.d.ts +17 -0
- package/dist/lib/postViewCounter.js +162 -0
- package/dist/lib/threadHelpers.d.ts +5 -0
- package/dist/lib/threadHelpers.js +23 -0
- package/dist/lib/unseenCountsOptimistic.d.ts +15 -0
- package/dist/lib/unseenCountsOptimistic.js +43 -0
- package/dist/log/index.d.ts +11 -0
- package/dist/log/index.js +14 -0
- package/dist/push/index.d.ts +16 -0
- package/dist/push/index.js +145 -0
- package/dist/push/usePushSubscription.d.ts +18 -0
- package/dist/push/usePushSubscription.js +102 -0
- package/dist/push/vapid.d.ts +6 -0
- package/dist/push/vapid.js +12 -0
- package/dist/pwa/InstallPrompt.d.ts +13 -0
- package/dist/pwa/InstallPrompt.js +17 -0
- package/dist/pwa/NotificationPermissionPrompt.d.ts +22 -0
- package/dist/pwa/NotificationPermissionPrompt.js +56 -0
- package/dist/pwa/PwaProvider.d.ts +16 -0
- package/dist/pwa/PwaProvider.js +56 -0
- package/dist/pwa/UpdatePrompt.d.ts +14 -0
- package/dist/pwa/UpdatePrompt.js +14 -0
- package/dist/pwa/index.d.ts +18 -0
- package/dist/pwa/index.js +16 -0
- package/dist/pwa/navigationUrl.d.ts +16 -0
- package/dist/pwa/navigationUrl.js +51 -0
- package/dist/pwa/pushInvalidate.d.ts +7 -0
- package/dist/pwa/pushInvalidate.js +29 -0
- package/dist/pwa/registration.d.ts +28 -0
- package/dist/pwa/registration.js +71 -0
- package/dist/pwa/sw-types.d.ts +14 -0
- package/dist/pwa/sw-types.js +1 -0
- package/dist/pwa/sw.d.ts +2 -0
- package/dist/pwa/sw.js +171 -0
- package/dist/pwa/useInstallPrompt.d.ts +10 -0
- package/dist/pwa/useInstallPrompt.js +45 -0
- package/dist/pwa/useNotificationBadgeSync.d.ts +2 -0
- package/dist/pwa/useNotificationBadgeSync.js +23 -0
- package/dist/pwa/useServiceWorker.d.ts +19 -0
- package/dist/pwa/useServiceWorker.js +49 -0
- package/dist/pwa/vite.d.ts +50 -0
- package/dist/pwa/vite.js +53 -0
- package/dist/react-native.d.ts +11 -0
- package/dist/react-native.js +11 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +5 -0
- package/dist/stores/breadcrumbs.d.ts +5 -0
- package/dist/stores/breadcrumbs.js +5 -0
- package/dist/stores/createStore.d.ts +19 -0
- package/dist/stores/createStore.js +63 -0
- package/dist/stores/index.d.ts +7 -0
- package/dist/stores/index.js +9 -0
- package/dist/stores/newPosts.d.ts +591 -0
- package/dist/stores/newPosts.js +191 -0
- package/dist/stores/pageHeader.d.ts +15 -0
- package/dist/stores/pageHeader.js +22 -0
- package/dist/stores/plusButton.d.ts +5 -0
- package/dist/stores/plusButton.js +13 -0
- package/dist/stores/types.d.ts +35 -0
- package/dist/stores/types.js +1 -0
- package/dist/streaming.d.ts +6 -0
- package/dist/streaming.js +6 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/index.js +1 -0
- package/package.json +72 -0
- package/src/pwa/navigationUrl.ts +61 -0
- package/src/pwa/sw-types.ts +9 -0
- package/src/pwa/sw.ts +228 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useT } from '../../../i18n/index.js';
|
|
4
|
+
import { VideoPlayer } from './VideoPlayer.js';
|
|
5
|
+
export function GalleryModal({ attachments, initialIndex = 0, onClose, }) {
|
|
6
|
+
const t = useT();
|
|
7
|
+
const [index, setIndex] = useState(initialIndex);
|
|
8
|
+
const attachment = attachments[index];
|
|
9
|
+
if (!attachment)
|
|
10
|
+
return null;
|
|
11
|
+
const prev = () => setIndex((i) => (i === 0 ? attachments.length - 1 : i - 1));
|
|
12
|
+
const next = () => setIndex((i) => (i === attachments.length - 1 ? 0 : i + 1));
|
|
13
|
+
return (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/80", role: "dialog", "aria-modal": true, children: [attachments.length > 1 ? (_jsx("button", { type: "button", title: t('posts.gallery.previous', { defaultValue: 'Previous' }), className: "absolute left-2 top-1/2 z-50 -translate-y-1/2 rounded-md bg-white/15 p-4 text-xl font-bold shadow-xl md:left-4", onClick: prev, children: "\u2190" })) : null, _jsx("div", { className: "max-h-[90vh] max-w-[90vw] overflow-auto p-4", children: attachment.type === 'video' || attachment.meta?.mimetype?.startsWith('video/') ? (_jsx(VideoPlayer, { attachment: attachment, className: "max-h-[85vh] max-w-full" }, attachment.url)) : attachment.type === 'audio' || attachment.meta?.mimetype?.startsWith('audio/') ? (_jsx("audio", { src: attachment.url, controls: true, className: "w-full min-w-[280px]" })) : attachment.type === 'image' || attachment.meta?.mimetype?.startsWith('image/') ? (_jsx("img", { src: attachment.previewUrl ?? attachment.url ?? '', alt: attachment.description ?? '', className: "max-h-[85vh] max-w-full object-contain" })) : (_jsxs("div", { className: "bg-card space-y-3 rounded-md p-6 text-center", children: [_jsx("p", { className: "font-medium", children: attachment.filename ?? attachment.description ?? 'Document' }), attachment.url ? (_jsx("a", { href: attachment.url, target: "_blank", rel: "noreferrer", className: "text-primary underline", children: t('posts.gallery.openDocument', {
|
|
14
|
+
defaultValue: 'Open file',
|
|
15
|
+
}) })) : null] })) }), attachments.length > 1 ? (_jsx("button", { type: "button", title: t('posts.gallery.next', { defaultValue: 'Next' }), className: "absolute right-2 top-1/2 z-50 -translate-y-1/2 rounded-md bg-white/15 p-4 text-xl font-bold shadow-xl md:right-4", onClick: next, children: "\u2192" })) : null, _jsx("button", { type: "button", title: t('posts.gallery.close', { defaultValue: 'Close' }), className: "fixed right-4 top-4 z-50 rounded-md bg-primary px-3 py-2 text-lg font-bold text-primary-foreground shadow-xl", onClick: onClose, children: "\u00D7" })] }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JamState } from '@openpeepshq/common/types';
|
|
2
|
+
export interface ParticipantsCardProps {
|
|
3
|
+
jamState: JamState;
|
|
4
|
+
size?: number;
|
|
5
|
+
}
|
|
6
|
+
/** Overlapping avatar stack of the first jam participants. Mirrors the Svelte
|
|
7
|
+
* `ParticipantsCard`. */
|
|
8
|
+
export declare function ParticipantsCard({ jamState, size }: ParticipantsCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
|
|
3
|
+
import { Avatar } from '../../profile/index.js';
|
|
4
|
+
function ParticipantAvatar({ id, size }) {
|
|
5
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
6
|
+
const profile = openpeepsApi.useProfile(id).data;
|
|
7
|
+
return (_jsx(Avatar, { profile: profile, size: size, borderless: true, containerClassName: "-mr-2" }));
|
|
8
|
+
}
|
|
9
|
+
/** Overlapping avatar stack of the first jam participants. Mirrors the Svelte
|
|
10
|
+
* `ParticipantsCard`. */
|
|
11
|
+
export function ParticipantsCard({ jamState, size = 1.5 }) {
|
|
12
|
+
return (_jsx("div", { className: "flex w-full items-center justify-between gap-4", children: _jsx("div", { className: "flex items-center", children: jamState.participants.slice(0, 2).map((id) => (_jsx(ParticipantAvatar, { id: id, size: size }, id))) }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { collectVotes, hasValue } from '@openpeepshq/common';
|
|
4
|
+
import { checkPostCapabilities, groupName } from '@openpeepshq/common/lib';
|
|
5
|
+
const isPast = (date) => new Date(date).getTime() < Date.now();
|
|
6
|
+
const formatDistanceToNow = (date) => {
|
|
7
|
+
const target = new Date(date).getTime();
|
|
8
|
+
const seconds = Math.round((target - Date.now()) / 1000);
|
|
9
|
+
const abs = Math.abs(seconds);
|
|
10
|
+
const rtf = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' });
|
|
11
|
+
if (abs < 60)
|
|
12
|
+
return rtf.format(seconds, 'second');
|
|
13
|
+
if (abs < 3600)
|
|
14
|
+
return rtf.format(Math.round(seconds / 60), 'minute');
|
|
15
|
+
if (abs < 86400)
|
|
16
|
+
return rtf.format(Math.round(seconds / 3600), 'hour');
|
|
17
|
+
return rtf.format(Math.round(seconds / 86400), 'day');
|
|
18
|
+
};
|
|
19
|
+
import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
|
|
20
|
+
import { useT } from '../../../i18n/index.js';
|
|
21
|
+
import { useAuthData, useCurrentProfile } from '../../layout/IdentityContext.js';
|
|
22
|
+
import { useToast } from '../../layout/ToastProvider.js';
|
|
23
|
+
import { useCapabilities } from '../../server-data/index.js';
|
|
24
|
+
import { Avatar } from '../../profile/index.js';
|
|
25
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
26
|
+
export function PollContent({ post }) {
|
|
27
|
+
const t = useT();
|
|
28
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
29
|
+
const currentProfile = useCurrentProfile();
|
|
30
|
+
const authData = useAuthData();
|
|
31
|
+
const capabilities = useCapabilities();
|
|
32
|
+
const { success, error } = useToast();
|
|
33
|
+
const votePoll = openpeepsApi.voteOnPostAction({ id: post.id });
|
|
34
|
+
const [selectedPollOption, setSelectedPollOption] = useState();
|
|
35
|
+
const [selectedPollOptions, setSelectedPollOptions] = useState([]);
|
|
36
|
+
if (post.data?.type !== 'question')
|
|
37
|
+
return null;
|
|
38
|
+
const pollData = post.data;
|
|
39
|
+
const { votes, voteCounts } = collectVotes(post);
|
|
40
|
+
const hasPollEnded = !!(pollData.expiresAt && isPast(pollData.expiresAt));
|
|
41
|
+
const hasVoted = !!(currentProfile &&
|
|
42
|
+
(votes.find((v) => v?.profile?.id === currentProfile.id)?.selection
|
|
43
|
+
?.length ?? 0) > 0);
|
|
44
|
+
const canVote = !!(currentProfile && !hasPollEnded && !hasVoted);
|
|
45
|
+
const totalVotes = votes.length || 1;
|
|
46
|
+
const handleVote = async () => {
|
|
47
|
+
const hasCapabilities = checkPostCapabilities(authData, ['core-posts-vote'], post, capabilities);
|
|
48
|
+
if (!hasCapabilities.success) {
|
|
49
|
+
error(post.group
|
|
50
|
+
? t('posts.vote.lackPermission', {
|
|
51
|
+
defaultValue: 'You need to be a member of {{groupName}} to vote.',
|
|
52
|
+
groupName: groupName(post.group),
|
|
53
|
+
})
|
|
54
|
+
: t('posts.vote.lackPermissionNoGroup', {
|
|
55
|
+
defaultValue: 'You do not have permission to vote on this poll.',
|
|
56
|
+
}));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const selection = (pollData.multiple
|
|
60
|
+
? selectedPollOptions
|
|
61
|
+
: hasValue(selectedPollOption)
|
|
62
|
+
? [selectedPollOption]
|
|
63
|
+
: undefined);
|
|
64
|
+
if (!selection?.length) {
|
|
65
|
+
error(t('posts.vote.selectOption', {
|
|
66
|
+
defaultValue: 'Please select an option to vote.',
|
|
67
|
+
}));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
await votePoll({ selection });
|
|
72
|
+
success(t('posts.vote.successToast', {
|
|
73
|
+
defaultValue: 'Your vote was counted.',
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
error(t('posts.vote.error', {
|
|
78
|
+
defaultValue: 'Could not update your vote. Please try again.',
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const handleClearVote = async () => {
|
|
83
|
+
try {
|
|
84
|
+
await votePoll({ selection: [] });
|
|
85
|
+
success(t('posts.vote.cleared', { defaultValue: 'Your vote was cleared.' }));
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
error(t('posts.vote.error', {
|
|
89
|
+
defaultValue: 'Could not update your vote. Please try again.',
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const stopFeedNavigation = (e) => {
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
};
|
|
97
|
+
return (_jsxs("div", { className: "bg-surface-100 rounded-lg px-4 py-4", onClick: stopFeedNavigation, onKeyDown: stopFeedNavigation, role: "presentation", children: [_jsx("div", { className: "space-y-4", children: pollData.options.map((option, index) => (_jsxs("div", { className: "flex items-center gap-2 py-2", children: [canVote ? (pollData.multiple ? (_jsx("input", { type: "checkbox", checked: selectedPollOptions.includes(index), onChange: () => setSelectedPollOptions((prev) => prev.includes(index)
|
|
98
|
+
? prev.filter((i) => i !== index)
|
|
99
|
+
: [...prev, index]) })) : (_jsx("input", { type: "radio", name: `poll-${post.id}`, checked: selectedPollOption === index, onChange: () => setSelectedPollOption(index) }))) : null, _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("span", { className: "text-base", children: option.content }), _jsxs("div", { className: "flex items-center gap-2", children: [pollData.votersVisible ? (_jsx("div", { className: "flex -space-x-2", children: votes
|
|
100
|
+
.filter((v) => v.selection.includes(index))
|
|
101
|
+
.slice(0, 2)
|
|
102
|
+
.map((vote) => (_jsx(Avatar, { profile: vote.profile, size: 1.5 }, vote.profile.id))) })) : null, _jsx("span", { children: voteCounts?.[index] ?? 0 })] })] }), _jsx("div", { className: "bg-surface-300 mt-2 h-2 overflow-hidden rounded-full", children: _jsx("div", { className: "bg-primary h-full rounded-full transition-all", style: {
|
|
103
|
+
width: `${((voteCounts[index] ?? 0) / totalVotes) * 100}%`,
|
|
104
|
+
} }) })] })] }, `${option.content}-${index}`))) }), canVote ? (_jsx(Button, { variant: "variant-filled-primary", className: "mt-4", title: t('posts.poll.vote', { defaultValue: 'Vote' }), action: handleVote, children: t('posts.form.poll.submit', { defaultValue: 'Vote' }) })) : null, _jsxs("div", { className: "text-muted-foreground mt-4 flex flex-wrap items-center gap-3 text-sm", children: [_jsxs("span", { children: [votes.length || 0, " ", t('posts.vote.count', { defaultValue: 'votes' })] }), pollData.expiresAt ? (_jsx("span", { children: hasPollEnded
|
|
105
|
+
? t('posts.poll.ended', { defaultValue: 'Poll ended' })
|
|
106
|
+
: `${formatDistanceToNow(pollData.expiresAt)} ${t('posts.poll.timeLeft', { defaultValue: 'left' })}` })) : null, hasVoted && !hasPollEnded ? (_jsx(Button, { variant: "variant-ghost-primary", className: "h-auto min-h-0 px-0 font-semibold", title: t('posts.poll.undoVoteTitle', {
|
|
107
|
+
defaultValue: 'Undo your vote',
|
|
108
|
+
}), action: handleClearVote, children: t('posts.poll.undoVote', { defaultValue: 'Undo vote' }) })) : null] })] }));
|
|
109
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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';
|
|
4
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
5
|
+
import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
|
|
6
|
+
import { useT } from '../../../i18n/index.js';
|
|
7
|
+
import { useCurrentProfile } from '../../layout/IdentityContext.js';
|
|
8
|
+
import { postReactionStats } from '../helpers.js';
|
|
9
|
+
import { useReplyModal } from '../post-form/ReplyModalContext.js';
|
|
10
|
+
export function PostActions({ post, compact = false }) {
|
|
11
|
+
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]);
|
|
24
|
+
if (!me)
|
|
25
|
+
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
|
+
};
|
|
52
|
+
const replyLabel = t('posts.footer.reply', { defaultValue: 'Reply' });
|
|
53
|
+
const repostLabel = t('posts.footer.repost', { defaultValue: 'Repost' });
|
|
54
|
+
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) => {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
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
|
|
59
|
+
? post.reactions?.length
|
|
60
|
+
? ` · ${postReactionStats(post)}`
|
|
61
|
+
: null
|
|
62
|
+
: likeLabel] })] }));
|
|
63
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PublicPost, PublicReplyPost } from '@openpeepshq/common/types';
|
|
2
|
+
export interface PostInfoHeaderProps {
|
|
3
|
+
post: PublicPost | PublicReplyPost;
|
|
4
|
+
showMenu?: boolean;
|
|
5
|
+
deleteCallback?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function PostInfoHeader({ post, showMenu, deleteCallback, }: PostInfoHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar, ProfileLink } from '../../profile/index.js';
|
|
3
|
+
import { UpdatingDate } from '@openpeepshq/react-ui';
|
|
4
|
+
import { PostMenu } from './PostMenu.js';
|
|
5
|
+
export function PostInfoHeader({ post, showMenu = false, deleteCallback, }) {
|
|
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] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PublicPost } from '@openpeepshq/common/types';
|
|
2
|
+
export interface PostMenuProps {
|
|
3
|
+
post: PublicPost;
|
|
4
|
+
deleteCallback?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function PostMenu({ post, deleteCallback }: PostMenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { BookmarkMinus, BookmarkPlus, FlagIcon, Pencil, Pin, Repeat2, ThumbsUp, Trash, } from 'lucide-react';
|
|
4
|
+
import { checkGroupCapabilities, checkPostCapabilities, checkRoleCapabilities, } from '@openpeepshq/common/lib';
|
|
5
|
+
import { PopupMenu, PopupMenuButton, PopupSeparator, } from '@openpeepshq/react-ui';
|
|
6
|
+
import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
|
|
7
|
+
import { useT } from '../../../i18n/index.js';
|
|
8
|
+
import { useAuthData, useCurrentProfile } from '../../layout/IdentityContext.js';
|
|
9
|
+
import { useCapabilities, useServerInfo } from '../../server-data/index.js';
|
|
10
|
+
import { ReportProfileOrPostModal } from '../../profile/ReportProfileOrPostModal.js';
|
|
11
|
+
import { DeletePostModal } from './modals/DeletePostModal.js';
|
|
12
|
+
import { ReactionsModal } from './modals/ReactionsModal.js';
|
|
13
|
+
import { RepostModal } from './modals/RepostModal.js';
|
|
14
|
+
import { useEditPostModal } from '../post-form/EditPostModalContext.js';
|
|
15
|
+
export function PostMenu({ post, deleteCallback }) {
|
|
16
|
+
const t = useT();
|
|
17
|
+
const me = useCurrentProfile();
|
|
18
|
+
const authData = useAuthData();
|
|
19
|
+
const capabilities = useCapabilities();
|
|
20
|
+
const serverInfo = useServerInfo();
|
|
21
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
22
|
+
const { openEditPost } = useEditPostModal();
|
|
23
|
+
const [modal, setModal] = useState(null);
|
|
24
|
+
const bookmarkedIdsQuery = openpeepsApi.useCurrentProfileBookmarkedIds();
|
|
25
|
+
const followProfile = openpeepsApi.followProfileAction({ id: post.profile.id });
|
|
26
|
+
const unfollowProfile = openpeepsApi.unfollowProfileAction({
|
|
27
|
+
id: post.profile.id,
|
|
28
|
+
});
|
|
29
|
+
const bookmarkPost = openpeepsApi.bookmarkPostAction({ id: post.id });
|
|
30
|
+
const unbookmarkPost = openpeepsApi.unbookmarkPostAction({ id: post.id });
|
|
31
|
+
const updateGroup = openpeepsApi.updateGroupAction({
|
|
32
|
+
id: post.group?.id ?? '',
|
|
33
|
+
});
|
|
34
|
+
const pinGloballyMutation = openpeepsApi.admin.pinPostGloballyAction();
|
|
35
|
+
const postProfile = post.profile;
|
|
36
|
+
const isFollowing = me?.following?.some((f) => f.id === postProfile.id);
|
|
37
|
+
const isBookmarked = bookmarkedIdsQuery.data?.includes(post.id) ?? false;
|
|
38
|
+
const pinnedGlobally = serverInfo.communityConfig?.content?.pinnedPost === post.id;
|
|
39
|
+
const pinnedInGroup = post.group?.pinnedPostId === post.id;
|
|
40
|
+
const canPinToGroup = useMemo(() => !!post.group &&
|
|
41
|
+
checkGroupCapabilities(authData, ['core-groups-pin'], post.group).success, [authData, post.group]);
|
|
42
|
+
const canPinGlobally = useMemo(() => ['public', 'local'].includes(post.visibility) &&
|
|
43
|
+
!!me &&
|
|
44
|
+
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]);
|
|
48
|
+
const isPostOwner = postProfile?.id === me?.id;
|
|
49
|
+
if (!me)
|
|
50
|
+
return null;
|
|
51
|
+
const handleEditPost = () => {
|
|
52
|
+
if (post.data?.type === 'event') {
|
|
53
|
+
window.location.assign(`/events/${post.id}/edit`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (post.data?.type === 'article') {
|
|
57
|
+
window.location.assign(`/articles/${post.id}/edit`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
openEditPost(post);
|
|
61
|
+
};
|
|
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 () => {
|
|
63
|
+
await unbookmarkPost(undefined);
|
|
64
|
+
} })) : (_jsx(PopupMenuButton, { title: t('posts.bookmark.title', { defaultValue: 'Bookmark' }), text: t('posts.bookmark.title', { defaultValue: 'Bookmark' }), icon: BookmarkPlus, action: async () => {
|
|
65
|
+
await bookmarkPost(undefined);
|
|
66
|
+
} })), canPinGlobally ? (_jsx(PopupMenuButton, { title: pinnedGlobally
|
|
67
|
+
? t('posts.unpinGlobally.title', { defaultValue: 'Unpin globally' })
|
|
68
|
+
: 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', {
|
|
71
|
+
defaultValue: 'Report @{{handle}}',
|
|
72
|
+
handle: post.profile.handle,
|
|
73
|
+
}), text: t('common.actions.reportProfile', {
|
|
74
|
+
defaultValue: 'Report @{{handle}}',
|
|
75
|
+
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) })] }));
|
|
77
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PublicPost } from '@openpeepshq/common/types';
|
|
2
|
+
export interface PostReactionHeaderProps {
|
|
3
|
+
post: PublicPost;
|
|
4
|
+
inGroup?: boolean;
|
|
5
|
+
deleteCallback?: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Small banner above feed posts that explains why this post is in the feed
|
|
9
|
+
* (reposted, reply, posted in group X). Translates
|
|
10
|
+
* `PostReactionHeader.svelte`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function PostReactionHeader({ post, inGroup, deleteCallback, }: PostReactionHeaderProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar, AvatarWithName, ProfileLink } from '../../profile/index.js';
|
|
3
|
+
import { useT } from '../../../i18n/index.js';
|
|
4
|
+
import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
|
|
5
|
+
import { PostMenu } from './PostMenu.js';
|
|
6
|
+
/**
|
|
7
|
+
* Small banner above feed posts that explains why this post is in the feed
|
|
8
|
+
* (reposted, reply, posted in group X). Translates
|
|
9
|
+
* `PostReactionHeader.svelte`.
|
|
10
|
+
*/
|
|
11
|
+
export function PostReactionHeader({ post, inGroup = false, deleteCallback, }) {
|
|
12
|
+
const t = useT();
|
|
13
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
14
|
+
const replyPostQuery = post.inReplyToId
|
|
15
|
+
? openpeepsApi.usePost?.(post.inReplyToId)
|
|
16
|
+
: undefined;
|
|
17
|
+
const replyPost = replyPostQuery?.data;
|
|
18
|
+
const showGroup = !!(post.groupId && post.group && !inGroup);
|
|
19
|
+
const isRepost = !!post.repost;
|
|
20
|
+
const isReply = !!post.inReplyToId && !!replyPost?.profile?.handle;
|
|
21
|
+
// In the feed the reply parent is fetched lazily via `usePost`, so until it
|
|
22
|
+
// resolves (or if it cannot be loaded) none of the branches below have data
|
|
23
|
+
// to render. Without this guard we'd still emit the bordered banner wrapper,
|
|
24
|
+
// leaving an empty bar above reply posts that looks broken. Render nothing
|
|
25
|
+
// until there is actual reply/repost/group context to show.
|
|
26
|
+
if (!showGroup && !isRepost && !isReply) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
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 })] }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Calendar, Copy, Repeat2, Send, Share } from 'lucide-react';
|
|
3
|
+
import { buildEventIcs } from '@openpeepshq/common/lib';
|
|
4
|
+
import { PopupMenu, PopupMenuButton, PopupSection, PopupSeparator, } from '@openpeepshq/react-ui';
|
|
5
|
+
import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
|
|
6
|
+
import { useT } from '../../../i18n/index.js';
|
|
7
|
+
import { useCurrentProfile } from '../../layout/IdentityContext.js';
|
|
8
|
+
import { useCreateNewConversation } from '../../conversations/CreateNewConversationContext.js';
|
|
9
|
+
export function ShareMenu({ post, menuButton }) {
|
|
10
|
+
const t = useT();
|
|
11
|
+
const me = useCurrentProfile();
|
|
12
|
+
const { openCreateConversation } = useCreateNewConversation();
|
|
13
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
14
|
+
const repostPost = openpeepsApi.repostPostAction({ id: post.id });
|
|
15
|
+
const postUrl = typeof window !== 'undefined'
|
|
16
|
+
? `${window.location.origin}/posts/${post.id}`
|
|
17
|
+
: `/posts/${post.id}`;
|
|
18
|
+
const downloadEventIcs = () => {
|
|
19
|
+
const ics = buildEventIcs(post, { postUrl });
|
|
20
|
+
if (!ics)
|
|
21
|
+
return;
|
|
22
|
+
const event = post.data;
|
|
23
|
+
const raw = event.name?.trim() || `event-${post.id}`;
|
|
24
|
+
const safe = raw.replace(/[/\\?%*:|"<>]/g, '-').slice(0, 100);
|
|
25
|
+
const blob = new Blob([ics], { type: 'text/calendar;charset=utf-8' });
|
|
26
|
+
const href = URL.createObjectURL(blob);
|
|
27
|
+
const a = document.createElement('a');
|
|
28
|
+
a.href = href;
|
|
29
|
+
a.download = `${safe}.ics`;
|
|
30
|
+
a.click();
|
|
31
|
+
URL.revokeObjectURL(href);
|
|
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', {
|
|
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', {
|
|
36
|
+
defaultValue: 'Send in message',
|
|
37
|
+
}), text: t('posts.shareMenu.sendInMessage', {
|
|
38
|
+
defaultValue: 'Send in message',
|
|
39
|
+
}), icon: Send, action: () => openCreateConversation({ message: postUrl }) }), _jsx(PopupSeparator, {}), _jsx(PopupSection, { title: t('posts.shareMenu.otherOptions', {
|
|
40
|
+
defaultValue: 'Other options',
|
|
41
|
+
}) })] })) : null, post.type === 'event' ? (_jsx(PopupMenuButton, { title: t('posts.shareMenu.downloadCalendarIcsTitle', {
|
|
42
|
+
defaultValue: 'Download calendar file',
|
|
43
|
+
}), text: t('posts.shareMenu.downloadCalendarIcs', {
|
|
44
|
+
defaultValue: 'Add to calendar (.ics)',
|
|
45
|
+
}), icon: Calendar, action: downloadEventIcs })) : null, _jsx(PopupMenuButton, { title: t('posts.shareMenu.copyLink', { defaultValue: 'Copy link' }), text: t('posts.shareMenu.copyLink', { defaultValue: 'Copy link' }), icon: Copy, action: () => void navigator.clipboard.writeText(postUrl) })] }));
|
|
46
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface UnreadPostIndicatorProps {
|
|
2
|
+
show: boolean;
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Subtle unread marker positioned in the host's left margin.
|
|
7
|
+
* Absolutely positioned so visibility changes never shift layout.
|
|
8
|
+
*/
|
|
9
|
+
export declare const UnreadPostIndicator: ({ show, className, }: UnreadPostIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Subtle unread marker positioned in the host's left margin.
|
|
4
|
+
* Absolutely positioned so visibility changes never shift layout.
|
|
5
|
+
*/
|
|
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'}` }));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MediaAttachmentData } from '@openpeepshq/common';
|
|
2
|
+
export interface VideoPlayerProps {
|
|
3
|
+
attachment: MediaAttachmentData;
|
|
4
|
+
autoPlay?: boolean;
|
|
5
|
+
/** Browsers block unmuted autoplay; start muted so playback can begin. */
|
|
6
|
+
muted?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Plays post-attachment videos through the server's HLS VOD endpoints using the
|
|
11
|
+
* `@videojs/react` (video.js v10) `HlsVideo` component, mirroring the Svelte
|
|
12
|
+
* gallery `VideoPlayer`: same-origin (local) media is transcoded via
|
|
13
|
+
* `createVodStream` + status polling and played through `HlsVideo`; federated
|
|
14
|
+
* media falls back to the source URL on a plain `<video>`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function VideoPlayer({ attachment, autoPlay, muted, className, }: VideoPlayerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { HlsVideo } from '@videojs/react/media/hls-video';
|
|
4
|
+
import { CircleAlert, LoaderCircle } from 'lucide-react';
|
|
5
|
+
import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
|
|
6
|
+
import { useT } from '../../../i18n/index.js';
|
|
7
|
+
const POLL_INTERVAL_MS = 5_000;
|
|
8
|
+
const originOf = (url) => {
|
|
9
|
+
try {
|
|
10
|
+
return new URL(url).origin;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Plays post-attachment videos through the server's HLS VOD endpoints using the
|
|
18
|
+
* `@videojs/react` (video.js v10) `HlsVideo` component, mirroring the Svelte
|
|
19
|
+
* gallery `VideoPlayer`: same-origin (local) media is transcoded via
|
|
20
|
+
* `createVodStream` + status polling and played through `HlsVideo`; federated
|
|
21
|
+
* media falls back to the source URL on a plain `<video>`.
|
|
22
|
+
*/
|
|
23
|
+
export function VideoPlayer({ attachment, autoPlay = true, muted = true, className = 'max-h-[85vh] max-w-full', }) {
|
|
24
|
+
const t = useT();
|
|
25
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
26
|
+
const createVodStream = openpeepsApi.createVodStreamAction();
|
|
27
|
+
const getVodStreamStatus = openpeepsApi.getVodStreamStatusAction();
|
|
28
|
+
const videoRef = useRef(null);
|
|
29
|
+
const [mode, setMode] = useState('pending');
|
|
30
|
+
const [localState, setLocalState] = useState('loading');
|
|
31
|
+
const [hlsUrl, setHlsUrl] = useState(null);
|
|
32
|
+
// Resolve playback mode and, for local content, drive the VOD transcode +
|
|
33
|
+
// status polling until the HLS master playlist is ready.
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
let disposed = false;
|
|
36
|
+
let pollTimer;
|
|
37
|
+
const origin = originOf(attachment.url);
|
|
38
|
+
const sameOrigin = typeof window !== 'undefined' && origin === window.location.origin;
|
|
39
|
+
const resolvedMode = sameOrigin ? 'local' : 'federated';
|
|
40
|
+
setMode(resolvedMode);
|
|
41
|
+
if (resolvedMode !== 'local')
|
|
42
|
+
return;
|
|
43
|
+
const apply = (stream) => {
|
|
44
|
+
if (stream.status === 'ready') {
|
|
45
|
+
setHlsUrl(openpeepsApi.vodMasterPlaylistUrl(stream.storageId, origin));
|
|
46
|
+
setLocalState('ready');
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
if (stream.status === 'error') {
|
|
50
|
+
setLocalState('error');
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
setLocalState('processing');
|
|
54
|
+
return false;
|
|
55
|
+
};
|
|
56
|
+
const poll = (storageId) => {
|
|
57
|
+
const tick = async () => {
|
|
58
|
+
if (disposed)
|
|
59
|
+
return;
|
|
60
|
+
try {
|
|
61
|
+
const status = await getVodStreamStatus({ storageId });
|
|
62
|
+
if (disposed)
|
|
63
|
+
return;
|
|
64
|
+
if (apply(status))
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// Transient blip — keep polling.
|
|
69
|
+
}
|
|
70
|
+
pollTimer = setTimeout(tick, POLL_INTERVAL_MS);
|
|
71
|
+
};
|
|
72
|
+
pollTimer = setTimeout(tick, POLL_INTERVAL_MS);
|
|
73
|
+
};
|
|
74
|
+
void (async () => {
|
|
75
|
+
try {
|
|
76
|
+
const stream = await createVodStream({ url: attachment.url });
|
|
77
|
+
if (disposed)
|
|
78
|
+
return;
|
|
79
|
+
if (!apply(stream))
|
|
80
|
+
poll(stream.storageId);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
if (!disposed)
|
|
84
|
+
setLocalState('error');
|
|
85
|
+
}
|
|
86
|
+
})();
|
|
87
|
+
return () => {
|
|
88
|
+
disposed = true;
|
|
89
|
+
if (pollTimer)
|
|
90
|
+
clearTimeout(pollTimer);
|
|
91
|
+
};
|
|
92
|
+
// create/get actions are re-created each render; depend only on the source
|
|
93
|
+
// URL so the flow runs once per attachment.
|
|
94
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
95
|
+
}, [attachment.url]);
|
|
96
|
+
// Best-effort autoplay once the media element can play, retrying muted if the
|
|
97
|
+
// browser blocks unmuted autoplay.
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (!autoPlay)
|
|
100
|
+
return;
|
|
101
|
+
const el = videoRef.current;
|
|
102
|
+
if (!el)
|
|
103
|
+
return;
|
|
104
|
+
const canPlay = mode === 'federated' ||
|
|
105
|
+
(mode === 'local' && localState === 'ready' && !!hlsUrl);
|
|
106
|
+
if (!canPlay || !el.paused)
|
|
107
|
+
return;
|
|
108
|
+
void el.play().catch(() => {
|
|
109
|
+
el.muted = true;
|
|
110
|
+
void el.play().catch(() => undefined);
|
|
111
|
+
});
|
|
112
|
+
}, [autoPlay, mode, localState, hlsUrl]);
|
|
113
|
+
if (mode === 'federated') {
|
|
114
|
+
return (_jsx("video", { ref: videoRef, src: attachment.url, poster: attachment.previewUrl ?? undefined, controls: true, autoPlay: autoPlay, muted: muted, playsInline: true, className: className }));
|
|
115
|
+
}
|
|
116
|
+
if (mode === 'local' && localState === 'ready' && hlsUrl) {
|
|
117
|
+
return (_jsx(HlsVideo, { ref: videoRef, src: hlsUrl, poster: attachment.previewUrl ?? undefined, controls: true, autoPlay: autoPlay, muted: muted, playsInline: true, className: className }));
|
|
118
|
+
}
|
|
119
|
+
if (localState === 'error') {
|
|
120
|
+
return (_jsxs("div", { role: "alert", className: `flex flex-col items-center justify-center gap-3 rounded-md bg-black/50 p-6 text-center text-red-300 ${className}`, children: [_jsx(CircleAlert, { className: "h-10 w-10" }), _jsx("span", { children: t('posts.gallery.videoError', {
|
|
121
|
+
defaultValue: 'This video could not be prepared for playback.',
|
|
122
|
+
}) })] }));
|
|
123
|
+
}
|
|
124
|
+
return (_jsxs("div", { "aria-live": "polite", className: `flex flex-col items-center justify-center gap-3 rounded-md bg-black/50 p-6 text-center text-white ${className}`, children: [_jsx(LoaderCircle, { className: "h-10 w-10 animate-spin" }), _jsx("span", { children: t('posts.gallery.videoProcessing', {
|
|
125
|
+
defaultValue: 'Preparing video…',
|
|
126
|
+
}) })] }));
|
|
127
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PublicPost } from '@openpeepshq/common/types';
|
|
2
|
+
export interface DeletePostModalProps {
|
|
3
|
+
post: PublicPost;
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
deleteCallback?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function DeletePostModal({ post, open, onClose, deleteCallback, }: DeletePostModalProps): import("react/jsx-runtime").JSX.Element;
|