@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 @@
|
|
|
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;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState, useEffect, useRef } from 'react';
|
|
3
|
+
import { useParams } from 'react-router-dom';
|
|
4
|
+
import { useT, useOpenpeeps } from '../../index.js';
|
|
5
|
+
import { Avatar, FeedPostContent } from '../../components/index.js';
|
|
6
|
+
import { LoadingSpinner, UpdatingDate } from '@openpeepshq/react-ui';
|
|
7
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
8
|
+
import { routeHandleParam } from '../../lib/routeHandles.js';
|
|
9
|
+
export function AdminReports() {
|
|
10
|
+
const t = useT();
|
|
11
|
+
const { handle: handleParam = '' } = useParams();
|
|
12
|
+
const handle = routeHandleParam(handleParam);
|
|
13
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
14
|
+
const profileQuery = openpeepsApi.useProfileByHandle(handle);
|
|
15
|
+
const reportsQuery = openpeepsApi.admin.useReportsList();
|
|
16
|
+
const reopen = openpeepsApi.admin.reopenReportAction();
|
|
17
|
+
const [tab, setTab] = useState('post');
|
|
18
|
+
const [filter, setFilter] = useState('not-resolved');
|
|
19
|
+
const [resolving, setResolving] = useState(null);
|
|
20
|
+
const initialTabHandle = useRef(null);
|
|
21
|
+
const profile = profileQuery.data;
|
|
22
|
+
const profileReportsBase = useMemo(() => {
|
|
23
|
+
const all = reportsQuery.data ?? [];
|
|
24
|
+
return all.filter((r) => profile
|
|
25
|
+
? r.reportedProfile.id === profile.id
|
|
26
|
+
: r.reportedProfile.handle === handle);
|
|
27
|
+
}, [reportsQuery.data, profile, handle]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!profile || reportsQuery.isLoading || !reportsQuery.data)
|
|
30
|
+
return;
|
|
31
|
+
if (initialTabHandle.current === handle)
|
|
32
|
+
return;
|
|
33
|
+
initialTabHandle.current = handle;
|
|
34
|
+
const unresolvedPost = profileReportsBase.filter((r) => r.reportedPosts.length > 0 && !r.resolution).length;
|
|
35
|
+
const unresolvedProfile = profileReportsBase.filter((r) => r.reportedPosts.length === 0 && !r.resolution).length;
|
|
36
|
+
setTab(unresolvedPost === 0 && unresolvedProfile > 0 ? 'profile' : 'post');
|
|
37
|
+
}, [
|
|
38
|
+
profile,
|
|
39
|
+
handle,
|
|
40
|
+
reportsQuery.data,
|
|
41
|
+
reportsQuery.isLoading,
|
|
42
|
+
profileReportsBase,
|
|
43
|
+
]);
|
|
44
|
+
const reports = useMemo(() => profileReportsBase
|
|
45
|
+
.filter((r) => tab === 'profile'
|
|
46
|
+
? r.reportedPosts.length === 0
|
|
47
|
+
: r.reportedPosts.length > 0)
|
|
48
|
+
.filter((r) => {
|
|
49
|
+
if (filter === 'resolved')
|
|
50
|
+
return !!r.resolution;
|
|
51
|
+
if (filter === 'not-resolved')
|
|
52
|
+
return !r.resolution;
|
|
53
|
+
return true;
|
|
54
|
+
}), [profileReportsBase, tab, filter]);
|
|
55
|
+
if (profileQuery.isLoading || reportsQuery.isLoading) {
|
|
56
|
+
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: _jsx(LoadingSpinner, {}) }));
|
|
57
|
+
}
|
|
58
|
+
if (!profile) {
|
|
59
|
+
return (_jsx("div", { className: "p-8 text-center text-2xl", children: t('profiles.notFound', { defaultValue: 'Profile not found' }) }));
|
|
60
|
+
}
|
|
61
|
+
return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsxs("header", { className: "flex items-center gap-3", children: [_jsx(Avatar, { profile: profile, size: 3 }), _jsxs("div", { className: "flex-1", children: [_jsx("h1", { className: "text-xl font-semibold", children: profile.displayName || `@${profile.handle}` }), _jsxs("p", { className: "text-muted-foreground text-sm", children: ["@", profile.handle] })] }), _jsx("a", { href: `/@${profile.handle}`, className: "border-input hover:bg-surface rounded-button border px-3 py-1.5 text-sm", children: t('admin.moderation.report.goToProfile', {
|
|
62
|
+
defaultValue: 'Go to profile',
|
|
63
|
+
}) })] }), _jsxs("nav", { "aria-label": t('admin.moderation.report.tabsLabel', {
|
|
64
|
+
defaultValue: 'Report types',
|
|
65
|
+
}), className: "border-border flex border-b", children: [_jsx(TabButton, { active: tab === 'post', onClick: () => setTab('post'), children: "Post Reports" }), _jsx(TabButton, { active: tab === 'profile', onClick: () => setTab('profile'), children: "Profile Reports" })] }), _jsxs("div", { className: "flex items-center gap-2 text-xs", children: [_jsx("span", { className: "text-muted-foreground", children: "Filter:" }), ['all', 'not-resolved', 'resolved'].map((value) => (_jsx("button", { type: "button", onClick: () => setFilter(value), className: `rounded-button px-2 py-1 ${filter === value ? 'bg-primary text-primary-foreground' : 'bg-surface hover:bg-surface'}`, children: value === 'all'
|
|
66
|
+
? 'All'
|
|
67
|
+
: value === 'resolved'
|
|
68
|
+
? 'Resolved'
|
|
69
|
+
: 'Not resolved' }, value)))] }), reports.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: "No reports." })) : (_jsx("ul", { className: "space-y-3", children: reports.map((report) => (_jsxs("li", { className: "space-y-1 rounded-md border p-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-muted-foreground text-xs", children: [_jsx(UpdatingDate, { date: report.createdAt }), " \u00B7 @", report.reporterProfile.handle, " reported"] }), _jsx("span", { className: `rounded px-2 py-0.5 text-xs ${report.resolution ? 'bg-success/20 text-success' : 'bg-warning/20 text-warning'}`, children: report.resolution ? 'Resolved' : 'Open' })] }), _jsx("p", { className: "text-sm", children: report.comment }), report.reportedPosts.length > 0 && (_jsx("ul", { className: "space-y-2", children: report.reportedPosts.map((post) => (_jsxs("li", { className: "bg-surface rounded-md p-2", children: [_jsxs("div", { className: "mb-2 flex items-center justify-between", children: [_jsx("h3", { className: "text-sm font-medium", children: t('admin.moderation.reportList.postHeading', {
|
|
70
|
+
defaultValue: 'Reported post',
|
|
71
|
+
}) }), _jsx("a", { href: `/posts/${post.repost?.id ?? post.id}`, className: "border-input hover:bg-surface rounded-button border px-2 py-1 text-xs", children: t('admin.moderation.reportList.goToPost', {
|
|
72
|
+
defaultValue: 'Go to post',
|
|
73
|
+
}) })] }), _jsx(FeedPostContent, { post: post })] }, post.id))) })), report.resolution ? (_jsx(Button, { title: t('admin.moderation.reopen', {
|
|
74
|
+
defaultValue: 'Reopen',
|
|
75
|
+
}), variant: "ghost", action: () => reopen({ reportId: report.id }), children: t('admin.moderation.reopen', { defaultValue: 'Reopen' }) })) : (_jsx(Button, { title: t('admin.moderation.reportList.closeReport', {
|
|
76
|
+
defaultValue: 'Close',
|
|
77
|
+
}), variant: "outline", action: () => setResolving(report), children: t('admin.moderation.reportList.closeReport', {
|
|
78
|
+
defaultValue: 'Close',
|
|
79
|
+
}) }))] }, report.id))) })), resolving ? (_jsx(ResolveReportModal, { report: resolving, onClose: () => setResolving(null) })) : null] }));
|
|
80
|
+
}
|
|
81
|
+
function ResolveReportModal({ report, onClose, }) {
|
|
82
|
+
const t = useT();
|
|
83
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
84
|
+
const resolveReport = openpeepsApi.admin.resolveReportAction({
|
|
85
|
+
reportId: report.id,
|
|
86
|
+
});
|
|
87
|
+
const deletePost = openpeepsApi.deletePostAction();
|
|
88
|
+
const deleteProfile = openpeepsApi.admin.deleteProfileAction();
|
|
89
|
+
const [step, setStep] = useState('options');
|
|
90
|
+
const [submitting, setSubmitting] = useState(false);
|
|
91
|
+
const [error, setError] = useState(null);
|
|
92
|
+
const isProfileReport = report.reportedPosts.length === 0;
|
|
93
|
+
const firstPostId = report.reportedPosts[0]?.id;
|
|
94
|
+
const run = async (fn) => {
|
|
95
|
+
setError(null);
|
|
96
|
+
setSubmitting(true);
|
|
97
|
+
try {
|
|
98
|
+
await fn();
|
|
99
|
+
onClose();
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
setError(err.message);
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
setSubmitting(false);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const closeReport = () => run(() => resolveReport({ resolution: 'ignore' }));
|
|
109
|
+
const removeAndResolve = (op) => run(async () => {
|
|
110
|
+
await op();
|
|
111
|
+
await resolveReport({ resolution: 'remove' });
|
|
112
|
+
});
|
|
113
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-md", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: step === 'options'
|
|
114
|
+
? t('admin.moderation.report.closeOptions.title', {
|
|
115
|
+
defaultValue: 'Close this report?',
|
|
116
|
+
})
|
|
117
|
+
: step === 'confirmPost'
|
|
118
|
+
? t('admin.moderation.post.delete.title', {
|
|
119
|
+
defaultValue: 'Delete this post?',
|
|
120
|
+
})
|
|
121
|
+
: step === 'confirmProfile'
|
|
122
|
+
? t('admin.moderation.profile.delete.title', {
|
|
123
|
+
defaultValue: 'Delete this profile?',
|
|
124
|
+
})
|
|
125
|
+
: t('admin.moderation.report.close.title', {
|
|
126
|
+
defaultValue: 'Just close report?',
|
|
127
|
+
}) }) }), step === 'options' ? (_jsxs("div", { className: "space-y-4 px-1", children: [_jsx("p", { className: "text-muted-foreground text-sm", children: t('admin.moderation.report.closeOptions.description', {
|
|
128
|
+
defaultValue: 'You are about to close this report, select an action below to close it:',
|
|
129
|
+
}) }), !isProfileReport && firstPostId ? (_jsxs("div", { className: "space-y-1", children: [_jsx(Button, { title: t('admin.moderation.report.closeOptions.deletePost.button', {
|
|
130
|
+
defaultValue: 'Delete Post',
|
|
131
|
+
}), variant: "destructive", action: () => setStep('confirmPost'), children: t('admin.moderation.report.closeOptions.deletePost.button', {
|
|
132
|
+
defaultValue: 'Delete Post',
|
|
133
|
+
}) }), _jsx("p", { className: "text-muted-foreground text-xs", children: t('admin.moderation.report.closeOptions.deletePost.description', {
|
|
134
|
+
defaultValue: 'Post will no longer be on the feed and community',
|
|
135
|
+
}) })] })) : null, _jsxs("div", { className: "space-y-1", children: [_jsx(Button, { title: t('admin.moderation.report.closeOptions.deleteProfile.button', {
|
|
136
|
+
defaultValue: 'Delete Profile',
|
|
137
|
+
}), variant: isProfileReport ? 'destructive' : 'outline', className: isProfileReport
|
|
138
|
+
? undefined
|
|
139
|
+
: 'border-error text-error hover:bg-error/10', action: () => setStep('confirmProfile'), children: t('admin.moderation.report.closeOptions.deleteProfile.button', {
|
|
140
|
+
defaultValue: 'Delete Profile',
|
|
141
|
+
}) }), _jsx("p", { className: "text-muted-foreground text-xs", children: t('admin.moderation.report.closeOptions.deleteProfile.description', {
|
|
142
|
+
defaultValue: 'Prevents the profile from showing up in lists and being seen by anyone, removes content also.',
|
|
143
|
+
}) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Button, { title: t('admin.moderation.report.closeOptions.closeReport.button', {
|
|
144
|
+
defaultValue: 'Just close it',
|
|
145
|
+
}), variant: "outline", action: () => setStep('confirmClose'), children: t('admin.moderation.report.closeOptions.closeReport.button', {
|
|
146
|
+
defaultValue: 'Just close it',
|
|
147
|
+
}) }), _jsx("p", { className: "text-muted-foreground text-xs", children: t('admin.moderation.report.closeOptions.closeReport.description', {
|
|
148
|
+
defaultValue: 'Resolve this report without doing anything',
|
|
149
|
+
}) })] })] })) : (_jsx("p", { className: "px-1 text-sm", children: step === 'confirmPost'
|
|
150
|
+
? t('admin.moderation.post.delete.description', {
|
|
151
|
+
defaultValue: 'You are about to delete this post, it will no longer be available in the community. Are you sure about this?',
|
|
152
|
+
})
|
|
153
|
+
: step === 'confirmProfile'
|
|
154
|
+
? t('admin.moderation.profile.delete.description', {
|
|
155
|
+
defaultValue: 'You are about to delete this profile. Are you sure about this?',
|
|
156
|
+
})
|
|
157
|
+
: t('admin.moderation.report.close.description', {
|
|
158
|
+
defaultValue: 'You are about to close this report without performing an action on it which will mark it as resolved. Are you sure about this?',
|
|
159
|
+
}) })), error ? (_jsx("p", { className: "border-error/40 text-error rounded-md border p-2 text-sm", children: error })) : null, step !== 'options' ? (_jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", action: () => setStep('options'), disabled: submitting, children: t('admin.moderation.report.close.cancel', {
|
|
160
|
+
defaultValue: 'Back',
|
|
161
|
+
}) }), _jsx(Button, { variant: "destructive", action: () => {
|
|
162
|
+
if (step === 'confirmClose')
|
|
163
|
+
closeReport();
|
|
164
|
+
else if (step === 'confirmPost' && firstPostId)
|
|
165
|
+
removeAndResolve(() => deletePost({ id: firstPostId }));
|
|
166
|
+
else if (step === 'confirmProfile')
|
|
167
|
+
removeAndResolve(() => deleteProfile({ id: report.reportedProfile.id }));
|
|
168
|
+
}, disabled: submitting, children: step === 'confirmClose'
|
|
169
|
+
? t('admin.moderation.report.close.confirm', {
|
|
170
|
+
defaultValue: 'Yes, close it',
|
|
171
|
+
})
|
|
172
|
+
: t('admin.moderation.post.delete.confirm', {
|
|
173
|
+
defaultValue: 'Yes, delete it',
|
|
174
|
+
}) })] })) : null] }) }));
|
|
175
|
+
}
|
|
176
|
+
function TabButton({ active, onClick, children, }) {
|
|
177
|
+
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 }));
|
|
178
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export declare const AnalyticsLayout: () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const AnalyticsLoading: () => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const AnalyticsSection: ({ title, info, children, className, collapsible, defaultOpen, csvRows, csvFilename, }: {
|
|
5
|
+
title: string;
|
|
6
|
+
/** Explanation shown from the section info badge. */
|
|
7
|
+
info?: string;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
collapsible?: boolean;
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
csvRows?: Array<Array<string | number>>;
|
|
13
|
+
csvFilename?: string;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import { Navigate, NavLink, Outlet, useLocation } from 'react-router-dom';
|
|
4
|
+
import { ChevronDown } from 'lucide-react';
|
|
5
|
+
import { AnalyticsInfoBadge, Button, DateRangeFilter, LoadingSpinner, } from '@openpeepshq/react-ui';
|
|
6
|
+
import { useOpenpeeps, useSetPageHeader, useT } from '../../../index.js';
|
|
7
|
+
import { AnalyticsRangeContext } from './AnalyticsRangeContext.js';
|
|
8
|
+
import { downloadCsv } from './downloadCsv.js';
|
|
9
|
+
const tabs = [
|
|
10
|
+
{
|
|
11
|
+
to: '/admin/analytics',
|
|
12
|
+
end: true,
|
|
13
|
+
labelKey: 'overview',
|
|
14
|
+
fallback: 'Overview',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
to: '/admin/analytics/members',
|
|
18
|
+
labelKey: 'members',
|
|
19
|
+
fallback: 'Members',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
to: '/admin/analytics/content',
|
|
23
|
+
labelKey: 'content',
|
|
24
|
+
fallback: 'Content',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
to: '/admin/analytics/engagement',
|
|
28
|
+
labelKey: 'engagement',
|
|
29
|
+
fallback: 'Engagement',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
to: '/admin/analytics/groups',
|
|
33
|
+
labelKey: 'groups',
|
|
34
|
+
fallback: 'Groups',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
to: '/admin/analytics/reports',
|
|
38
|
+
labelKey: 'reports',
|
|
39
|
+
fallback: 'Reports',
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
export const AnalyticsLayout = () => {
|
|
43
|
+
const t = useT();
|
|
44
|
+
const location = useLocation();
|
|
45
|
+
const { client } = useOpenpeeps();
|
|
46
|
+
const [range, setRange] = useState({ preset: '30d' });
|
|
47
|
+
const queryParams = useMemo(() => {
|
|
48
|
+
const params = {};
|
|
49
|
+
if (range.preset)
|
|
50
|
+
params.preset = range.preset;
|
|
51
|
+
if (range.from)
|
|
52
|
+
params.from = range.from;
|
|
53
|
+
if (range.to)
|
|
54
|
+
params.to = range.to;
|
|
55
|
+
return params;
|
|
56
|
+
}, [range]);
|
|
57
|
+
const onExportPdf = useCallback(async () => {
|
|
58
|
+
const result = await client.admin.analytics.export({
|
|
59
|
+
queryParameters: { ...queryParams, format: 'pdf' },
|
|
60
|
+
});
|
|
61
|
+
if ('error' in result)
|
|
62
|
+
return;
|
|
63
|
+
const { filename, content, encoding, contentType } = result.data;
|
|
64
|
+
const blob = encoding === 'base64'
|
|
65
|
+
? new Blob([Uint8Array.from(atob(content), (c) => c.charCodeAt(0))], {
|
|
66
|
+
type: contentType,
|
|
67
|
+
})
|
|
68
|
+
: new Blob([content], { type: contentType });
|
|
69
|
+
const url = URL.createObjectURL(blob);
|
|
70
|
+
const a = document.createElement('a');
|
|
71
|
+
a.href = url;
|
|
72
|
+
a.download = filename;
|
|
73
|
+
a.click();
|
|
74
|
+
URL.revokeObjectURL(url);
|
|
75
|
+
}, [client, queryParams]);
|
|
76
|
+
const headerActions = useMemo(() => (_jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [_jsx(DateRangeFilter, { compact: true, value: range, onChange: setRange }), _jsx(Button, { type: "button", size: "sm", variant: "outline", onClick: () => void onExportPdf(), children: t('admin.analytics.exportPdf', { defaultValue: 'Export PDF' }) })] })), [onExportPdf, range, setRange, t]);
|
|
77
|
+
useSetPageHeader(t('admin.analytics.title', { defaultValue: 'Analytics' }), headerActions);
|
|
78
|
+
if (location.pathname === '/admin/analytics/growth') {
|
|
79
|
+
return _jsx(Navigate, { to: "/admin/analytics/members", replace: true });
|
|
80
|
+
}
|
|
81
|
+
if (location.pathname === '/admin/analytics/retention') {
|
|
82
|
+
return _jsx(Navigate, { to: "/admin/analytics/members", replace: true });
|
|
83
|
+
}
|
|
84
|
+
return (_jsx(AnalyticsRangeContext.Provider, { value: { range, setRange, queryParams }, children: _jsxs("div", { className: "bg-background min-h-full space-y-5 p-4 sm:p-6", children: [_jsx("nav", { "aria-label": t('admin.analytics.tabsLabel', {
|
|
85
|
+
defaultValue: 'Analytics sections',
|
|
86
|
+
}), className: "border-border flex flex-wrap gap-1 border-b", children: tabs.map((tab) => (_jsx(NavLink, { to: tab.to, end: 'end' in tab ? tab.end : false, className: ({ isActive }) => `-mb-px border-b-2 px-3 py-2.5 text-sm font-medium transition-colors ${isActive
|
|
87
|
+
? 'border-foreground text-foreground'
|
|
88
|
+
: 'text-muted-foreground hover:text-foreground border-transparent'}`, children: t(`admin.analytics.tabs.${tab.labelKey}`, {
|
|
89
|
+
defaultValue: tab.fallback,
|
|
90
|
+
}) }, tab.to))) }), _jsx(Outlet, {})] }) }));
|
|
91
|
+
};
|
|
92
|
+
export const AnalyticsLoading = () => (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: _jsx(LoadingSpinner, {}) }));
|
|
93
|
+
export const AnalyticsSection = ({ title, info, children, className, collapsible = false, defaultOpen = true, csvRows, csvFilename, }) => {
|
|
94
|
+
const t = useT();
|
|
95
|
+
const titleRow = (_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsx("h2", { className: "text-muted-foreground text-xs font-semibold uppercase tracking-wide", children: title }), _jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [csvRows && csvRows.length > 0 ? (_jsx(Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: (event) => {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
event.stopPropagation();
|
|
98
|
+
downloadCsv(csvFilename ?? 'analytics.csv', csvRows);
|
|
99
|
+
}, children: t('admin.analytics.sectionCsv', { defaultValue: 'CSV' }) })) : null, info ? _jsx(AnalyticsInfoBadge, { label: title, info: info }) : null, collapsible ? (_jsx(ChevronDown, { "aria-hidden": true, className: "text-muted-foreground size-4 transition-transform group-open:rotate-180" })) : null] })] }));
|
|
100
|
+
if (!collapsible) {
|
|
101
|
+
return (_jsxs("section", { className: `bg-background relative rounded-xl border p-4 shadow-sm ${className ?? ''}`, children: [_jsx("div", { className: "mb-4", children: titleRow }), children] }));
|
|
102
|
+
}
|
|
103
|
+
return (_jsxs("details", { open: defaultOpen, className: `bg-background group relative rounded-xl border p-4 shadow-sm ${className ?? ''}`, children: [_jsx("summary", { className: "cursor-pointer list-none marker:content-none [&::-webkit-details-marker]:hidden", children: titleRow }), _jsx("div", { className: "mt-4", children: children })] }));
|
|
104
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DateRangeValue } from '@openpeepshq/react-ui';
|
|
2
|
+
type AnalyticsRangeContextValue = {
|
|
3
|
+
range: DateRangeValue;
|
|
4
|
+
setRange: (value: DateRangeValue) => void;
|
|
5
|
+
queryParams: Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
export declare const AnalyticsRangeContext: import("react").Context<AnalyticsRangeContextValue | null>;
|
|
8
|
+
export declare const useAnalyticsRangeContext: () => AnalyticsRangeContextValue;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const AnalyticsRangeContext = createContext(null);
|
|
3
|
+
export const useAnalyticsRangeContext = () => {
|
|
4
|
+
const ctx = useContext(AnalyticsRangeContext);
|
|
5
|
+
if (!ctx) {
|
|
6
|
+
throw new Error('useAnalyticsRangeContext must be used within AnalyticsLayout');
|
|
7
|
+
}
|
|
8
|
+
return ctx;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AnalyticsContentPage: () => import("react/jsx-runtime").JSX.Element;
|