@openpeepshq/react 0.2.3 → 0.2.4
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 +7 -2
- 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/GalleryModal.js +36 -5
- package/dist/components/post/pieces/PollContent.js +4 -4
- 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 +34 -8
- 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/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 +53 -0
- package/dist/contexts/openpeeps/hooks/admin.js +1 -0
- package/dist/contexts/openpeeps/hooks/jams.js +1 -1
- package/dist/contexts/openpeeps/hooks/other.d.ts +8 -0
- 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/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/package.json +12 -7
- package/dist/components/jams/useJamLiveKitTheme.d.ts +0 -3
- package/dist/components/jams/useJamLiveKitTheme.js +0 -10
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
4
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
5
|
+
import { toCsvRow } from '@openpeepshq/common/lib';
|
|
6
|
+
const PAGE_SIZE_OPTIONS = [50, 200, 1000, 'all'];
|
|
7
|
+
/** Server hard cap used for "All". */
|
|
8
|
+
const PAGE_SIZE_ALL = 10_000;
|
|
9
|
+
const pageSizeToLimit = (size) => size === 'all' ? PAGE_SIZE_ALL : size;
|
|
10
|
+
const formatCell = (value) => {
|
|
11
|
+
if (value == null)
|
|
12
|
+
return '';
|
|
13
|
+
if (typeof value === 'object')
|
|
14
|
+
return JSON.stringify(value);
|
|
15
|
+
return String(value);
|
|
16
|
+
};
|
|
17
|
+
const cellEditorValue = (value, dataType) => {
|
|
18
|
+
if (value == null)
|
|
19
|
+
return '';
|
|
20
|
+
if (dataType.includes('json') || typeof value === 'object') {
|
|
21
|
+
return JSON.stringify(value, null, 2);
|
|
22
|
+
}
|
|
23
|
+
return String(value);
|
|
24
|
+
};
|
|
25
|
+
const rowsToCsv = (columns, rows) => {
|
|
26
|
+
const header = toCsvRow(columns);
|
|
27
|
+
const body = rows.map((row) => toCsvRow(columns.map((col) => {
|
|
28
|
+
const value = row[col];
|
|
29
|
+
if (value == null)
|
|
30
|
+
return '';
|
|
31
|
+
if (typeof value === 'object')
|
|
32
|
+
return JSON.stringify(value);
|
|
33
|
+
if (typeof value === 'string' ||
|
|
34
|
+
typeof value === 'number' ||
|
|
35
|
+
typeof value === 'boolean') {
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
return String(value);
|
|
39
|
+
})));
|
|
40
|
+
return [header, ...body].join('\n');
|
|
41
|
+
};
|
|
42
|
+
const downloadBlob = (content, filename) => {
|
|
43
|
+
const blob = new Blob([content], { type: 'text/csv;charset=utf-8' });
|
|
44
|
+
const url = URL.createObjectURL(blob);
|
|
45
|
+
const a = document.createElement('a');
|
|
46
|
+
a.href = url;
|
|
47
|
+
a.download = filename;
|
|
48
|
+
a.click();
|
|
49
|
+
URL.revokeObjectURL(url);
|
|
50
|
+
};
|
|
51
|
+
export function AdminDb() {
|
|
52
|
+
const t = useT();
|
|
53
|
+
const { openpeepsApi, client } = useOpenpeeps();
|
|
54
|
+
const tablesQuery = openpeepsApi.admin.useDbTables();
|
|
55
|
+
const updateRow = openpeepsApi.admin.updateDbRowAction();
|
|
56
|
+
const runSql = openpeepsApi.admin.runDbSqlAction();
|
|
57
|
+
const [tab, setTab] = useState('browse');
|
|
58
|
+
const [selectedTable, setSelectedTable] = useState('');
|
|
59
|
+
const [filterCol, setFilterCol] = useState('');
|
|
60
|
+
const [filterValue, setFilterValue] = useState('');
|
|
61
|
+
const [appliedFilter, setAppliedFilter] = useState(null);
|
|
62
|
+
const [offset, setOffset] = useState(0);
|
|
63
|
+
const [editing, setEditing] = useState(null);
|
|
64
|
+
const [sqlText, setSqlText] = useState('SELECT 1');
|
|
65
|
+
const [sqlError, setSqlError] = useState(null);
|
|
66
|
+
const [sqlResult, setSqlResult] = useState(null);
|
|
67
|
+
const [browsePageSize, setBrowsePageSize] = useState(50);
|
|
68
|
+
const [sqlPageSize, setSqlPageSize] = useState(50);
|
|
69
|
+
const limit = pageSizeToLimit(browsePageSize);
|
|
70
|
+
const rowsQueryParams = useMemo(() => {
|
|
71
|
+
const q = {
|
|
72
|
+
limit: String(limit),
|
|
73
|
+
offset: String(offset),
|
|
74
|
+
};
|
|
75
|
+
if (appliedFilter?.col && appliedFilter.value) {
|
|
76
|
+
q[`filter.${appliedFilter.col}`] = appliedFilter.value;
|
|
77
|
+
}
|
|
78
|
+
return q;
|
|
79
|
+
}, [appliedFilter, limit, offset]);
|
|
80
|
+
const rowsQuery = openpeepsApi.admin.useDbRows(selectedTable, selectedTable ? rowsQueryParams : undefined);
|
|
81
|
+
const tables = tablesQuery.data?.tables ?? [];
|
|
82
|
+
const selectedMeta = tables.find((table) => table.name === selectedTable);
|
|
83
|
+
const columns = selectedMeta?.columns ?? [];
|
|
84
|
+
const pkNames = columns.filter((c) => c.primaryKey).map((c) => c.name);
|
|
85
|
+
useSetPageHeader(t('admin.database.title', { defaultValue: 'Database' }));
|
|
86
|
+
const applyFilter = () => {
|
|
87
|
+
setOffset(0);
|
|
88
|
+
setAppliedFilter(filterCol && filterValue ? { col: filterCol, value: filterValue } : null);
|
|
89
|
+
};
|
|
90
|
+
const clearFilter = () => {
|
|
91
|
+
setFilterCol('');
|
|
92
|
+
setFilterValue('');
|
|
93
|
+
setAppliedFilter(null);
|
|
94
|
+
setOffset(0);
|
|
95
|
+
};
|
|
96
|
+
const downloadCsv = useCallback(async () => {
|
|
97
|
+
if (!selectedTable)
|
|
98
|
+
return;
|
|
99
|
+
const query = {};
|
|
100
|
+
if (appliedFilter?.col && appliedFilter.value) {
|
|
101
|
+
query[`filter.${appliedFilter.col}`] = appliedFilter.value;
|
|
102
|
+
}
|
|
103
|
+
const csv = await client.admin.db.exportCsv(selectedTable, query);
|
|
104
|
+
downloadBlob(csv, `${selectedTable}.csv`);
|
|
105
|
+
}, [appliedFilter, client.admin.db, selectedTable]);
|
|
106
|
+
const downloadSqlCsv = useCallback(() => {
|
|
107
|
+
if (!sqlResult?.columns.length)
|
|
108
|
+
return;
|
|
109
|
+
downloadBlob(rowsToCsv(sqlResult.columns, sqlResult.rows), 'query-result.csv');
|
|
110
|
+
}, [sqlResult]);
|
|
111
|
+
const saveEdit = async () => {
|
|
112
|
+
if (!editing || !selectedTable)
|
|
113
|
+
return;
|
|
114
|
+
let patchValue = editing.value;
|
|
115
|
+
if (editing.dataType.includes('json')) {
|
|
116
|
+
patchValue = JSON.parse(editing.value);
|
|
117
|
+
}
|
|
118
|
+
await updateRow({
|
|
119
|
+
primaryKey: editing.primaryKey,
|
|
120
|
+
patch: { [editing.column]: patchValue },
|
|
121
|
+
}, { table: selectedTable });
|
|
122
|
+
setEditing(null);
|
|
123
|
+
await rowsQuery.refetch();
|
|
124
|
+
};
|
|
125
|
+
const executeSql = async () => {
|
|
126
|
+
setSqlError(null);
|
|
127
|
+
try {
|
|
128
|
+
const result = await runSql({
|
|
129
|
+
statement: sqlText,
|
|
130
|
+
limit: pageSizeToLimit(sqlPageSize),
|
|
131
|
+
});
|
|
132
|
+
setSqlResult(result);
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
setSqlResult(null);
|
|
136
|
+
const message = err && typeof err === 'object' && 'message' in err
|
|
137
|
+
? String(err.message)
|
|
138
|
+
: String(err);
|
|
139
|
+
setSqlError(message);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const pageSizeSelect = (value, onChange) => (_jsxs("label", { className: "flex flex-col gap-1 text-sm", children: [_jsx("span", { children: t('admin.database.pageSize', { defaultValue: 'Rows' }) }), _jsx("select", { className: "rounded border px-2 py-1", value: value === 'all' ? 'all' : String(value), onChange: (e) => {
|
|
143
|
+
const raw = e.target.value;
|
|
144
|
+
if (raw === 'all') {
|
|
145
|
+
onChange('all');
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
onChange(Number(raw));
|
|
149
|
+
}, children: PAGE_SIZE_OPTIONS.map((option) => (_jsx("option", { value: option === 'all' ? 'all' : String(option), children: option === 'all'
|
|
150
|
+
? t('admin.database.pageSizeAll', { defaultValue: 'All' })
|
|
151
|
+
: String(option) }, String(option)))) })] }));
|
|
152
|
+
const rows = rowsQuery.data?.rows ?? [];
|
|
153
|
+
const total = rowsQuery.data?.total ?? 0;
|
|
154
|
+
return (_jsxs("div", { className: "flex h-[calc(100vh-4rem)] flex-col gap-3 p-4", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { title: t('admin.database.browseTab', { defaultValue: 'Browse' }), variant: tab === 'browse' ? 'default' : 'outline', action: () => setTab('browse'), children: t('admin.database.browseTab', { defaultValue: 'Browse' }) }), _jsx(Button, { title: t('admin.database.sqlTab', { defaultValue: 'SQL' }), variant: tab === 'sql' ? 'default' : 'outline', action: () => setTab('sql'), children: t('admin.database.sqlTab', { defaultValue: 'SQL' }) })] }), tab === 'browse' ? (_jsxs("div", { className: "flex min-h-0 flex-1 gap-3", children: [_jsxs("aside", { className: "w-56 shrink-0 overflow-y-auto rounded border p-2", children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: t('admin.database.tables', { defaultValue: 'Tables' }) }), tablesQuery.isLoading ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('admin.database.loading', { defaultValue: 'Loading…' }) })) : (_jsx("ul", { className: "space-y-0.5 text-sm", children: tables.map((table) => (_jsx("li", { children: _jsx("button", { type: "button", className: `hover:bg-surface rounded-button w-full px-2 py-1 text-left ${selectedTable === table.name
|
|
155
|
+
? 'bg-surface font-medium'
|
|
156
|
+
: ''}`, onClick: () => {
|
|
157
|
+
setSelectedTable(table.name);
|
|
158
|
+
setOffset(0);
|
|
159
|
+
setFilterCol('');
|
|
160
|
+
setFilterValue('');
|
|
161
|
+
setAppliedFilter(null);
|
|
162
|
+
setEditing(null);
|
|
163
|
+
}, children: table.name }) }, table.name))) }))] }), _jsx("section", { className: "flex min-w-0 flex-1 flex-col gap-2", children: !selectedTable ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('admin.database.selectTable', {
|
|
164
|
+
defaultValue: 'Select a table to browse rows.',
|
|
165
|
+
}) })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex flex-wrap items-end gap-2", children: [_jsxs("label", { className: "flex flex-col gap-1 text-sm", children: [_jsx("span", { children: t('admin.database.filterColumn', {
|
|
166
|
+
defaultValue: 'Filter column',
|
|
167
|
+
}) }), _jsxs("select", { className: "rounded border px-2 py-1", value: filterCol, onChange: (e) => setFilterCol(e.target.value), children: [_jsx("option", { value: "", children: t('admin.database.anyColumn', {
|
|
168
|
+
defaultValue: '—',
|
|
169
|
+
}) }), columns.map((col) => (_jsx("option", { value: col.name, children: col.name }, col.name)))] })] }), _jsxs("label", { className: "flex flex-col gap-1 text-sm", children: [_jsx("span", { children: t('admin.database.filterValue', {
|
|
170
|
+
defaultValue: 'Contains',
|
|
171
|
+
}) }), _jsx("input", { className: "rounded border px-2 py-1", value: filterValue, onChange: (e) => setFilterValue(e.target.value), onKeyDown: (e) => {
|
|
172
|
+
if (e.key === 'Enter')
|
|
173
|
+
applyFilter();
|
|
174
|
+
} })] }), _jsx(Button, { title: t('admin.database.applyFilter', {
|
|
175
|
+
defaultValue: 'Apply',
|
|
176
|
+
}), variant: "default", action: applyFilter, children: t('admin.database.applyFilter', { defaultValue: 'Apply' }) }), _jsx(Button, { title: t('admin.database.clearFilter', {
|
|
177
|
+
defaultValue: 'Clear',
|
|
178
|
+
}), variant: "outline", action: clearFilter, children: t('admin.database.clearFilter', { defaultValue: 'Clear' }) }), _jsx(Button, { title: t('admin.database.downloadCsv', {
|
|
179
|
+
defaultValue: 'Download CSV',
|
|
180
|
+
}), variant: "outline", action: () => {
|
|
181
|
+
void downloadCsv();
|
|
182
|
+
}, children: t('admin.database.downloadCsv', {
|
|
183
|
+
defaultValue: 'Download CSV',
|
|
184
|
+
}) }), pageSizeSelect(browsePageSize, (next) => {
|
|
185
|
+
setBrowsePageSize(next);
|
|
186
|
+
setOffset(0);
|
|
187
|
+
})] }), _jsx("div", { className: "min-h-0 flex-1 overflow-auto rounded border", children: rowsQuery.isLoading ? (_jsx("p", { className: "p-3 text-sm", children: t('admin.database.loading', {
|
|
188
|
+
defaultValue: 'Loading…',
|
|
189
|
+
}) })) : rowsQuery.isError ? (_jsx("p", { className: "p-3 text-sm text-red-600", children: t('admin.database.loadError', {
|
|
190
|
+
defaultValue: 'Failed to load rows.',
|
|
191
|
+
}) })) : (_jsxs("table", { className: "w-full border-collapse text-left text-xs", children: [_jsx("thead", { className: "bg-surface sticky top-0", children: _jsx("tr", { children: columns.map((col) => (_jsxs("th", { className: "whitespace-nowrap border-b px-2 py-1 font-medium", children: [col.name, _jsx("span", { className: "text-muted-foreground ml-1 font-normal", children: col.dataType })] }, col.name))) }) }), _jsx("tbody", { children: rows.map((row, rowIndex) => {
|
|
192
|
+
const pk = {};
|
|
193
|
+
for (const name of pkNames) {
|
|
194
|
+
pk[name] = row[name];
|
|
195
|
+
}
|
|
196
|
+
return (_jsx("tr", { className: "hover:bg-surface/50", children: columns.map((col) => (_jsx("td", { className: "max-w-xs cursor-pointer truncate border-b px-2 py-1 align-top", title: formatCell(row[col.name]), onClick: () => {
|
|
197
|
+
if (col.primaryKey)
|
|
198
|
+
return;
|
|
199
|
+
setEditing({
|
|
200
|
+
primaryKey: pk,
|
|
201
|
+
column: col.name,
|
|
202
|
+
value: cellEditorValue(row[col.name], col.dataType),
|
|
203
|
+
dataType: col.dataType,
|
|
204
|
+
});
|
|
205
|
+
}, children: formatCell(row[col.name]) }, col.name))) }, rowIndex));
|
|
206
|
+
}) })] })) }), _jsxs("div", { className: "flex items-center justify-between text-sm", children: [_jsx("span", { children: t('admin.database.showing', {
|
|
207
|
+
defaultValue: 'Showing {{from}}–{{to}} of {{total}}',
|
|
208
|
+
from: total === 0 ? 0 : offset + 1,
|
|
209
|
+
to: Math.min(offset + limit, total),
|
|
210
|
+
total,
|
|
211
|
+
}) }), browsePageSize === 'all' ? null : (_jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { title: t('admin.database.prev', {
|
|
212
|
+
defaultValue: 'Prev',
|
|
213
|
+
}), variant: "outline", action: () => setOffset(Math.max(0, offset - limit)), disabled: offset === 0, children: t('admin.database.prev', { defaultValue: 'Prev' }) }), _jsx(Button, { title: t('admin.database.next', {
|
|
214
|
+
defaultValue: 'Next',
|
|
215
|
+
}), variant: "outline", action: () => setOffset(offset + limit), disabled: offset + limit >= total, children: t('admin.database.next', { defaultValue: 'Next' }) })] }))] })] })) })] })) : (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-2", children: [_jsx("textarea", { className: "min-h-32 rounded border p-2 font-mono text-sm", value: sqlText, onChange: (e) => setSqlText(e.target.value), spellCheck: false }), _jsxs("div", { className: "flex flex-wrap items-end gap-2", children: [_jsx(Button, { title: t('admin.database.runSql', { defaultValue: 'Run' }), variant: "default", action: () => {
|
|
216
|
+
void executeSql();
|
|
217
|
+
}, children: t('admin.database.runSql', { defaultValue: 'Run' }) }), _jsx(Button, { title: t('admin.database.downloadCsv', {
|
|
218
|
+
defaultValue: 'Download CSV',
|
|
219
|
+
}), variant: "outline", action: downloadSqlCsv, disabled: !sqlResult?.columns.length, children: t('admin.database.downloadCsv', {
|
|
220
|
+
defaultValue: 'Download CSV',
|
|
221
|
+
}) }), pageSizeSelect(sqlPageSize, setSqlPageSize)] }), sqlError ? (_jsx("pre", { className: "overflow-auto rounded border border-red-300 bg-red-50 p-2 text-xs text-red-800", children: sqlError })) : null, sqlResult ? (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-1", children: [_jsx("p", { className: "text-sm", children: sqlResult.rows.length < sqlResult.rowCount
|
|
222
|
+
? t('admin.database.sqlMetaTruncated', {
|
|
223
|
+
defaultValue: '{{command}} — showing {{shown}} of {{count}} row(s)',
|
|
224
|
+
command: sqlResult.command,
|
|
225
|
+
shown: sqlResult.rows.length,
|
|
226
|
+
count: sqlResult.rowCount,
|
|
227
|
+
})
|
|
228
|
+
: t('admin.database.sqlMeta', {
|
|
229
|
+
defaultValue: '{{command}} — {{count}} row(s)',
|
|
230
|
+
command: sqlResult.command,
|
|
231
|
+
count: sqlResult.rowCount,
|
|
232
|
+
}) }), _jsx("div", { className: "min-h-0 flex-1 overflow-auto rounded border", children: _jsxs("table", { className: "w-full border-collapse text-left text-xs", children: [_jsx("thead", { className: "bg-surface sticky top-0", children: _jsx("tr", { children: sqlResult.columns.map((col) => (_jsx("th", { className: "whitespace-nowrap border-b px-2 py-1 font-medium", children: col }, col))) }) }), _jsx("tbody", { children: sqlResult.rows.map((row, i) => (_jsx("tr", { children: sqlResult.columns.map((col) => (_jsx("td", { className: "max-w-xs truncate border-b px-2 py-1", title: formatCell(row[col]), children: formatCell(row[col]) }, col))) }, i))) })] }) })] })) : null] })), editing ? (_jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4", children: _jsxs("div", { className: "bg-background w-full max-w-lg space-y-3 rounded-lg p-4 shadow-lg", children: [_jsx("h2", { className: "text-lg font-medium", children: t('admin.database.editTitle', {
|
|
233
|
+
defaultValue: 'Edit {{column}}',
|
|
234
|
+
column: editing.column,
|
|
235
|
+
}) }), _jsx("textarea", { className: "min-h-40 w-full rounded border p-2 font-mono text-sm", value: editing.value, onChange: (e) => setEditing({ ...editing, value: e.target.value }) }), _jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { title: t('admin.database.cancel', { defaultValue: 'Cancel' }), variant: "outline", action: () => setEditing(null), children: t('admin.database.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { title: t('admin.database.save', { defaultValue: 'Save' }), variant: "default", action: () => {
|
|
236
|
+
void saveEdit();
|
|
237
|
+
}, children: t('admin.database.save', { defaultValue: 'Save' }) })] })] }) })) : null] }));
|
|
238
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AdminDiagnostics(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useT, useSetPageHeader } from '../../index.js';
|
|
3
|
+
import { ConfigMenuButton } from '../../components/index.js';
|
|
4
|
+
export function AdminDiagnostics() {
|
|
5
|
+
const t = useT();
|
|
6
|
+
useSetPageHeader(t('diagnostics.title', { defaultValue: 'Diagnostics' }));
|
|
7
|
+
return (_jsxs("div", { className: "p-4", children: [_jsx(ConfigMenuButton, { translationPrefix: "diagnostics.email", action: "/admin/diagnostics/email" }), _jsx(ConfigMenuButton, { translationPrefix: "diagnostics.logs", action: "/admin/diagnostics/logs" }), _jsx(ConfigMenuButton, { translationPrefix: "diagnostics.performance", action: "/admin/diagnostics/performance" })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AdminDiagnosticsEmail(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Link } from 'react-router-dom';
|
|
4
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
5
|
+
import { Button, Toast } from '@openpeepshq/react-ui';
|
|
6
|
+
const formatFailureTime = (finishedOn) => {
|
|
7
|
+
const iso = new Date(finishedOn).toISOString();
|
|
8
|
+
return `${iso.slice(0, 10)} ${iso.slice(11, 19)} UTC`;
|
|
9
|
+
};
|
|
10
|
+
export function AdminDiagnosticsEmail() {
|
|
11
|
+
const t = useT();
|
|
12
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
13
|
+
const statsQuery = openpeepsApi.admin.useEmailQueueStats();
|
|
14
|
+
const queueTest = openpeepsApi.admin.queueTestEmailAction();
|
|
15
|
+
useSetPageHeader(t('diagnostics.email.title', { defaultValue: 'Email' }));
|
|
16
|
+
const [recipient, setRecipient] = useState('');
|
|
17
|
+
const [queuing, setQueuing] = useState(false);
|
|
18
|
+
const [message, setMessage] = useState(null);
|
|
19
|
+
const stats = statsQuery.data;
|
|
20
|
+
const handleQueueTest = async () => {
|
|
21
|
+
const trimmed = recipient.trim();
|
|
22
|
+
if (!trimmed) {
|
|
23
|
+
setMessage({
|
|
24
|
+
type: 'error',
|
|
25
|
+
text: t('diagnostics.email.recipientRequired'),
|
|
26
|
+
});
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setQueuing(true);
|
|
30
|
+
setMessage(null);
|
|
31
|
+
try {
|
|
32
|
+
await queueTest({ to: trimmed });
|
|
33
|
+
setMessage({
|
|
34
|
+
type: 'success',
|
|
35
|
+
text: t('diagnostics.email.queueSuccess'),
|
|
36
|
+
});
|
|
37
|
+
await statsQuery.refetch();
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
const detail = err.message;
|
|
41
|
+
setMessage({
|
|
42
|
+
type: 'error',
|
|
43
|
+
text: detail
|
|
44
|
+
? `${t('diagnostics.email.queueFailed')}: ${detail}`
|
|
45
|
+
: t('diagnostics.email.queueFailed'),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
setQueuing(false);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const counters = stats
|
|
53
|
+
? [
|
|
54
|
+
{ labelKey: 'waiting', value: stats.counts.waiting },
|
|
55
|
+
{ labelKey: 'active', value: stats.counts.active },
|
|
56
|
+
{ labelKey: 'completed', value: stats.counts.completed },
|
|
57
|
+
{ labelKey: 'failed', value: stats.counts.failed, error: true },
|
|
58
|
+
{ labelKey: 'delayed', value: stats.counts.delayed },
|
|
59
|
+
{ labelKey: 'prioritized', value: stats.counts.prioritized },
|
|
60
|
+
]
|
|
61
|
+
: [];
|
|
62
|
+
return (_jsxs("div", { className: "space-y-6 p-4", children: [_jsxs("div", { className: "bg-surface-2 rounded-lg p-4", children: [_jsx("p", { className: "font-medium", children: t('diagnostics.email.testTitle') }), _jsx("p", { className: "mb-3 text-sm opacity-80", children: t('diagnostics.email.testHint') }), _jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-end", children: [_jsxs("label", { className: "flex-1", children: [_jsx("span", { children: t('diagnostics.email.testRecipient') }), _jsx("input", { type: "email", value: recipient, onChange: (e) => setRecipient(e.target.value), className: "op-input rounded", placeholder: t('diagnostics.email.testRecipientPlaceholder'), autoComplete: "email" })] }), _jsx(Button, { variant: "secondary", title: t('diagnostics.email.queueTest'), action: handleQueueTest, disabled: queuing, children: queuing
|
|
63
|
+
? t('common.form.loading')
|
|
64
|
+
: t('diagnostics.email.queueTest') })] }), message ? (_jsx(Toast, { variant: message.type, onDismiss: () => setMessage(null), children: message.text })) : null] }), _jsxs("div", { className: "bg-surface-2 rounded-lg p-4", children: [_jsxs("div", { className: "mb-2 flex flex-wrap items-center justify-between gap-2", children: [_jsx("p", { className: "font-medium", children: t('diagnostics.email.queueTitle') }), _jsx(Button, { variant: "secondary", title: t('diagnostics.email.refresh'), action: () => statsQuery.refetch(), children: t('diagnostics.email.refresh') })] }), _jsx("p", { className: "mb-3 text-sm opacity-80", children: t('diagnostics.email.countsHint') }), statsQuery.isPending ? (_jsx("p", { className: "text-sm opacity-70", children: t('common.form.loading') })) : statsQuery.isError ? (_jsx("p", { className: "text-error text-sm", children: t('diagnostics.email.statsError') })) : stats ? (_jsxs(_Fragment, { children: [_jsx("dl", { className: "grid grid-cols-2 gap-2 text-sm sm:grid-cols-3 md:grid-cols-6", children: counters.map((c) => (_jsxs("div", { children: [_jsx("dt", { className: "opacity-70", children: t(`diagnostics.email.${c.labelKey}`) }), _jsx("dd", { className: `font-mono ${c.error ? 'text-error' : ''}`, children: c.value })] }, c.labelKey))) }), stats.recentFailures.length > 0 ? (_jsxs("div", { className: "border-border mt-4 border-t pt-3", children: [_jsx("p", { className: "text-error mb-2 font-medium", children: t('diagnostics.email.recentFailures') }), _jsx("ul", { className: "space-y-2 text-sm", children: stats.recentFailures.map((f, idx) => (_jsxs("li", { className: "border-error/30 bg-error/10 rounded border p-2", children: [_jsxs("div", { className: "mb-1 flex flex-wrap items-baseline justify-between gap-2", children: [f.id ? (_jsx(Link, { to: `/admin/diagnostics/jobs/${encodeURIComponent(f.queue)}/${encodeURIComponent(f.id)}`, className: "op-anchor font-mono text-xs", title: t('diagnostics.jobs.viewLogs'), children: f.name })) : (_jsx("span", { className: "font-mono text-xs opacity-80", children: f.name })), f.finishedOn != null ? (_jsx("time", { className: "text-xs opacity-70", dateTime: new Date(f.finishedOn).toISOString(), children: formatFailureTime(f.finishedOn) })) : null] }), _jsx("p", { className: "whitespace-pre-wrap break-words", children: f.failedReason }), f.id ? (_jsx(Link, { to: `/admin/diagnostics/jobs/${encodeURIComponent(f.queue)}/${encodeURIComponent(f.id)}`, className: "op-anchor mt-1 inline-block text-xs", children: t('diagnostics.jobs.viewLogs') })) : null] }, `${f.queue}-${f.id ?? f.name}-${idx}`))) })] })) : null] })) : null, _jsx("p", { className: "mt-4 text-xs opacity-70", children: t('diagnostics.email.bounceNote') })] })] }));
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AdminDiagnosticsJob(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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
|
+
}
|