@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,36 @@
|
|
|
1
|
+
import { marked, Renderer } from 'marked';
|
|
2
|
+
import { linkOpensInNewTab } from './linkTargets.js';
|
|
3
|
+
const escapeHtml = (text) => text
|
|
4
|
+
.replace(/&/g, '&')
|
|
5
|
+
.replace(/</g, '<')
|
|
6
|
+
.replace(/>/g, '>')
|
|
7
|
+
.replace(/"/g, '"');
|
|
8
|
+
const cleanHref = (href) => {
|
|
9
|
+
try {
|
|
10
|
+
return encodeURI(href).replace(/%25/g, '%');
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export const compileMarkdownToHtml = (source, options = {}) => {
|
|
17
|
+
const { origin, newTab = false } = options;
|
|
18
|
+
const renderer = new Renderer();
|
|
19
|
+
renderer.link = function ({ href, title, tokens }) {
|
|
20
|
+
const text = this.parser.parseInline(tokens);
|
|
21
|
+
const cleaned = href ? cleanHref(href) : null;
|
|
22
|
+
if (!cleaned) {
|
|
23
|
+
return text;
|
|
24
|
+
}
|
|
25
|
+
let out = `<a href="${cleaned}"`;
|
|
26
|
+
if (title) {
|
|
27
|
+
out += ` title="${escapeHtml(title)}"`;
|
|
28
|
+
}
|
|
29
|
+
if (linkOpensInNewTab(cleaned, origin, newTab)) {
|
|
30
|
+
out += ' target="_blank" rel="noopener noreferrer"';
|
|
31
|
+
}
|
|
32
|
+
out += `>${text}</a>`;
|
|
33
|
+
return out;
|
|
34
|
+
};
|
|
35
|
+
return marked.parse(source, { renderer, async: false });
|
|
36
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { OpenpeepsMarkdown } from './OpenpeepsMarkdown';
|
|
2
|
+
export type { OpenpeepsMarkdownProps } from './OpenpeepsMarkdown';
|
|
3
|
+
export { OPENPEEPS_MARKDOWN_PROSE_CLASS, OPENPEEPS_MARKDOWN_STATIC_CLASS, } from './classes';
|
|
4
|
+
export { compileMarkdownToHtml } from './compileMarkdown';
|
|
5
|
+
export { CompiledMarkdown } from './CompiledMarkdown';
|
|
6
|
+
export type { CompiledMarkdownProps } from './CompiledMarkdown';
|
|
7
|
+
export { StaticRenderContext, useStaticRender, resolveStaticUrl, } from './staticRender';
|
|
8
|
+
export type { StaticRenderContextValue } from './staticRender';
|
|
9
|
+
/** @deprecated Use OpenpeepsMarkdown */
|
|
10
|
+
export { OpenpeepsMarkdown as PostMarkdown } from './OpenpeepsMarkdown';
|
|
11
|
+
export type { OpenpeepsMarkdownProps as PostMarkdownProps } from './OpenpeepsMarkdown';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { OpenpeepsMarkdown } from './OpenpeepsMarkdown.js';
|
|
2
|
+
export { OPENPEEPS_MARKDOWN_PROSE_CLASS, OPENPEEPS_MARKDOWN_STATIC_CLASS, } from './classes.js';
|
|
3
|
+
export { compileMarkdownToHtml } from './compileMarkdown.js';
|
|
4
|
+
export { CompiledMarkdown } from './CompiledMarkdown.js';
|
|
5
|
+
export { StaticRenderContext, useStaticRender, resolveStaticUrl, } from './staticRender.js';
|
|
6
|
+
/** @deprecated Use OpenpeepsMarkdown */
|
|
7
|
+
export { OpenpeepsMarkdown as PostMarkdown } from './OpenpeepsMarkdown.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Mirrors Svelte `OpenpeepsMarkdown` / `a.svelte` external-link detection. */
|
|
2
|
+
export declare const isExternalLink: (href: string, origin?: string) => boolean;
|
|
3
|
+
export declare const linkOpensInNewTab: (href: string | null | undefined, origin: string | undefined, newTab: boolean) => boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Mirrors Svelte `OpenpeepsMarkdown` / `a.svelte` external-link detection. */
|
|
2
|
+
export const isExternalLink = (href, origin) => {
|
|
3
|
+
if (!href || /^(mailto:|tel:|#)/.test(href)) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
if (href.startsWith('/') && !href.startsWith('//')) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (!origin) {
|
|
10
|
+
return !href.startsWith('/');
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
return new URL(href, origin).origin !== origin;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return !href.startsWith('/');
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export const linkOpensInNewTab = (href, origin, newTab) => {
|
|
20
|
+
if (!href) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (newTab) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return isExternalLink(href, origin);
|
|
27
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface StaticRenderContextValue {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
/** When set, relative `href`/`src` values are rewritten for email links. */
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Signals that post content is being rendered in a static, non-interactive
|
|
8
|
+
* context (e.g. server-rendered notification emails). When enabled, components
|
|
9
|
+
* skip data-fetching/interactive affordances such as link previews so the
|
|
10
|
+
* markup can render without the in-app providers (`OpenpeepsProvider`, query
|
|
11
|
+
* client, …).
|
|
12
|
+
*/
|
|
13
|
+
export declare const StaticRenderContext: import("react").Context<StaticRenderContextValue>;
|
|
14
|
+
export declare const useStaticRender: () => StaticRenderContextValue;
|
|
15
|
+
/** Prefix a path with `baseUrl` when rendering for email. */
|
|
16
|
+
export declare const resolveStaticUrl: (path: string, baseUrl?: string) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
const defaultValue = { enabled: false };
|
|
3
|
+
/**
|
|
4
|
+
* Signals that post content is being rendered in a static, non-interactive
|
|
5
|
+
* context (e.g. server-rendered notification emails). When enabled, components
|
|
6
|
+
* skip data-fetching/interactive affordances such as link previews so the
|
|
7
|
+
* markup can render without the in-app providers (`OpenpeepsProvider`, query
|
|
8
|
+
* client, …).
|
|
9
|
+
*/
|
|
10
|
+
export const StaticRenderContext = createContext(defaultValue);
|
|
11
|
+
export const useStaticRender = () => useContext(StaticRenderContext);
|
|
12
|
+
/** Prefix a path with `baseUrl` when rendering for email. */
|
|
13
|
+
export const resolveStaticUrl = (path, baseUrl) => {
|
|
14
|
+
if (!baseUrl || !path.startsWith('/'))
|
|
15
|
+
return path;
|
|
16
|
+
return `${baseUrl.replace(/\/$/, '')}${path}`;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ContentHeader(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft } from 'lucide-react';
|
|
3
|
+
import { capitalizeFirstLetter } from '@openpeepshq/common/lib';
|
|
4
|
+
import { usePageHeader } from '../../stores/index.js';
|
|
5
|
+
import { useT } from '../../i18n/index.js';
|
|
6
|
+
import { useRouter } from '../../contexts/router/index.js';
|
|
7
|
+
export function ContentHeader() {
|
|
8
|
+
const pageHeader = usePageHeader();
|
|
9
|
+
const t = useT();
|
|
10
|
+
const router = useRouter();
|
|
11
|
+
const titleString = typeof pageHeader?.title === 'string'
|
|
12
|
+
? pageHeader.title
|
|
13
|
+
: capitalizeFirstLetter(router.pathname.split('/').filter(Boolean).pop() ?? '');
|
|
14
|
+
const titleNode = pageHeader?.title && typeof pageHeader.title !== 'string'
|
|
15
|
+
? pageHeader.title
|
|
16
|
+
: null;
|
|
17
|
+
return (_jsxs("div", { className: "bg-card sticky top-0 z-10 flex h-16 w-full items-center justify-between border-b p-4", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("button", { type: "button", title: t('navigation.back'), onClick: () => router.back(), children: _jsx(ChevronLeft, {}) }), titleNode ?? (_jsx("h1", { className: "truncate text-xl font-semibold", "data-testid": pageHeader?.testId, children: titleString }))] }), pageHeader?.actions && (_jsx("div", { className: "flex items-center gap-2", children: pageHeader.actions }))] }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface FooterMobileProps {
|
|
2
|
+
/** Wired to the `+` mobile button. Consumers control the modal open. */
|
|
3
|
+
onNewPost?: () => void | Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export declare function FooterMobile({ onNewPost }?: FooterMobileProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Bell, Home, Newspaper, PlusSquare, Users } from 'lucide-react';
|
|
3
|
+
import { MobileMenuItem } from './MobileMenuItem.js';
|
|
4
|
+
import { useT } from '../../i18n/index.js';
|
|
5
|
+
export function FooterMobile({ onNewPost } = {}) {
|
|
6
|
+
const t = useT();
|
|
7
|
+
return (_jsxs("div", { className: "bg-card flex h-20 w-full items-center justify-evenly md:hidden", children: [_jsx(MobileMenuItem, { title: t('navigation.home'), icon: Home, action: "/feeds/local" }), _jsx(MobileMenuItem, { title: t('navigation.myFeed'), icon: Newspaper, action: "/feeds/my" }), _jsx(MobileMenuItem, { title: t('navigation.newPost'), icon: PlusSquare, action: onNewPost ?? '/posts/new' }), _jsx(MobileMenuItem, { title: t('navigation.groups'), icon: Users, action: "/groups" }), _jsx(MobileMenuItem, { title: t('navigation.notifications'), icon: Bell, action: "/notifications" })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface HeaderMobileProps {
|
|
3
|
+
/** Render slot to draw the avatar trigger (defaults to a generic icon). */
|
|
4
|
+
avatar?: ReactNode;
|
|
5
|
+
/** Same slots as desktop `SideBar` (mobile drawer). */
|
|
6
|
+
sideBar?: {
|
|
7
|
+
mainMenu?: () => ReactNode;
|
|
8
|
+
profileMenu?: () => ReactNode;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare function HeaderMobile({ avatar, sideBar }?: HeaderMobileProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { MessageSquareText, Menu } from 'lucide-react';
|
|
4
|
+
import { Dialog, DialogContent, DialogPortal, DialogOverlay, DialogTrigger, } from '@openpeepshq/react-ui';
|
|
5
|
+
import { getTheme } from '@openpeepshq/common';
|
|
6
|
+
import { useServerInfo } from '../server-data/index.js';
|
|
7
|
+
import { useCurrentProfile, useCurrentProfileSettings, } from '../layout/IdentityContext.js';
|
|
8
|
+
import { useRouter } from '../../contexts/router/index.js';
|
|
9
|
+
import { useT } from '../../i18n/index.js';
|
|
10
|
+
import { Avatar } from '../profile/index.js';
|
|
11
|
+
import { SideBar } from './SideBar.js';
|
|
12
|
+
import { SidebarNavCloseContext } from './SidebarNavContext.js';
|
|
13
|
+
export function HeaderMobile({ avatar, sideBar } = {}) {
|
|
14
|
+
const serverInfo = useServerInfo();
|
|
15
|
+
const profileSettings = useCurrentProfileSettings();
|
|
16
|
+
const profile = useCurrentProfile();
|
|
17
|
+
const router = useRouter();
|
|
18
|
+
const t = useT();
|
|
19
|
+
const [open, setOpen] = useState(false);
|
|
20
|
+
const logoSmall = getTheme(serverInfo.communityConfig, profileSettings).logoSmall;
|
|
21
|
+
// Mirror Svelte HeaderMobile: the avatar is the drawer trigger for signed-in
|
|
22
|
+
// users; guests fall back to a generic menu icon.
|
|
23
|
+
const trigger = avatar ??
|
|
24
|
+
(profile ? _jsx(Avatar, { profile: profile, size: 2.5, borderless: true }) : _jsx(Menu, {}));
|
|
25
|
+
return (_jsx("div", { className: "bg-background sticky top-0 z-10 flex px-4 py-2 md:hidden", children: _jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, children: _jsx("button", { type: "button", title: t('navigation.profile'), children: trigger }) }), _jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsx(DialogContent, { showCloseButton: false, className: "left-0 top-0 h-screen w-[380px] translate-x-0 translate-y-0 rounded-none border-r p-0", children: _jsx(SidebarNavCloseContext.Provider, { value: () => setOpen(false), children: _jsx(SideBar, { onClose: () => setOpen(false), mainMenu: sideBar?.mainMenu?.(), profileMenu: sideBar?.profileMenu?.() }) }) })] })] }), _jsx("div", { children: logoSmall && (_jsx("a", { href: "/", children: _jsx("img", { src: logoSmall, alt: "logo", className: "h-6 px-4" }) })) }), _jsx("button", { type: "button", title: t('navigation.messages'), onClick: () => router.navigate('/conversations'), children: _jsx(MessageSquareText, {}) })] }) }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IconType } from '@openpeepshq/react-ui';
|
|
2
|
+
export interface MobileMenuItemProps {
|
|
3
|
+
action: string | (() => unknown);
|
|
4
|
+
icon: IconType;
|
|
5
|
+
title?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function MobileMenuItem({ action, icon: Icon, title, }: MobileMenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '@openpeepshq/react-ui';
|
|
3
|
+
import { useRouter } from '../../contexts/router/index.js';
|
|
4
|
+
export function MobileMenuItem({ action, icon: Icon, title, }) {
|
|
5
|
+
const router = useRouter();
|
|
6
|
+
const active = typeof action === 'string' && router.pathname === action;
|
|
7
|
+
return (_jsx("button", { type: "button", title: title, onClick: () => {
|
|
8
|
+
if (typeof action === 'function')
|
|
9
|
+
action();
|
|
10
|
+
else
|
|
11
|
+
router.navigate(action);
|
|
12
|
+
}, children: _jsx("span", { className: cn('flex items-center gap-x-2', active ? 'text-primary-500 font-bold' : 'text-foreground/70'), children: _jsx(Icon, { className: "mr-1 h-5 w-5" }) }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
3
|
+
export function PageHeaderAction({ title, action }) {
|
|
4
|
+
return (_jsx(Button, { title: title, className: "h-6 w-fit text-sm", variant: "variant-ringed-surface", action: action
|
|
5
|
+
? () => Promise.resolve(action()).then(() => undefined)
|
|
6
|
+
: undefined, children: _jsx("span", { children: title }) }));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PlusButton(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Plus } from 'lucide-react';
|
|
3
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
4
|
+
import { usePlusButton } from '../../stores/index.js';
|
|
5
|
+
export function PlusButton() {
|
|
6
|
+
const plusButton = usePlusButton();
|
|
7
|
+
if (!plusButton || Array.isArray(plusButton))
|
|
8
|
+
return null;
|
|
9
|
+
const Icon = plusButton.icon ?? Plus;
|
|
10
|
+
return (_jsx("div", { className: "sticky bottom-1 flex w-full justify-end sm:bottom-4", children: _jsx(Button, { compact: true, title: plusButton.title ?? '', variant: "variant-filled-primary", action: plusButton.action, className: "z-10 mr-4 size-16 rounded-full sm:mb-4", "data-testid": "posts-new-post-button", children: _jsx(Icon, { size: 24 }) }) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SideBarProps {
|
|
2
|
+
onClose?: () => void;
|
|
3
|
+
/** Slot for the consumer-supplied main menu (was `<MainMenu />` in Svelte). */
|
|
4
|
+
mainMenu?: React.ReactNode;
|
|
5
|
+
/** Slot for the consumer-supplied profile menu (was `<ProfileMenu />`). */
|
|
6
|
+
profileMenu?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Translation of @openpeepshq/svelte/components/navigation/SideBar.svelte.
|
|
10
|
+
*
|
|
11
|
+
* The Svelte version reached into a sprawling `<MainMenu />` / `<ProfileMenu />`
|
|
12
|
+
* sub-tree (which referenced 30+ feature components). To keep the React port
|
|
13
|
+
* a focused, framework-agnostic shell we expose those as slots, so consumers
|
|
14
|
+
* compose them however their app structures menus.
|
|
15
|
+
*/
|
|
16
|
+
export declare function SideBar({ onClose, mainMenu, profileMenu }?: SideBarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { X } from 'lucide-react';
|
|
3
|
+
import { Button, Link } from '@openpeepshq/react-ui';
|
|
4
|
+
import { getTheme } from '@openpeepshq/common';
|
|
5
|
+
import { useServerInfo } from '../server-data/index.js';
|
|
6
|
+
import { useCurrentProfile, useCurrentProfileSettings, } from '../layout/IdentityContext.js';
|
|
7
|
+
import { useT } from '../../i18n/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Translation of @openpeepshq/svelte/components/navigation/SideBar.svelte.
|
|
10
|
+
*
|
|
11
|
+
* The Svelte version reached into a sprawling `<MainMenu />` / `<ProfileMenu />`
|
|
12
|
+
* sub-tree (which referenced 30+ feature components). To keep the React port
|
|
13
|
+
* a focused, framework-agnostic shell we expose those as slots, so consumers
|
|
14
|
+
* compose them however their app structures menus.
|
|
15
|
+
*/
|
|
16
|
+
export function SideBar({ onClose, mainMenu, profileMenu } = {}) {
|
|
17
|
+
const serverInfo = useServerInfo();
|
|
18
|
+
const profileSettings = useCurrentProfileSettings();
|
|
19
|
+
const profile = useCurrentProfile();
|
|
20
|
+
const t = useT();
|
|
21
|
+
const logoSmall = getTheme(serverInfo.communityConfig, profileSettings).logoSmall;
|
|
22
|
+
const { name, tagLine } = serverInfo.communityConfig?.info ?? {};
|
|
23
|
+
return (_jsxs("div", { className: "relative h-screen w-full pt-3 md:h-full", children: [_jsxs("div", { className: "h-[90%] overflow-y-auto", children: [_jsxs("div", { className: "flex w-full items-center justify-between px-4 md:items-start", children: [_jsx("a", { href: "/", children: logoSmall && (_jsx("img", { src: logoSmall, alt: "logo", className: "h-10 object-contain" })) }), onClose && (_jsx("button", { type: "button", title: t('common.close'), className: "flex md:hidden", onClick: onClose, children: _jsx(X, {}) }))] }), profile?.type === 'local' ? (_jsxs(_Fragment, { children: [profileMenu, mainMenu] })) : (_jsx("div", { className: "mt-4 px-4", children: _jsxs("div", { className: "flex h-full flex-col items-center justify-center space-y-4", children: [name && (_jsx("p", { className: "text-center text-lg font-semibold", children: t('navigation.welcome', { name }) })), tagLine && _jsx("p", { className: "px-2 text-center text-sm", children: tagLine }), _jsx(Button, { title: t('navigation.joinCommunity'), variant: "variant-filled-primary", action: "/auth/register", children: t('navigation.joinCommunity') }), _jsxs("span", { className: "text-sm", children: [t('navigation.haveAccount'), ' ', _jsx(Link, { action: "/auth/login", children: t('navigation.logIn') })] })] }) }))] }), _jsx("div", { className: "bg-card absolute bottom-3", children: _jsx("p", { className: "ml-4 text-center", children: t('navigation.poweredBy') }) })] }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
/** When the sidebar is shown in the mobile drawer, call this after in-app navigation to close it. */
|
|
3
|
+
export const SidebarNavCloseContext = createContext(undefined);
|
|
4
|
+
export const useSidebarNavClose = () => useContext(SidebarNavCloseContext);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Breadcrumbs(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { useBreadcrumbs } from '../../../stores/index.js';
|
|
4
|
+
import { CrumbItem } from './Crumb.js';
|
|
5
|
+
export function Breadcrumbs() {
|
|
6
|
+
const breadcrumbs = useBreadcrumbs();
|
|
7
|
+
if (breadcrumbs.length === 0)
|
|
8
|
+
return null;
|
|
9
|
+
return (_jsx("ol", { className: "text-muted-foreground mb-3 flex flex-wrap items-center gap-1 px-4 text-sm", children: breadcrumbs.map((crumb, idx) => (_jsxs(Fragment, { children: [idx > 0 && (_jsx("li", { className: "op-crumb-separator", "aria-hidden": "true", children: "\u203A" })), _jsx(CrumbItem, { crumb: crumb })] }, `${crumb.text}-${idx}`))) }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { SideBar } from './SideBar';
|
|
2
|
+
export type { SideBarProps } from './SideBar';
|
|
3
|
+
export { sideBarNavLinkClass } from './sideBarNavLinkClass';
|
|
4
|
+
export { SidebarNavCloseContext, useSidebarNavClose, } from './SidebarNavContext';
|
|
5
|
+
export { HeaderMobile } from './HeaderMobile';
|
|
6
|
+
export type { HeaderMobileProps } from './HeaderMobile';
|
|
7
|
+
export { FooterMobile } from './FooterMobile';
|
|
8
|
+
export type { FooterMobileProps } from './FooterMobile';
|
|
9
|
+
export { MobileMenuItem } from './MobileMenuItem';
|
|
10
|
+
export type { MobileMenuItemProps } from './MobileMenuItem';
|
|
11
|
+
export { ContentHeader } from './ContentHeader';
|
|
12
|
+
export { PageHeaderAction } from './PageHeaderAction';
|
|
13
|
+
export type { PageHeaderActionProps } from './PageHeaderAction';
|
|
14
|
+
export { PlusButton } from './PlusButton';
|
|
15
|
+
export { Breadcrumbs } from './breadcrumbs/Breadcrumbs';
|
|
16
|
+
export { CrumbItem } from './breadcrumbs/Crumb';
|
|
17
|
+
export type { CrumbItemProps } from './breadcrumbs/Crumb';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { SideBar } from './SideBar.js';
|
|
2
|
+
export { sideBarNavLinkClass } from './sideBarNavLinkClass.js';
|
|
3
|
+
export { SidebarNavCloseContext, useSidebarNavClose, } from './SidebarNavContext.js';
|
|
4
|
+
export { HeaderMobile } from './HeaderMobile.js';
|
|
5
|
+
export { FooterMobile } from './FooterMobile.js';
|
|
6
|
+
export { MobileMenuItem } from './MobileMenuItem.js';
|
|
7
|
+
export { ContentHeader } from './ContentHeader.js';
|
|
8
|
+
export { PageHeaderAction } from './PageHeaderAction.js';
|
|
9
|
+
export { PlusButton } from './PlusButton.js';
|
|
10
|
+
export { Breadcrumbs } from './breadcrumbs/Breadcrumbs.js';
|
|
11
|
+
export { CrumbItem } from './breadcrumbs/Crumb.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { cn } from '@openpeepshq/react-ui';
|
|
2
|
+
/** Active/inactive classes for sidebar nav links (parity with Svelte `MenuItem.svelte`). */
|
|
3
|
+
export const sideBarNavLinkClass = ({ isActive }) => cn('flex items-center gap-2 rounded-md px-3 py-2 hover:bg-muted', isActive ? 'text-primary font-bold' : 'text-foreground/70');
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component, type ErrorInfo, type ReactNode } from 'react';
|
|
2
|
+
type NotificationErrorBoundaryProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
notificationId?: string;
|
|
5
|
+
};
|
|
6
|
+
type NotificationErrorBoundaryState = {
|
|
7
|
+
hasError: boolean;
|
|
8
|
+
};
|
|
9
|
+
/** Per-notification error isolation (parity with Svelte's svelte:boundary on Notification.svelte). */
|
|
10
|
+
export declare class NotificationErrorBoundary extends Component<NotificationErrorBoundaryProps, NotificationErrorBoundaryState> {
|
|
11
|
+
state: NotificationErrorBoundaryState;
|
|
12
|
+
static getDerivedStateFromError(): NotificationErrorBoundaryState;
|
|
13
|
+
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
14
|
+
render(): ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
/** Per-notification error isolation (parity with Svelte's svelte:boundary on Notification.svelte). */
|
|
3
|
+
export class NotificationErrorBoundary extends Component {
|
|
4
|
+
state = { hasError: false };
|
|
5
|
+
static getDerivedStateFromError() {
|
|
6
|
+
return { hasError: true };
|
|
7
|
+
}
|
|
8
|
+
componentDidCatch(error, info) {
|
|
9
|
+
console.error('Notification render failed', {
|
|
10
|
+
notificationId: this.props.notificationId,
|
|
11
|
+
error,
|
|
12
|
+
componentStack: info.componentStack,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
if (this.state.hasError) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return this.props.children;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translation of `core/notification/NotificationHeaderActions.svelte`.
|
|
3
|
+
* Page-header actions for the notifications feed: mark every notification as
|
|
4
|
+
* read and a link to the notification preferences screen.
|
|
5
|
+
*/
|
|
6
|
+
export declare function NotificationHeaderActions(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CheckCheck, Settings2 } from 'lucide-react';
|
|
3
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
4
|
+
import { useT } from '../../i18n/index.js';
|
|
5
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
6
|
+
import { useToast } from '../layout/ToastProvider.js';
|
|
7
|
+
/**
|
|
8
|
+
* Translation of `core/notification/NotificationHeaderActions.svelte`.
|
|
9
|
+
* Page-header actions for the notifications feed: mark every notification as
|
|
10
|
+
* read and a link to the notification preferences screen.
|
|
11
|
+
*/
|
|
12
|
+
export function NotificationHeaderActions() {
|
|
13
|
+
const t = useT();
|
|
14
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
15
|
+
const toast = useToast();
|
|
16
|
+
const markAllNotificationsAsSeen = openpeepsApi.markAllNotificationsAsSeenAction()();
|
|
17
|
+
const markAllRead = async () => {
|
|
18
|
+
try {
|
|
19
|
+
await markAllNotificationsAsSeen();
|
|
20
|
+
toast.success(t('settings.notifications.markAllReadSuccess', {
|
|
21
|
+
defaultValue: 'All notifications marked as read',
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
toast.error(t('notification.markAllReadError', {
|
|
26
|
+
defaultValue: 'Failed to mark notifications as read',
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { title: t('settings.notifications.feedPreferences.markAllRead', {
|
|
31
|
+
defaultValue: 'Mark all as read',
|
|
32
|
+
}), action: markAllRead, variant: "variant-ringed-surface", children: _jsx(CheckCheck, { size: 18 }) }), _jsx(Button, { title: t('settings.notifications.headerPreferencesTitle', {
|
|
33
|
+
defaultValue: 'Notification preferences',
|
|
34
|
+
}), action: "/settings/notifications/preferences", variant: "variant-ringed-surface", children: _jsx(Settings2, { size: 18 }) })] }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PublicNotification } from '@openpeepshq/common/types';
|
|
2
|
+
export interface NotificationItemProps {
|
|
3
|
+
notification: PublicNotification;
|
|
4
|
+
}
|
|
5
|
+
export declare function NotificationItem({ notification }: NotificationItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { NotificationErrorBoundary } from './NotificationErrorBoundary.js';
|
|
3
|
+
import { TypedNotification } from './TypedNotification.js';
|
|
4
|
+
export function NotificationItem({ notification }) {
|
|
5
|
+
return (_jsx(NotificationErrorBoundary, { notificationId: notification.id, children: _jsx(TypedNotification, { notification: notification }) }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PublicProfile } from '@openpeepshq/common/types';
|
|
3
|
+
export interface NotificationWrapperProps {
|
|
4
|
+
profile: PublicProfile;
|
|
5
|
+
seen?: boolean;
|
|
6
|
+
isGroup?: boolean;
|
|
7
|
+
showProfile?: boolean;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function NotificationWrapper({ profile, seen, isGroup, showProfile, children, }: NotificationWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dot, User, Users } from 'lucide-react';
|
|
3
|
+
import { Avatar, ProfileLink } from '../profile/index.js';
|
|
4
|
+
export function NotificationWrapper({ profile, seen = true, isGroup = false, showProfile = true, children, }) {
|
|
5
|
+
return (_jsxs("div", { className: "hover:bg-surface-300 w-full items-start gap-3 overflow-hidden border-b px-4 py-5", children: [_jsx("div", { className: "flex justify-end", children: !seen ? _jsx(Dot, { className: "h-3 w-3" }) : null }), showProfile ? (_jsxs("div", { className: "flex items-center gap-4 px-6", children: [isGroup ? (_jsx(Users, { className: "text-surface-500 h-8 w-8" })) : (_jsx(User, { className: "text-surface-500 h-8 w-8" })), _jsx(ProfileLink, { profile: profile, children: _jsx(Avatar, { profile: profile, size: 3.5 }) })] })) : null, _jsx("div", { className: "flex flex-1 flex-col", children: children })] }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface NotificationsListProps {
|
|
2
|
+
pageSize?: number;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Translation of `routes/(protected)/(private)/notifications/+page.svelte`.
|
|
6
|
+
* Loads `useCurrentProfileNotifications` and renders one
|
|
7
|
+
* `<NotificationItem>` per entry with IntersectionObserver-driven pagination.
|
|
8
|
+
*
|
|
9
|
+
* Also marks all notifications as seen on mount and clears the PWA app badge
|
|
10
|
+
* — matching the Svelte version's `onMount`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function NotificationsList({ pageSize }: NotificationsListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef, useMemo } from 'react';
|
|
3
|
+
import { useT } from '../../i18n/index.js';
|
|
4
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
5
|
+
import { syncAppBadgeCount } from '../../lib/notificationBadge.js';
|
|
6
|
+
import { NotificationItem } from './NotificationItem.js';
|
|
7
|
+
import { LoadingSpinner } from '@openpeepshq/react-ui';
|
|
8
|
+
/**
|
|
9
|
+
* Translation of `routes/(protected)/(private)/notifications/+page.svelte`.
|
|
10
|
+
* Loads `useCurrentProfileNotifications` and renders one
|
|
11
|
+
* `<NotificationItem>` per entry with IntersectionObserver-driven pagination.
|
|
12
|
+
*
|
|
13
|
+
* Also marks all notifications as seen on mount and clears the PWA app badge
|
|
14
|
+
* — matching the Svelte version's `onMount`.
|
|
15
|
+
*/
|
|
16
|
+
export function NotificationsList({ pageSize = 15 }) {
|
|
17
|
+
const t = useT();
|
|
18
|
+
const { openpeepsApi, queryClient, client } = useOpenpeeps();
|
|
19
|
+
const sentinelRef = useRef(null);
|
|
20
|
+
const query = openpeepsApi.useCurrentProfileNotifications({
|
|
21
|
+
limit: pageSize,
|
|
22
|
+
});
|
|
23
|
+
const markAllNotificationsAsSeen = openpeepsApi.markAllNotificationsAsSeenAction()();
|
|
24
|
+
const statsQueryKey = client.profiles.current.notificationStats.queryKey({});
|
|
25
|
+
const resetNotificationsView = useCallback(async () => {
|
|
26
|
+
try {
|
|
27
|
+
await markAllNotificationsAsSeen();
|
|
28
|
+
queryClient.setQueryData(statsQueryKey, (current) => ({
|
|
29
|
+
unread: current?.unread ?? 0,
|
|
30
|
+
unseen: 0,
|
|
31
|
+
}));
|
|
32
|
+
await syncAppBadgeCount(0);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// A failed mark-seen should not block rendering the feed.
|
|
36
|
+
}
|
|
37
|
+
}, [markAllNotificationsAsSeen, queryClient, statsQueryKey]);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
void resetNotificationsView();
|
|
40
|
+
}, [resetNotificationsView]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (typeof document === 'undefined')
|
|
43
|
+
return;
|
|
44
|
+
const onVisibilityChange = () => {
|
|
45
|
+
if (document.visibilityState === 'visible') {
|
|
46
|
+
void query.refetch();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
50
|
+
return () => document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
51
|
+
}, [query]);
|
|
52
|
+
const notifications = useMemo(() => {
|
|
53
|
+
const flat = (query.data?.pages ?? []).flat();
|
|
54
|
+
const seen = new Set();
|
|
55
|
+
const out = [];
|
|
56
|
+
for (const n of flat) {
|
|
57
|
+
if (seen.has(n.id))
|
|
58
|
+
continue;
|
|
59
|
+
seen.add(n.id);
|
|
60
|
+
out.push(n);
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}, [query.data]);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const el = sentinelRef.current;
|
|
66
|
+
if (!el)
|
|
67
|
+
return;
|
|
68
|
+
const observer = new IntersectionObserver((entries) => {
|
|
69
|
+
const entry = entries[0];
|
|
70
|
+
if (!entry)
|
|
71
|
+
return;
|
|
72
|
+
if (entry.isIntersecting &&
|
|
73
|
+
query.hasNextPage &&
|
|
74
|
+
!query.isFetchingNextPage) {
|
|
75
|
+
void query.fetchNextPage();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
observer.observe(el);
|
|
79
|
+
return () => observer.disconnect();
|
|
80
|
+
}, [query]);
|
|
81
|
+
if (query.isLoading) {
|
|
82
|
+
return (_jsx("div", { className: "flex h-32 items-center justify-center text-sm text-muted-foreground", children: _jsx(LoadingSpinner, {}) }));
|
|
83
|
+
}
|
|
84
|
+
if (notifications.length === 0) {
|
|
85
|
+
return (_jsx("p", { className: "px-5 py-8 text-sm text-muted-foreground", children: t('notification.empty', { defaultValue: 'No notifications' }) }));
|
|
86
|
+
}
|
|
87
|
+
return (_jsxs("div", { className: "relative overflow-hidden", children: [notifications.map((n) => (_jsx(NotificationItem, { notification: n }, n.id))), _jsx("div", { ref: sentinelRef, "aria-hidden": "true", className: "h-8" }), query.isFetchingNextPage && (_jsx("div", { className: "flex justify-center py-4 text-sm text-muted-foreground", children: _jsx(LoadingSpinner, {}) }))] }));
|
|
88
|
+
}
|