@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,13 @@
|
|
|
1
|
+
export interface HeaderAvatarInputProps {
|
|
2
|
+
header?: string;
|
|
3
|
+
avatar?: string;
|
|
4
|
+
onHeaderChange: (url: string | null) => void;
|
|
5
|
+
onAvatarChange: (url: string | null) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Translation of `form/HeaderAvatarInput.svelte`: a full-width cover banner
|
|
9
|
+
* (forced 3:1 crop) with the round avatar picker overhanging its lower-left
|
|
10
|
+
* corner. Both reuse the shared `ImageInput` so the upload/crop flow matches
|
|
11
|
+
* the Svelte UI.
|
|
12
|
+
*/
|
|
13
|
+
export declare function HeaderAvatarInput({ header, avatar, onHeaderChange, onAvatarChange, }: HeaderAvatarInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PROFILE_GROUP_HEADER_ASPECT_RATIO } from '@openpeepshq/common/lib';
|
|
3
|
+
import { useT } from '../../i18n/index.js';
|
|
4
|
+
import { ImageInput } from './ImageInput.js';
|
|
5
|
+
/**
|
|
6
|
+
* Translation of `form/HeaderAvatarInput.svelte`: a full-width cover banner
|
|
7
|
+
* (forced 3:1 crop) with the round avatar picker overhanging its lower-left
|
|
8
|
+
* corner. Both reuse the shared `ImageInput` so the upload/crop flow matches
|
|
9
|
+
* the Svelte UI.
|
|
10
|
+
*/
|
|
11
|
+
export function HeaderAvatarInput({ header, avatar, onHeaderChange, onAvatarChange, }) {
|
|
12
|
+
const t = useT();
|
|
13
|
+
return (_jsxs("div", { className: "relative mb-16 w-full", children: [_jsx(ImageInput, { usage: "header-image", url: header, onChange: (url) => onHeaderChange(url ?? null), aspectRatio: PROFILE_GROUP_HEADER_ASPECT_RATIO, showAltInput: false, text: t('form.headerAvatarInput.coverImage', {
|
|
14
|
+
defaultValue: 'Cover image',
|
|
15
|
+
}), specsText: t('form.headerAvatarInput.coverImageDescription') }), _jsx("div", { className: "absolute -bottom-12 left-4", children: _jsx(ImageInput, { usage: "avatar-image", displayType: "avatar", url: avatar, onChange: (url) => onAvatarChange(url ?? null), showAltInput: false }) })] }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface ImageEditModalProps {
|
|
2
|
+
file: File;
|
|
3
|
+
previewUrl: string;
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onConfirm: (file: File, description: string) => void;
|
|
7
|
+
/** When false, skip alt-text input (profile/group avatars). */
|
|
8
|
+
showAltInput?: boolean;
|
|
9
|
+
/** Round mask for avatar crops. */
|
|
10
|
+
cropShape?: 'rect' | 'round';
|
|
11
|
+
/**
|
|
12
|
+
* Fixed crop ratio as `"w:h"` (e.g. `"3:1"`, `"16:9"`). Combined with
|
|
13
|
+
* `showSelectAspectRatio={false}` this forces the crop to that ratio and
|
|
14
|
+
* hides the ratio picker, mirroring the Svelte fixed-aspect mode.
|
|
15
|
+
*/
|
|
16
|
+
aspectRatio?: string;
|
|
17
|
+
/**
|
|
18
|
+
* When true, show the ratio picker (free crop). Defaults to false, matching
|
|
19
|
+
* the Svelte modal: a supplied `aspectRatio` is then a forced crop.
|
|
20
|
+
*/
|
|
21
|
+
showSelectAspectRatio?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function ImageEditModal({ file, previewUrl, open, onClose, onConfirm, showAltInput, cropShape, aspectRatio, showSelectAspectRatio, }: ImageEditModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
import Cropper, {} from 'react-easy-crop';
|
|
4
|
+
import { Badge, Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, Label, Textarea, } from '@openpeepshq/react-ui';
|
|
5
|
+
import { useT } from '../../i18n/index.js';
|
|
6
|
+
import { convertToWebpIfHeic, getCroppedImg } from '../../lib/canvasUtils.js';
|
|
7
|
+
const parseAspectRatio = (ratio) => {
|
|
8
|
+
if (!ratio)
|
|
9
|
+
return undefined;
|
|
10
|
+
const [w, h] = ratio.split(':').map(Number);
|
|
11
|
+
return w && h ? w / h : undefined;
|
|
12
|
+
};
|
|
13
|
+
const ASPECT_RATIOS = [
|
|
14
|
+
{ label: 'Original', value: undefined },
|
|
15
|
+
{ label: '1:1', value: 1 },
|
|
16
|
+
{ label: '4:3', value: 4 / 3 },
|
|
17
|
+
{ label: '16:9', value: 16 / 9 },
|
|
18
|
+
{ label: '3:4', value: 3 / 4 },
|
|
19
|
+
{ label: '9:16', value: 9 / 16 },
|
|
20
|
+
];
|
|
21
|
+
const SQUARE_ASPECT_INDEX = ASPECT_RATIOS.findIndex((r) => r.value === 1);
|
|
22
|
+
export function ImageEditModal({ file, previewUrl, open, onClose, onConfirm, showAltInput = true, cropShape = 'rect', aspectRatio, showSelectAspectRatio = false, }) {
|
|
23
|
+
const t = useT();
|
|
24
|
+
const fixedAspect = parseAspectRatio(aspectRatio);
|
|
25
|
+
// Fixed-aspect mode: a ratio was given and the caller doesn't want a picker.
|
|
26
|
+
const fixedAspectMode = cropShape === 'round' ||
|
|
27
|
+
(fixedAspect !== undefined && !showSelectAspectRatio);
|
|
28
|
+
const [description, setDescription] = useState('');
|
|
29
|
+
const [aspectIndex, setAspectIndex] = useState(cropShape === 'round' && SQUARE_ASPECT_INDEX >= 0 ? SQUARE_ASPECT_INDEX : 0);
|
|
30
|
+
const [crop, setCrop] = useState({ x: 0, y: 0 });
|
|
31
|
+
const [zoom, setZoom] = useState(1);
|
|
32
|
+
const [croppedAreaPixels, setCroppedAreaPixels] = useState(null);
|
|
33
|
+
const [submitting, setSubmitting] = useState(false);
|
|
34
|
+
const aspect = cropShape === 'round'
|
|
35
|
+
? 1
|
|
36
|
+
: fixedAspectMode
|
|
37
|
+
? fixedAspect
|
|
38
|
+
: ASPECT_RATIOS[aspectIndex]?.value;
|
|
39
|
+
const onCropComplete = useCallback((_, pixels) => {
|
|
40
|
+
setCroppedAreaPixels(pixels);
|
|
41
|
+
}, []);
|
|
42
|
+
const confirm = async () => {
|
|
43
|
+
setSubmitting(true);
|
|
44
|
+
try {
|
|
45
|
+
let processed = await convertToWebpIfHeic(file);
|
|
46
|
+
// "Original" (no aspect) leaves the image untouched; crop only when a
|
|
47
|
+
// fixed ratio or round mask is selected.
|
|
48
|
+
if (croppedAreaPixels && (aspect || cropShape === 'round')) {
|
|
49
|
+
processed = await getCroppedImg(processed, croppedAreaPixels);
|
|
50
|
+
}
|
|
51
|
+
onConfirm(processed, description.trim());
|
|
52
|
+
onClose();
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
setSubmitting(false);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
// "Original" (no fixed aspect, rectangular) shows the untouched image; any
|
|
59
|
+
// ratio or the round mask switches to the interactive cropper.
|
|
60
|
+
const isCropping = !!aspect || cropShape === 'round';
|
|
61
|
+
const showAspectRatio = cropShape !== 'round' && !fixedAspectMode;
|
|
62
|
+
// Mirror the Svelte modal: the cropper shares a row with the crop-ratio /
|
|
63
|
+
// alt-text controls so the dialog stays short. With no side controls (e.g.
|
|
64
|
+
// round avatar crops) the cropper spans the full width.
|
|
65
|
+
const hasSidebar = showAspectRatio || showAltInput;
|
|
66
|
+
return (_jsx(Dialog, { open: open, onOpenChange: (next) => !next && onClose(), children: _jsxs(DialogContent, { className: "max-h-[90vh] max-w-2xl overflow-y-auto", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('posts.form.editImage', { defaultValue: 'Edit image' }) }) }), _jsxs("div", { className: "flex flex-col gap-4 sm:flex-row", children: [_jsxs("div", { className: hasSidebar ? 'sm:w-1/2' : 'w-full', children: [_jsx("div", { className: "relative h-52 w-full overflow-hidden rounded-md bg-black", children: isCropping ? (_jsx(Cropper, { image: previewUrl, crop: crop, zoom: zoom, aspect: aspect, cropShape: cropShape, showGrid: !!aspect, onCropChange: setCrop, onZoomChange: setZoom, onCropComplete: onCropComplete })) : (_jsx("img", { src: previewUrl, alt: "", className: "h-full w-full object-contain" })) }), isCropping ? (_jsxs("div", { className: "mt-2 space-y-1", children: [_jsx(Label, { htmlFor: "zoom-range", children: t('posts.form.zoom', { defaultValue: 'Zoom' }) }), _jsx("input", { id: "zoom-range", type: "range", min: 1, max: 3, step: 0.05, value: zoom, onChange: (e) => setZoom(Number(e.target.value)), className: "w-full" })] })) : null] }), hasSidebar ? (_jsxs("div", { className: "space-y-3 sm:w-1/2", children: [showAspectRatio ? (_jsxs("div", { className: "space-y-1", children: [_jsx("div", { className: "text-sm font-medium", children: t('posts.form.aspectRatio', {
|
|
67
|
+
defaultValue: 'Crop ratio',
|
|
68
|
+
}) }), _jsx("div", { className: "flex flex-wrap gap-2", children: ASPECT_RATIOS.map((item, index) => (_jsx("button", { type: "button", title: item.label, onClick: () => setAspectIndex(index), children: _jsx(Badge, { status: item.label, variant: aspectIndex === index
|
|
69
|
+
? 'variant-filled-primary'
|
|
70
|
+
: 'variant-ghost-primary' }) }, item.label))) })] })) : null, showAltInput ? (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "alt-text", children: t('common.media.altText', { defaultValue: 'Alt text' }) }), _jsx(Textarea, { id: "alt-text", rows: 3, value: description, onChange: (e) => setDescription(e.target.value), placeholder: t('common.media.altTextDescription', {
|
|
71
|
+
defaultValue: 'Describe the image for accessibility',
|
|
72
|
+
}) })] })) : null] })) : 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: confirm, disabled: submitting, children: submitting
|
|
73
|
+
? t('common.uploading', { defaultValue: 'Uploading…' })
|
|
74
|
+
: t('common.add', { defaultValue: 'Add' }) })] })] }) }));
|
|
75
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface ImageInputProps {
|
|
2
|
+
usage: string;
|
|
3
|
+
url?: string;
|
|
4
|
+
onChange: (url: string | undefined) => void;
|
|
5
|
+
/** Bold call-to-action shown in the empty state. */
|
|
6
|
+
text?: string;
|
|
7
|
+
/** Smaller hint shown below the call-to-action. */
|
|
8
|
+
specsText?: string;
|
|
9
|
+
/** Show the alt-text field inside the crop modal. */
|
|
10
|
+
showAltInput?: boolean;
|
|
11
|
+
/** Extra classes for the drop-zone (e.g. aspect ratio overrides). */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** When true, show the full image (contain) instead of cropping to cover. */
|
|
14
|
+
showFullImage?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* `full` is the dashed banner drop-zone; `avatar` is a round picker with a
|
|
17
|
+
* camera badge (mirrors the Svelte `displayType`).
|
|
18
|
+
*/
|
|
19
|
+
displayType?: 'full' | 'avatar';
|
|
20
|
+
/** Fixed crop ratio (`"w:h"`) forwarded to the crop modal. */
|
|
21
|
+
aspectRatio?: string;
|
|
22
|
+
/** Show the crop-ratio picker in the modal (free crop). */
|
|
23
|
+
showSelectAspectRatio?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Image picker mirroring the Svelte `ImageInput`. `displayType="full"` is a
|
|
27
|
+
* dashed box that prompts for an upload when empty and shows the image as a
|
|
28
|
+
* cover with replace/remove controls once set; `displayType="avatar"` is a
|
|
29
|
+
* round picker with a camera badge. Cropping happens in `ImageEditModal`; the
|
|
30
|
+
* cropped file is uploaded and the resulting URL is reported via `onChange`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function ImageInput({ usage, url, onChange, text, specsText, showAltInput, className, showFullImage, displayType, aspectRatio, showSelectAspectRatio, }: ImageInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
import { Camera, Image as ImageIcon, Loader2, X } from 'lucide-react';
|
|
4
|
+
import { useT } from '../../i18n/index.js';
|
|
5
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
6
|
+
import { convertToWebpIfHeic } from '../../lib/canvasUtils.js';
|
|
7
|
+
import { ImageEditModal } from './ImageEditModal.js';
|
|
8
|
+
/**
|
|
9
|
+
* Image picker mirroring the Svelte `ImageInput`. `displayType="full"` is a
|
|
10
|
+
* dashed box that prompts for an upload when empty and shows the image as a
|
|
11
|
+
* cover with replace/remove controls once set; `displayType="avatar"` is a
|
|
12
|
+
* round picker with a camera badge. Cropping happens in `ImageEditModal`; the
|
|
13
|
+
* cropped file is uploaded and the resulting URL is reported via `onChange`.
|
|
14
|
+
*/
|
|
15
|
+
export function ImageInput({ usage, url, onChange, text, specsText, showAltInput = false, className, showFullImage = false, displayType = 'full', aspectRatio, showSelectAspectRatio, }) {
|
|
16
|
+
const t = useT();
|
|
17
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
18
|
+
const { upload } = openpeepsApi.useMediaUpload();
|
|
19
|
+
const fileInputRef = useRef(null);
|
|
20
|
+
const [pendingImage, setPendingImage] = useState(null);
|
|
21
|
+
const [loading, setLoading] = useState(false);
|
|
22
|
+
const isAvatar = displayType === 'avatar';
|
|
23
|
+
const pickFile = (file) => {
|
|
24
|
+
void (async () => {
|
|
25
|
+
const processed = await convertToWebpIfHeic(file);
|
|
26
|
+
setPendingImage({
|
|
27
|
+
file: processed,
|
|
28
|
+
previewUrl: URL.createObjectURL(processed),
|
|
29
|
+
});
|
|
30
|
+
})();
|
|
31
|
+
};
|
|
32
|
+
const clearPending = () => {
|
|
33
|
+
if (pendingImage)
|
|
34
|
+
URL.revokeObjectURL(pendingImage.previewUrl);
|
|
35
|
+
setPendingImage(null);
|
|
36
|
+
};
|
|
37
|
+
const fileInput = (_jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", className: "hidden", onChange: (e) => {
|
|
38
|
+
const file = e.target.files?.[0];
|
|
39
|
+
if (file)
|
|
40
|
+
pickFile(file);
|
|
41
|
+
e.target.value = '';
|
|
42
|
+
} }));
|
|
43
|
+
const cropModal = pendingImage ? (_jsx(ImageEditModal, { file: pendingImage.file, previewUrl: pendingImage.previewUrl, open: true, showAltInput: showAltInput, cropShape: isAvatar ? 'round' : 'rect', aspectRatio: aspectRatio, showSelectAspectRatio: showSelectAspectRatio, onClose: clearPending, onConfirm: async (file) => {
|
|
44
|
+
clearPending();
|
|
45
|
+
setLoading(true);
|
|
46
|
+
try {
|
|
47
|
+
const attachment = await upload({ file, usage });
|
|
48
|
+
onChange(attachment.url ?? undefined);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
setLoading(false);
|
|
52
|
+
}
|
|
53
|
+
} })) : null;
|
|
54
|
+
if (isAvatar) {
|
|
55
|
+
return (_jsxs("div", { className: `relative size-24 ${className ?? ''}`, children: [_jsx("button", { type: "button", className: `flex size-24 items-center justify-center overflow-hidden rounded-full bg-cover bg-center ${url ? '' : 'bg-surface-300 text-muted-foreground'}`, style: url ? { backgroundImage: `url(${url})` } : undefined, onClick: () => fileInputRef.current?.click(), title: t('form.headerAvatarInput.avatar', {
|
|
56
|
+
defaultValue: 'Profile photo',
|
|
57
|
+
}), children: url ? null : _jsx(ImageIcon, { className: "size-8" }) }), _jsx("span", { className: `bg-surface-200 pointer-events-none absolute bottom-0 right-0 flex size-9 items-center justify-center rounded-full ${url ? 'opacity-80' : ''}`, children: _jsx(Camera, { className: "size-5" }) }), loading ? (_jsx("span", { className: "bg-surface-100/80 absolute inset-0 z-20 flex items-center justify-center rounded-full", children: _jsx(Loader2, { className: "size-6 animate-spin" }) })) : null, fileInput, cropModal] }));
|
|
58
|
+
}
|
|
59
|
+
return (_jsxs("div", { className: `bg-surface-200 relative flex h-52 w-full items-center justify-center overflow-hidden rounded border border-dashed bg-center bg-no-repeat ${showFullImage ? 'bg-contain' : 'bg-cover'} ${className ?? ''}`, style: url ? { backgroundImage: `url(${url})` } : undefined, children: [url ? (_jsxs("div", { className: "relative z-10 flex items-center gap-4", children: [_jsx("button", { type: "button", title: t('form.imageInput.replace', {
|
|
60
|
+
defaultValue: 'Replace image',
|
|
61
|
+
}), className: "bg-surface-200/80 flex size-10 items-center justify-center rounded-full", onClick: () => fileInputRef.current?.click(), children: _jsx(Camera, { className: "size-5" }) }), _jsx("button", { type: "button", title: t('form.imageInput.remove', {
|
|
62
|
+
defaultValue: 'Remove image',
|
|
63
|
+
}), className: "bg-surface-200/80 flex size-10 items-center justify-center rounded-full", onClick: () => onChange(undefined), children: _jsx(X, { className: "size-5" }) })] })) : (_jsxs("button", { type: "button", className: "text-muted-foreground flex size-full flex-col items-center justify-center gap-1", onClick: () => fileInputRef.current?.click(), children: [_jsx(Camera, { className: "size-8" }), _jsx("span", { className: "font-bold", children: text ??
|
|
64
|
+
t('form.imageInput.uploadText', { defaultValue: 'Upload Image' }) }), specsText ? _jsx("span", { className: "text-sm", children: specsText }) : null] })), loading ? (_jsx("span", { className: "bg-surface-100/80 absolute inset-0 z-20 flex items-center justify-center", children: _jsx(Loader2, { className: "size-8 animate-spin" }) })) : null, fileInput, cropModal] }));
|
|
65
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GeocodingResult, Location } from '@openpeepshq/common';
|
|
2
|
+
export interface LocationInputProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
value?: Location;
|
|
6
|
+
onChange: (location: Location) => void;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
/** Override the geocoder. Defaults to the openpeeps geocode endpoint. */
|
|
11
|
+
geocode?: (query: string) => Promise<GeocodingResult[]>;
|
|
12
|
+
/** Debounce in ms for the geocode lookup. Defaults to 1500. */
|
|
13
|
+
debounceMs?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Controlled port of @openpeepshq/svelte/components/form/LocationInput.svelte. A
|
|
17
|
+
* text input wired to a debounced geocoder that captures coordinates from the
|
|
18
|
+
* selected suggestion.
|
|
19
|
+
*/
|
|
20
|
+
export declare function LocationInput({ title, description, value, onChange, placeholder, disabled, readOnly, geocode, debounceMs, }: LocationInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { MapPin } from 'lucide-react';
|
|
4
|
+
import { Button, Input, Label, LoadingIcon, cn } from '@openpeepshq/react-ui';
|
|
5
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
6
|
+
import { useT } from '../../i18n/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Controlled port of @openpeepshq/svelte/components/form/LocationInput.svelte. A
|
|
9
|
+
* text input wired to a debounced geocoder that captures coordinates from the
|
|
10
|
+
* selected suggestion.
|
|
11
|
+
*/
|
|
12
|
+
export function LocationInput({ title = '', description = '', value, onChange, placeholder, disabled = false, readOnly = false, geocode, debounceMs = 1500, }) {
|
|
13
|
+
const t = useT();
|
|
14
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
15
|
+
const [name, setName] = useState(value?.text ?? '');
|
|
16
|
+
const [suggestions, setSuggestions] = useState(null);
|
|
17
|
+
const [pending, setPending] = useState(false);
|
|
18
|
+
const debounceRef = useRef(null);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setName(value?.text ?? '');
|
|
21
|
+
}, [value?.text]);
|
|
22
|
+
useEffect(() => () => {
|
|
23
|
+
if (debounceRef.current)
|
|
24
|
+
clearTimeout(debounceRef.current);
|
|
25
|
+
}, []);
|
|
26
|
+
const runGeocode = async (query) => {
|
|
27
|
+
if (geocode)
|
|
28
|
+
return geocode(query);
|
|
29
|
+
const result = await openpeepsApi.useGeocode(query);
|
|
30
|
+
return Array.isArray(result)
|
|
31
|
+
? result
|
|
32
|
+
: (result.data ?? []);
|
|
33
|
+
};
|
|
34
|
+
const onSelection = (sel) => {
|
|
35
|
+
onChange({ text: sel.name, coordinates: sel.center });
|
|
36
|
+
setName(sel.name);
|
|
37
|
+
setSuggestions(null);
|
|
38
|
+
};
|
|
39
|
+
const onTextChange = (e) => {
|
|
40
|
+
const text = e.currentTarget.value;
|
|
41
|
+
setName(text);
|
|
42
|
+
onChange({ text });
|
|
43
|
+
if (debounceRef.current)
|
|
44
|
+
clearTimeout(debounceRef.current);
|
|
45
|
+
if (text.trim().length < 3) {
|
|
46
|
+
setSuggestions(null);
|
|
47
|
+
setPending(false);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
setPending(true);
|
|
51
|
+
debounceRef.current = setTimeout(() => {
|
|
52
|
+
void runGeocode(text.trim()).then((r) => {
|
|
53
|
+
setSuggestions(r);
|
|
54
|
+
setPending(false);
|
|
55
|
+
});
|
|
56
|
+
}, debounceMs);
|
|
57
|
+
};
|
|
58
|
+
return (_jsxs(Label, { title: title, description: description, classes: "relative", children: [_jsxs("div", { className: cn('op-input-group grid grid-cols-[auto_1fr_auto] rounded-full'), children: [_jsx("div", { className: "op-input-group-shim", children: _jsx(MapPin, { className: "size-4" }) }), _jsx(Input, { value: name, type: "text", placeholder: placeholder ?? title, disabled: disabled, readOnly: readOnly, onChange: onTextChange })] }), (pending || suggestions) && (_jsx("div", { className: "op-card absolute bottom-16 flex w-full flex-col items-start gap-3 p-2 text-sm", children: pending ? (_jsxs("div", { className: "flex w-full flex-col items-center justify-center gap-2 p-4", children: [_jsx("span", { children: t('location.lookup', { name }) }), _jsx(LoadingIcon, {})] })) : (_jsxs(_Fragment, { children: [_jsx(Button, { className: "border-surface-300 hover:bg-muted w-full rounded border p-2 text-left", action: () => onSelection({ name }), children: name }), suggestions?.map((res, idx) => (_jsx(Button, { className: "border-surface-300 hover:bg-muted w-full rounded border p-2 text-left", action: () => onSelection(res), children: res.name }, idx)))] })) }))] }));
|
|
59
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { LocationInput } from './LocationInput';
|
|
2
|
+
export type { LocationInputProps } from './LocationInput';
|
|
3
|
+
export { ImageEditModal } from './ImageEditModal';
|
|
4
|
+
export type { ImageEditModalProps } from './ImageEditModal';
|
|
5
|
+
export { ImageInput } from './ImageInput';
|
|
6
|
+
export type { ImageInputProps } from './ImageInput';
|
|
7
|
+
export { HeaderAvatarInput } from './HeaderAvatarInput';
|
|
8
|
+
export type { HeaderAvatarInputProps } from './HeaderAvatarInput';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GroupWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export interface AddGroupMemberModalProps {
|
|
3
|
+
group: GroupWithMeta;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const AddGroupMemberModal: ({ group, onClose, }: AddGroupMemberModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { groupName } from '@openpeepshq/common/lib';
|
|
4
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
5
|
+
import { useT } from '../../i18n/index.js';
|
|
6
|
+
import { useCurrentProfile } from '../layout/IdentityContext.js';
|
|
7
|
+
import { ProfileSelector } from '../profile/index.js';
|
|
8
|
+
export const AddGroupMemberModal = ({ group, onClose, }) => {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const me = useCurrentProfile();
|
|
11
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
12
|
+
const membersQuery = openpeepsApi.useGroupMembers(group.id);
|
|
13
|
+
const addMember = openpeepsApi.addGroupMemberAction({ id: group.id });
|
|
14
|
+
const [submitting, setSubmitting] = useState(false);
|
|
15
|
+
const banlist = useMemo(() => {
|
|
16
|
+
const members = (membersQuery.data ?? []).map((m) => m.profile);
|
|
17
|
+
return me ? [...members, me] : members;
|
|
18
|
+
}, [membersQuery.data, me]);
|
|
19
|
+
const submit = async (profiles) => {
|
|
20
|
+
if (!profiles.length || submitting)
|
|
21
|
+
return;
|
|
22
|
+
setSubmitting(true);
|
|
23
|
+
try {
|
|
24
|
+
for (const profile of profiles) {
|
|
25
|
+
await addMember(profile);
|
|
26
|
+
}
|
|
27
|
+
onClose();
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
setSubmitting(false);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return (_jsx(ProfileSelector, { open: true, onOpenChange: (open) => {
|
|
34
|
+
if (!open && !submitting)
|
|
35
|
+
onClose();
|
|
36
|
+
}, mode: "multiple", selectedProfiles: [], banlist: banlist, onConfirm: submit, title: t('groups.modals.addMembers.title', {
|
|
37
|
+
defaultValue: 'Add members to {{groupName}}',
|
|
38
|
+
groupName: groupName(group),
|
|
39
|
+
}) }));
|
|
40
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { GroupWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export interface AddGroupMembersButtonProps {
|
|
3
|
+
group: GroupWithMeta;
|
|
4
|
+
}
|
|
5
|
+
export declare const AddGroupMembersButton: ({ group }: AddGroupMembersButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { checkGroupCapabilities } from '@openpeepshq/common/lib';
|
|
4
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
5
|
+
import { useT } from '../../i18n/index.js';
|
|
6
|
+
import { useAuthData } from '../layout/IdentityContext.js';
|
|
7
|
+
import { AddGroupMemberModal } from './AddGroupMemberModal.js';
|
|
8
|
+
export const AddGroupMembersButton = ({ group }) => {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const authData = useAuthData();
|
|
11
|
+
const [open, setOpen] = useState(false);
|
|
12
|
+
const canAddMembers = checkGroupCapabilities(authData, ['core-groups-addMember'], group).success;
|
|
13
|
+
if (!canAddMembers) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { title: t('groups.actions.addMembers', { defaultValue: 'Add Members' }), variant: "variant-ringed-primary", action: () => setOpen(true), "data-testid": "groups-add-members-button", children: t('groups.actions.addMembers', { defaultValue: 'Add Members' }) }), open ? (_jsx(AddGroupMemberModal, { group: group, onClose: () => setOpen(false) })) : null] }));
|
|
17
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GroupMember, GroupWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export interface ChangeGroupRolesModalProps {
|
|
3
|
+
group: GroupWithMeta;
|
|
4
|
+
member: GroupMember;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function ChangeGroupRolesModal({ group, member, onClose, }: ChangeGroupRolesModalProps): 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 { defaultGroupRoles } from '@openpeepshq/common/types';
|
|
4
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, Label, } from '@openpeepshq/react-ui';
|
|
5
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
6
|
+
import { useT } from '../../i18n/index.js';
|
|
7
|
+
export function ChangeGroupRolesModal({ group, member, onClose, }) {
|
|
8
|
+
const t = useT();
|
|
9
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
10
|
+
const setMemberRoles = openpeepsApi.setGroupMemberRolesAction({
|
|
11
|
+
id: group.id,
|
|
12
|
+
memberId: member.profile.id,
|
|
13
|
+
});
|
|
14
|
+
const [roles, setRoles] = useState(() => new Set(member.roles ?? []));
|
|
15
|
+
const [submitting, setSubmitting] = useState(false);
|
|
16
|
+
const [error, setError] = useState(null);
|
|
17
|
+
const toggleRole = (role, checked) => {
|
|
18
|
+
setRoles((prev) => {
|
|
19
|
+
const next = new Set(prev);
|
|
20
|
+
if (checked)
|
|
21
|
+
next.add(role);
|
|
22
|
+
else
|
|
23
|
+
next.delete(role);
|
|
24
|
+
return next;
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const submit = async () => {
|
|
28
|
+
setError(null);
|
|
29
|
+
setSubmitting(true);
|
|
30
|
+
try {
|
|
31
|
+
await setMemberRoles({ roles: [...roles] });
|
|
32
|
+
onClose();
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
setError(err.message);
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
setSubmitting(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-sm", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('groups.changeRoles.title', { defaultValue: 'Change roles' }) }) }), _jsx("p", { className: "px-1 text-sm", children: t('groups.changeRoles.description', {
|
|
42
|
+
defaultValue: 'Update roles for @{{handle}}',
|
|
43
|
+
handle: member.profile.handle,
|
|
44
|
+
}) }), _jsx("div", { className: "space-y-3 px-1", children: defaultGroupRoles.map((role) => (_jsxs("div", { className: "flex items-center justify-between gap-4", children: [_jsx(Label, { htmlFor: `role-${role}`, classes: "text-base font-medium", children: t(`groups.roles.${role}`, { defaultValue: role }) }), _jsx("input", { id: `role-${role}`, type: "checkbox", checked: roles.has(role), onChange: (e) => toggleRole(role, e.target.checked), className: "size-4" })] }, role))) }), error ? (_jsx("p", { className: "border-error/40 text-error rounded-md border p-2 text-sm", children: error })) : null, _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-ringed-primary", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "variant-filled-primary", action: submit, disabled: submitting, children: t('groups.changeRoles.confirm', { defaultValue: 'Save roles' }) })] })] }) }));
|
|
45
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GroupWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export interface ConfirmGroupExitModalProps {
|
|
3
|
+
group: GroupWithMeta;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function ConfirmGroupExitModal({ group, onClose, }: ConfirmGroupExitModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
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, } from '@openpeepshq/react-ui';
|
|
4
|
+
import { useNavigate } from '../../contexts/router/index.js';
|
|
5
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
6
|
+
import { useT } from '../../i18n/index.js';
|
|
7
|
+
export function ConfirmGroupExitModal({ group, onClose, }) {
|
|
8
|
+
const t = useT();
|
|
9
|
+
const navigate = useNavigate();
|
|
10
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
11
|
+
const leaveGroup = openpeepsApi.leaveGroupAction({ id: group.id });
|
|
12
|
+
const [submitting, setSubmitting] = useState(false);
|
|
13
|
+
const [error, setError] = useState(null);
|
|
14
|
+
const submit = async () => {
|
|
15
|
+
setError(null);
|
|
16
|
+
setSubmitting(true);
|
|
17
|
+
try {
|
|
18
|
+
await leaveGroup();
|
|
19
|
+
onClose();
|
|
20
|
+
navigate('/groups');
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
setError(err.message);
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
setSubmitting(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-sm", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('groups.modals.confirmExit.title', {
|
|
30
|
+
defaultValue: 'Leave group',
|
|
31
|
+
}) }) }), _jsx("p", { className: "px-1 text-sm", children: t('groups.modals.confirmExit.body', {
|
|
32
|
+
defaultValue: 'Leave @{{handle}}?',
|
|
33
|
+
handle: group.handle,
|
|
34
|
+
}) }), error ? (_jsx("p", { className: "border-error/40 text-error rounded-md border p-2 text-sm", children: error })) : null, _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-ringed-primary", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "variant-filled-error", action: submit, disabled: submitting, children: t('groups.modals.confirmExit.leave', { defaultValue: 'Leave' }) })] })] }) }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GroupWithMeta, PublicProfile } from '@openpeepshq/common/types';
|
|
2
|
+
export interface ConfirmMemberRemovalModalProps {
|
|
3
|
+
group: GroupWithMeta;
|
|
4
|
+
profile: PublicProfile;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function ConfirmMemberRemovalModal({ group, profile, onClose, }: ConfirmMemberRemovalModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
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, } from '@openpeepshq/react-ui';
|
|
4
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
5
|
+
import { useT } from '../../i18n/index.js';
|
|
6
|
+
export function ConfirmMemberRemovalModal({ group, profile, onClose, }) {
|
|
7
|
+
const t = useT();
|
|
8
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
9
|
+
const removeMember = openpeepsApi.removeGroupMemberAction({
|
|
10
|
+
id: group.id,
|
|
11
|
+
memberId: profile.id,
|
|
12
|
+
});
|
|
13
|
+
const [submitting, setSubmitting] = useState(false);
|
|
14
|
+
const [error, setError] = useState(null);
|
|
15
|
+
const submit = async () => {
|
|
16
|
+
setError(null);
|
|
17
|
+
setSubmitting(true);
|
|
18
|
+
try {
|
|
19
|
+
await removeMember();
|
|
20
|
+
onClose();
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
setError(err.message);
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
setSubmitting(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-sm", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('groups.removeMember.title', { defaultValue: 'Remove member' }) }) }), _jsx("p", { className: "px-1 text-sm", children: t('groups.removeMember.description', {
|
|
30
|
+
defaultValue: 'Remove @{{handle}} from this group?',
|
|
31
|
+
handle: profile.handle,
|
|
32
|
+
}) }), error ? (_jsx("p", { className: "border-error/40 text-error rounded-md border p-2 text-sm", children: error })) : null, _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-ringed-primary", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "variant-filled-error", action: submit, disabled: submitting, children: t('groups.removeMember.confirm', { defaultValue: 'Remove' }) })] })] }) }));
|
|
33
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GroupWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export interface DeleteGroupModalProps {
|
|
3
|
+
group: GroupWithMeta;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function DeleteGroupModal({ group, onClose }: DeleteGroupModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { groupName } from '@openpeepshq/common/lib';
|
|
4
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
5
|
+
import { useRouter } from '../../contexts/router/index.js';
|
|
6
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
7
|
+
import { useT } from '../../i18n/index.js';
|
|
8
|
+
export function DeleteGroupModal({ group, onClose }) {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const router = useRouter();
|
|
11
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
12
|
+
const deleteGroup = openpeepsApi.deleteGroupAction({ id: group.id });
|
|
13
|
+
const [submitting, setSubmitting] = useState(false);
|
|
14
|
+
const [error, setError] = useState(null);
|
|
15
|
+
const submit = async () => {
|
|
16
|
+
setError(null);
|
|
17
|
+
setSubmitting(true);
|
|
18
|
+
try {
|
|
19
|
+
await deleteGroup();
|
|
20
|
+
onClose();
|
|
21
|
+
router.back();
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
setError(err.message);
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
setSubmitting(false);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-sm", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('groups.delete.title', { defaultValue: 'Delete group' }) }) }), _jsx("p", { className: "px-1 text-sm", children: t('groups.delete.description', {
|
|
31
|
+
defaultValue: 'Delete {{groupName}} permanently?',
|
|
32
|
+
groupName: groupName(group),
|
|
33
|
+
}) }), error ? (_jsx("p", { className: "border-error/40 text-error rounded-md border p-2 text-sm", children: error })) : null, _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-ringed-surface", action: onClose, children: t('groups.delete.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "variant-filled-error", action: submit, disabled: submitting, children: t('groups.delete.deleteButton', { defaultValue: 'Delete' }) })] })] }) }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GroupData, GroupWithMeta } from '@openpeepshq/common/types';
|
|
2
|
+
export interface GroupAvatarProps {
|
|
3
|
+
group?: GroupData | GroupWithMeta;
|
|
4
|
+
/** rem-equivalent unit (matches Svelte version: 3.5 → 3.5rem). */
|
|
5
|
+
size?: number;
|
|
6
|
+
borderless?: boolean;
|
|
7
|
+
containerClassName?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Translation of `@openpeepshq/svelte/components/core/groups/GroupAvatar.svelte`.
|
|
11
|
+
* Renders a circular group avatar with the group picture, falling back to the
|
|
12
|
+
* community's `defaultGroupAvatar` and finally to letter initials.
|
|
13
|
+
*/
|
|
14
|
+
export declare function GroupAvatar({ group, size, borderless, containerClassName, }: GroupAvatarProps): import("react/jsx-runtime").JSX.Element;
|