@openpeepshq/react 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accounts/SignUpLoginModal.js +2 -2
- package/dist/components/configuration/ConfigMenuButton.d.ts +10 -0
- package/dist/components/configuration/ConfigMenuButton.js +12 -0
- package/dist/components/configuration/ConfigurationTree.js +1 -1
- package/dist/components/configuration/index.d.ts +2 -0
- package/dist/components/configuration/index.js +1 -0
- package/dist/components/conversations/ConversationMessageBubble.d.ts +2 -1
- package/dist/components/conversations/ConversationMessageBubble.js +4 -5
- package/dist/components/conversations/CreateNewConversation.js +10 -42
- package/dist/components/conversations/DirectMessagesHeaderActions.js +1 -1
- package/dist/components/conversations/MessageInThread.js +1 -2
- package/dist/components/form/ImageEditModal.js +2 -4
- package/dist/components/form/ImageInput.js +13 -8
- package/dist/components/form/LocationInput.js +1 -1
- package/dist/components/groups/AddGroupMembersButton.d.ts +1 -1
- package/dist/components/groups/AddGroupMembersButton.js +2 -2
- package/dist/components/groups/ChangeGroupRolesModal.js +1 -1
- package/dist/components/groups/ConfirmGroupExitModal.js +2 -2
- package/dist/components/groups/ConfirmMemberRemovalModal.js +1 -1
- package/dist/components/groups/DeleteGroupModal.js +1 -1
- package/dist/components/groups/GroupAvatar.js +4 -4
- package/dist/components/groups/GroupCard.js +3 -3
- package/dist/components/groups/GroupHeader.js +1 -1
- package/dist/components/groups/GroupMembersList.js +2 -3
- package/dist/components/groups/GroupOptionsMenu.js +12 -6
- package/dist/components/groups/JoinGroupButton.js +3 -20
- package/dist/components/jams/CreateNewJam.js +4 -4
- package/dist/components/jams/JamCallParticipant.js +17 -7
- package/dist/components/jams/JamCapacityGate.js +1 -1
- package/dist/components/jams/JamChatDrawer.js +2 -2
- package/dist/components/jams/JamConference.js +1 -1
- package/dist/components/jams/JamContext.d.ts +4 -0
- package/dist/components/jams/JamContext.js +17 -2
- package/dist/components/jams/JamDetailsDrawer.js +1 -1
- package/dist/components/jams/JamDeviceSelectors.d.ts +15 -0
- package/dist/components/jams/JamDeviceSelectors.js +4 -3
- package/dist/components/jams/JamFooter.js +15 -16
- package/dist/components/jams/JamGuestForm.js +2 -2
- package/dist/components/jams/JamLobby.js +9 -19
- package/dist/components/jams/JamObserverShell.js +1 -1
- package/dist/components/jams/JamParticipantConference.js +1 -1
- package/dist/components/jams/JamPeopleDrawer.js +17 -13
- package/dist/components/jams/JamReactionMenu.js +1 -1
- package/dist/components/jams/JamRequestJoin.js +1 -1
- package/dist/components/jams/JamRoom.js +84 -4
- package/dist/components/jams/JamToolbarButton.d.ts +21 -0
- package/dist/components/jams/JamToolbarButton.js +19 -0
- package/dist/components/jams/JamVideoCall.js +8 -3
- package/dist/components/jams/JamVideoLayout.js +16 -5
- package/dist/components/jams/LeaveCloseButton.js +9 -44
- package/dist/components/jams/LiveJamsSection.js +1 -1
- package/dist/components/jams/constants.js +4 -0
- package/dist/components/jams/useParticipantConnection.d.ts +7 -0
- package/dist/components/jams/useParticipantConnection.js +11 -0
- package/dist/components/layout/Auth.js +1 -1
- package/dist/components/layout/Infos.js +2 -2
- package/dist/components/layout/OpenpeepsContextProvider.js +4 -3
- package/dist/components/layout/OpenpeepsThemeProvider.d.ts +3 -4
- package/dist/components/layout/OpenpeepsThemeProvider.js +23 -9
- package/dist/components/layout/Root.js +1 -1
- package/dist/components/markdown/CompiledMarkdown.js +15 -1
- package/dist/components/markdown/classes.d.ts +2 -0
- package/dist/components/markdown/classes.js +2 -0
- package/dist/components/markdown/index.d.ts +1 -1
- package/dist/components/markdown/index.js +1 -1
- package/dist/components/navigation/ContentHeader.js +1 -1
- package/dist/components/navigation/FooterMobile.js +5 -1
- package/dist/components/navigation/HeaderMobile.js +1 -1
- package/dist/components/navigation/MobileMenuItem.js +1 -1
- package/dist/components/navigation/PageHeaderAction.js +1 -1
- package/dist/components/navigation/PlusButton.js +1 -1
- package/dist/components/navigation/SideBar.js +6 -1
- package/dist/components/navigation/breadcrumbs/Breadcrumbs.js +5 -1
- package/dist/components/navigation/sideBarNavLinkClass.js +1 -1
- package/dist/components/notifications/NotificationHeaderActions.js +2 -2
- package/dist/components/notifications/NotificationWrapper.js +1 -1
- package/dist/components/notifications/NotificationsList.js +3 -3
- package/dist/components/notifications/TypedNotification.js +3 -3
- package/dist/components/post/Feed.js +3 -3
- package/dist/components/post/FeedPost.d.ts +2 -1
- package/dist/components/post/FeedPost.js +11 -6
- package/dist/components/post/FeedPostContent.js +1 -1
- package/dist/components/post/FullPostLayout.js +11 -4
- package/dist/components/post/NewEventButton.js +1 -1
- package/dist/components/post/NewNoteButton.js +1 -1
- package/dist/components/post/PinnedPost.js +1 -1
- package/dist/components/post/ReplyBox.js +1 -1
- package/dist/components/post/feed/events/EventsFeed.js +3 -3
- package/dist/components/post/feed/threaded/ThreadPost.js +1 -1
- package/dist/components/post/feed/threaded/ThreadedFeed.d.ts +3 -1
- package/dist/components/post/feed/threaded/ThreadedFeed.js +3 -3
- package/dist/components/post/pieces/Attachments.js +3 -3
- package/dist/components/post/pieces/EventMenu.js +1 -1
- package/dist/components/post/pieces/EventRsvpButton.js +3 -3
- package/dist/components/post/pieces/FeedPostStats.js +2 -2
- package/dist/components/post/pieces/GalleryModal.js +36 -5
- package/dist/components/post/pieces/PollContent.js +33 -14
- package/dist/components/post/pieces/PostActions.js +6 -45
- package/dist/components/post/pieces/PostInfoHeader.js +1 -1
- package/dist/components/post/pieces/PostMenu.js +35 -9
- package/dist/components/post/pieces/PostReactionHeader.js +1 -1
- package/dist/components/post/pieces/ShareMenu.js +4 -2
- package/dist/components/post/pieces/UnreadPostIndicator.d.ts +5 -3
- package/dist/components/post/pieces/UnreadPostIndicator.js +4 -3
- package/dist/components/post/pieces/modals/DeletePostModal.js +1 -1
- package/dist/components/post/pieces/modals/RepostModal.d.ts +5 -3
- package/dist/components/post/pieces/modals/RepostModal.js +8 -7
- package/dist/components/post/post-form/AttachmentCard.js +2 -2
- package/dist/components/post/post-form/ComposeAttachments.js +1 -1
- package/dist/components/post/post-form/DescriptionEditModal.js +1 -1
- package/dist/components/post/post-form/EditPostModal.js +22 -12
- package/dist/components/post/post-form/EventForm.js +2 -2
- package/dist/components/post/post-form/EventTypeSwitcher.js +1 -1
- package/dist/components/post/post-form/NewPostModal.d.ts +1 -1
- package/dist/components/post/post-form/NewPostModal.js +10 -10
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.js +2 -2
- package/dist/components/post/post-form/PollComposerFields.d.ts +2 -0
- package/dist/components/post/post-form/PollComposerFields.js +12 -8
- package/dist/components/post/post-form/PostAudienceSelector.js +3 -3
- package/dist/components/post/post-form/PostTypeSwitcher.js +1 -1
- package/dist/components/post/post-form/ReplyModal.js +9 -8
- package/dist/components/post/post-form/VisibilitySelector.js +1 -1
- package/dist/components/post/types/Article.js +2 -1
- package/dist/components/post/types/Event.js +1 -1
- package/dist/components/post/types/Note.js +2 -1
- package/dist/components/post/types/Poll.js +2 -1
- package/dist/components/post/types/event/CardEvent.js +2 -2
- package/dist/components/post/types/event/FullEvent.js +8 -8
- package/dist/components/post/types/event/ProfileEventRelationship.d.ts +1 -1
- package/dist/components/post/types/event/ProfileEventRelationship.js +38 -18
- package/dist/components/preview-link/LocalPreviewLink.js +1 -1
- package/dist/components/preview-link/RemotePreviewLink.js +5 -1
- package/dist/components/profile/Avatar.js +3 -2
- package/dist/components/profile/FollowUnfollowButton.js +2 -2
- package/dist/components/profile/ProfileBadge.js +1 -1
- package/dist/components/profile/ProfileCard.js +1 -1
- package/dist/components/profile/ProfileHeader.js +1 -1
- package/dist/components/profile/ProfilePageAction.js +3 -3
- package/dist/components/profile/ProfilePostsAndReplies.js +3 -1
- package/dist/components/profile/ProfileSelector.js +3 -3
- package/dist/components/profile/ProfilesInput.js +1 -1
- package/dist/components/profile/ReportProfileOrPostModal.js +6 -4
- package/dist/components/server-data/context.d.ts +8 -0
- package/dist/contexts/openpeeps/hooks/admin.d.ts +63 -16774
- package/dist/contexts/openpeeps/hooks/admin.js +34 -14
- package/dist/contexts/openpeeps/hooks/conversations.d.ts +330 -0
- package/dist/contexts/openpeeps/hooks/jams.d.ts +110 -0
- package/dist/contexts/openpeeps/hooks/jams.js +1 -1
- package/dist/contexts/openpeeps/hooks/other.d.ts +8 -0
- package/dist/contexts/openpeeps/hooks/posts.d.ts +933 -53
- package/dist/contexts/openpeeps/hooks/profiles.d.ts +220 -0
- package/dist/contexts/openpeeps/hooks/search.d.ts +330 -0
- package/dist/contexts/openpeeps/index.d.ts +1 -1
- package/dist/contexts/openpeeps/index.js +10 -2
- package/dist/contexts/router/index.d.ts +8 -3
- package/dist/contexts/router/index.js +7 -3
- package/dist/hooks/conversations/useCreateConversation.d.ts +124 -0
- package/dist/hooks/conversations/useCreateConversation.js +56 -0
- package/dist/hooks/groups/useJoinGroup.d.ts +8 -0
- package/dist/hooks/groups/useJoinGroup.js +23 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/jams/useLeaveCloseJam.d.ts +20 -0
- package/dist/hooks/jams/useLeaveCloseJam.js +59 -0
- package/dist/hooks/posts/useFeedPostActions.d.ts +18 -0
- package/dist/hooks/posts/useFeedPostActions.js +51 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/lib/Markdown.d.ts +14 -0
- package/dist/lib/Markdown.js +16 -0
- package/dist/lib/analyticsClicks.d.ts +12 -0
- package/dist/lib/analyticsClicks.js +64 -0
- package/dist/lib/auth.d.ts +8 -0
- package/dist/lib/auth.js +27 -0
- package/dist/lib/canvasUtils.d.ts +6 -0
- package/dist/lib/canvasUtils.js +62 -1
- package/dist/lib/groupCapabilityHelpers.d.ts +1 -1
- package/dist/lib/passwordStrength.d.ts +6 -0
- package/dist/lib/passwordStrength.js +26 -0
- package/dist/lib/postUnread.d.ts +7 -0
- package/dist/lib/postUnread.js +7 -0
- package/dist/lib/postViewCounter.d.ts +1 -1
- package/dist/lib/postViewCounter.js +3 -1
- package/dist/lib/routeHandles.d.ts +2 -0
- package/dist/lib/routeHandles.js +2 -0
- package/dist/lib/svgCover.d.ts +2 -0
- package/dist/lib/svgCover.js +18 -0
- package/dist/navigation/index.d.ts +11 -0
- package/dist/navigation/index.js +2 -0
- package/dist/navigation/menuItems.d.ts +8 -0
- package/dist/navigation/menuItems.js +83 -0
- package/dist/navigation/targets.d.ts +94 -0
- package/dist/navigation/targets.js +12 -0
- package/dist/pages/About.d.ts +1 -0
- package/dist/pages/About.js +19 -0
- package/dist/pages/CodeOfConduct.d.ts +1 -0
- package/dist/pages/CodeOfConduct.js +14 -0
- package/dist/pages/Explore.d.ts +1 -0
- package/dist/pages/Explore.js +132 -0
- package/dist/pages/Home.d.ts +6 -0
- package/dist/pages/Home.js +31 -0
- package/dist/pages/Members.d.ts +1 -0
- package/dist/pages/Members.js +35 -0
- package/dist/pages/NotFound.d.ts +1 -0
- package/dist/pages/NotFound.js +9 -0
- package/dist/pages/Notifications.d.ts +1 -0
- package/dist/pages/Notifications.js +8 -0
- package/dist/pages/PostDetail.d.ts +1 -0
- package/dist/pages/PostDetail.js +27 -0
- package/dist/pages/Profile.d.ts +1 -0
- package/dist/pages/Profile.js +20 -0
- package/dist/pages/Tags.d.ts +1 -0
- package/dist/pages/Tags.js +14 -0
- package/dist/pages/Welcome.d.ts +1 -0
- package/dist/pages/Welcome.js +89 -0
- package/dist/pages/admin/Analytics.d.ts +11 -0
- package/dist/pages/admin/Analytics.js +11 -0
- package/dist/pages/admin/ApiKeys.d.ts +1 -0
- package/dist/pages/admin/ApiKeys.js +141 -0
- package/dist/pages/admin/Backups.d.ts +1 -0
- package/dist/pages/admin/Backups.js +39 -0
- package/dist/pages/admin/ConfigEditor.d.ts +14 -0
- package/dist/pages/admin/ConfigEditor.js +91 -0
- package/dist/pages/admin/Configuration.d.ts +1 -0
- package/dist/pages/admin/Configuration.js +8 -0
- package/dist/pages/admin/ConfigurationCommunity.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunity.js +7 -0
- package/dist/pages/admin/ConfigurationCommunityLanguage.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunityLanguage.js +71 -0
- package/dist/pages/admin/ConfigurationEmail.d.ts +1 -0
- package/dist/pages/admin/ConfigurationEmail.js +97 -0
- package/dist/pages/admin/ConfigurationI18n.d.ts +1 -0
- package/dist/pages/admin/ConfigurationI18n.js +51 -0
- package/dist/pages/admin/Dashboard.d.ts +1 -0
- package/dist/pages/admin/Dashboard.js +40 -0
- package/dist/pages/admin/Db.d.ts +1 -0
- package/dist/pages/admin/Db.js +238 -0
- package/dist/pages/admin/Diagnostics.d.ts +1 -0
- package/dist/pages/admin/Diagnostics.js +8 -0
- package/dist/pages/admin/DiagnosticsEmail.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsEmail.js +65 -0
- package/dist/pages/admin/DiagnosticsJob.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsJob.js +51 -0
- package/dist/pages/admin/DiagnosticsLogs.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsLogs.js +62 -0
- package/dist/pages/admin/DiagnosticsPerformance.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsPerformance.js +34 -0
- package/dist/pages/admin/GroupMembers.d.ts +1 -0
- package/dist/pages/admin/GroupMembers.js +109 -0
- package/dist/pages/admin/Groups.d.ts +1 -0
- package/dist/pages/admin/Groups.js +61 -0
- package/dist/pages/admin/Invites.d.ts +1 -0
- package/dist/pages/admin/Invites.js +72 -0
- package/dist/pages/admin/Members.d.ts +1 -0
- package/dist/pages/admin/Members.js +49 -0
- package/dist/pages/admin/Moderation.d.ts +1 -0
- package/dist/pages/admin/Moderation.js +62 -0
- package/dist/pages/admin/Reports.d.ts +1 -0
- package/dist/pages/admin/Reports.js +178 -0
- package/dist/pages/admin/analytics/AnalyticsLayout.d.ts +14 -0
- package/dist/pages/admin/analytics/AnalyticsLayout.js +104 -0
- package/dist/pages/admin/analytics/AnalyticsRangeContext.d.ts +9 -0
- package/dist/pages/admin/analytics/AnalyticsRangeContext.js +9 -0
- package/dist/pages/admin/analytics/Content.d.ts +1 -0
- package/dist/pages/admin/analytics/Content.js +117 -0
- package/dist/pages/admin/analytics/Engagement.d.ts +1 -0
- package/dist/pages/admin/analytics/Engagement.js +220 -0
- package/dist/pages/admin/analytics/Groups.d.ts +1 -0
- package/dist/pages/admin/analytics/Groups.js +139 -0
- package/dist/pages/admin/analytics/Members.d.ts +1 -0
- package/dist/pages/admin/analytics/Members.js +96 -0
- package/dist/pages/admin/analytics/Overview.d.ts +1 -0
- package/dist/pages/admin/analytics/Overview.js +165 -0
- package/dist/pages/admin/analytics/ReportSettings.d.ts +1 -0
- package/dist/pages/admin/analytics/ReportSettings.js +62 -0
- package/dist/pages/admin/analytics/analyticsInfo.d.ts +3 -0
- package/dist/pages/admin/analytics/analyticsInfo.js +4 -0
- package/dist/pages/admin/analytics/downloadCsv.d.ts +2 -0
- package/dist/pages/admin/analytics/downloadCsv.js +20 -0
- package/dist/pages/admin/community/CommunityFavicons.d.ts +1 -0
- package/dist/pages/admin/community/CommunityFavicons.js +47 -0
- package/dist/pages/admin/community/CommunityInfo.d.ts +1 -0
- package/dist/pages/admin/community/CommunityInfo.js +35 -0
- package/dist/pages/admin/community/CommunityLinks.d.ts +1 -0
- package/dist/pages/admin/community/CommunityLinks.js +35 -0
- package/dist/pages/admin/community/CommunityMarkdownPage.d.ts +8 -0
- package/dist/pages/admin/community/CommunityMarkdownPage.js +35 -0
- package/dist/pages/admin/community/CommunityProfileFields.d.ts +1 -0
- package/dist/pages/admin/community/CommunityProfileFields.js +50 -0
- package/dist/pages/admin/community/CommunityRoles.d.ts +1 -0
- package/dist/pages/admin/community/CommunityRoles.js +109 -0
- package/dist/pages/admin/community/CommunityTheme.d.ts +1 -0
- package/dist/pages/admin/community/CommunityTheme.js +56 -0
- package/dist/pages/admin/community/useCommunityConfig.d.ts +168 -0
- package/dist/pages/admin/community/useCommunityConfig.js +28 -0
- package/dist/pages/admin/components/AdminCharts.d.ts +22 -0
- package/dist/pages/admin/components/AdminCharts.js +29 -0
- package/dist/pages/admin/components/AdminGroupCard.d.ts +6 -0
- package/dist/pages/admin/components/AdminGroupCard.js +42 -0
- package/dist/pages/admin/components/AdminInviteActions.d.ts +1 -0
- package/dist/pages/admin/components/AdminInviteActions.js +23 -0
- package/dist/pages/admin/components/InviteWithEmailModal.d.ts +3 -0
- package/dist/pages/admin/components/InviteWithEmailModal.js +82 -0
- package/dist/pages/admin/components/InviteWithLinkModal.d.ts +22 -0
- package/dist/pages/admin/components/InviteWithLinkModal.js +98 -0
- package/dist/pages/admin/components/ProfileRowActions.d.ts +5 -0
- package/dist/pages/admin/components/ProfileRowActions.js +131 -0
- package/dist/pages/admin/components/RestoreBackupModal.d.ts +4 -0
- package/dist/pages/admin/components/RestoreBackupModal.js +33 -0
- package/dist/pages/admin/components/RestoreTestBackupModal.d.ts +4 -0
- package/dist/pages/admin/components/RestoreTestBackupModal.js +36 -0
- package/dist/pages/articles/Edit.d.ts +1 -0
- package/dist/pages/articles/Edit.js +60 -0
- package/dist/pages/articles/Index.d.ts +1 -0
- package/dist/pages/articles/Index.js +18 -0
- package/dist/pages/articles/New.d.ts +1 -0
- package/dist/pages/articles/New.js +48 -0
- package/dist/pages/auth/Closed.d.ts +1 -0
- package/dist/pages/auth/Closed.js +14 -0
- package/dist/pages/auth/Login.d.ts +1 -0
- package/dist/pages/auth/Login.js +74 -0
- package/dist/pages/auth/OidcCallback.d.ts +5 -0
- package/dist/pages/auth/OidcCallback.js +31 -0
- package/dist/pages/auth/OidcPending.d.ts +5 -0
- package/dist/pages/auth/OidcPending.js +39 -0
- package/dist/pages/auth/Register.d.ts +4 -0
- package/dist/pages/auth/Register.js +124 -0
- package/dist/pages/auth/RegisterInvitation.d.ts +1 -0
- package/dist/pages/auth/RegisterInvitation.js +5 -0
- package/dist/pages/auth/RequestResetPassword.d.ts +1 -0
- package/dist/pages/auth/RequestResetPassword.js +50 -0
- package/dist/pages/auth/ResetPassword.d.ts +1 -0
- package/dist/pages/auth/ResetPassword.js +40 -0
- package/dist/pages/auth/SsoCallback.d.ts +1 -0
- package/dist/pages/auth/SsoCallback.js +34 -0
- package/dist/pages/auth/ValidateEmail.d.ts +6 -0
- package/dist/pages/auth/ValidateEmail.js +64 -0
- package/dist/pages/conversations/Index.d.ts +1 -0
- package/dist/pages/conversations/Index.js +58 -0
- package/dist/pages/conversations/Info.d.ts +1 -0
- package/dist/pages/conversations/Info.js +26 -0
- package/dist/pages/conversations/New.d.ts +1 -0
- package/dist/pages/conversations/New.js +8 -0
- package/dist/pages/conversations/Show.d.ts +1 -0
- package/dist/pages/conversations/Show.js +100 -0
- package/dist/pages/events/Edit.d.ts +1 -0
- package/dist/pages/events/Edit.js +69 -0
- package/dist/pages/events/Index.d.ts +1 -0
- package/dist/pages/events/Index.js +23 -0
- package/dist/pages/events/My.d.ts +1 -0
- package/dist/pages/events/My.js +24 -0
- package/dist/pages/events/New.d.ts +1 -0
- package/dist/pages/events/New.js +66 -0
- package/dist/pages/feeds/Bookmarks.d.ts +1 -0
- package/dist/pages/feeds/Bookmarks.js +10 -0
- package/dist/pages/feeds/Local.d.ts +1 -0
- package/dist/pages/feeds/Local.js +14 -0
- package/dist/pages/feeds/My.d.ts +1 -0
- package/dist/pages/feeds/My.js +12 -0
- package/dist/pages/groups/Edit.d.ts +1 -0
- package/dist/pages/groups/Edit.js +57 -0
- package/dist/pages/groups/Index.d.ts +1 -0
- package/dist/pages/groups/Index.js +50 -0
- package/dist/pages/groups/Info.d.ts +1 -0
- package/dist/pages/groups/Info.js +21 -0
- package/dist/pages/groups/Members.d.ts +1 -0
- package/dist/pages/groups/Members.js +28 -0
- package/dist/pages/groups/New.d.ts +1 -0
- package/dist/pages/groups/New.js +68 -0
- package/dist/pages/groups/Show.d.ts +1 -0
- package/dist/pages/groups/Show.js +64 -0
- package/dist/pages/index.d.ts +94 -0
- package/dist/pages/index.js +94 -0
- package/dist/pages/jams/Event.d.ts +8 -0
- package/dist/pages/jams/Event.js +57 -0
- package/dist/pages/jams/Index.d.ts +6 -0
- package/dist/pages/jams/Index.js +44 -0
- package/dist/pages/payment/Success.d.ts +1 -0
- package/dist/pages/payment/Success.js +30 -0
- package/dist/pages/plugins/Index.d.ts +1 -0
- package/dist/pages/plugins/Index.js +69 -0
- package/dist/pages/profile/Followers.d.ts +6 -0
- package/dist/pages/profile/Followers.js +28 -0
- package/dist/pages/settings/AccessTokens.d.ts +1 -0
- package/dist/pages/settings/AccessTokens.js +149 -0
- package/dist/pages/settings/Account.d.ts +1 -0
- package/dist/pages/settings/Account.js +81 -0
- package/dist/pages/settings/Billing.d.ts +1 -0
- package/dist/pages/settings/Billing.js +82 -0
- package/dist/pages/settings/Index.d.ts +1 -0
- package/dist/pages/settings/Index.js +13 -0
- package/dist/pages/settings/Language.d.ts +1 -0
- package/dist/pages/settings/Language.js +54 -0
- package/dist/pages/settings/NotificationPreferences.d.ts +1 -0
- package/dist/pages/settings/NotificationPreferences.js +180 -0
- package/dist/pages/settings/Notifications.d.ts +1 -0
- package/dist/pages/settings/Notifications.js +10 -0
- package/dist/pages/settings/PublicProfile.d.ts +1 -0
- package/dist/pages/settings/PublicProfile.js +135 -0
- package/dist/pages/settings/PushEnabledDevices.d.ts +1 -0
- package/dist/pages/settings/PushEnabledDevices.js +67 -0
- package/dist/pages/settings/Theme.d.ts +1 -0
- package/dist/pages/settings/Theme.js +37 -0
- package/dist/pages/test/Error.d.ts +1 -0
- package/dist/pages/test/Error.js +10 -0
- package/dist/pages/test/Markdown.d.ts +1 -0
- package/dist/pages/test/Markdown.js +32 -0
- package/dist/pwa/InstallPrompt.js +1 -1
- package/dist/pwa/NotificationPermissionPrompt.js +2 -2
- package/dist/pwa/UpdatePrompt.js +1 -1
- package/dist/react-native.d.ts +1 -0
- package/dist/react-native.js +1 -0
- package/dist/session/useSessionEvents.d.ts +3 -0
- package/dist/session/useSessionEvents.js +64 -0
- package/dist/stores/newPosts.d.ts +8 -8
- package/package.json +14 -9
- package/dist/components/jams/useJamLiveKitTheme.d.ts +0 -3
- package/dist/components/jams/useJamLiveKitTheme.js +0 -10
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useParams } from 'react-router-dom';
|
|
3
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
4
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
5
|
+
function formatTime(ms) {
|
|
6
|
+
if (ms == null)
|
|
7
|
+
return '—';
|
|
8
|
+
const iso = new Date(ms).toISOString();
|
|
9
|
+
return `${iso.slice(0, 10)} ${iso.slice(11, 19)} UTC`;
|
|
10
|
+
}
|
|
11
|
+
function formatPayload(data) {
|
|
12
|
+
if (data == null)
|
|
13
|
+
return '—';
|
|
14
|
+
try {
|
|
15
|
+
return JSON.stringify(data, null, 2);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return String(data);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function JobDetails({ job, onRefresh, }) {
|
|
22
|
+
const t = useT();
|
|
23
|
+
return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsxs("div", { className: "bg-surface rounded-lg border p-4", children: [_jsxs("div", { className: "mb-3 flex flex-wrap items-center justify-between gap-2", children: [_jsx("p", { className: "font-medium", children: t('diagnostics.jobs.details', { defaultValue: 'Job details' }) }), _jsx(Button, { variant: "default", action: onRefresh, children: t('diagnostics.jobs.refresh', { defaultValue: 'Refresh' }) })] }), _jsxs("dl", { className: "grid gap-2 text-sm sm:grid-cols-2", children: [_jsxs("div", { children: [_jsx("dt", { className: "opacity-70", children: t('diagnostics.jobs.queue', { defaultValue: 'Queue' }) }), _jsx("dd", { className: "font-mono", children: job.queue })] }), _jsxs("div", { children: [_jsx("dt", { className: "opacity-70", children: t('diagnostics.jobs.id', { defaultValue: 'ID' }) }), _jsx("dd", { className: "break-all font-mono", children: job.id })] }), _jsxs("div", { children: [_jsx("dt", { className: "opacity-70", children: t('diagnostics.jobs.name', { defaultValue: 'Name' }) }), _jsx("dd", { className: "break-all font-mono", children: job.name })] }), _jsxs("div", { children: [_jsx("dt", { className: "opacity-70", children: t('diagnostics.jobs.state', { defaultValue: 'State' }) }), _jsx("dd", { className: "font-mono", children: job.state })] }), _jsxs("div", { children: [_jsx("dt", { className: "opacity-70", children: t('diagnostics.jobs.queuedAt', { defaultValue: 'Queued at' }) }), _jsx("dd", { children: formatTime(job.timestamp) })] }), _jsxs("div", { children: [_jsx("dt", { className: "opacity-70", children: t('diagnostics.jobs.finishedAt', {
|
|
24
|
+
defaultValue: 'Finished at',
|
|
25
|
+
}) }), _jsx("dd", { children: formatTime(job.finishedOn) })] })] }), job.failedReason ? (_jsxs("div", { className: "border-error/30 bg-error/10 mt-3 rounded border p-2 text-sm", children: [_jsx("p", { className: "text-error mb-1 font-medium", children: t('diagnostics.jobs.failedReason', {
|
|
26
|
+
defaultValue: 'Failed reason',
|
|
27
|
+
}) }), _jsx("p", { className: "whitespace-pre-wrap break-words", children: job.failedReason })] })) : null, _jsxs("div", { className: "mt-3", children: [_jsx("p", { className: "mb-1 text-sm opacity-70", children: t('diagnostics.jobs.payload', { defaultValue: 'Payload' }) }), _jsx("pre", { className: "bg-surface-2 max-h-64 overflow-auto whitespace-pre-wrap break-words rounded p-2 font-mono text-xs", children: formatPayload(job.data) })] })] }), _jsxs("div", { className: "bg-surface rounded-lg border p-4", children: [_jsx("p", { className: "mb-2 font-medium", children: t('diagnostics.jobs.logs', { defaultValue: 'Logs' }) }), _jsx("p", { className: "mb-3 text-sm opacity-80", children: t('diagnostics.jobs.logsHint', {
|
|
28
|
+
defaultValue: '{{count}} log lines',
|
|
29
|
+
count: job.logCount,
|
|
30
|
+
}) }), job.logs.length === 0 ? (_jsx("p", { className: "text-sm opacity-70", children: t('diagnostics.jobs.logsEmpty', {
|
|
31
|
+
defaultValue: 'No logs recorded.',
|
|
32
|
+
}) })) : (_jsx("ol", { className: "space-y-1 font-mono text-xs", children: job.logs.map((line, index) => (_jsxs("li", { className: "bg-surface-2 whitespace-pre-wrap break-words rounded px-2 py-1", children: [_jsxs("span", { className: "mr-2 opacity-50", children: [index + 1, "."] }), line] }, index))) }))] })] }));
|
|
33
|
+
}
|
|
34
|
+
export function AdminDiagnosticsJob() {
|
|
35
|
+
const t = useT();
|
|
36
|
+
const { queue, jobId } = useParams();
|
|
37
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
38
|
+
const jobQuery = openpeepsApi.admin.useJobDetail(queue ?? '', jobId ?? '');
|
|
39
|
+
useSetPageHeader(t('diagnostics.jobs.title', { defaultValue: 'Queue job' }));
|
|
40
|
+
if (!queue || !jobId) {
|
|
41
|
+
return (_jsx("p", { className: "text-error p-4 text-sm", children: t('diagnostics.jobs.notFound', { defaultValue: 'Job not found.' }) }));
|
|
42
|
+
}
|
|
43
|
+
const refresh = () => jobQuery.refetch();
|
|
44
|
+
if (jobQuery.isLoading) {
|
|
45
|
+
return (_jsx("p", { className: "p-4 text-sm opacity-70", children: t('common.form.loading', { defaultValue: 'Loading…' }) }));
|
|
46
|
+
}
|
|
47
|
+
if (jobQuery.isError || !jobQuery.data) {
|
|
48
|
+
return (_jsx("p", { className: "text-error p-4 text-sm", children: t('diagnostics.jobs.notFound', { defaultValue: 'Job not found.' }) }));
|
|
49
|
+
}
|
|
50
|
+
return _jsx(JobDetails, { job: jobQuery.data, onRefresh: refresh });
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AdminDiagnosticsLogs(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
4
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
5
|
+
const LOG_LEVELS = [
|
|
6
|
+
'trace',
|
|
7
|
+
'debug',
|
|
8
|
+
'info',
|
|
9
|
+
'warn',
|
|
10
|
+
'error',
|
|
11
|
+
'fatal',
|
|
12
|
+
];
|
|
13
|
+
const todayIsoDate = () => new Date().toISOString().slice(0, 10);
|
|
14
|
+
const levelClass = (level) => {
|
|
15
|
+
switch (level.toLowerCase()) {
|
|
16
|
+
case 'error':
|
|
17
|
+
case 'fatal':
|
|
18
|
+
return 'bg-error/15 text-error';
|
|
19
|
+
case 'warn':
|
|
20
|
+
return 'bg-warning/15 text-warning';
|
|
21
|
+
case 'debug':
|
|
22
|
+
case 'trace':
|
|
23
|
+
return 'bg-surface text-muted-foreground';
|
|
24
|
+
default:
|
|
25
|
+
return 'bg-primary/10 text-primary';
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const formatTimestamp = (timestamp) => {
|
|
29
|
+
try {
|
|
30
|
+
return new Date(timestamp).toISOString().slice(11, 23);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return timestamp;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export function AdminDiagnosticsLogs() {
|
|
37
|
+
const t = useT();
|
|
38
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
39
|
+
const [date, setDate] = useState(todayIsoDate());
|
|
40
|
+
const [textFilter, setTextFilter] = useState('');
|
|
41
|
+
const [levelFilter, setLevelFilter] = useState('all');
|
|
42
|
+
const isToday = date === todayIsoDate();
|
|
43
|
+
const logsQuery = openpeepsApi.admin.useLogsList(date, isToday ? 5000 : undefined);
|
|
44
|
+
useSetPageHeader(t('diagnostics.logs.title', { defaultValue: 'Logs' }));
|
|
45
|
+
const logs = logsQuery.data ?? [];
|
|
46
|
+
const filtered = useMemo(() => {
|
|
47
|
+
const needle = textFilter.trim().toLowerCase();
|
|
48
|
+
return logs.filter((log) => {
|
|
49
|
+
if (levelFilter !== 'all' && log.level.toLowerCase() !== levelFilter) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (!needle)
|
|
53
|
+
return true;
|
|
54
|
+
return (log.message.toLowerCase().includes(needle) ||
|
|
55
|
+
log.namespace.toLowerCase().includes(needle));
|
|
56
|
+
});
|
|
57
|
+
}, [logs, textFilter, levelFilter]);
|
|
58
|
+
return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsxs("div", { className: "bg-surface-2 rounded-lg p-4", children: [_jsxs("div", { className: "mb-3 flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: t('diagnostics.logs.title') }), _jsx("p", { className: "text-sm opacity-80", children: t('diagnostics.logs.hint') })] }), _jsx(Button, { variant: "secondary", title: t('diagnostics.logs.refresh'), action: () => logsQuery.refetch(), children: t('diagnostics.logs.refresh') })] }), _jsxs("div", { className: "grid gap-3 md:grid-cols-3", children: [_jsxs("label", { children: [_jsx("span", { children: t('diagnostics.logs.date') }), _jsx("input", { type: "date", value: date, onChange: (e) => setDate(e.target.value), className: "op-input rounded", max: todayIsoDate() })] }), _jsxs("label", { children: [_jsx("span", { children: t('diagnostics.logs.level') }), _jsxs("select", { value: levelFilter, onChange: (e) => setLevelFilter(e.target.value), className: "op-input rounded", children: [_jsx("option", { value: "all", children: t('diagnostics.logs.allLevels') }), LOG_LEVELS.map((level) => (_jsx("option", { value: level, children: level.toUpperCase() }, level)))] })] }), _jsxs("label", { children: [_jsx("span", { children: t('diagnostics.logs.filter') }), _jsx("input", { type: "search", value: textFilter, onChange: (e) => setTextFilter(e.target.value), className: "op-input rounded", placeholder: t('diagnostics.logs.filterPlaceholder') })] })] }), _jsxs("div", { className: "mt-3 flex flex-wrap items-center gap-x-4 gap-y-1 text-sm opacity-80", children: [_jsx("span", { children: t('diagnostics.logs.showing', {
|
|
59
|
+
count: filtered.length,
|
|
60
|
+
total: logs.length,
|
|
61
|
+
}) }), isToday ? (_jsx("span", { className: "text-primary", children: t('diagnostics.logs.autoRefresh') })) : null] })] }), _jsx("div", { className: "border-border bg-surface overflow-hidden rounded-lg border", children: logsQuery.isPending ? (_jsx("p", { className: "p-4 text-sm opacity-70", children: t('common.form.loading') })) : logsQuery.isError ? (_jsx("p", { className: "text-error p-4 text-sm", children: t('diagnostics.logs.loadError') })) : filtered.length === 0 ? (_jsx("p", { className: "p-4 text-sm opacity-70", children: t('diagnostics.logs.empty') })) : (_jsx("div", { className: "max-h-[calc(100vh-20rem)] overflow-y-auto", children: _jsxs("table", { className: "w-full table-fixed text-sm", children: [_jsx("thead", { className: "bg-surface-2 sticky top-0 z-10 text-left", children: _jsxs("tr", { children: [_jsx("th", { className: "w-28 px-3 py-2 font-medium", children: t('diagnostics.logs.timestamp') }), _jsx("th", { className: "w-20 px-3 py-2 font-medium", children: t('diagnostics.logs.levelColumn') }), _jsx("th", { className: "w-44 px-3 py-2 font-medium", children: t('diagnostics.logs.namespaceColumn') }), _jsx("th", { className: "px-3 py-2 font-medium", children: t('diagnostics.logs.messageColumn') })] }) }), _jsx("tbody", { className: "font-mono", children: filtered.map((log, idx) => (_jsxs("tr", { className: "border-border border-t align-top", children: [_jsx("td", { className: "px-3 py-2 text-xs opacity-80", children: formatTimestamp(log.timestamp) }), _jsx("td", { className: "px-3 py-2", children: _jsx("span", { className: `inline-block rounded px-1.5 py-0.5 text-xs font-semibold uppercase ${levelClass(log.level)}`, children: log.level }) }), _jsx("td", { className: "break-all px-3 py-2 text-xs opacity-90", children: log.namespace }), _jsx("td", { className: "whitespace-pre-wrap break-words px-3 py-2", children: log.message })] }, `${log.timestamp}-${log.namespace}-${idx}`))) })] }) })) })] }));
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AdminDiagnosticsPerformance: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
3
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
4
|
+
export const AdminDiagnosticsPerformance = () => {
|
|
5
|
+
const t = useT();
|
|
6
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
7
|
+
const statsQuery = openpeepsApi.admin.usePerformanceStats();
|
|
8
|
+
useSetPageHeader(t('diagnostics.performance.title', { defaultValue: 'Performance' }));
|
|
9
|
+
const stats = statsQuery.data;
|
|
10
|
+
const slowRequests = stats?.slowRequests ?? [];
|
|
11
|
+
return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsx("p", { className: "text-muted-foreground text-sm", children: t('diagnostics.performance.description', {
|
|
12
|
+
defaultValue: 'Recent slow HTTP requests from this process (in-memory ring buffer). Threshold is controlled by PERF_SLOW_REQUEST_MS.',
|
|
13
|
+
}) }), _jsxs("div", { className: "flex flex-wrap items-center gap-3 text-sm", children: [_jsxs("span", { children: [t('diagnostics.performance.threshold', {
|
|
14
|
+
defaultValue: 'Slow threshold',
|
|
15
|
+
}), ": ", _jsxs("strong", { children: [stats?.slowRequestMs ?? '—', "ms"] })] }), _jsxs("span", { children: [t('diagnostics.performance.dbTiming', {
|
|
16
|
+
defaultValue: 'DB timing',
|
|
17
|
+
}), ":", ' ', _jsx("strong", { children: stats
|
|
18
|
+
? stats.dbTimingEnabled
|
|
19
|
+
? t('diagnostics.performance.on', { defaultValue: 'on' })
|
|
20
|
+
: t('diagnostics.performance.off', { defaultValue: 'off' })
|
|
21
|
+
: '—' })] }), _jsx(Button, { variant: "outline", action: () => void statsQuery.refetch(), children: t('diagnostics.performance.refresh', { defaultValue: 'Refresh' }) })] }), statsQuery.isError ? (_jsx("p", { className: "text-error text-sm", children: t('diagnostics.performance.loadError', {
|
|
22
|
+
defaultValue: 'Could not load performance stats.',
|
|
23
|
+
}) })) : null, slowRequests.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('diagnostics.performance.empty', {
|
|
24
|
+
defaultValue: 'No slow requests recorded yet.',
|
|
25
|
+
}) })) : (_jsx("div", { className: "overflow-x-auto rounded-md border", children: _jsxs("table", { className: "w-full text-left text-sm", children: [_jsx("thead", { className: "bg-surface", children: _jsxs("tr", { children: [_jsx("th", { className: "p-2 font-medium", children: t('diagnostics.performance.when', { defaultValue: 'When' }) }), _jsx("th", { className: "p-2 font-medium", children: t('diagnostics.performance.hostname', {
|
|
26
|
+
defaultValue: 'Hostname',
|
|
27
|
+
}) }), _jsx("th", { className: "p-2 font-medium", children: t('diagnostics.performance.method', {
|
|
28
|
+
defaultValue: 'Method',
|
|
29
|
+
}) }), _jsx("th", { className: "p-2 font-medium", children: t('diagnostics.performance.path', { defaultValue: 'Path' }) }), _jsx("th", { className: "p-2 font-medium", children: t('diagnostics.performance.status', {
|
|
30
|
+
defaultValue: 'Status',
|
|
31
|
+
}) }), _jsx("th", { className: "p-2 font-medium", children: t('diagnostics.performance.duration', {
|
|
32
|
+
defaultValue: 'Duration',
|
|
33
|
+
}) })] }) }), _jsx("tbody", { children: slowRequests.map((row, index) => (_jsxs("tr", { className: "border-t", children: [_jsx("td", { className: "text-muted-foreground whitespace-nowrap p-2", children: row.at }), _jsx("td", { className: "text-muted-foreground p-2 font-mono", children: row.hostname ?? '—' }), _jsx("td", { className: "p-2 font-mono", children: row.method }), _jsx("td", { className: "max-w-md truncate p-2 font-mono", children: row.path }), _jsx("td", { className: "p-2", children: row.status }), _jsxs("td", { className: "p-2 font-semibold", children: [row.durationMs, "ms"] })] }, `${row.at}-${row.path}-${index}`))) })] }) }))] }));
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AdminGroupMembers(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useParams } from 'react-router-dom';
|
|
4
|
+
import { MessageSquareText, MoreVertical, PencilIcon, Trash2, } from 'lucide-react';
|
|
5
|
+
import { groupName, truncateText } from '@openpeepshq/common/lib';
|
|
6
|
+
import { defaultGroupRoles } from '@openpeepshq/common/types';
|
|
7
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
8
|
+
import { Avatar, useCreateNewConversation, useCurrentProfile, } from '../../components/index.js';
|
|
9
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, Label, LoadingSpinner, PopupMenu, PopupMenuButton, } from '@openpeepshq/react-ui';
|
|
10
|
+
import { routeHandleParam } from '../../lib/routeHandles.js';
|
|
11
|
+
export function AdminGroupMembers() {
|
|
12
|
+
const t = useT();
|
|
13
|
+
const { handle: handleParam = '' } = useParams();
|
|
14
|
+
const handle = routeHandleParam(handleParam);
|
|
15
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
16
|
+
const groupQuery = openpeepsApi.useGroupByHandle(handle);
|
|
17
|
+
const membersQuery = openpeepsApi.useGroupMembers(groupQuery.data?.id ?? '');
|
|
18
|
+
const group = groupQuery.data;
|
|
19
|
+
const headerTitle = group
|
|
20
|
+
? `${groupName(group)} - ${t('admin.members.title', { defaultValue: 'Members' })}`
|
|
21
|
+
: t('admin.members.title', { defaultValue: 'Members' });
|
|
22
|
+
useSetPageHeader(headerTitle);
|
|
23
|
+
if (groupQuery.isLoading || membersQuery.isLoading) {
|
|
24
|
+
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: _jsx(LoadingSpinner, {}) }));
|
|
25
|
+
}
|
|
26
|
+
if (!group) {
|
|
27
|
+
return (_jsx("div", { className: "p-8 text-center text-2xl", children: t('groups.notFound', { defaultValue: 'Group not found' }) }));
|
|
28
|
+
}
|
|
29
|
+
const members = membersQuery.data ?? [];
|
|
30
|
+
return (_jsx("div", { className: "p-4", children: _jsx("div", { className: "rounded-md border", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-surface", children: _jsxs("tr", { children: [_jsx("th", { className: "p-2 text-left", children: t('admin.members.profileColumn', { defaultValue: 'Profile' }) }), _jsx("th", { className: "p-2 text-left", children: t('admin.members.handleColumn', { defaultValue: 'Handle' }) }), _jsx("th", { className: "p-2 text-left", children: t('admin.members.rolesColumn', { defaultValue: 'Roles' }) }), _jsx("th", { className: "p-2" })] }) }), _jsx("tbody", { children: members.map((m) => (_jsxs("tr", { className: "border-t", children: [_jsx("td", { className: "p-2", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Avatar, { profile: m.profile, size: 2 }), _jsx("span", { children: m.profile.displayName || `@${m.profile.handle}` })] }) }), _jsxs("td", { className: "text-muted-foreground p-2", children: ["@", m.profile.handle] }), _jsx("td", { className: "p-2 text-xs", children: (m.roles ?? [])
|
|
31
|
+
.map((r) => t(`groups.roles.${r}`, { defaultValue: r }))
|
|
32
|
+
.join(', ') || '—' }), _jsx("td", { className: "p-2 text-right", children: _jsx(MemberRowActions, { group: group, member: m }) })] }, m.profile.id))) })] }) }) }));
|
|
33
|
+
}
|
|
34
|
+
function MemberRowActions({ group, member, }) {
|
|
35
|
+
const t = useT();
|
|
36
|
+
const me = useCurrentProfile();
|
|
37
|
+
const { openCreateConversation } = useCreateNewConversation();
|
|
38
|
+
const [activeModal, setActiveModal] = useState(null);
|
|
39
|
+
return (_jsxs(_Fragment, { children: [_jsxs(PopupMenu, { placement: "bottom-end", width: "w-56", icon: MoreVertical, children: [me?.id !== member.profile.id ? (_jsx(PopupMenuButton, { icon: MessageSquareText, title: `Message @${member.profile.handle}`, text: t('conversations.newMessage', {
|
|
40
|
+
defaultValue: `Message @${truncateText(member.profile.handle, 10)}`,
|
|
41
|
+
handle: truncateText(member.profile.handle, 10),
|
|
42
|
+
}), action: () => openCreateConversation({
|
|
43
|
+
profiles: [member.profile],
|
|
44
|
+
skipProfileSelection: true,
|
|
45
|
+
}) })) : null, _jsx(PopupMenuButton, { icon: PencilIcon, title: t('groups.changeRoles.title', {
|
|
46
|
+
defaultValue: 'Change Roles',
|
|
47
|
+
}), text: t('groups.changeRoles.title', { defaultValue: 'Change Roles' }), action: () => setActiveModal('roles') }), _jsx(PopupMenuButton, { icon: Trash2, title: t('groups.removeMember.title', {
|
|
48
|
+
defaultValue: 'Remove Member',
|
|
49
|
+
}), text: t('groups.removeMember.confirm', { defaultValue: 'Remove' }), action: () => setActiveModal('remove'), danger: true })] }), activeModal === 'roles' ? (_jsx(ChangeRolesModal, { group: group, member: member, onClose: () => setActiveModal(null) })) : null, activeModal === 'remove' ? (_jsx(RemoveMemberModal, { group: group, member: member, onClose: () => setActiveModal(null) })) : null] }));
|
|
50
|
+
}
|
|
51
|
+
function ChangeRolesModal({ group, member, onClose, }) {
|
|
52
|
+
const t = useT();
|
|
53
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
54
|
+
const setMemberRoles = openpeepsApi.setGroupMemberRolesAction();
|
|
55
|
+
const [selected, setSelected] = useState(() => new Set((member.roles ?? [])));
|
|
56
|
+
const [submitting, setSubmitting] = useState(false);
|
|
57
|
+
const [error, setError] = useState(null);
|
|
58
|
+
const toggle = (role, checked) => setSelected((prev) => {
|
|
59
|
+
const next = new Set(prev);
|
|
60
|
+
if (checked)
|
|
61
|
+
next.add(role);
|
|
62
|
+
else
|
|
63
|
+
next.delete(role);
|
|
64
|
+
return next;
|
|
65
|
+
});
|
|
66
|
+
const submit = async () => {
|
|
67
|
+
setError(null);
|
|
68
|
+
setSubmitting(true);
|
|
69
|
+
try {
|
|
70
|
+
await setMemberRoles({ roles: Array.from(selected) }, { id: group.id, memberId: member.profile.id });
|
|
71
|
+
onClose();
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
setError(err.message);
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
setSubmitting(false);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
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', {
|
|
81
|
+
defaultValue: 'Change roles for this group',
|
|
82
|
+
handle: member.profile.handle,
|
|
83
|
+
}) }), _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: `group-role-${role}`, classes: "text-base", children: t(`groups.roles.${role}`, { defaultValue: role }) }), _jsx("input", { id: `group-role-${role}`, type: "checkbox", className: "size-4", checked: selected.has(role), onChange: (e) => toggle(role, e.target.checked) })] }, 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: "outline", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "default", action: submit, disabled: submitting, children: t('groups.changeRoles.confirm', { defaultValue: 'Update Roles' }) })] })] }) }));
|
|
84
|
+
}
|
|
85
|
+
function RemoveMemberModal({ group, member, onClose, }) {
|
|
86
|
+
const t = useT();
|
|
87
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
88
|
+
const removeMember = openpeepsApi.removeGroupMemberAction();
|
|
89
|
+
const [submitting, setSubmitting] = useState(false);
|
|
90
|
+
const [error, setError] = useState(null);
|
|
91
|
+
const submit = async () => {
|
|
92
|
+
setError(null);
|
|
93
|
+
setSubmitting(true);
|
|
94
|
+
try {
|
|
95
|
+
await removeMember({ id: group.id, memberId: member.profile.id });
|
|
96
|
+
onClose();
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
setError(err.message);
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
setSubmitting(false);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
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', {
|
|
106
|
+
defaultValue: 'Are you sure you want to remove @{{handle}} from group?',
|
|
107
|
+
handle: member.profile.handle,
|
|
108
|
+
}) }), 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: "outline", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "destructive", action: submit, disabled: submitting, children: t('groups.removeMember.confirm', { defaultValue: 'Remove' }) })] })] }) }));
|
|
109
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AdminGroups(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import { Users } from 'lucide-react';
|
|
5
|
+
import { groupName } from '@openpeepshq/common/lib';
|
|
6
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
7
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, Input, } from '@openpeepshq/react-ui';
|
|
8
|
+
import { AdminGroupCard } from './components/AdminGroupCard.js';
|
|
9
|
+
export function AdminGroups() {
|
|
10
|
+
const t = useT();
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
13
|
+
const groupsQuery = openpeepsApi.admin.useAllGroupsList();
|
|
14
|
+
const [search, setSearch] = useState('');
|
|
15
|
+
const [toDelete, setToDelete] = useState(null);
|
|
16
|
+
const createLabel = t('groups.create.title', {
|
|
17
|
+
defaultValue: 'Create Group',
|
|
18
|
+
});
|
|
19
|
+
const headerActions = useMemo(() => (_jsx(Button, { title: createLabel, variant: "default", action: () => navigate('/groups/new'), children: createLabel })), [createLabel, navigate]);
|
|
20
|
+
useSetPageHeader(t('admin.groups.title', { defaultValue: 'Groups' }), headerActions);
|
|
21
|
+
const groups = groupsQuery.data ?? [];
|
|
22
|
+
const filtered = search
|
|
23
|
+
? groups.filter((g) => {
|
|
24
|
+
const q = search.toLowerCase();
|
|
25
|
+
return (g.handle.toLowerCase().includes(q) ||
|
|
26
|
+
(g.displayName ?? '').toLowerCase().includes(q));
|
|
27
|
+
})
|
|
28
|
+
: groups;
|
|
29
|
+
return (_jsxs("div", { className: "p-4", children: [_jsx("form", { role: "search", className: "mb-4", onSubmit: (e) => {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
}, children: _jsx(Input, { placeholder: t('groups.searchPlaceholder', {
|
|
32
|
+
defaultValue: 'Search by group name',
|
|
33
|
+
}), value: search, onChange: (e) => setSearch(e.target.value) }) }), filtered.length === 0 ? (_jsxs("div", { className: "text-muted-foreground flex flex-col items-center gap-3 py-20", children: [_jsx(Users, { size: 48 }), _jsx("p", { children: search
|
|
34
|
+
? t('groups.noGroupsFound', { defaultValue: 'No groups found' })
|
|
35
|
+
: t('groups.noGroupsYet', { defaultValue: 'No groups yet' }) })] })) : (_jsx("div", { className: "space-y-2", children: filtered.map((g) => (_jsx(AdminGroupCard, { group: g, onDelete: setToDelete }, g.id))) })), toDelete ? (_jsx(DeleteGroupModal, { group: toDelete, onClose: () => setToDelete(null) })) : null] }));
|
|
36
|
+
}
|
|
37
|
+
function DeleteGroupModal({ group, onClose, }) {
|
|
38
|
+
const t = useT();
|
|
39
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
40
|
+
const deleteGroup = openpeepsApi.admin.deleteGroupAction();
|
|
41
|
+
const [submitting, setSubmitting] = useState(false);
|
|
42
|
+
const [error, setError] = useState(null);
|
|
43
|
+
const submit = async () => {
|
|
44
|
+
setError(null);
|
|
45
|
+
setSubmitting(true);
|
|
46
|
+
try {
|
|
47
|
+
await deleteGroup({ groupId: group.id });
|
|
48
|
+
onClose();
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
setError(err.message);
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
setSubmitting(false);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-sm", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('admin.groups.deleteTitle', { defaultValue: 'Delete group' }) }) }), _jsx("p", { className: "px-1 text-sm", children: t('admin.groups.deleteDescription', {
|
|
58
|
+
defaultValue: 'Are you sure you want to delete this group? This action cannot be undone.',
|
|
59
|
+
name: groupName(group),
|
|
60
|
+
}) }), 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: "outline", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "destructive", action: submit, disabled: submitting, children: t('admin.groups.delete', { defaultValue: 'Delete group' }) })] })] }) }));
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AdminInvites(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { CheckCheck, Copy, MoreVertical, Users, X } from 'lucide-react';
|
|
4
|
+
import { inviteLinkMatchesQuery } from '@openpeepshq/common/lib';
|
|
5
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
6
|
+
import { Avatar } from '../../components/index.js';
|
|
7
|
+
import { UpdatingDate } from '@openpeepshq/react-ui';
|
|
8
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, Input, PopupMenu, PopupMenuButton, } from '@openpeepshq/react-ui';
|
|
9
|
+
import { AdminInviteActions } from './components/AdminInviteActions.js';
|
|
10
|
+
import { inviteUrl } from './components/InviteWithLinkModal.js';
|
|
11
|
+
export function AdminInvites() {
|
|
12
|
+
const t = useT();
|
|
13
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
14
|
+
const invitesQuery = openpeepsApi.admin.useInvitesList();
|
|
15
|
+
const [search, setSearch] = useState('');
|
|
16
|
+
const headerActions = useMemo(() => _jsx(AdminInviteActions, {}), []);
|
|
17
|
+
useSetPageHeader(t('admin.invites.title', { defaultValue: 'Invites' }), headerActions);
|
|
18
|
+
const invites = (invitesQuery.data ?? []);
|
|
19
|
+
const filtered = search
|
|
20
|
+
? invites.filter((i) => inviteLinkMatchesQuery(i, search))
|
|
21
|
+
: invites;
|
|
22
|
+
return (_jsxs("div", { className: "p-4", children: [_jsx("form", { role: "search", className: "mb-4", onSubmit: (e) => {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
}, children: _jsx(Input, { placeholder: t('admin.invites.searchPlaceholder', {
|
|
25
|
+
defaultValue: 'Search by name or email',
|
|
26
|
+
}), value: search, onChange: (e) => setSearch(e.target.value) }) }), filtered.length === 0 ? (_jsx("div", { className: "flex w-full items-center justify-center p-4", children: _jsx("h2", { className: "text-lg", children: t('admin.invites.noInvitesFound', {
|
|
27
|
+
defaultValue: 'No invites found',
|
|
28
|
+
}) }) })) : (_jsx("div", { className: "rounded-md border", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-surface", children: _jsxs("tr", { children: [_jsx("th", { className: "p-2 text-left", children: t('admin.invites.linkColumn', { defaultValue: 'Link' }) }), _jsx("th", { className: "p-2 text-left", children: t('admin.invites.createdByColumn', {
|
|
29
|
+
defaultValue: 'Created by',
|
|
30
|
+
}) }), _jsx("th", { className: "p-2 text-left", children: t('admin.invites.groupsColumn', { defaultValue: 'Groups' }) }), _jsx("th", { className: "p-2 text-left", children: t('admin.invites.expirationDateColumn', {
|
|
31
|
+
defaultValue: 'Expires',
|
|
32
|
+
}) }), _jsx("th", { className: "p-2 text-left", children: t('admin.invites.usesColumn', { defaultValue: 'Uses' }) }), _jsx("th", { className: "p-2 text-left", children: t('admin.invites.statusColumn', { defaultValue: 'Status' }) }), _jsx("th", { className: "p-2" })] }) }), _jsx("tbody", { children: filtered.map((invite) => {
|
|
33
|
+
const active = invite.active && new Date(invite.expiresAt) > new Date();
|
|
34
|
+
return (_jsxs("tr", { className: "border-t", children: [_jsx("td", { className: "p-2 font-mono text-xs", children: invite.slug }), _jsxs("td", { className: "p-2", children: ["@", invite.profile.handle] }), _jsx("td", { className: "p-2 text-xs", children: invite.groups
|
|
35
|
+
.map((g) => g.displayName || `@${g.handle}`)
|
|
36
|
+
.join(', ') || '—' }), _jsx("td", { className: "p-2 text-xs", children: _jsx(UpdatingDate, { date: invite.expiresAt }) }), _jsxs("td", { className: "p-2 text-xs", children: [invite.redemptions.length, "/", invite.maxUses] }), _jsx("td", { className: "p-2 text-xs", children: _jsx("span", { className: `rounded px-2 py-0.5 ${active ? 'bg-success/20 text-success' : 'bg-error/20 text-error'}`, children: active
|
|
37
|
+
? t('admin.invites.statusActive', {
|
|
38
|
+
defaultValue: 'Active',
|
|
39
|
+
})
|
|
40
|
+
: t('admin.invites.statusInactive', {
|
|
41
|
+
defaultValue: 'Inactive',
|
|
42
|
+
}) }) }), _jsx("td", { className: "p-2 text-right", children: _jsx(InvitesTablePopup, { invite: invite }) })] }, invite.id));
|
|
43
|
+
}) })] }) }))] }));
|
|
44
|
+
}
|
|
45
|
+
function InvitesTablePopup({ invite }) {
|
|
46
|
+
const t = useT();
|
|
47
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
48
|
+
const activate = openpeepsApi.admin.activateInviteAction();
|
|
49
|
+
const deactivate = openpeepsApi.admin.deactivateInviteAction();
|
|
50
|
+
const [showInvited, setShowInvited] = useState(false);
|
|
51
|
+
const active = invite.active && new Date(invite.expiresAt) > new Date();
|
|
52
|
+
const expired = new Date(invite.expiresAt) <= new Date();
|
|
53
|
+
return (_jsxs(_Fragment, { children: [_jsxs(PopupMenu, { placement: "bottom-end", width: "w-56", icon: MoreVertical, children: [_jsx(PopupMenuButton, { icon: Users, title: t('admin.invites.seeInvitedAccounts', {
|
|
54
|
+
defaultValue: 'See invited accounts',
|
|
55
|
+
}), text: t('admin.invites.seeInvitedAccounts', {
|
|
56
|
+
defaultValue: 'See invited accounts',
|
|
57
|
+
}), action: () => setShowInvited(true) }), active ? (_jsxs(_Fragment, { children: [_jsx(PopupMenuButton, { icon: Copy, title: t('admin.invites.copyLink', {
|
|
58
|
+
defaultValue: 'Copy link',
|
|
59
|
+
}), text: t('admin.invites.copyLink', { defaultValue: 'Copy link' }), action: () => void navigator.clipboard.writeText(inviteUrl(invite.slug)) }), _jsx(PopupMenuButton, { icon: X, title: t('admin.invites.deactivate', {
|
|
60
|
+
defaultValue: 'Deactivate',
|
|
61
|
+
}), text: t('admin.invites.deactivate', {
|
|
62
|
+
defaultValue: 'Deactivate',
|
|
63
|
+
}), action: () => deactivate({ id: invite.id }) })] })) : !expired ? (_jsx(PopupMenuButton, { icon: CheckCheck, title: t('admin.invites.activate', { defaultValue: 'Activate' }), text: t('admin.invites.activate', { defaultValue: 'Activate' }), action: () => activate({ id: invite.id }) })) : null] }), showInvited ? (_jsx(ListOfInvitedMembers, { invite: invite, onClose: () => setShowInvited(false) })) : null] }));
|
|
64
|
+
}
|
|
65
|
+
function ListOfInvitedMembers({ invite, onClose, }) {
|
|
66
|
+
const t = useT();
|
|
67
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-md", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('admin.invites.invitedMembers', {
|
|
68
|
+
defaultValue: 'Invited members',
|
|
69
|
+
}) }) }), _jsx("div", { className: "max-h-[50vh] space-y-2 overflow-y-auto px-1", children: invite.redemptions.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('admin.invites.noJoinedAccounts', {
|
|
70
|
+
defaultValue: 'No accounts have joined with this link yet.',
|
|
71
|
+
}) })) : (invite.redemptions.map((profile) => (_jsxs("a", { href: `/@${profile.handle}`, className: "hover:bg-surface flex items-center gap-2 rounded-md p-2", children: [_jsx(Avatar, { profile: profile, size: 2 }), _jsx("span", { children: profile.displayName || `@${profile.handle}` })] }, profile.id)))) })] }) }));
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AdminMembers(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import { DownloadIcon } from 'lucide-react';
|
|
4
|
+
import { matchesQuery } from '@openpeepshq/common/lib';
|
|
5
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
6
|
+
import { Avatar } from '../../components/index.js';
|
|
7
|
+
import { Button, Input } from '@openpeepshq/react-ui';
|
|
8
|
+
import { AdminInviteActions } from './components/AdminInviteActions.js';
|
|
9
|
+
import { ProfileRowActions } from './components/ProfileRowActions.js';
|
|
10
|
+
const downloadCsv = (csv, filename) => {
|
|
11
|
+
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8' });
|
|
12
|
+
const url = URL.createObjectURL(blob);
|
|
13
|
+
const link = document.createElement('a');
|
|
14
|
+
link.href = url;
|
|
15
|
+
link.download = filename;
|
|
16
|
+
link.click();
|
|
17
|
+
URL.revokeObjectURL(url);
|
|
18
|
+
};
|
|
19
|
+
export function AdminMembers() {
|
|
20
|
+
const t = useT();
|
|
21
|
+
const { openpeepsApi, client } = useOpenpeeps();
|
|
22
|
+
const profilesQuery = openpeepsApi.admin.useProfilesList();
|
|
23
|
+
const [search, setSearch] = useState('');
|
|
24
|
+
const handleDownload = useCallback(async () => {
|
|
25
|
+
const csv = await client.admin.profiles.exportCsv();
|
|
26
|
+
downloadCsv(csv, 'members.csv');
|
|
27
|
+
}, [client]);
|
|
28
|
+
const headerActions = useMemo(() => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Button, { variant: "outline", compact: true, action: handleDownload, children: [_jsx(DownloadIcon, { size: 16 }), t('admin.members.downloadCsv', { defaultValue: 'Download CSV' })] }), _jsx(AdminInviteActions, {})] })), [handleDownload, t]);
|
|
29
|
+
useSetPageHeader(t('admin.members.title', { defaultValue: 'Members' }), headerActions);
|
|
30
|
+
const filtered = useMemo(() => {
|
|
31
|
+
const profiles = profilesQuery.data ?? [];
|
|
32
|
+
if (!search)
|
|
33
|
+
return profiles;
|
|
34
|
+
return profiles.filter((p) => matchesQuery(p, search));
|
|
35
|
+
}, [profilesQuery.data, search]);
|
|
36
|
+
return (_jsxs("div", { className: "p-4", children: [_jsx("form", { role: "search", className: "mb-4", onSubmit: (e) => {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
}, children: _jsx(Input, { placeholder: t('admin.members.searchPlaceholder', {
|
|
39
|
+
defaultValue: 'Search member by name or email',
|
|
40
|
+
}), value: search, onChange: (e) => setSearch(e.target.value) }) }), filtered.length === 0 ? (_jsx("div", { className: "flex w-full items-center justify-center p-4", children: _jsx("h2", { className: "text-lg", children: t('admin.members.noUsersFound', {
|
|
41
|
+
defaultValue: 'No users found',
|
|
42
|
+
}) }) })) : (_jsx("div", { className: "rounded-md border", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-surface", children: _jsxs("tr", { children: [_jsx("th", { className: "p-2 text-left", children: t('admin.members.profileColumn', {
|
|
43
|
+
defaultValue: 'Profile',
|
|
44
|
+
}) }), _jsx("th", { className: "p-2 text-left", children: t('admin.members.handleColumn', { defaultValue: 'Handle' }) }), _jsx("th", { className: "p-2 text-left", children: t('admin.members.rolesColumn', { defaultValue: 'Roles' }) }), _jsx("th", { className: "p-2 text-left", children: t('admin.members.createdColumn', {
|
|
45
|
+
defaultValue: 'Created',
|
|
46
|
+
}) }), _jsx("th", { className: "p-2" })] }) }), _jsx("tbody", { children: filtered.map((p) => (_jsxs("tr", { className: "border-t", children: [_jsx("td", { className: "p-2", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Avatar, { profile: p, size: 2 }), _jsx("span", { children: p.displayName || `@${p.handle}` })] }) }), _jsxs("td", { className: "text-muted-foreground p-2", children: ["@", p.handle] }), _jsx("td", { className: "p-2 text-xs", children: (p.roles ?? [])
|
|
47
|
+
.map((r) => r.displayName || r.key)
|
|
48
|
+
.join(', ') || '—' }), _jsx("td", { className: "text-muted-foreground p-2 text-xs", children: new Date(p.createdAt).toLocaleDateString() }), _jsx("td", { className: "p-2 text-right", children: _jsx(ProfileRowActions, { profile: p }) })] }, p.id))) })] }) }))] }));
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AdminModeration(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { Link } from 'react-router-dom';
|
|
4
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
5
|
+
import { Avatar } from '../../components/index.js';
|
|
6
|
+
import { UpdatingDate } from '@openpeepshq/react-ui';
|
|
7
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
8
|
+
export function AdminModeration() {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
11
|
+
const reportsQuery = openpeepsApi.admin.useReportsList();
|
|
12
|
+
const [tab, setTab] = useState('summary');
|
|
13
|
+
useSetPageHeader(t('admin.moderation.title', { defaultValue: 'Moderation' }));
|
|
14
|
+
const reports = reportsQuery.data ?? [];
|
|
15
|
+
return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsxs("nav", { "aria-label": t('admin.moderation.tabsLabel', {
|
|
16
|
+
defaultValue: 'Moderation sections',
|
|
17
|
+
}), className: "border-border flex border-b", children: [_jsx(TabButton, { active: tab === 'summary', onClick: () => setTab('summary'), children: t('admin.moderation.summaryTab', { defaultValue: 'Summary' }) }), _jsx(TabButton, { active: tab === 'resolved', onClick: () => setTab('resolved'), children: t('admin.moderation.resolvedTab', { defaultValue: 'Resolved' }) })] }), tab === 'summary' ? (_jsx(SummaryTab, { reports: reports })) : (_jsx(ResolvedTab, { reports: reports }))] }));
|
|
18
|
+
}
|
|
19
|
+
function SummaryTab({ reports }) {
|
|
20
|
+
const t = useT();
|
|
21
|
+
const grouped = useMemo(() => {
|
|
22
|
+
const map = new Map();
|
|
23
|
+
for (const report of reports) {
|
|
24
|
+
const key = String(report.reportedProfile.id);
|
|
25
|
+
if (!map.has(key)) {
|
|
26
|
+
map.set(key, { profile: report.reportedProfile, reports: [] });
|
|
27
|
+
}
|
|
28
|
+
map.get(key).reports.push(report);
|
|
29
|
+
}
|
|
30
|
+
return Array.from(map.values()).filter((g) => g.reports.some((r) => !r.resolution));
|
|
31
|
+
}, [reports]);
|
|
32
|
+
if (grouped.length === 0) {
|
|
33
|
+
return (_jsx("p", { className: "text-muted-foreground text-sm", children: t('admin.moderation.report.resolvedBadge', {
|
|
34
|
+
defaultValue: 'All reports resolved',
|
|
35
|
+
}) }));
|
|
36
|
+
}
|
|
37
|
+
return (_jsx("ul", { className: "space-y-2", children: grouped.map(({ profile, reports: profileReports }) => {
|
|
38
|
+
const unresolved = profileReports.filter((r) => !r.resolution).length;
|
|
39
|
+
return (_jsx("li", { children: _jsxs(Link, { to: `/admin/moderation/reports/@${profile.handle}`, className: "hover:bg-surface flex items-center justify-between rounded-md border p-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Avatar, { profile: profile, size: 2 }), _jsxs("div", { children: [_jsx("p", { className: "font-medium", children: profile.displayName || `@${profile.handle}` }), _jsxs("p", { className: "text-muted-foreground text-xs", children: ["@", profile.handle] })] })] }), _jsx("span", { className: "bg-error rounded-full px-3 py-1 text-xs text-white", children: t('admin.moderation.report.unresolvedBadge', {
|
|
40
|
+
defaultValue: '{{reportsCount}} unresolved reports',
|
|
41
|
+
reportsCount: unresolved,
|
|
42
|
+
}) })] }) }, profile.id));
|
|
43
|
+
}) }));
|
|
44
|
+
}
|
|
45
|
+
function ResolvedTab({ reports }) {
|
|
46
|
+
const t = useT();
|
|
47
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
48
|
+
const reopenReport = openpeepsApi.admin.reopenReportAction();
|
|
49
|
+
const resolved = reports.filter((r) => !!r.resolution);
|
|
50
|
+
if (resolved.length === 0) {
|
|
51
|
+
return (_jsx("p", { className: "text-muted-foreground text-sm", children: t('admin.moderation.reportList.unresolvedBadge', {
|
|
52
|
+
defaultValue: 'Not resolved',
|
|
53
|
+
}) }));
|
|
54
|
+
}
|
|
55
|
+
return (_jsx("ul", { className: "space-y-2", children: resolved.map((report) => (_jsxs("li", { className: "flex items-center justify-between rounded-md border p-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Avatar, { profile: report.reportedProfile, size: 2 }), _jsxs("div", { children: [_jsx("p", { className: "font-medium", children: report.reportedProfile.displayName ||
|
|
56
|
+
`@${report.reportedProfile.handle}` }), _jsxs("p", { className: "text-muted-foreground text-xs", children: [_jsx(UpdatingDate, { date: report.createdAt }), " \u00B7 ", report.resolution] })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Link, { to: `/admin/moderation/reports/@${report.reportedProfile.handle}`, className: "text-primary text-xs hover:underline", children: t('admin.moderation.reportList.seeReports', {
|
|
57
|
+
defaultValue: 'See reports',
|
|
58
|
+
}) }), _jsx(Button, { title: t('admin.moderation.reopen', { defaultValue: 'Reopen' }), variant: "ghost", action: () => reopenReport({ reportId: report.id }), children: t('admin.moderation.reopen', { defaultValue: 'Reopen' }) })] })] }, report.id))) }));
|
|
59
|
+
}
|
|
60
|
+
function TabButton({ active, onClick, children, }) {
|
|
61
|
+
return (_jsx("button", { type: "button", onClick: onClick, className: `px-4 py-2 text-sm ${active ? 'border-primary border-b-2 font-semibold' : 'text-muted-foreground hover:text-foreground'}`, children: children }));
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AdminReports(): import("react/jsx-runtime").JSX.Element;
|