@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,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
3
|
+
import { useOpenpeeps } from '../../../../contexts/openpeeps/index.js';
|
|
4
|
+
import { useT } from '../../../../i18n/index.js';
|
|
5
|
+
import { FeedPost } from '../../FeedPost.js';
|
|
6
|
+
export function DeletePostModal({ post, open, onClose, deleteCallback, }) {
|
|
7
|
+
const t = useT();
|
|
8
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
9
|
+
const deletePost = openpeepsApi.deletePostAction({ id: post.id });
|
|
10
|
+
const handleDelete = async () => {
|
|
11
|
+
await deletePost(undefined);
|
|
12
|
+
deleteCallback?.();
|
|
13
|
+
onClose();
|
|
14
|
+
};
|
|
15
|
+
return (_jsx(Dialog, { open: open, onOpenChange: (next) => !next && onClose(), children: _jsxs(DialogContent, { className: "max-w-lg overflow-x-hidden", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('posts.deleteModal.deletePostTitle', {
|
|
16
|
+
defaultValue: 'Delete post',
|
|
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
|
+
defaultValue: 'Are you sure you want to delete this post?',
|
|
19
|
+
}) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-filled-error", action: handleDelete, children: t('posts.deleteModal.delete', { defaultValue: 'Delete' }) }), _jsx(Button, { variant: "variant-ringed-surface", action: onClose, children: t('posts.deleteModal.cancel', { defaultValue: 'Cancel' }) })] })] }) }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactionWithPublicProfile } from '@openpeepshq/common/types';
|
|
2
|
+
export interface ReactionsModalProps {
|
|
3
|
+
reactions: ReactionWithPublicProfile[];
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function ReactionsModal({ reactions, open, onClose, }: ReactionsModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
3
|
+
import { useT } from '../../../../i18n/index.js';
|
|
4
|
+
import { Avatar } from '../../../profile/index.js';
|
|
5
|
+
import { FollowUnfollowButton } from '../../../profile/FollowUnfollowButton.js';
|
|
6
|
+
export function ReactionsModal({ reactions, open, onClose, }) {
|
|
7
|
+
const t = useT();
|
|
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.reactionsModal.title', { defaultValue: 'Reactions' }) }) }), _jsxs("article", { className: "pb-3", children: [reactions.map(({ reaction, profile }) => (_jsxs("div", { className: "mb-4 flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { children: reaction }), _jsx(Avatar, { profile: profile }), _jsxs("div", { children: [_jsx("p", { className: "font-bold", children: profile.displayName || profile.handle }), _jsxs("span", { className: "text-muted-foreground text-sm", children: ["@", profile.handle] })] })] }), _jsx(FollowUnfollowButton, { profile: profile, compact: true })] }, profile.id))), reactions.length === 0 ? (_jsx("p", { className: "p-5 text-center text-sm text-muted-foreground", children: t('posts.reactionsModal.empty', {
|
|
9
|
+
defaultValue: 'No reactions yet',
|
|
10
|
+
}) })) : null] })] }) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PublicPost } from '@openpeepshq/common/types';
|
|
2
|
+
export interface RepostModalProps {
|
|
3
|
+
post: PublicPost;
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function RepostModal({ post, open, onClose }: RepostModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, LoadingSpinner, } from '@openpeepshq/react-ui';
|
|
3
|
+
import { useOpenpeeps } from '../../../../contexts/openpeeps/index.js';
|
|
4
|
+
import { useT } from '../../../../i18n/index.js';
|
|
5
|
+
import { ProfileWithActionCard } from '../../../profile/ProfileWithActionCard.js';
|
|
6
|
+
export function RepostModal({ post, open, onClose }) {
|
|
7
|
+
const t = useT();
|
|
8
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
9
|
+
const repostsQuery = openpeepsApi.usePostReposts(post.id);
|
|
10
|
+
return (_jsx(Dialog, { open: open, onOpenChange: (next) => !next && onClose(), children: _jsxs(DialogContent, { className: "max-h-[80vh] max-w-md overflow-y-auto", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('posts.repostModal.title', { defaultValue: 'Reposters' }) }) }), _jsx("article", { className: "pb-3", children: repostsQuery.isLoading ? (_jsx("div", { className: "p-5 text-center text-sm text-muted-foreground", children: _jsx(LoadingSpinner, {}) })) : repostsQuery.data?.length ? (repostsQuery.data.map((repost) => (_jsx(ProfileWithActionCard, { profile: repost.profile }, repost.profile.id)))) : (_jsx("p", { className: "p-5 text-center text-sm text-muted-foreground", children: t('posts.repostModal.empty', {
|
|
11
|
+
defaultValue: 'No reposters yet',
|
|
12
|
+
}) })) })] }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PostCreationData } from '@openpeepshq/common/types';
|
|
2
|
+
export interface ArticleFormProps {
|
|
3
|
+
postData: PostCreationData;
|
|
4
|
+
onChange: (data: PostCreationData) => void;
|
|
5
|
+
isEdit?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function ArticleForm({ postData, onChange, isEdit, }: ArticleFormProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Input, Label } from '@openpeepshq/react-ui';
|
|
4
|
+
import { useT } from '../../../i18n/index.js';
|
|
5
|
+
import { useCurrentProfile } from '../../layout/IdentityContext.js';
|
|
6
|
+
import { ImageInput } from '../../form/ImageInput.js';
|
|
7
|
+
import { OpenpeepsMarkdownInput } from './OpenpeepsMarkdownInput.js';
|
|
8
|
+
import { ComposePreviewLinks } from './ComposePreviewLinks.js';
|
|
9
|
+
import { PostAudienceSelector } from './PostAudienceSelector.js';
|
|
10
|
+
import { VisibilitySelector } from './VisibilitySelector.js';
|
|
11
|
+
export function ArticleForm({ postData, onChange, isEdit = false, }) {
|
|
12
|
+
const t = useT();
|
|
13
|
+
const me = useCurrentProfile();
|
|
14
|
+
const article = postData.data;
|
|
15
|
+
const [audienceOpen, setAudienceOpen] = useState(false);
|
|
16
|
+
const patchArticle = (patch) => {
|
|
17
|
+
onChange({
|
|
18
|
+
...postData,
|
|
19
|
+
data: { ...article, ...patch },
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const setAudience = (settings) => {
|
|
23
|
+
const audience = settings.audience ?? undefined;
|
|
24
|
+
const includesMe = audience?.some((p) => p.id === me?.id);
|
|
25
|
+
onChange({
|
|
26
|
+
...postData,
|
|
27
|
+
visibility: settings.visibility,
|
|
28
|
+
groupId: settings.groupId ?? undefined,
|
|
29
|
+
audience: settings.visibility === 'direct'
|
|
30
|
+
? includesMe
|
|
31
|
+
? audience
|
|
32
|
+
: [...(audience ?? []), ...(me ? [me] : [])]
|
|
33
|
+
: undefined,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
return (_jsxs("div", { children: [_jsx(ImageInput, { usage: "article-header-image", url: article.image, onChange: (image) => patchArticle({ image }), className: "h-96", showSelectAspectRatio: true, showFullImage: true, text: t('articles.form.uploadCover', {
|
|
37
|
+
defaultValue: 'Upload your cover image',
|
|
38
|
+
}), showAltInput: false }), _jsxs("div", { className: "mt-4 flex flex-col gap-4 px-3", children: [_jsx("h2", { className: "text-lg", children: t('articles.form.title', { defaultValue: 'New Article' }) }), _jsx(Label, { title: t('articles.form.title', { defaultValue: 'New Article' }), htmlFor: "article-title", children: _jsx(Input, { id: "article-title", value: article.title ?? '', onChange: (e) => patchArticle({ title: e.target.value }) }) }), _jsx(OpenpeepsMarkdownInput, { rows: 16, maxLength: 10000, value: article.content ?? '', onChange: (content) => patchArticle({ content }), placeholder: t('articles.form.contentPlaceholder', {
|
|
39
|
+
defaultValue: 'Write your content here. User markdown for formatting',
|
|
40
|
+
}) }), _jsx(ComposePreviewLinks, { content: article.content }), _jsx(Label, { title: t('articles.form.visibility', {
|
|
41
|
+
defaultValue: 'Who can see this (Required)',
|
|
42
|
+
}), description: t('articles.form.visibilityNotChangeable', {
|
|
43
|
+
defaultValue: "Once you post your article, you can't change the visibility",
|
|
44
|
+
}), children: _jsx(VisibilitySelector, { postData: postData, onClick: () => setAudienceOpen(true), disabled: isEdit, showDirect: true }) })] }), !isEdit ? (_jsx(PostAudienceSelector, { open: audienceOpen, onClose: () => setAudienceOpen(false), type: "article", visibility: postData.visibility, groupId: postData.groupId ?? undefined, audience: postData.audience ?? [], showDirect: true, onConfirm: setAudience })) : null] }));
|
|
45
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MediaAttachment, MediaAttachmentData } from '@openpeepshq/common';
|
|
2
|
+
export interface ComposeItem {
|
|
3
|
+
key: string;
|
|
4
|
+
/** Local file pending upload; cleared once the server returns an attachment. */
|
|
5
|
+
file?: File;
|
|
6
|
+
usage: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
/** Local blob preview shown during upload (images/videos). */
|
|
9
|
+
previewUrl?: string;
|
|
10
|
+
/** Server attachment once uploaded (carries `id`/`status` for processing). */
|
|
11
|
+
attachment?: MediaAttachmentData;
|
|
12
|
+
failed?: boolean;
|
|
13
|
+
error?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AttachmentCardProps {
|
|
16
|
+
item: ComposeItem;
|
|
17
|
+
onUploaded: (key: string, attachment: MediaAttachment) => void;
|
|
18
|
+
onProcessed: (key: string, attachment: MediaAttachmentData) => void;
|
|
19
|
+
onFailed: (key: string, error?: string) => void;
|
|
20
|
+
onRemove: (key: string) => void;
|
|
21
|
+
onUpdate: (key: string, attachment: MediaAttachmentData) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A single post-composer attachment, mirroring the Svelte `AttachmentContainer`:
|
|
25
|
+
* shows a pie overlay for the byte-upload phase, then for the server-side
|
|
26
|
+
* processing phase (SSE), a failed state, and finally the preview with a
|
|
27
|
+
* remove affordance.
|
|
28
|
+
*/
|
|
29
|
+
export declare function AttachmentCard({ item, onUploaded, onProcessed, onFailed, onRemove, onUpdate, }: AttachmentCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Pencil, X } from 'lucide-react';
|
|
4
|
+
import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
|
|
5
|
+
import { useT } from '../../../i18n/index.js';
|
|
6
|
+
import { DescriptionEditModal } from './DescriptionEditModal.js';
|
|
7
|
+
import { VideoPlayOverlay } from '../VideoPlayOverlay.js';
|
|
8
|
+
import { resolveAttachmentPreviewUrl } from '../attachmentPreview.js';
|
|
9
|
+
const PIE = { cx: 18, cy: 18, r: 16 };
|
|
10
|
+
const piePath = (percent) => {
|
|
11
|
+
const p = Math.max(0, Math.min(100, percent));
|
|
12
|
+
if (p <= 0)
|
|
13
|
+
return '';
|
|
14
|
+
const { cx, cy, r } = PIE;
|
|
15
|
+
if (p >= 100) {
|
|
16
|
+
return `M ${cx - r},${cy} A ${r},${r} 0 1,0 ${cx + r},${cy} A ${r},${r} 0 1,0 ${cx - r},${cy} Z`;
|
|
17
|
+
}
|
|
18
|
+
const angle = (p / 100) * 2 * Math.PI;
|
|
19
|
+
const endX = cx + r * Math.sin(angle);
|
|
20
|
+
const endY = cy - r * Math.cos(angle);
|
|
21
|
+
const largeArc = p > 50 ? 1 : 0;
|
|
22
|
+
return `M ${cx},${cy} L ${cx},${cy - r} A ${r},${r} 0 ${largeArc},1 ${endX},${endY} Z`;
|
|
23
|
+
};
|
|
24
|
+
const formatRemaining = (ms) => {
|
|
25
|
+
const totalSeconds = Math.max(1, Math.ceil(ms / 1000));
|
|
26
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
27
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
28
|
+
const seconds = totalSeconds % 60;
|
|
29
|
+
if (hours > 0)
|
|
30
|
+
return `${hours}h ${minutes}m`;
|
|
31
|
+
if (minutes > 0)
|
|
32
|
+
return `${minutes}m ${seconds}s`;
|
|
33
|
+
return `${seconds}s`;
|
|
34
|
+
};
|
|
35
|
+
const attachmentId = (a) => a?.id;
|
|
36
|
+
/**
|
|
37
|
+
* A single post-composer attachment, mirroring the Svelte `AttachmentContainer`:
|
|
38
|
+
* shows a pie overlay for the byte-upload phase, then for the server-side
|
|
39
|
+
* processing phase (SSE), a failed state, and finally the preview with a
|
|
40
|
+
* remove affordance.
|
|
41
|
+
*/
|
|
42
|
+
export function AttachmentCard({ item, onUploaded, onProcessed, onFailed, onRemove, onUpdate, }) {
|
|
43
|
+
const t = useT();
|
|
44
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
45
|
+
const { state, upload, abort } = openpeepsApi.useMediaUpload();
|
|
46
|
+
const [editing, setEditing] = useState(false);
|
|
47
|
+
const att = item.attachment;
|
|
48
|
+
const uploading = !!item.file && !att && !item.failed;
|
|
49
|
+
const processing = !item.failed && att?.status === 'processing';
|
|
50
|
+
const failed = !!item.failed;
|
|
51
|
+
const showOverlay = uploading || processing;
|
|
52
|
+
const showEdit = !showOverlay && !failed && !!att;
|
|
53
|
+
// Abort an in-flight byte upload if the card unmounts (e.g. the composer is
|
|
54
|
+
// dismissed) so the request doesn't linger, mirroring the Svelte
|
|
55
|
+
// `abortUploadsForAttachments` onDestroy cleanup.
|
|
56
|
+
const abortRef = useRef(abort);
|
|
57
|
+
abortRef.current = abort;
|
|
58
|
+
useEffect(() => () => abortRef.current(), []);
|
|
59
|
+
// --- Upload phase: run the byte transfer once, report up. -----------------
|
|
60
|
+
const startedRef = useRef(false);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (startedRef.current || !item.file)
|
|
63
|
+
return;
|
|
64
|
+
startedRef.current = true;
|
|
65
|
+
upload({
|
|
66
|
+
file: item.file,
|
|
67
|
+
usage: item.usage,
|
|
68
|
+
description: item.description ?? item.file.name,
|
|
69
|
+
})
|
|
70
|
+
.then((attachment) => onUploaded(item.key, attachment))
|
|
71
|
+
.catch((err) => onFailed(item.key, err instanceof Error ? err.message : undefined));
|
|
72
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
|
+
}, [item.file]);
|
|
74
|
+
// --- Processing phase: subscribe to the SSE feed while processing. --------
|
|
75
|
+
const processingId = processing ? attachmentId(att) : undefined;
|
|
76
|
+
const event = openpeepsApi.useMediaProgress(processingId);
|
|
77
|
+
const reportedRef = useRef(undefined);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
const data = event?.mediaAttachment;
|
|
80
|
+
if (!data || !processingId)
|
|
81
|
+
return;
|
|
82
|
+
if (data.status === 'processing')
|
|
83
|
+
return;
|
|
84
|
+
if (reportedRef.current === processingId)
|
|
85
|
+
return;
|
|
86
|
+
reportedRef.current = processingId;
|
|
87
|
+
if (data.status === 'failed') {
|
|
88
|
+
onFailed(item.key, data.error);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
onProcessed(item.key, { ...att, ...data, type: att?.type ?? data.type });
|
|
92
|
+
}
|
|
93
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
94
|
+
}, [event?.mediaAttachment?.status, processingId]);
|
|
95
|
+
const piePercent = uploading
|
|
96
|
+
? Math.max(0, Math.min(100, state.uploadPercent))
|
|
97
|
+
: Math.min(95, Math.max(0, event?.progressPercent ?? 0));
|
|
98
|
+
const etaMs = uploading
|
|
99
|
+
? state.uploadEstimatedRemainingMs
|
|
100
|
+
: event?.estimatedRemainingMs;
|
|
101
|
+
const phaseLabel = uploading
|
|
102
|
+
? t('form.upload.uploading', { defaultValue: 'Uploading' })
|
|
103
|
+
: t('form.upload.processing', { defaultValue: 'Processing' });
|
|
104
|
+
const remove = () => {
|
|
105
|
+
abort();
|
|
106
|
+
onRemove(item.key);
|
|
107
|
+
};
|
|
108
|
+
const previewUrl = resolveAttachmentPreviewUrl(item.previewUrl, att);
|
|
109
|
+
const isImage = (att?.type ?? (item.file?.type.startsWith('image/') ? 'image' : '')) ===
|
|
110
|
+
'image';
|
|
111
|
+
const isVideo = (att?.type ?? (item.file?.type.startsWith('video/') ? 'video' : '')) ===
|
|
112
|
+
'video';
|
|
113
|
+
return (_jsxs("div", { className: "relative aspect-square w-full overflow-hidden rounded-md border", children: [!failed ? (_jsxs("div", { className: "absolute right-1 top-1 z-20 flex gap-1", children: [showEdit ? (_jsx("button", { type: "button", title: t('posts.attachments.editTitle', {
|
|
114
|
+
defaultValue: 'Edit description',
|
|
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
|
+
defaultValue: 'Delete attachment',
|
|
117
|
+
}), onClick: remove, className: "bg-background/80 rounded-full p-1", children: _jsx(X, { className: "size-4" }) })] })) : null, showEdit && att ? (_jsx(DescriptionEditModal, { attachment: att, open: editing, onClose: () => setEditing(false), onSave: (description) => onUpdate(item.key, { ...att, description }) })) : null, showOverlay ? (_jsxs("div", { "data-testid": "attachment-progress", className: "bg-surface-700 absolute inset-0 z-10 flex flex-col items-center justify-center gap-1 text-white", children: [_jsxs("svg", { viewBox: "0 0 36 36", className: "h-16 w-16", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(piePercent), children: [_jsx("circle", { cx: PIE.cx, cy: PIE.cy, r: PIE.r, fill: "rgba(255,255,255,0.25)" }), piePath(piePercent) ? (_jsx("path", { d: piePath(piePercent), fill: "white" })) : null, _jsxs("text", { x: PIE.cx, y: PIE.cy + 1, textAnchor: "middle", dominantBaseline: "middle", fontSize: "8", fontWeight: "600", fill: "rgb(30 41 59)", children: [Math.round(piePercent), "%"] })] }), _jsx("span", { className: "text-xs font-medium uppercase tracking-wide", children: phaseLabel }), etaMs !== undefined && etaMs > 1000 ? (_jsxs("span", { className: "text-xs opacity-80", children: ["~", formatRemaining(etaMs)] })) : null] })) : null, failed ? (_jsxs("div", { "data-testid": "attachment-failed", className: "bg-error absolute inset-0 z-30 flex flex-col items-center justify-center gap-2 text-white", children: [_jsx("span", { className: "text-sm font-semibold", children: t('posts.attachments.failed', { defaultValue: 'Upload failed' }) }), _jsx("button", { type: "button", onClick: remove, title: t('posts.attachments.deleteTitle', {
|
|
118
|
+
defaultValue: 'Delete attachment',
|
|
119
|
+
}), className: "bg-surface-50 text-error-700 hover:bg-surface-200 rounded-full p-3", children: _jsx(X, { className: "size-8" }) })] })) : null, showOverlay || failed ? (_jsx("div", { className: "bg-surface-200 h-full w-full" })) : isImage || isVideo ? (_jsxs("div", { className: "relative h-full w-full", children: [_jsx("img", { src: previewUrl, alt: att?.description ?? '', className: "h-full w-full object-cover" }), _jsx(VideoPlayOverlay, { video: isVideo })] })) : (_jsx("div", { className: "flex h-full w-full items-center justify-center p-2", children: _jsx("p", { className: "truncate text-xs", children: att?.filename ?? item.file?.name ?? 'File' }) }))] }));
|
|
120
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { MediaAttachmentData } from '@openpeepshq/common';
|
|
3
|
+
export interface ComposeAttachmentsProps {
|
|
4
|
+
attachments: MediaAttachmentData[];
|
|
5
|
+
onChange: (attachments: MediaAttachmentData[]) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ComposeAttachmentsApi {
|
|
8
|
+
openImagePicker: () => void;
|
|
9
|
+
openDocumentPicker: () => void;
|
|
10
|
+
/** True while any attachment is still uploading or processing. */
|
|
11
|
+
pending: boolean;
|
|
12
|
+
/** Attachment cards — render where the previews should appear. */
|
|
13
|
+
previews: ReactNode;
|
|
14
|
+
/** Hidden file inputs + image cropper — render once anywhere in the tree. */
|
|
15
|
+
inputs: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Owns the attachment list and its upload lifecycle. Each item is shown
|
|
19
|
+
* immediately as a card with byte-upload and server-processing progress
|
|
20
|
+
* (mirrors the Svelte `Attachments` + `AttachmentContainer`), and only ready
|
|
21
|
+
* attachments are reported back via `onChange`. Exposes the toolbar pickers and
|
|
22
|
+
* preview grid separately so callers can lay them out independently.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useComposeAttachments({ attachments, onChange, }: ComposeAttachmentsProps): ComposeAttachmentsApi;
|
|
25
|
+
export declare function ComposeAttachments(props: ComposeAttachmentsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Image, Paperclip } from 'lucide-react';
|
|
4
|
+
import { useT } from '../../../i18n/index.js';
|
|
5
|
+
import { ImageEditModal } from '../../form/ImageEditModal.js';
|
|
6
|
+
import { convertToWebpIfHeic } from '../../../lib/canvasUtils.js';
|
|
7
|
+
import { AttachmentCard } from './AttachmentCard.js';
|
|
8
|
+
import { isBlobUrl, revokeBlobUrl } from '../attachmentPreview.js';
|
|
9
|
+
function usageForFile(file) {
|
|
10
|
+
if (file.type.startsWith('image/'))
|
|
11
|
+
return 'post-image';
|
|
12
|
+
if (file.type.startsWith('video/') || file.name.endsWith('.mkv'))
|
|
13
|
+
return 'post-video';
|
|
14
|
+
return 'post-document';
|
|
15
|
+
}
|
|
16
|
+
const newKey = () => typeof crypto !== 'undefined' && 'randomUUID' in crypto
|
|
17
|
+
? crypto.randomUUID()
|
|
18
|
+
: `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
19
|
+
const readyItem = (attachment) => ({
|
|
20
|
+
key: newKey(),
|
|
21
|
+
usage: attachment.meta?.usage ?? 'unknown',
|
|
22
|
+
attachment,
|
|
23
|
+
previewUrl: attachment.previewUrl ?? attachment.url ?? undefined,
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Owns the attachment list and its upload lifecycle. Each item is shown
|
|
27
|
+
* immediately as a card with byte-upload and server-processing progress
|
|
28
|
+
* (mirrors the Svelte `Attachments` + `AttachmentContainer`), and only ready
|
|
29
|
+
* attachments are reported back via `onChange`. Exposes the toolbar pickers and
|
|
30
|
+
* preview grid separately so callers can lay them out independently.
|
|
31
|
+
*/
|
|
32
|
+
export function useComposeAttachments({ attachments, onChange, }) {
|
|
33
|
+
const imageInputRef = useRef(null);
|
|
34
|
+
const documentInputRef = useRef(null);
|
|
35
|
+
const [pendingImage, setPendingImage] = useState(null);
|
|
36
|
+
// `attachments` seeds the list once; thereafter the items are the source of
|
|
37
|
+
// truth (so in-flight upload/processing state isn't clobbered by re-renders).
|
|
38
|
+
const [items, setItems] = useState(() => attachments.map(readyItem));
|
|
39
|
+
// Report only ready attachments upward; uploading/processing/failed ones stay
|
|
40
|
+
// local until they resolve (matching the Svelte submit-gating model).
|
|
41
|
+
const onChangeRef = useRef(onChange);
|
|
42
|
+
onChangeRef.current = onChange;
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const ready = items
|
|
45
|
+
.filter((i) => i.attachment && !i.failed && i.attachment.status !== 'processing')
|
|
46
|
+
.map((i) => i.attachment);
|
|
47
|
+
onChangeRef.current(ready);
|
|
48
|
+
}, [items]);
|
|
49
|
+
const enqueue = (file, usage, description, previewUrl) => {
|
|
50
|
+
setItems((prev) => [
|
|
51
|
+
...prev,
|
|
52
|
+
{ key: newKey(), file, usage, description, previewUrl },
|
|
53
|
+
]);
|
|
54
|
+
};
|
|
55
|
+
const enqueueFile = (file) => {
|
|
56
|
+
const usage = usageForFile(file);
|
|
57
|
+
const previewUrl = file.type.startsWith('image/') || file.type.startsWith('video/')
|
|
58
|
+
? URL.createObjectURL(file)
|
|
59
|
+
: undefined;
|
|
60
|
+
enqueue(file, usage, usage === 'post-document' ? file.name : undefined, previewUrl);
|
|
61
|
+
};
|
|
62
|
+
const handleImageSelected = async (file) => {
|
|
63
|
+
const processed = await convertToWebpIfHeic(file);
|
|
64
|
+
if (processed.type.startsWith('image/')) {
|
|
65
|
+
setPendingImage({
|
|
66
|
+
file: processed,
|
|
67
|
+
previewUrl: URL.createObjectURL(processed),
|
|
68
|
+
});
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
enqueueFile(processed);
|
|
72
|
+
};
|
|
73
|
+
const onUploaded = (key, attachment) => setItems((prev) => prev.map((i) => {
|
|
74
|
+
if (i.key !== key)
|
|
75
|
+
return i;
|
|
76
|
+
const previewUrl = attachment.previewUrl ?? i.previewUrl;
|
|
77
|
+
if (attachment.previewUrl && isBlobUrl(i.previewUrl)) {
|
|
78
|
+
revokeBlobUrl(i.previewUrl);
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
...i,
|
|
82
|
+
file: undefined,
|
|
83
|
+
attachment,
|
|
84
|
+
previewUrl,
|
|
85
|
+
};
|
|
86
|
+
}));
|
|
87
|
+
const onProcessed = (key, attachment) => setItems((prev) => prev.map((i) => {
|
|
88
|
+
if (i.key !== key)
|
|
89
|
+
return i;
|
|
90
|
+
if (attachment.previewUrl && isBlobUrl(i.previewUrl)) {
|
|
91
|
+
revokeBlobUrl(i.previewUrl);
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
...i,
|
|
95
|
+
attachment,
|
|
96
|
+
previewUrl: attachment.previewUrl ?? undefined,
|
|
97
|
+
};
|
|
98
|
+
}));
|
|
99
|
+
const onFailed = (key, error) => setItems((prev) => prev.map((i) => (i.key === key ? { ...i, failed: true, error } : i)));
|
|
100
|
+
const onRemove = (key) => setItems((prev) => prev.filter((i) => i.key !== key));
|
|
101
|
+
const onUpdate = (key, attachment) => setItems((prev) => prev.map((i) => (i.key === key ? { ...i, attachment } : i)));
|
|
102
|
+
const pending = items.some((i) => (i.file && !i.attachment && !i.failed) ||
|
|
103
|
+
i.attachment?.status === 'processing');
|
|
104
|
+
const previews = items.length > 0 ? (_jsx("div", { className: "grid grid-cols-2 gap-2", children: items.map((item) => (_jsx(AttachmentCard, { item: item, onUploaded: onUploaded, onProcessed: onProcessed, onFailed: onFailed, onRemove: onRemove, onUpdate: onUpdate }, item.key))) })) : null;
|
|
105
|
+
const inputs = (_jsxs(_Fragment, { children: [_jsx("input", { ref: imageInputRef, type: "file", accept: "image/*,video/*,.mkv", className: "hidden", onChange: (e) => {
|
|
106
|
+
const file = e.target.files?.[0];
|
|
107
|
+
if (file)
|
|
108
|
+
void handleImageSelected(file);
|
|
109
|
+
e.target.value = '';
|
|
110
|
+
} }), _jsx("input", { ref: documentInputRef, type: "file", accept: ".pdf,.doc,.docx,.txt,.md,.csv", className: "hidden", onChange: (e) => {
|
|
111
|
+
const file = e.target.files?.[0];
|
|
112
|
+
if (file)
|
|
113
|
+
enqueueFile(file);
|
|
114
|
+
e.target.value = '';
|
|
115
|
+
} }), pendingImage ? (_jsx(ImageEditModal, { file: pendingImage.file, previewUrl: pendingImage.previewUrl, open: true, onClose: () => {
|
|
116
|
+
URL.revokeObjectURL(pendingImage.previewUrl);
|
|
117
|
+
setPendingImage(null);
|
|
118
|
+
}, onConfirm: (file, description) => {
|
|
119
|
+
URL.revokeObjectURL(pendingImage.previewUrl);
|
|
120
|
+
setPendingImage(null);
|
|
121
|
+
enqueue(file, 'post-image', description, URL.createObjectURL(file));
|
|
122
|
+
} })) : null] }));
|
|
123
|
+
return {
|
|
124
|
+
openImagePicker: () => imageInputRef.current?.click(),
|
|
125
|
+
openDocumentPicker: () => documentInputRef.current?.click(),
|
|
126
|
+
pending,
|
|
127
|
+
previews,
|
|
128
|
+
inputs,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
export function ComposeAttachments(props) {
|
|
132
|
+
const t = useT();
|
|
133
|
+
const { openImagePicker, openDocumentPicker, previews, inputs } = useComposeAttachments(props);
|
|
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
|
+
defaultValue: 'Add image or video',
|
|
136
|
+
}), onClick: openImagePicker, className: "hover:bg-surface-200 rounded-md p-2", children: _jsx(Image, { className: "size-5" }) }), _jsx("button", { type: "button", title: t('posts.form.addDocument', { defaultValue: 'Add document' }), onClick: openDocumentPicker, className: "hover:bg-surface-200 rounded-md p-2", children: _jsx(Paperclip, { className: "size-5" }) })] }), previews, inputs] }));
|
|
137
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { extractUrlsFromText } from '../../preview-link/helpers.js';
|
|
3
|
+
import { PreviewLink } from '../../preview-link/PreviewLink.js';
|
|
4
|
+
export function ComposePreviewLinks({ content }) {
|
|
5
|
+
const urls = extractUrlsFromText(content);
|
|
6
|
+
if (urls.length === 0)
|
|
7
|
+
return null;
|
|
8
|
+
return (_jsx("div", { className: "my-2 min-w-0 space-y-2", children: urls.map((url) => (_jsx(PreviewLink, { url: url.replace(/[),.]+$/, '') }, url))) }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MediaAttachmentData } from '@openpeepshq/common/types';
|
|
2
|
+
export interface DescriptionEditModalProps {
|
|
3
|
+
attachment: MediaAttachmentData;
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onSave: (description: string) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Edit an already-uploaded attachment's alt text / description, mirroring the
|
|
10
|
+
* Svelte `DescriptionEditModal`. Used by the composer to add accessibility text
|
|
11
|
+
* to images and documents after they finish uploading.
|
|
12
|
+
*/
|
|
13
|
+
export declare function DescriptionEditModal({ attachment, open, onClose, onSave, }: DescriptionEditModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, Label, Textarea, } from '@openpeepshq/react-ui';
|
|
4
|
+
import { useT } from '../../../i18n/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Edit an already-uploaded attachment's alt text / description, mirroring the
|
|
7
|
+
* Svelte `DescriptionEditModal`. Used by the composer to add accessibility text
|
|
8
|
+
* to images and documents after they finish uploading.
|
|
9
|
+
*/
|
|
10
|
+
export function DescriptionEditModal({ attachment, open, onClose, onSave, }) {
|
|
11
|
+
const t = useT();
|
|
12
|
+
const [description, setDescription] = useState(attachment.description ?? '');
|
|
13
|
+
const saveAndClose = () => {
|
|
14
|
+
onSave(description.trim());
|
|
15
|
+
onClose();
|
|
16
|
+
};
|
|
17
|
+
return (_jsx(Dialog, { open: open, onOpenChange: (next) => !next && onClose(), children: _jsxs(DialogContent, { className: "max-w-lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('form.uploadEditModal.description.title', {
|
|
18
|
+
defaultValue: 'Edit description',
|
|
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
|
+
defaultValue: 'Describe this attachment for accessibility',
|
|
21
|
+
}) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-ringed-primary", action: onClose, children: t('common.back', { defaultValue: 'Back' }) }), _jsx(Button, { variant: "variant-filled-primary", action: saveAndClose, children: t('common.done', { defaultValue: 'Done' }) })] })] }) }));
|
|
22
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
4
|
+
import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
|
|
5
|
+
import { useT } from '../../../i18n/index.js';
|
|
6
|
+
import { OpenpeepsMarkdown } from '../../markdown/OpenpeepsMarkdown.js';
|
|
7
|
+
import { ComposeAttachments } from './ComposeAttachments.js';
|
|
8
|
+
import { ComposePreviewLinks } from './ComposePreviewLinks.js';
|
|
9
|
+
import { OpenpeepsMarkdownInput } from './OpenpeepsMarkdownInput.js';
|
|
10
|
+
import { PollComposerFields } from './PollComposerFields.js';
|
|
11
|
+
const toDatetimeLocal = (iso) => {
|
|
12
|
+
if (!iso)
|
|
13
|
+
return '';
|
|
14
|
+
const d = new Date(iso);
|
|
15
|
+
if (Number.isNaN(d.getTime()))
|
|
16
|
+
return '';
|
|
17
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
18
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
19
|
+
};
|
|
20
|
+
export function EditPostModal({ post, onClose }) {
|
|
21
|
+
const t = useT();
|
|
22
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
23
|
+
const updatePost = openpeepsApi.updatePostAction({ id: post.id });
|
|
24
|
+
const [data, setData] = useState(post.data);
|
|
25
|
+
const [submitting, setSubmitting] = useState(false);
|
|
26
|
+
const [error, setError] = useState(null);
|
|
27
|
+
const publish = async () => {
|
|
28
|
+
setError(null);
|
|
29
|
+
setSubmitting(true);
|
|
30
|
+
try {
|
|
31
|
+
await updatePost(data);
|
|
32
|
+
onClose();
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
setError(err.message);
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
setSubmitting(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const setContent = (content) => {
|
|
42
|
+
if (data.type === 'note' || data.type === 'question') {
|
|
43
|
+
setData({ ...data, content });
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const setAttachments = (attachments) => {
|
|
47
|
+
if (data.type === 'note' || data.type === 'question') {
|
|
48
|
+
setData({ ...data, attachments });
|
|
49
|
+
}
|
|
50
|
+
};
|
|
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
|
+
const canSave = useMemo(() => {
|
|
57
|
+
if (data.type === 'question') {
|
|
58
|
+
return content.trim().length > 0 && validPollOptions.length >= 2;
|
|
59
|
+
}
|
|
60
|
+
if (data.type === 'note') {
|
|
61
|
+
return content.trim().length > 0 || (data.attachments?.length ?? 0) > 0;
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}, [content, data, validPollOptions.length]);
|
|
65
|
+
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
|
+
...data,
|
|
67
|
+
options: options.map((text) => ({
|
|
68
|
+
type: 'note',
|
|
69
|
+
content: text,
|
|
70
|
+
})),
|
|
71
|
+
}), expiresAt: toDatetimeLocal(data.expiresAt), onExpiresAtChange: (value) => setData({
|
|
72
|
+
...data,
|
|
73
|
+
expiresAt: value ? new Date(value).toISOString() : undefined,
|
|
74
|
+
}), multiple: data.multiple, onMultipleChange: (value) => setData({ ...data, multiple: value }), votersVisible: data.votersVisible, onVotersVisibleChange: (value) => setData({ ...data, votersVisible: value }) })] })) : data.type === 'note' ? (_jsxs(_Fragment, { children: [_jsx(OpenpeepsMarkdownInput, { rows: 6, value: content, onChange: setContent }), _jsx(ComposePreviewLinks, { content: content }), _jsx(ComposeAttachments, { attachments: data.attachments ?? [], onChange: setAttachments })] })) : (_jsx(OpenpeepsMarkdown, { source: data.type === 'article'
|
|
75
|
+
? data.content
|
|
76
|
+
: data.type === 'event'
|
|
77
|
+
? data.content
|
|
78
|
+
: '', mentions: post.mentions })), error ? _jsx("p", { className: "text-error text-sm", children: error }) : null, _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-ghost-primary", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "variant-filled-primary", action: publish, disabled: submitting || !canSave, children: submitting
|
|
79
|
+
? t('common.saving', { defaultValue: 'Saving…' })
|
|
80
|
+
: t('common.save', { defaultValue: 'Save' }) })] })] }) }));
|
|
81
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { PublicPost } from '@openpeepshq/common/types';
|
|
3
|
+
interface EditPostModalContextValue {
|
|
4
|
+
openEditPost: (post: PublicPost) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function EditPostModalProvider({ children }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function useEditPostModal(): EditPostModalContextValue;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useState, } from 'react';
|
|
3
|
+
import { EditPostModal } from './EditPostModal.js';
|
|
4
|
+
const EditPostModalContext = createContext(null);
|
|
5
|
+
export function EditPostModalProvider({ children }) {
|
|
6
|
+
const [post, setPost] = useState();
|
|
7
|
+
const openEditPost = useCallback((next) => {
|
|
8
|
+
setPost(next);
|
|
9
|
+
}, []);
|
|
10
|
+
return (_jsxs(EditPostModalContext.Provider, { value: { openEditPost }, children: [children, post ? (_jsx(EditPostModal, { post: post, onClose: () => setPost(undefined) })) : null] }));
|
|
11
|
+
}
|
|
12
|
+
export function useEditPostModal() {
|
|
13
|
+
const ctx = useContext(EditPostModalContext);
|
|
14
|
+
if (!ctx) {
|
|
15
|
+
throw new Error('useEditPostModal must be used within EditPostModalProvider');
|
|
16
|
+
}
|
|
17
|
+
return ctx;
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PostCreationData } from '@openpeepshq/common/types';
|
|
2
|
+
export interface EventFormProps {
|
|
3
|
+
postData: PostCreationData;
|
|
4
|
+
onChange: (data: PostCreationData) => void;
|
|
5
|
+
isEdit?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function EventForm({ postData, onChange, isEdit, }: EventFormProps): import("react/jsx-runtime").JSX.Element;
|