@openpeepshq/react 0.2.5 → 0.2.6
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/CapabilityMatrix.d.ts +24 -0
- package/dist/components/CapabilityMatrix.js +51 -0
- package/dist/components/RelationCapabilitiesEditor.d.ts +1 -0
- package/dist/components/RelationCapabilitiesEditor.js +138 -0
- package/dist/components/RoleCapabilityMatrix.d.ts +10 -0
- package/dist/components/RoleCapabilityMatrix.js +100 -0
- package/dist/components/accounts/SignUpLoginModal.js +7 -5
- package/dist/components/configuration/ConfigMenuButton.d.ts +3 -1
- package/dist/components/configuration/ConfigMenuButton.js +2 -2
- package/dist/components/configuration/ConfigurationList.js +7 -4
- package/dist/components/configuration/ConfigurationValueEditor.js +2 -2
- package/dist/components/conversations/ConversationParticipantsModal.d.ts +7 -0
- package/dist/components/conversations/ConversationParticipantsModal.js +10 -0
- package/dist/components/conversations/CreateNewConversation.js +9 -7
- package/dist/components/conversations/MessageInThread.js +4 -1
- package/dist/components/conversations/index.d.ts +2 -0
- package/dist/components/conversations/index.js +1 -0
- package/dist/components/form/ImageEditModal.js +4 -4
- package/dist/components/form/LocationInput.js +2 -2
- package/dist/components/form/TimeZoneSelect.d.ts +7 -0
- package/dist/components/form/TimeZoneSelect.js +7 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +1 -0
- package/dist/components/groups/ChangeGroupRolesModal.js +15 -4
- package/dist/components/groups/ConfirmGroupExitModal.js +4 -2
- package/dist/components/groups/ConfirmMemberRemovalModal.js +4 -2
- package/dist/components/groups/DeleteGroupModal.js +4 -2
- package/dist/components/groups/GroupAvatar.d.ts +2 -1
- package/dist/components/groups/GroupAvatar.js +9 -12
- package/dist/components/groups/GroupCapabilityMatrix.d.ts +6 -0
- package/dist/components/groups/GroupCapabilityMatrix.js +12 -0
- package/dist/components/groups/GroupCard.js +2 -2
- package/dist/components/groups/GroupFeed.js +2 -1
- package/dist/components/groups/GroupForm.d.ts +11 -1
- package/dist/components/groups/GroupForm.js +14 -67
- package/dist/components/groups/GroupMembersList.js +25 -17
- package/dist/components/groups/GroupOptionsMenu.js +13 -10
- package/dist/components/groups/index.d.ts +3 -1
- package/dist/components/groups/index.js +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +3 -0
- package/dist/components/jams/CreateNewJam.js +5 -127
- package/dist/components/jams/JamCallParticipant.d.ts +7 -1
- package/dist/components/jams/JamCallParticipant.js +28 -38
- package/dist/components/jams/JamCapacityGate.d.ts +2 -1
- package/dist/components/jams/JamCapacityGate.js +2 -2
- package/dist/components/jams/JamChatDrawer.js +12 -47
- package/dist/components/jams/JamChatMessage.d.ts +3 -2
- package/dist/components/jams/JamChatMessage.js +13 -4
- package/dist/components/jams/JamConference.js +4 -3
- package/dist/components/jams/JamContext.d.ts +8 -3
- package/dist/components/jams/JamContext.js +4 -7
- package/dist/components/jams/JamDetailsDrawer.js +11 -8
- package/dist/components/jams/JamEventsContext.d.ts +3 -1
- package/dist/components/jams/JamEventsContext.js +1 -3
- package/dist/components/jams/JamFooter.js +12 -78
- package/dist/components/jams/JamGuestForm.js +0 -1
- package/dist/components/jams/JamLobby.d.ts +2 -6
- package/dist/components/jams/JamLobby.js +11 -57
- package/dist/components/jams/JamObserverShell.js +1 -1
- package/dist/components/jams/JamParticipantConference.js +5 -2
- package/dist/components/jams/JamPeopleDrawer.js +5 -41
- package/dist/components/jams/JamRequestJoin.d.ts +2 -6
- package/dist/components/jams/JamRequestJoin.js +3 -21
- package/dist/components/jams/JamRoom.d.ts +2 -1
- package/dist/components/jams/JamRoom.js +13 -175
- package/dist/components/jams/JamToolbarButton.js +2 -2
- package/dist/components/jams/JamVideoCall.d.ts +3 -2
- package/dist/components/jams/JamVideoCall.js +1 -1
- package/dist/components/jams/JamVideoLayout.d.ts +2 -2
- package/dist/components/jams/JamVideoLayout.js +81 -26
- package/dist/components/jams/LeaveCloseButton.js +2 -1
- package/dist/components/jams/LiveJamsSection.js +1 -1
- package/dist/components/jams/disconnectReason.d.ts +6 -0
- package/dist/components/jams/disconnectReason.js +19 -0
- package/dist/components/jams/jamEventActions.d.ts +3 -0
- package/dist/components/jams/jamEventActions.js +10 -0
- package/dist/components/jams/jamRecordingState.d.ts +6 -0
- package/dist/components/jams/jamRecordingState.js +15 -1
- package/dist/components/jams/reactionEmojis.d.ts +1 -28
- package/dist/components/jams/reactionEmojis.js +1 -55
- package/dist/components/jams/speakerLayout.d.ts +19 -0
- package/dist/components/jams/speakerLayout.js +33 -0
- package/dist/components/jams/useJamSpotlight.d.ts +14 -0
- package/dist/components/jams/useJamSpotlight.js +72 -0
- package/dist/components/layout/Auth.js +20 -3
- package/dist/components/layout/IdentityContext.js +7 -1
- package/dist/components/layout/OpenpeepsThemeProvider.d.ts +15 -0
- package/dist/components/layout/OpenpeepsThemeProvider.js +13 -3
- package/dist/components/layout/ProfileProvider.d.ts +2 -2
- package/dist/components/layout/ProfileProvider.js +15 -32
- package/dist/components/layout/Root.js +1 -1
- package/dist/components/layout/useProfileIdentity.d.ts +59 -0
- package/dist/components/layout/useProfileIdentity.js +38 -0
- package/dist/components/markdown/OpenpeepsMarkdown.js +2 -9
- package/dist/components/markdown/classes.d.ts +2 -2
- package/dist/components/markdown/classes.js +2 -2
- package/dist/components/markdown/staticRender.d.ts +2 -0
- package/dist/components/navigation/ContentHeader.js +1 -1
- package/dist/components/navigation/FooterMobile.js +4 -1
- package/dist/components/navigation/HeaderMobile.js +6 -2
- package/dist/components/navigation/MobileMenuItem.d.ts +3 -1
- package/dist/components/navigation/MobileMenuItem.js +6 -4
- package/dist/components/navigation/PlusButton.js +1 -1
- package/dist/components/navigation/SideBar.js +5 -1
- package/dist/components/notifications/NotificationHeaderActions.js +3 -1
- package/dist/components/notifications/NotificationsList.js +28 -16
- package/dist/components/notifications/TypedNotification.js +50 -6
- package/dist/components/post/CompactReplyParent.d.ts +7 -0
- package/dist/components/post/CompactReplyParent.js +121 -0
- package/dist/components/post/EventViewSwitch.d.ts +1 -0
- package/dist/components/post/EventViewSwitch.js +15 -0
- package/dist/components/post/Feed.d.ts +3 -1
- package/dist/components/post/Feed.js +11 -5
- package/dist/components/post/FeedFormatSwitch.d.ts +1 -0
- package/dist/components/post/FeedFormatSwitch.js +16 -0
- package/dist/components/post/FeedPost.js +9 -19
- package/dist/components/post/FeedPostContent.js +8 -1
- package/dist/components/post/FullPostLayout.js +8 -11
- package/dist/components/post/PinnedPost.js +1 -1
- package/dist/components/post/feed/events/EventsCalendar.d.ts +7 -0
- package/dist/components/post/feed/events/EventsCalendar.js +54 -0
- package/dist/components/post/feed/events/EventsView.d.ts +10 -0
- package/dist/components/post/feed/events/EventsView.js +9 -0
- package/dist/components/post/feed/events/eventCalendar.d.ts +36 -0
- package/dist/components/post/feed/events/eventCalendar.js +145 -0
- package/dist/components/post/feed/threaded/ThreadedFeed.d.ts +1 -4
- package/dist/components/post/feed/threaded/ThreadedFeed.js +5 -2
- package/dist/components/post/helpers.js +3 -1
- package/dist/components/post/index.d.ts +11 -0
- package/dist/components/post/index.js +6 -0
- package/dist/components/post/pieces/Attachments.js +19 -13
- package/dist/components/post/pieces/AudioAttachment.d.ts +13 -0
- package/dist/components/post/pieces/AudioAttachment.js +93 -0
- package/dist/components/post/pieces/EventLocation.d.ts +2 -1
- package/dist/components/post/pieces/EventLocation.js +13 -9
- package/dist/components/post/pieces/EventMenu.d.ts +2 -1
- package/dist/components/post/pieces/EventMenu.js +26 -26
- package/dist/components/post/pieces/EventOccurrenceList.d.ts +10 -0
- package/dist/components/post/pieces/EventOccurrenceList.js +49 -0
- package/dist/components/post/pieces/EventRsvpButton.d.ts +3 -1
- package/dist/components/post/pieces/EventRsvpButton.js +15 -37
- package/dist/components/post/pieces/EventRsvpList.d.ts +12 -0
- package/dist/components/post/pieces/EventRsvpList.js +108 -0
- package/dist/components/post/pieces/EventRsvpScopeDialog.d.ts +16 -0
- package/dist/components/post/pieces/EventRsvpScopeDialog.js +92 -0
- package/dist/components/post/pieces/FeedPostStats.js +5 -4
- package/dist/components/post/pieces/FeedThreadPreview.d.ts +9 -0
- package/dist/components/post/pieces/FeedThreadPreview.js +37 -0
- package/dist/components/post/pieces/GalleryModal.js +8 -5
- package/dist/components/post/pieces/PollContent.js +8 -4
- package/dist/components/post/pieces/PostActions.js +2 -2
- package/dist/components/post/pieces/PostMenu.js +17 -1
- package/dist/components/post/pieces/ShareMenu.js +11 -16
- package/dist/components/post/pieces/VideoPlayer.js +1 -1
- package/dist/components/post/pieces/modals/DeletePostModal.js +6 -2
- package/dist/components/post/pieces/modals/ReactionsModal.js +2 -3
- package/dist/components/post/post-form/ArticleForm.js +2 -14
- package/dist/components/post/post-form/AttachmentCard.js +18 -7
- package/dist/components/post/post-form/ComposeAttachments.d.ts +1 -0
- package/dist/components/post/post-form/ComposeAttachments.js +30 -7
- package/dist/components/post/post-form/DescriptionEditModal.js +2 -2
- package/dist/components/post/post-form/EditPostModal.js +9 -7
- package/dist/components/post/post-form/EventForm.d.ts +2 -1
- package/dist/components/post/post-form/EventForm.js +41 -61
- package/dist/components/post/post-form/EventTypeSwitcher.d.ts +1 -1
- package/dist/components/post/post-form/EventTypeSwitcher.js +15 -134
- package/dist/components/post/post-form/NewPostModal.js +14 -9
- package/dist/components/post/post-form/NewPostModalContext.js +6 -2
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.js +1 -1
- package/dist/components/post/post-form/PollComposerFields.js +7 -5
- package/dist/components/post/post-form/PostAudienceSelector.js +4 -2
- package/dist/components/post/post-form/PostTypeSwitcher.d.ts +5 -2
- package/dist/components/post/post-form/PostTypeSwitcher.js +19 -1
- package/dist/components/post/post-form/ReplyModal.js +13 -9
- package/dist/components/post/post-form/ReplyModalContext.d.ts +5 -8
- package/dist/components/post/post-form/ReplyModalContext.js +9 -12
- package/dist/components/post/post-form/audienceChoices.d.ts +4 -6
- package/dist/components/post/post-form/audienceChoices.js +12 -63
- package/dist/components/post/types/Article.js +3 -1
- package/dist/components/post/types/Event.js +13 -2
- package/dist/components/post/types/article/FullArticle.js +5 -1
- package/dist/components/post/types/event/CardEvent.d.ts +2 -1
- package/dist/components/post/types/event/CardEvent.js +16 -10
- package/dist/components/post/types/event/FullEvent.js +78 -44
- package/dist/components/preview-link/local/PostPreview.js +3 -2
- package/dist/components/profile/Avatar.d.ts +3 -3
- package/dist/components/profile/Avatar.js +15 -15
- package/dist/components/profile/FollowUnfollowButton.d.ts +2 -1
- package/dist/components/profile/FollowUnfollowButton.js +8 -15
- package/dist/components/profile/ProfileActivitySummary.d.ts +5 -0
- package/dist/components/profile/ProfileActivitySummary.js +41 -0
- package/dist/components/profile/ProfileCard.js +3 -1
- package/dist/components/profile/ProfileHeader.js +7 -1
- package/dist/components/profile/ProfilePageAction.js +46 -4
- package/dist/components/profile/ProfilePostsAndReplies.d.ts +4 -3
- package/dist/components/profile/ProfilePostsAndReplies.js +8 -5
- package/dist/components/profile/ProfileSelector.js +2 -2
- package/dist/components/profile/ProfileWithActionCard.d.ts +3 -1
- package/dist/components/profile/ProfileWithActionCard.js +2 -2
- package/dist/components/profile/ReportProfileOrPostModal.js +7 -7
- package/dist/components/profile/index.d.ts +2 -0
- package/dist/components/profile/index.js +1 -0
- package/dist/components/profile/profileFieldDisplay.d.ts +8 -0
- package/dist/components/profile/profileFieldDisplay.js +36 -0
- package/dist/components/registry/PluginRegistryProvider.d.ts +1 -0
- package/dist/components/registry/PluginRegistryProvider.js +6 -1
- package/dist/components/registry/PluginSlot.js +1 -1
- package/dist/components/server-data/context.d.ts +18 -1
- package/dist/contexts/openpeeps/helpers.js +12 -1
- package/dist/contexts/openpeeps/hooks/accounts.js +42 -1
- package/dist/contexts/openpeeps/hooks/admin.d.ts +10065 -4
- package/dist/contexts/openpeeps/hooks/admin.js +17 -0
- package/dist/contexts/openpeeps/hooks/auth.d.ts +2 -1
- package/dist/contexts/openpeeps/hooks/conversations.d.ts +12 -10140
- package/dist/contexts/openpeeps/hooks/conversations.js +8 -2
- package/dist/contexts/openpeeps/hooks/groups.d.ts +15 -3
- package/dist/contexts/openpeeps/hooks/jams.d.ts +7273 -606
- package/dist/contexts/openpeeps/hooks/jams.js +20 -5
- package/dist/contexts/openpeeps/hooks/other.d.ts +18 -1
- package/dist/contexts/openpeeps/hooks/posts.d.ts +64999 -11998
- package/dist/contexts/openpeeps/hooks/profiles.d.ts +49 -7101
- package/dist/contexts/openpeeps/hooks/profiles.js +24 -4
- package/dist/contexts/openpeeps/hooks/search.d.ts +13 -9948
- package/dist/contexts/openpeeps/index.js +18 -9
- package/dist/hooks/auth/useAuthForms.d.ts +25 -0
- package/dist/hooks/auth/useAuthForms.js +101 -0
- package/dist/hooks/community/useCommunityInfoPages.d.ts +10 -0
- package/dist/hooks/community/useCommunityInfoPages.js +18 -0
- package/dist/hooks/conversations/useCreateConversation.d.ts +14 -2
- package/dist/hooks/events/useEventComposer.d.ts +10965 -0
- package/dist/hooks/events/useEventComposer.js +164 -0
- package/dist/hooks/events/useEventForm.d.ts +108 -0
- package/dist/hooks/events/useEventForm.js +154 -0
- package/dist/hooks/events/useEventMenu.d.ts +9 -0
- package/dist/hooks/events/useEventMenu.js +47 -0
- package/dist/hooks/events/useEventRsvp.d.ts +99 -0
- package/dist/hooks/events/useEventRsvp.js +111 -0
- package/dist/hooks/events/useEventTypeSwitcher.d.ts +102 -0
- package/dist/hooks/events/useEventTypeSwitcher.js +160 -0
- package/dist/hooks/events/useEventsCalendar.d.ts +19822 -0
- package/dist/hooks/events/useEventsCalendar.js +89 -0
- package/dist/hooks/groups/useEditGroup.d.ts +87 -0
- package/dist/hooks/groups/useEditGroup.js +80 -0
- package/dist/hooks/groups/useGroupTemplateSelection.d.ts +22 -0
- package/dist/hooks/groups/useGroupTemplateSelection.js +67 -0
- package/dist/hooks/groups/useNewGroup.d.ts +152 -0
- package/dist/hooks/groups/useNewGroup.js +75 -0
- package/dist/hooks/index.d.ts +58 -0
- package/dist/hooks/index.js +36 -0
- package/dist/hooks/jams/useCreateNewJamForm.d.ts +543 -0
- package/dist/hooks/jams/useCreateNewJamForm.js +140 -0
- package/dist/hooks/jams/useJamChat.d.ts +78 -0
- package/dist/hooks/jams/useJamChat.js +64 -0
- package/dist/hooks/jams/useJamDetails.d.ts +9921 -0
- package/dist/hooks/jams/useJamDetails.js +74 -0
- package/dist/hooks/jams/useJamFooterControls.d.ts +27 -0
- package/dist/hooks/jams/useJamFooterControls.js +92 -0
- package/dist/hooks/jams/useJamLobby.d.ts +105 -0
- package/dist/hooks/jams/useJamLobby.js +61 -0
- package/dist/hooks/jams/useJamParticipant.d.ts +11 -0
- package/dist/hooks/jams/useJamParticipant.js +49 -0
- package/dist/hooks/jams/useJamPeople.d.ts +79 -0
- package/dist/hooks/jams/useJamPeople.js +63 -0
- package/dist/hooks/jams/useJamRoom.d.ts +19934 -0
- package/dist/hooks/jams/useJamRoom.js +216 -0
- package/dist/hooks/jams/useJamStage.d.ts +21 -0
- package/dist/hooks/jams/useJamStage.js +48 -0
- package/dist/hooks/jams/useLeaveCloseJam.d.ts +2 -1
- package/dist/hooks/jams/useLeaveCloseJam.js +3 -3
- package/dist/hooks/posts/replyOpener.d.ts +9 -0
- package/dist/hooks/posts/replyOpener.js +12 -0
- package/dist/hooks/posts/useArticleComposer.d.ts +10879 -0
- package/dist/hooks/posts/useArticleComposer.js +112 -0
- package/dist/hooks/posts/useFeedPostActions.d.ts +3 -1
- package/dist/hooks/posts/useFeedPostActions.js +21 -10
- package/dist/hooks/posts/useFeedPostPresentation.d.ts +19827 -0
- package/dist/hooks/posts/useFeedPostPresentation.js +39 -0
- package/dist/hooks/posts/usePostDetailTitle.d.ts +9906 -0
- package/dist/hooks/posts/usePostDetailTitle.js +32 -0
- package/dist/hooks/posts/usePostThreads.d.ts +6 -0
- package/dist/hooks/posts/usePostThreads.js +17 -0
- package/dist/hooks/posts/useShareMenu.d.ts +14 -0
- package/dist/hooks/posts/useShareMenu.js +24 -0
- package/dist/hooks/profile/useFollowProfile.d.ts +8 -0
- package/dist/hooks/profile/useFollowProfile.js +21 -0
- package/dist/hooks/settings/useAccessTokens.d.ts +61 -0
- package/dist/hooks/settings/useAccessTokens.js +128 -0
- package/dist/hooks/settings/useFeedFormatPreference.d.ts +8 -0
- package/dist/hooks/settings/useFeedFormatPreference.js +35 -0
- package/dist/hooks/settings/useLanguagePreference.d.ts +11 -0
- package/dist/hooks/settings/useLanguagePreference.js +55 -0
- package/dist/hooks/settings/useNotificationPreferences.d.ts +26 -0
- package/dist/hooks/settings/useNotificationPreferences.js +79 -0
- package/dist/hooks/settings/usePushEnabledDevices.d.ts +111 -0
- package/dist/hooks/settings/usePushEnabledDevices.js +63 -0
- package/dist/hooks/settings/useThemePreference.d.ts +7 -0
- package/dist/hooks/settings/useThemePreference.js +27 -0
- package/dist/hooks/settings/useTimezonePreference.d.ts +14 -0
- package/dist/hooks/settings/useTimezonePreference.js +52 -0
- package/dist/hooks/useResolvedFeedFormat.d.ts +16 -0
- package/dist/hooks/useResolvedFeedFormat.js +20 -0
- package/dist/i18n/I18nProvider.js +21 -15
- package/dist/i18n/index.d.ts +14 -0
- package/dist/i18n/index.js +26 -0
- package/dist/lib/analyticsClicks.d.ts +1 -1
- package/dist/lib/analyticsClicks.js +4 -10
- package/dist/lib/audienceChoices.d.ts +14 -0
- package/dist/lib/audienceChoices.js +50 -0
- package/dist/lib/audienceSetting.d.ts +6 -0
- package/dist/lib/audienceSetting.js +18 -0
- package/dist/lib/capabilityMatrix.d.ts +76 -0
- package/dist/lib/capabilityMatrix.js +274 -0
- package/dist/lib/configuration/helpers.d.ts +12 -0
- package/dist/lib/configuration/helpers.js +38 -2
- package/dist/lib/groupCapabilityMatrix.d.ts +12 -0
- package/dist/lib/groupCapabilityMatrix.js +17 -0
- package/dist/lib/groupFormErrors.d.ts +15 -0
- package/dist/lib/groupFormErrors.js +61 -0
- package/dist/lib/initialsAvatar.d.ts +7 -0
- package/dist/lib/initialsAvatar.js +23 -0
- package/dist/lib/notificationBadge.d.ts +6 -2
- package/dist/lib/notificationBadge.js +17 -0
- package/dist/lib/reactionEmojis.d.ts +28 -0
- package/dist/lib/reactionEmojis.js +55 -0
- package/dist/navigation/targets.d.ts +2 -1
- package/dist/pages/About.js +4 -7
- package/dist/pages/CodeOfConduct.js +4 -5
- package/dist/pages/Explore.js +2 -2
- package/dist/pages/PostDetail.js +11 -20
- package/dist/pages/Profile.js +9 -2
- package/dist/pages/Tags.d.ts +1 -1
- package/dist/pages/Tags.js +48 -6
- package/dist/pages/Tags.test.d.ts +1 -0
- package/dist/pages/Tags.test.js +75 -0
- package/dist/pages/Welcome.js +1 -1
- package/dist/pages/admin/Analytics.d.ts +1 -0
- package/dist/pages/admin/Analytics.js +1 -0
- package/dist/pages/admin/ConfigEditor.js +4 -8
- package/dist/pages/admin/Configuration.js +18 -2
- package/dist/pages/admin/ConfigurationCommunity.js +1 -1
- package/dist/pages/admin/ConfigurationCommunityFeed.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunityFeed.js +69 -0
- package/dist/pages/admin/ConfigurationCommunityTimezone.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunityTimezone.js +69 -0
- package/dist/pages/admin/ConfigurationPluginPage.d.ts +1 -0
- package/dist/pages/admin/ConfigurationPluginPage.js +21 -0
- package/dist/pages/admin/ConfigurationSso.d.ts +1 -0
- package/dist/pages/admin/ConfigurationSso.js +104 -0
- package/dist/pages/admin/ConfigurationSsoNew.d.ts +1 -0
- package/dist/pages/admin/ConfigurationSsoNew.js +44 -0
- package/dist/pages/admin/Dashboard.js +65 -20
- package/dist/pages/admin/Db.js +2 -2
- package/dist/pages/admin/GroupMembers.js +6 -39
- package/dist/pages/admin/Groups.js +4 -2
- package/dist/pages/admin/Invites.js +9 -4
- package/dist/pages/admin/MemberDetail.d.ts +1 -0
- package/dist/pages/admin/MemberDetail.js +66 -0
- package/dist/pages/admin/Members.js +39 -10
- package/dist/pages/admin/Plugins.d.ts +1 -0
- package/dist/pages/admin/Plugins.js +208 -0
- package/dist/pages/admin/Reports.js +17 -17
- package/dist/pages/admin/analytics/AnalyticsLayout.js +30 -5
- package/dist/pages/admin/analytics/Content.js +6 -6
- package/dist/pages/admin/analytics/Engagement.js +10 -10
- package/dist/pages/admin/analytics/Groups.js +5 -13
- package/dist/pages/admin/analytics/Members.js +10 -2
- package/dist/pages/admin/analytics/Overview.js +10 -10
- package/dist/pages/admin/analytics/PluginPage.d.ts +1 -0
- package/dist/pages/admin/analytics/PluginPage.js +26 -0
- package/dist/pages/admin/analytics/analyticsPluginTabs.d.ts +4 -0
- package/dist/pages/admin/analytics/analyticsPluginTabs.js +25 -0
- package/dist/pages/admin/community/CommunityRoles.js +107 -58
- package/dist/pages/admin/community/CommunityTheme.js +1 -1
- package/dist/pages/admin/community/useCommunityConfig.d.ts +6 -2
- package/dist/pages/admin/components/AdminGroupCard.js +1 -1
- package/dist/pages/admin/components/InviteWithEmailModal.js +5 -5
- package/dist/pages/admin/components/InviteWithLinkModal.d.ts +0 -1
- package/dist/pages/admin/components/InviteWithLinkModal.js +45 -14
- package/dist/pages/admin/components/ProfileRowActions.js +19 -13
- package/dist/pages/admin/components/RestoreBackupModal.js +6 -2
- package/dist/pages/admin/components/RestoreTestBackupModal.js +6 -4
- package/dist/pages/admin/components/ServerStatusSection.d.ts +5 -0
- package/dist/pages/admin/components/ServerStatusSection.js +62 -0
- package/dist/pages/admin/components/inviteQr.d.ts +8 -0
- package/dist/pages/admin/components/inviteQr.js +72 -0
- package/dist/pages/admin/components/serverStatusFormat.d.ts +3 -0
- package/dist/pages/admin/components/serverStatusFormat.js +32 -0
- package/dist/pages/admin/configurationPluginPages.d.ts +4 -0
- package/dist/pages/admin/configurationPluginPages.js +26 -0
- package/dist/pages/admin/configurationSsoShared.d.ts +307 -0
- package/dist/pages/admin/configurationSsoShared.js +192 -0
- package/dist/pages/articles/Edit.js +6 -40
- package/dist/pages/articles/Index.js +2 -1
- package/dist/pages/articles/New.js +6 -39
- package/dist/pages/auth/Closed.js +4 -2
- package/dist/pages/auth/Login.js +55 -21
- package/dist/pages/auth/Register.js +25 -9
- package/dist/pages/auth/RequestResetPassword.js +4 -4
- package/dist/pages/auth/ResetPassword.js +4 -4
- package/dist/pages/conversations/Index.js +19 -6
- package/dist/pages/conversations/Info.js +40 -3
- package/dist/pages/conversations/Show.js +29 -20
- package/dist/pages/events/Edit.js +11 -52
- package/dist/pages/events/Index.js +7 -4
- package/dist/pages/events/My.js +2 -2
- package/dist/pages/events/New.js +6 -57
- package/dist/pages/feeds/Bookmarks.js +4 -2
- package/dist/pages/feeds/Local.js +2 -1
- package/dist/pages/feeds/My.js +2 -1
- package/dist/pages/groups/Edit.js +11 -41
- package/dist/pages/groups/EditInfo.d.ts +1 -0
- package/dist/pages/groups/EditInfo.js +22 -0
- package/dist/pages/groups/EditRoles.d.ts +1 -0
- package/dist/pages/groups/EditRoles.js +29 -0
- package/dist/pages/groups/New.js +6 -58
- package/dist/pages/groups/Show.js +2 -2
- package/dist/pages/index.d.ts +13 -0
- package/dist/pages/index.js +13 -0
- package/dist/pages/jams/Event.js +3 -1
- package/dist/pages/jams/Index.js +3 -1
- package/dist/pages/payment/Success.js +2 -2
- package/dist/pages/settings/AccessTokens.js +10 -104
- package/dist/pages/settings/Account.js +43 -2
- package/dist/pages/settings/Billing.js +11 -7
- package/dist/pages/settings/Blocked.d.ts +1 -0
- package/dist/pages/settings/Blocked.js +29 -0
- package/dist/pages/settings/Feed.d.ts +1 -0
- package/dist/pages/settings/Feed.js +36 -0
- package/dist/pages/settings/Index.js +1 -1
- package/dist/pages/settings/Language.js +9 -44
- package/dist/pages/settings/NotificationPreferences.js +16 -68
- package/dist/pages/settings/PublicProfile.js +9 -0
- package/dist/pages/settings/PushEnabledDevices.js +10 -43
- package/dist/pages/settings/Theme.js +5 -21
- package/dist/pages/settings/Timezone.d.ts +1 -0
- package/dist/pages/settings/Timezone.js +19 -0
- package/dist/pwa/PwaProvider.d.ts +3 -2
- package/dist/pwa/PwaProvider.js +19 -2
- package/dist/pwa/pageReload.d.ts +12 -0
- package/dist/pwa/pageReload.js +30 -0
- package/dist/pwa/registration.js +3 -0
- package/dist/pwa/staleAppReload.d.ts +33 -0
- package/dist/pwa/staleAppReload.js +123 -0
- package/dist/pwa/useServiceWorker.d.ts +1 -1
- package/dist/pwa/useServiceWorker.js +15 -1
- package/dist/react-native.d.ts +46 -0
- package/dist/react-native.js +33 -0
- package/dist/stores/eventView.d.ts +10 -0
- package/dist/stores/eventView.js +14 -0
- package/dist/stores/feedFormat.d.ts +7 -0
- package/dist/stores/feedFormat.js +14 -0
- package/dist/stores/index.d.ts +3 -0
- package/dist/stores/index.js +2 -0
- package/dist/stores/newPosts.d.ts +78 -12
- package/package.json +10 -6
- package/dist/lib/groupCapabilityHelpers.d.ts +0 -24
- package/dist/lib/groupCapabilityHelpers.js +0 -119
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type MatrixCapabilities } from '../lib/capabilityMatrix';
|
|
2
|
+
export interface CapabilityMatrixColumn {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export interface CapabilityMatrixProps {
|
|
7
|
+
/** Editor capability keys (leaves + wildcard allows). */
|
|
8
|
+
editorKeys: readonly string[];
|
|
9
|
+
/** Columns rendered across the matrix (relationships or roles). */
|
|
10
|
+
columns: CapabilityMatrixColumn[];
|
|
11
|
+
value: MatrixCapabilities;
|
|
12
|
+
onChange: (value: MatrixCapabilities) => void;
|
|
13
|
+
/** i18n prefix for title/description/capability/allowAll/stateHint. */
|
|
14
|
+
i18nPrefix: string;
|
|
15
|
+
/** Prefix for cell-state tooltips; defaults to `${i18nPrefix}.state`. */
|
|
16
|
+
stateI18nPrefix?: string;
|
|
17
|
+
/** Column that applies to everyone and cascades; omit to disable cascading. */
|
|
18
|
+
everyoneColumn?: string;
|
|
19
|
+
/** Hide the descriptive help text (matrix used inline). */
|
|
20
|
+
compact?: boolean;
|
|
21
|
+
/** Default capabilities to compare against for change highlighting. */
|
|
22
|
+
defaultCapabilities?: MatrixCapabilities;
|
|
23
|
+
}
|
|
24
|
+
export declare function CapabilityMatrix({ editorKeys, columns, value, onChange, i18nPrefix, stateI18nPrefix, everyoneColumn, compact, defaultCapabilities, }: CapabilityMatrixProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { Label } from '@openpeepshq/react-ui';
|
|
4
|
+
import { useT } from '../i18n/index.js';
|
|
5
|
+
import { capabilityEditorGroups, cycleCapabilityCell, getCapabilityCellState, } from '../lib/capabilityMatrix.js';
|
|
6
|
+
const cellClass = {
|
|
7
|
+
none: 'border-border bg-background hover:bg-surface',
|
|
8
|
+
'implicit-remove': 'border-error/40 bg-error/15 text-error cursor-not-allowed',
|
|
9
|
+
'implicit-add': 'border-success/40 bg-success/10 text-success hover:bg-success/20',
|
|
10
|
+
'specific-add': 'border-success bg-success/25 text-success hover:bg-success/35',
|
|
11
|
+
'specific-remove': 'border-error bg-error/25 text-error hover:bg-error/35',
|
|
12
|
+
};
|
|
13
|
+
export function CapabilityMatrix({ editorKeys, columns, value, onChange, i18nPrefix, stateI18nPrefix, everyoneColumn, compact = false, defaultCapabilities, }) {
|
|
14
|
+
const t = useT();
|
|
15
|
+
const options = {
|
|
16
|
+
editorKeys,
|
|
17
|
+
columns: columns.map((column) => column.key),
|
|
18
|
+
everyoneColumn,
|
|
19
|
+
};
|
|
20
|
+
const groups = capabilityEditorGroups(editorKeys);
|
|
21
|
+
const statePrefix = stateI18nPrefix ?? `${i18nPrefix}.state`;
|
|
22
|
+
const stateLabel = (state) => t(`${statePrefix}.${state}`, { defaultValue: state });
|
|
23
|
+
const cycleCap = (column, cap) => {
|
|
24
|
+
onChange(cycleCapabilityCell(options, value, column, cap));
|
|
25
|
+
};
|
|
26
|
+
const CapabilityCell = ({ column, cap, subLabel, }) => {
|
|
27
|
+
const state = getCapabilityCellState(options, value, column, cap);
|
|
28
|
+
const locked = state === 'implicit-remove';
|
|
29
|
+
const changed = getCapabilityCellState(options, defaultCapabilities ?? {}, column, cap) !== state;
|
|
30
|
+
return (_jsxs("button", { type: "button", disabled: locked, "aria-label": `${column} ${cap}: ${stateLabel(state)}`, title: stateLabel(state), "data-testid": `cap-cell-${column}-${cap}`, "data-cap-state": state, "data-changed": changed ? 'true' : undefined, className: `mx-auto flex h-7 w-7 flex-col items-center justify-center rounded border text-[0.6rem] font-semibold leading-none ${cellClass[state]} ${changed ? 'ring-primary ring-2' : ''}`, onClick: () => cycleCap(column, cap), children: [state === 'implicit-add' ? '~' : null, state === 'specific-add' ? '+' : null, state === 'specific-remove' ? '−' : null, state === 'implicit-remove' ? '×' : null, subLabel ? (_jsx("span", { className: "text-muted-foreground mt-0.5 text-[0.55rem] font-normal", children: subLabel })) : null] }));
|
|
31
|
+
};
|
|
32
|
+
return (_jsxs("div", { className: "space-y-2 px-1", children: [compact ? null : (_jsxs(_Fragment, { children: [_jsx(Label, { children: t(`${i18nPrefix}.title`, {
|
|
33
|
+
defaultValue: 'Role capabilities',
|
|
34
|
+
}) }), _jsx("p", { className: "text-muted-foreground text-sm", children: t(`${i18nPrefix}.description`, {
|
|
35
|
+
defaultValue: 'Click a cell to toggle a capability for this relationship.',
|
|
36
|
+
}) }), _jsx("p", { className: "text-muted-foreground text-xs", children: t(`${i18nPrefix}.stateHint`, {
|
|
37
|
+
defaultValue: 'Click a cell to cycle: empty → allow (+) → deny (−). ~ = allowed by a wildcard. × = denied by a wildcard and cannot be changed.',
|
|
38
|
+
}) })] })), _jsx("div", { className: "overflow-x-auto rounded-md border", children: _jsxs("table", { className: "w-full table-fixed text-left text-xs", children: [_jsxs("colgroup", { children: [_jsx("col", { className: "w-28" }), columns.map((column) => (_jsx("col", {}, column.key)))] }), _jsx("thead", { className: "bg-surface", children: _jsxs("tr", { children: [_jsx("th", { className: "p-2 font-medium", children: t(`${i18nPrefix}.capability`, {
|
|
39
|
+
defaultValue: 'Capability',
|
|
40
|
+
}) }), columns.map((column) => (_jsx("th", { className: "h-32 p-2 text-center font-medium", title: column.label, children: _jsx("span", { className: "block -rotate-90 whitespace-nowrap", children: column.label }) }, column.key)))] }) }), _jsx("tbody", { children: groups.map((group) => {
|
|
41
|
+
const groupLabel = group.prefix.replace(/-$/, '');
|
|
42
|
+
return (_jsxs(Fragment, { children: [_jsxs("tr", { className: "bg-surface/60 border-t", children: [_jsx("td", { className: "truncate p-2 font-medium", title: groupLabel, children: groupLabel || group.wildcard }), columns.map((column) => (_jsx("td", { className: "p-2 text-center", children: _jsx(CapabilityCell, { column: column.key, cap: group.wildcard, subLabel: t(`${i18nPrefix}.allowAll`, {
|
|
43
|
+
defaultValue: 'All',
|
|
44
|
+
}) }) }, column.key)))] }), group.leaves.map((cap) => {
|
|
45
|
+
const capLabel = cap.startsWith(group.prefix)
|
|
46
|
+
? cap.slice(group.prefix.length)
|
|
47
|
+
: cap;
|
|
48
|
+
return (_jsxs("tr", { className: "border-t", children: [_jsx("td", { className: "truncate p-2 pl-4 font-mono", title: cap, children: capLabel }), columns.map((column) => (_jsx("td", { className: "p-2 text-center", children: _jsx(CapabilityCell, { column: column.key, cap: cap }) }, column.key)))] }, cap));
|
|
49
|
+
})] }, group.wildcard));
|
|
50
|
+
}) })] }) })] }));
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function RelationCapabilitiesEditor(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { accessTokenCapabilityEditorKeys, accessTokenRelationships, postCapabilityEditorKeys, postRelationships, profileCapabilityEditorKeys, profileRelationships, reportCapabilityEditorKeys, reportRelationships, } from '@openpeepshq/common/types';
|
|
4
|
+
import { checkRoleCapabilities } from '@openpeepshq/common/lib';
|
|
5
|
+
import { Button, Toast } from '@openpeepshq/react-ui';
|
|
6
|
+
import { useT } from '../i18n/index.js';
|
|
7
|
+
import { useOpenpeeps } from '../contexts/openpeeps/index.js';
|
|
8
|
+
import { useCurrentProfile } from './layout/IdentityContext.js';
|
|
9
|
+
import { CapabilityMatrix } from './CapabilityMatrix.js';
|
|
10
|
+
import { diffRelationshipMatrix } from '../lib/capabilityMatrix.js';
|
|
11
|
+
const relationObjects = [
|
|
12
|
+
{
|
|
13
|
+
key: 'post',
|
|
14
|
+
editorKeys: postCapabilityEditorKeys,
|
|
15
|
+
baseRelationships: postRelationships,
|
|
16
|
+
titleI18n: 'capabilities.relations.post.title',
|
|
17
|
+
descriptionI18n: 'capabilities.relations.post.description',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
key: 'profile',
|
|
21
|
+
editorKeys: profileCapabilityEditorKeys,
|
|
22
|
+
baseRelationships: profileRelationships,
|
|
23
|
+
titleI18n: 'capabilities.relations.profile.title',
|
|
24
|
+
descriptionI18n: 'capabilities.relations.profile.description',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: 'report',
|
|
28
|
+
editorKeys: reportCapabilityEditorKeys,
|
|
29
|
+
baseRelationships: reportRelationships,
|
|
30
|
+
titleI18n: 'capabilities.relations.report.title',
|
|
31
|
+
descriptionI18n: 'capabilities.relations.report.description',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: 'accessToken',
|
|
35
|
+
editorKeys: accessTokenCapabilityEditorKeys,
|
|
36
|
+
baseRelationships: accessTokenRelationships,
|
|
37
|
+
titleI18n: 'capabilities.relations.accessToken.title',
|
|
38
|
+
descriptionI18n: 'capabilities.relations.accessToken.description',
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
export function RelationCapabilitiesEditor() {
|
|
42
|
+
const t = useT();
|
|
43
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
44
|
+
const currentProfile = useCurrentProfile();
|
|
45
|
+
const configQuery = openpeepsApi.admin.useConfigRead('openpeeps', 'capabilities');
|
|
46
|
+
const updateConfig = openpeepsApi.admin.updateConfigAction({
|
|
47
|
+
namespace: 'openpeeps',
|
|
48
|
+
name: 'capabilities',
|
|
49
|
+
});
|
|
50
|
+
const [draft, setDraft] = useState(null);
|
|
51
|
+
const [saving, setSaving] = useState(false);
|
|
52
|
+
const [status, setStatus] = useState(null);
|
|
53
|
+
const merged = configQuery.data?.config;
|
|
54
|
+
const defaults = configQuery.data?.defaults;
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (merged) {
|
|
57
|
+
setDraft(JSON.parse(JSON.stringify(merged)));
|
|
58
|
+
}
|
|
59
|
+
}, [merged]);
|
|
60
|
+
// Sparse patch: only relationship buckets that diverge from the defaults, so
|
|
61
|
+
// saves never persist values identical to the shipped defaults.
|
|
62
|
+
const diffPatch = useMemo(() => {
|
|
63
|
+
if (!draft || !defaults)
|
|
64
|
+
return null;
|
|
65
|
+
const patch = {};
|
|
66
|
+
for (const obj of relationObjects) {
|
|
67
|
+
const edited = (draft[obj.key] ?? {});
|
|
68
|
+
const df = (defaults[obj.key] ?? {});
|
|
69
|
+
const columns = new Set([
|
|
70
|
+
...obj.baseRelationships,
|
|
71
|
+
...Object.keys(edited),
|
|
72
|
+
...Object.keys(df),
|
|
73
|
+
]);
|
|
74
|
+
const changed = diffRelationshipMatrix(edited, df, [...columns]);
|
|
75
|
+
if (Object.keys(changed).length > 0) {
|
|
76
|
+
patch[obj.key] = changed;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return Object.keys(patch).length === 0
|
|
80
|
+
? null
|
|
81
|
+
: patch;
|
|
82
|
+
}, [draft, defaults]);
|
|
83
|
+
const objectColumns = (obj) => {
|
|
84
|
+
const rels = new Set(obj.baseRelationships);
|
|
85
|
+
const draftObj = draft?.[obj.key] ?? {};
|
|
86
|
+
Object.keys(draftObj).forEach((rel) => rels.add(rel));
|
|
87
|
+
return [...rels].map((rel) => ({ key: rel, label: rel }));
|
|
88
|
+
};
|
|
89
|
+
const updateObject = (objKey, next) => {
|
|
90
|
+
setDraft((prev) => prev
|
|
91
|
+
? { ...prev, [objKey]: next }
|
|
92
|
+
: { [objKey]: next });
|
|
93
|
+
};
|
|
94
|
+
const canUpdateConfig = checkRoleCapabilities(currentProfile?.roles ?? [], [
|
|
95
|
+
'core-config-update',
|
|
96
|
+
]).success;
|
|
97
|
+
const handleSave = async () => {
|
|
98
|
+
if (!diffPatch || !canUpdateConfig)
|
|
99
|
+
return;
|
|
100
|
+
setSaving(true);
|
|
101
|
+
setStatus(null);
|
|
102
|
+
try {
|
|
103
|
+
await updateConfig({ config: diffPatch });
|
|
104
|
+
setStatus({
|
|
105
|
+
type: 'success',
|
|
106
|
+
message: t('capabilities.relations.saveSuccess', {
|
|
107
|
+
defaultValue: 'Relationship capabilities updated',
|
|
108
|
+
}),
|
|
109
|
+
});
|
|
110
|
+
// Capabilities config is consumed by boot-time singletons, so a reload
|
|
111
|
+
// re-initializes the in-memory config the same way AdminConfigEditor does.
|
|
112
|
+
window.location.reload();
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
setStatus({ type: 'error', message: err.message });
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
setSaving(false);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const handleRestoreDefaults = () => {
|
|
122
|
+
if (defaults) {
|
|
123
|
+
setDraft(JSON.parse(JSON.stringify(defaults)));
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
if (configQuery.isLoading || !draft) {
|
|
127
|
+
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: t('common.form.loading', { defaultValue: 'Loading…' }) }));
|
|
128
|
+
}
|
|
129
|
+
return (_jsxs("div", { className: "flex flex-col gap-6", children: [relationObjects.map((obj) => (_jsxs("div", { className: "space-y-2", children: [_jsx("h3", { className: "text-lg font-semibold", children: t(obj.titleI18n) }), _jsx(CapabilityMatrix, { editorKeys: [...obj.editorKeys], columns: objectColumns(obj), value: (draft[obj.key] ?? {}), onChange: (next) => updateObject(obj.key, next), i18nPrefix: "capabilities.relations", stateI18nPrefix: "groups.capabilities.state", everyoneColumn: "none", compact: true, defaultCapabilities: (defaults?.[obj.key] ?? {}) }), _jsx("p", { className: "text-muted-foreground text-xs", children: t(obj.descriptionI18n, {
|
|
130
|
+
defaultValue: 'Choose what each relationship can do for this object type.',
|
|
131
|
+
}) })] }, obj.key))), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Button, { variant: "default", action: handleSave, disabled: saving || !canUpdateConfig || !diffPatch, loadingContent: t('common.saving', { defaultValue: 'Saving…' }), title: t('common.save', { defaultValue: 'Save' }), children: saving
|
|
132
|
+
? t('common.saving', { defaultValue: 'Saving…' })
|
|
133
|
+
: t('common.save', { defaultValue: 'Save' }) }), canUpdateConfig && diffPatch ? (_jsx(Button, { variant: "outline", action: handleRestoreDefaults, title: t('common.restoreDefaults', {
|
|
134
|
+
defaultValue: 'Restore defaults',
|
|
135
|
+
}), children: t('common.restoreDefaults', { defaultValue: 'Restore defaults' }) })) : null, !canUpdateConfig ? (_jsx("span", { className: "text-muted-foreground text-xs", children: t('capabilities.relations.noUpdateCapability', {
|
|
136
|
+
defaultValue: 'You can view but not edit relationship capabilities without core-config-update.',
|
|
137
|
+
}) })) : null] }), status ? (_jsx(Toast, { variant: status.type, onDismiss: () => setStatus(null), children: status.message })) : null] }));
|
|
138
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Role } from '@openpeepshq/common/types';
|
|
2
|
+
export interface RoleCapabilityMatrixProps {
|
|
3
|
+
roles: Role[];
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Instance-admin matrix for the capabilities of every role. Columns are the
|
|
7
|
+
* instance roles, rows are the role capability keys — mirrors the group roles
|
|
8
|
+
* matrix, but without an "everyone" column since roles are independent.
|
|
9
|
+
*/
|
|
10
|
+
export declare function RoleCapabilityMatrix({ roles }: RoleCapabilityMatrixProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { currentRoleDefaults, defaultRoles, roleCapabilityEditorKeys, } from '@openpeepshq/common/types';
|
|
4
|
+
import { checkRoleCapabilities } from '@openpeepshq/common/lib';
|
|
5
|
+
import { Button, Input, Switch, Toast } from '@openpeepshq/react-ui';
|
|
6
|
+
import { useT } from '../i18n/index.js';
|
|
7
|
+
import { useOpenpeeps } from '../contexts/openpeeps/index.js';
|
|
8
|
+
import { useCurrentProfile } from './layout/IdentityContext.js';
|
|
9
|
+
import { CapabilityMatrix } from './CapabilityMatrix.js';
|
|
10
|
+
import { filterRoles, roleDefaultCapabilities } from '../lib/capabilityMatrix.js';
|
|
11
|
+
const builtInRoleKeys = new Set(defaultRoles.map((role) => role.key));
|
|
12
|
+
/**
|
|
13
|
+
* Instance-admin matrix for the capabilities of every role. Columns are the
|
|
14
|
+
* instance roles, rows are the role capability keys — mirrors the group roles
|
|
15
|
+
* matrix, but without an "everyone" column since roles are independent.
|
|
16
|
+
*/
|
|
17
|
+
export function RoleCapabilityMatrix({ roles }) {
|
|
18
|
+
const t = useT();
|
|
19
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
20
|
+
const currentProfile = useCurrentProfile();
|
|
21
|
+
const updateRole = openpeepsApi.admin.updateRoleAction();
|
|
22
|
+
const [draft, setDraft] = useState({});
|
|
23
|
+
const [saving, setSaving] = useState(false);
|
|
24
|
+
const [showDefault, setShowDefault] = useState(true);
|
|
25
|
+
const [showCustom, setShowCustom] = useState(true);
|
|
26
|
+
const [filter, setFilter] = useState('');
|
|
27
|
+
const [status, setStatus] = useState(null);
|
|
28
|
+
const loadedDraft = useMemo(() => Object.fromEntries(roles.map((role) => [
|
|
29
|
+
role.key,
|
|
30
|
+
role.capabilities ?? { add: [], remove: [] },
|
|
31
|
+
])), [roles]);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
setDraft(loadedDraft);
|
|
34
|
+
}, [loadedDraft]);
|
|
35
|
+
const roleDefaults = useMemo(() => roleDefaultCapabilities(roles), [roles]);
|
|
36
|
+
const columns = useMemo(() => filterRoles(roles, { showDefault, showCustom, filter }).map((role) => ({
|
|
37
|
+
key: role.key,
|
|
38
|
+
label: role.displayName || role.key,
|
|
39
|
+
})), [roles, showDefault, showCustom, filter]);
|
|
40
|
+
const visibleCount = columns.length;
|
|
41
|
+
const changedRoleIds = useMemo(() => roles
|
|
42
|
+
.filter((role) => JSON.stringify(draft[role.key]) !==
|
|
43
|
+
JSON.stringify(role.capabilities ?? { add: [], remove: [] }))
|
|
44
|
+
.map((role) => role.id), [roles, draft]);
|
|
45
|
+
const deviatesFromDefaults = useMemo(() => roles.some((role) => JSON.stringify(draft[role.key]) !==
|
|
46
|
+
JSON.stringify(roleDefaults[role.key])), [roles, draft, roleDefaults]);
|
|
47
|
+
const canUpdateRoles = checkRoleCapabilities(currentProfile?.roles ?? [], [
|
|
48
|
+
'core-roles-update',
|
|
49
|
+
]).success;
|
|
50
|
+
const handleSave = async () => {
|
|
51
|
+
if (!canUpdateRoles || changedRoleIds.length === 0)
|
|
52
|
+
return;
|
|
53
|
+
setSaving(true);
|
|
54
|
+
setStatus(null);
|
|
55
|
+
try {
|
|
56
|
+
await Promise.all(roles
|
|
57
|
+
.filter((role) => changedRoleIds.includes(role.id))
|
|
58
|
+
.map((role) => updateRole({
|
|
59
|
+
key: role.key,
|
|
60
|
+
default: role.default,
|
|
61
|
+
displayName: role.displayName,
|
|
62
|
+
description: role.description,
|
|
63
|
+
capabilities: draft[role.key] ?? role.capabilities,
|
|
64
|
+
// Anchor built-in roles to the defaults version they are
|
|
65
|
+
// customized against, so later default changes can be merged
|
|
66
|
+
// back into the customization on server start.
|
|
67
|
+
...(builtInRoleKeys.has(role.key)
|
|
68
|
+
? { baseVersion: currentRoleDefaults.version }
|
|
69
|
+
: {}),
|
|
70
|
+
}, { roleId: role.id })));
|
|
71
|
+
setStatus({
|
|
72
|
+
type: 'success',
|
|
73
|
+
message: t('capabilities.roles.saveSuccess', {
|
|
74
|
+
defaultValue: 'Role capabilities updated',
|
|
75
|
+
}),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
setStatus({ type: 'error', message: err.message });
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
setSaving(false);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-x-5 gap-y-2 px-1", children: [_jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx(Switch, { checked: showDefault, onCheckedChange: setShowDefault }), t('capabilities.roles.defaultRoles', {
|
|
86
|
+
defaultValue: 'Default roles',
|
|
87
|
+
})] }), _jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx(Switch, { checked: showCustom, onCheckedChange: setShowCustom }), t('capabilities.roles.customRoles', {
|
|
88
|
+
defaultValue: 'Custom roles',
|
|
89
|
+
})] }), _jsx(Input, { className: "max-w-56", value: filter, placeholder: t('capabilities.roles.filterPlaceholder', {
|
|
90
|
+
defaultValue: 'Filter roles…',
|
|
91
|
+
}), onChange: (e) => setFilter(e.target.value) })] }), visibleCount === 0 ? (_jsx("p", { className: "text-muted-foreground px-1 text-sm", children: t('capabilities.roles.noRolesMatch', {
|
|
92
|
+
defaultValue: 'No roles match the filter.',
|
|
93
|
+
}) })) : (_jsx(CapabilityMatrix, { editorKeys: [...roleCapabilityEditorKeys], columns: columns, value: draft, onChange: setDraft, i18nPrefix: "capabilities.roles", stateI18nPrefix: "groups.capabilities.state", everyoneColumn: undefined, defaultCapabilities: loadedDraft })), _jsxs("div", { className: "flex items-center gap-3 px-1", children: [_jsx(Button, { variant: "default", action: handleSave, disabled: saving || !canUpdateRoles || changedRoleIds.length === 0, loadingContent: t('common.saving', { defaultValue: 'Saving…' }), title: t('common.save', { defaultValue: 'Save' }), children: saving
|
|
94
|
+
? t('common.saving', { defaultValue: 'Saving…' })
|
|
95
|
+
: t('common.save', { defaultValue: 'Save' }) }), canUpdateRoles && deviatesFromDefaults ? (_jsx(Button, { variant: "outline", action: () => setDraft(roleDefaults), title: t('common.restoreDefaults', {
|
|
96
|
+
defaultValue: 'Restore defaults',
|
|
97
|
+
}), children: t('common.restoreDefaults', { defaultValue: 'Restore defaults' }) })) : null, !canUpdateRoles ? (_jsx("span", { className: "text-muted-foreground text-xs", children: t('capabilities.roles.noUpdateCapability', {
|
|
98
|
+
defaultValue: 'You can view but not edit role capabilities without core-roles-update.',
|
|
99
|
+
}) })) : null] }), status ? (_jsx(Toast, { variant: status.type, onDismiss: () => setStatus(null), children: status.message })) : null] }));
|
|
100
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Dialog, DialogActions, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
3
3
|
import { useT } from '../../i18n/index.js';
|
|
4
4
|
import { useRouter } from '../../contexts/router/index.js';
|
|
5
5
|
/**
|
|
@@ -12,8 +12,10 @@ export function SignUpLoginModal({ onClose }) {
|
|
|
12
12
|
const router = useRouter();
|
|
13
13
|
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-md", showCloseButton: false, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: t('accounts.login.title', { defaultValue: 'Login' }) }), _jsx(DialogDescription, { children: t('accounts.login.description', {
|
|
14
14
|
defaultValue: 'Login to your account',
|
|
15
|
-
}) })] }),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
}) })] }), _jsx(DialogActions, { cancelLabel: t('common.cancel', { defaultValue: 'Cancel' }), onCancel: onClose, actionLabel: t('accounts.login.loginButton', {
|
|
16
|
+
defaultValue: 'Log In',
|
|
17
|
+
}), onAction: () => {
|
|
18
|
+
router.navigate({ type: 'auth', mode: 'login' });
|
|
19
|
+
onClose();
|
|
20
|
+
} })] }) }));
|
|
19
21
|
}
|
|
@@ -2,9 +2,11 @@ export interface ConfigMenuButtonProps {
|
|
|
2
2
|
translationPrefix: string;
|
|
3
3
|
action: string;
|
|
4
4
|
testId?: string;
|
|
5
|
+
titleFallback?: string;
|
|
6
|
+
descriptionFallback?: string;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* Row in a settings / configuration menu: title, description and a chevron.
|
|
8
10
|
* Shared by the admin configuration screens and the user settings index.
|
|
9
11
|
*/
|
|
10
|
-
export declare function ConfigMenuButton({ translationPrefix, action, testId, }: ConfigMenuButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function ConfigMenuButton({ translationPrefix, action, testId, titleFallback, descriptionFallback, }: ConfigMenuButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { useT } from '../../i18n/index.js';
|
|
|
6
6
|
* Row in a settings / configuration menu: title, description and a chevron.
|
|
7
7
|
* Shared by the admin configuration screens and the user settings index.
|
|
8
8
|
*/
|
|
9
|
-
export function ConfigMenuButton({ translationPrefix, action, testId, }) {
|
|
9
|
+
export function ConfigMenuButton({ translationPrefix, action, testId, titleFallback, descriptionFallback, }) {
|
|
10
10
|
const t = useT();
|
|
11
|
-
return (_jsxs(Link, { to: action, "data-testid": testId, className: "hover:bg-surface flex w-full items-center justify-between px-4 py-3 text-start", children: [_jsxs("div", { children: [_jsx("div", { className: "font-medium", children: t(`${translationPrefix}.title
|
|
11
|
+
return (_jsxs(Link, { to: action, "data-testid": testId, className: "hover:bg-surface flex w-full items-center justify-between px-4 py-3 text-start", children: [_jsxs("div", { children: [_jsx("div", { className: "font-medium", children: t(`${translationPrefix}.title`, titleFallback ? { defaultValue: titleFallback } : {}) }), _jsx("div", { className: "text-muted-foreground text-xs", children: t(`${translationPrefix}.description`, descriptionFallback ? { defaultValue: descriptionFallback } : {}) })] }), _jsx("span", { "aria-hidden": "true", children: _jsx(ChevronRight, { className: "h-4 w-4" }) })] }));
|
|
12
12
|
}
|
|
@@ -3,7 +3,7 @@ import { useMemo, useState } from 'react';
|
|
|
3
3
|
import { z, ZodArray } from 'zod';
|
|
4
4
|
import { Minus, Plus } from 'lucide-react';
|
|
5
5
|
import { useT } from '../../i18n/index.js';
|
|
6
|
-
import { equal, unwrap } from '../../lib/configuration/helpers.js';
|
|
6
|
+
import { defaultFromSchema, equal, unwrap, } from '../../lib/configuration/helpers.js';
|
|
7
7
|
import { ConfigurationCategory } from './ConfigurationCategory.js';
|
|
8
8
|
import { ConfigurationValueEditor } from './ConfigurationValueEditor.js';
|
|
9
9
|
export function ConfigurationList({ schema, config, path = [], value: valueProp, onChange, disabled: disabledProp, }) {
|
|
@@ -11,14 +11,15 @@ export function ConfigurationList({ schema, config, path = [], value: valueProp,
|
|
|
11
11
|
const disabled = disabledProp ?? schema.description === 'fixed';
|
|
12
12
|
const elementSchema = (schema.element ?? schema._def.type);
|
|
13
13
|
const unwrappedElementSchema = unwrap(elementSchema);
|
|
14
|
-
const defaults = useMemo(() => elementSchema
|
|
14
|
+
const defaults = useMemo(() => defaultFromSchema(elementSchema), [elementSchema]);
|
|
15
15
|
const [value, setValue] = useState(valueProp ?? [...config]);
|
|
16
16
|
const setAndNotify = (next) => {
|
|
17
17
|
setValue(next);
|
|
18
18
|
onChange(next);
|
|
19
19
|
};
|
|
20
20
|
const dirty = !equal(config, value); // list roots are arrays
|
|
21
|
-
return (_jsxs("div", { className: "mt-4 pl-4", children: [_jsx("p", { className: dirty ? 'font-bold' : '', children: path.at(-1) ||
|
|
21
|
+
return (_jsxs("div", { className: "mt-4 pl-4", children: [_jsx("p", { className: dirty ? 'font-bold' : '', children: path.at(-1) ||
|
|
22
|
+
t('admin.configuration.unnamedSection', { defaultValue: 'Section' }) }), value.map((_, index) => (_jsxs("div", { children: [unwrappedElementSchema instanceof z.ZodObject ? (_jsx(ConfigurationCategory, { schema: unwrappedElementSchema, path: [...path, String(index)], config: (config?.[index] ?? defaults), defaults: defaults, value: (value[index] ?? defaults), onChange: (entry) => {
|
|
22
23
|
const next = [...value];
|
|
23
24
|
next[index] = entry;
|
|
24
25
|
setAndNotify(next);
|
|
@@ -26,5 +27,7 @@ export function ConfigurationList({ schema, config, path = [], value: valueProp,
|
|
|
26
27
|
const next = [...value];
|
|
27
28
|
next[index] = entry;
|
|
28
29
|
setAndNotify(next);
|
|
29
|
-
}, disabled: disabled })), _jsx("button", { type: "button", title: t('common.listEditor.removeTitle', {
|
|
30
|
+
}, disabled: disabled })), _jsx("button", { type: "button", title: t('common.listEditor.removeTitle', {
|
|
31
|
+
defaultValue: 'Remove',
|
|
32
|
+
}), onClick: () => setAndNotify(value.toSpliced(index, 1)), children: _jsx(Minus, { className: "h-4 w-4" }) })] }, index))), _jsx("button", { type: "button", title: t('common.listEditor.addTitle', { defaultValue: 'Add' }), onClick: () => setAndNotify([...value, structuredClone(defaults)]), children: _jsx(Plus, { className: "h-4 w-4" }) })] }));
|
|
30
33
|
}
|
|
@@ -3,7 +3,7 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { Input, Textarea } from '@openpeepshq/react-ui';
|
|
5
5
|
import { useT } from '../../i18n/index.js';
|
|
6
|
-
import { unwrap } from '../../lib/configuration/helpers.js';
|
|
6
|
+
import { configurationLabelKey, unwrap } from '../../lib/configuration/helpers.js';
|
|
7
7
|
export function ConfigurationValueEditor({ schema, config, defaults, path, value: valueProp, onChange, disabled: disabledProp, }) {
|
|
8
8
|
const t = useT();
|
|
9
9
|
const unwrappedSchema = useMemo(() => unwrap(schema), [schema]);
|
|
@@ -17,7 +17,7 @@ export function ConfigurationValueEditor({ schema, config, defaults, path, value
|
|
|
17
17
|
onChange(next);
|
|
18
18
|
};
|
|
19
19
|
const dirty = value !== config;
|
|
20
|
-
const label = t(
|
|
20
|
+
const label = t(configurationLabelKey(path), {
|
|
21
21
|
defaultValue: String(path.at(-1)),
|
|
22
22
|
});
|
|
23
23
|
const password = schema.description === 'password';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PublicProfile } from '@openpeepshq/common/types';
|
|
2
|
+
export interface ConversationParticipantsModalProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
participants: PublicProfile[];
|
|
6
|
+
}
|
|
7
|
+
export declare const ConversationParticipantsModal: ({ open, onOpenChange, participants, }: ConversationParticipantsModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
3
|
+
import { useT } from '../../i18n/index.js';
|
|
4
|
+
import { ProfileCard } from '../profile/index.js';
|
|
5
|
+
export const ConversationParticipantsModal = ({ open, onOpenChange, participants, }) => {
|
|
6
|
+
const t = useT();
|
|
7
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "flex max-h-[85vh] max-w-md flex-col gap-0 overflow-hidden p-0", children: [_jsx(DialogHeader, { className: "p-6 pb-2 pr-12", children: _jsx(DialogTitle, { children: t('conversations.participants.title', {
|
|
8
|
+
defaultValue: 'Participants',
|
|
9
|
+
}) }) }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: participants.map((profile) => (_jsx(ProfileCard, { profile: profile, showAction: false }, profile.id))) })] }) }));
|
|
10
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { blockedPairIds } from '@openpeepshq/common/lib';
|
|
3
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
3
4
|
import { useT } from '../../i18n/index.js';
|
|
4
5
|
import { useCreateConversation } from '../../hooks/conversations/useCreateConversation.js';
|
|
6
|
+
import { OpenpeepsMarkdownInput } from '../post/index.js';
|
|
5
7
|
import { ProfilesInput } from '../profile/index.js';
|
|
6
8
|
const MAX_MESSAGE_LENGTH = 500;
|
|
7
9
|
export const CreateNewConversation = ({ profiles: initialProfiles = [], message: initialMessage = '', skipProfileSelection = false, onClose, }) => {
|
|
@@ -14,15 +16,15 @@ export const CreateNewConversation = ({ profiles: initialProfiles = [], message:
|
|
|
14
16
|
});
|
|
15
17
|
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsx(DialogContent, { className: "flex max-h-[85vh] max-w-lg flex-col overflow-hidden", children: step === 1 ? (_jsxs(_Fragment, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('conversations.createNew.title', {
|
|
16
18
|
defaultValue: 'New message',
|
|
17
|
-
}) }) }), _jsx("div", { className: "min-h-0 flex-1 space-y-2 overflow-y-auto", children: _jsx(ProfilesInput, { value: selectedProfiles, onChange: setSelectedProfiles, banlist: me ? [me] : [], placeholder: t('conversations.createNew.searchPlaceholder', {
|
|
19
|
+
}) }) }), _jsx("div", { className: "min-h-0 flex-1 space-y-2 overflow-y-auto", children: _jsx(ProfilesInput, { value: selectedProfiles, onChange: setSelectedProfiles, banlist: me ? [me.id, ...blockedPairIds(me)] : [], placeholder: t('conversations.createNew.searchPlaceholder', {
|
|
18
20
|
defaultValue: 'Search members…',
|
|
19
21
|
}), title: t('conversations.createNew.title', {
|
|
20
22
|
defaultValue: 'New message',
|
|
21
|
-
}) }) }),
|
|
23
|
+
}) }) }), _jsx(DialogActions, { cancelLabel: t('common.cancel', { defaultValue: 'Cancel' }), onCancel: onClose, actionLabel: t('common.next', { defaultValue: 'Next' }), onAction: () => setStep(2), disabled: selectedProfiles.length === 0 })] })) : (_jsxs(_Fragment, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('conversations.createNew.sendMessage', {
|
|
22
24
|
defaultValue: 'Send message',
|
|
23
|
-
}) }) }), _jsx("
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
}) }) }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: _jsx(OpenpeepsMarkdownInput, { rows: 5, value: message, onChange: setMessage, maxLength: MAX_MESSAGE_LENGTH, placeholder: t('conversations.createNew.messagePlaceholder', {
|
|
26
|
+
defaultValue: 'Write a message…',
|
|
27
|
+
}) }) }), error ? _jsx("p", { className: "text-error text-sm", children: error }) : null, _jsxs(DialogFooter, { className: "flex-wrap gap-2", children: [!skipProfileSelection ? (_jsx(Button, { variant: "outline", action: () => setStep(1), children: t('common.back', { defaultValue: 'Back' }) })) : (_jsx(Button, { variant: "outline", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) })), _jsx(Button, { variant: "default", disabled: submitting || selectedProfiles.length === 0, action: send, children: submitting
|
|
26
28
|
? t('common.sending', { defaultValue: 'Sending…' })
|
|
27
29
|
: t('conversations.createNew.send', {
|
|
28
30
|
defaultValue: 'Send',
|
|
@@ -30,11 +30,14 @@ export function MessageInThread({ previous, message, multipleParticipants = true
|
|
|
30
30
|
adjustUnread: isUnread,
|
|
31
31
|
});
|
|
32
32
|
const { added, removed } = audienceDiff(previous, message);
|
|
33
|
+
// The author leaving their own conversation is shown via the "left" label
|
|
34
|
+
// below, so exclude them from the "removedBy" avatars to avoid redundancy.
|
|
35
|
+
const removedOthers = removed.filter((p) => p.id !== message.profile.id);
|
|
33
36
|
const name = profileName(message.profile);
|
|
34
37
|
const isMe = message.profile.id === me?.id;
|
|
35
38
|
return (_jsxs(_Fragment, { children: [!previous && (_jsx("div", { className: "mt-2 w-full text-center text-sm", children: message.inReplyToId
|
|
36
39
|
? t('conversations.messageInThread.addedBy', { name })
|
|
37
40
|
: t('conversations.messageInThread.startedBy', { name }) })), previous &&
|
|
38
41
|
inAudience(previous, message.profile) &&
|
|
39
|
-
!inAudience(message, message.profile) && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Avatar, { profile: message.profile, size: 2.5, borderless: true, navigate: true }), t('conversations.messageInThread.left', { name })] })), previous && added.length > 0 && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex -space-x-2", children: added.map((p) => (_jsx(Avatar, { profile: p, size: 2.5, borderless: true, navigate: true }, p.id))) }), t('conversations.messageInThread.addedBy', { name })] })),
|
|
42
|
+
!inAudience(message, message.profile) && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Avatar, { profile: message.profile, size: 2.5, borderless: true, navigate: true }), t('conversations.messageInThread.left', { name })] })), previous && added.length > 0 && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex -space-x-2", children: added.map((p) => (_jsx(Avatar, { profile: p, size: 2.5, borderless: true, navigate: true }, p.id))) }), t('conversations.messageInThread.addedBy', { name })] })), removedOthers.length > 0 && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex -space-x-2", children: removedOthers.map((p) => (_jsx(Avatar, { profile: p, size: 2.5, borderless: true, navigate: true }, p.id))) }), t('conversations.messageInThread.removedBy', { name })] })), _jsxs("article", { ref: postViewRef, className: "flex", children: [!isMe && multipleParticipants && (_jsx(Avatar, { containerClassName: "mt-6 mr-2", profile: message.profile, navigate: true })), _jsx("div", { className: "min-w-0 flex-1", children: _jsx(ConversationMessageBubble, { message: message, unread: isUnread }) })] }), _jsxs("div", { className: `mt-2 w-full text-sm ${isMe ? 'text-right' : 'text-left'}`, children: [multipleParticipants && !isMe && _jsxs("span", { children: [name, " \u00B7 "] }), _jsx(UpdatingDate, { date: message.createdAt })] })] }));
|
|
40
43
|
}
|
|
@@ -3,6 +3,8 @@ export type { CreateNewConversationProps } from './CreateNewConversation';
|
|
|
3
3
|
export { CreateNewConversationProvider, useCreateNewConversation, } from './CreateNewConversationContext';
|
|
4
4
|
export type { CreateConversationOptions } from './CreateNewConversationContext';
|
|
5
5
|
export { DirectMessagesHeaderActions } from './DirectMessagesHeaderActions';
|
|
6
|
+
export { ConversationParticipantsModal } from './ConversationParticipantsModal';
|
|
7
|
+
export type { ConversationParticipantsModalProps } from './ConversationParticipantsModal';
|
|
6
8
|
export { ConversationMessageBubble } from './ConversationMessageBubble';
|
|
7
9
|
export { MessageInThread } from './MessageInThread';
|
|
8
10
|
export type { MessageInThreadProps } from './MessageInThread';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { CreateNewConversation } from './CreateNewConversation.js';
|
|
2
2
|
export { CreateNewConversationProvider, useCreateNewConversation, } from './CreateNewConversationContext.js';
|
|
3
3
|
export { DirectMessagesHeaderActions } from './DirectMessagesHeaderActions.js';
|
|
4
|
+
export { ConversationParticipantsModal } from './ConversationParticipantsModal.js';
|
|
4
5
|
export { ConversationMessageBubble } from './ConversationMessageBubble.js';
|
|
5
6
|
export { MessageInThread } from './MessageInThread.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from 'react';
|
|
3
3
|
import Cropper, {} from 'react-easy-crop';
|
|
4
|
-
import { Badge,
|
|
4
|
+
import { Badge, Dialog, DialogActions, DialogContent, DialogHeader, DialogTitle, Label, Textarea, } from '@openpeepshq/react-ui';
|
|
5
5
|
import { useT } from '../../i18n/index.js';
|
|
6
6
|
import { convertToWebpIfHeic, getCroppedImg } from '../../lib/canvasUtils.js';
|
|
7
7
|
const parseAspectRatio = (ratio) => {
|
|
@@ -67,7 +67,7 @@ export function ImageEditModal({ file, previewUrl, open, onClose, onConfirm, sho
|
|
|
67
67
|
defaultValue: 'Crop ratio',
|
|
68
68
|
}) }), _jsx("div", { className: "flex flex-wrap gap-2", children: ASPECT_RATIOS.map((item, index) => (_jsx("button", { type: "button", title: item.label, onClick: () => setAspectIndex(index), children: _jsx(Badge, { status: item.label, variant: aspectIndex === index ? 'default' : 'outline' }) }, item.label))) })] })) : null, showAltInput ? (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "alt-text", children: t('common.media.altText', { defaultValue: 'Alt text' }) }), _jsx(Textarea, { id: "alt-text", rows: 3, value: description, onChange: (e) => setDescription(e.target.value), placeholder: t('common.media.altTextDescription', {
|
|
69
69
|
defaultValue: 'Describe the image for accessibility',
|
|
70
|
-
}) })] })) : null] })) : null] }),
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
}) })] })) : null] })) : null] }), _jsx(DialogActions, { cancelLabel: t('common.cancel', { defaultValue: 'Cancel' }), onCancel: onClose, actionLabel: submitting
|
|
71
|
+
? t('common.uploading', { defaultValue: 'Uploading…' })
|
|
72
|
+
: t('common.add', { defaultValue: 'Add' }), onAction: confirm, disabled: submitting })] }) }));
|
|
73
73
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { MapPin } from 'lucide-react';
|
|
4
|
-
import { Button, Input, Label,
|
|
4
|
+
import { Button, Input, Label, LoadingSpinner, cn } from '@openpeepshq/react-ui';
|
|
5
5
|
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
6
6
|
import { useT } from '../../i18n/index.js';
|
|
7
7
|
/**
|
|
@@ -55,5 +55,5 @@ export function LocationInput({ title = '', description = '', value, onChange, p
|
|
|
55
55
|
});
|
|
56
56
|
}, debounceMs);
|
|
57
57
|
};
|
|
58
|
-
return (_jsxs(Label, { title: title, description: description, classes: "relative", children: [_jsxs("div", { className: cn('op-input-group grid grid-cols-[auto_1fr_auto] rounded-full'), children: [_jsx("div", { className: "op-input-group-shim", children: _jsx(MapPin, { className: "size-4" }) }), _jsx(Input, { value: name, type: "text", placeholder: placeholder ?? title, disabled: disabled, readOnly: readOnly, onChange: onTextChange })] }), (pending || suggestions) && (_jsx("div", { className: "op-card absolute bottom-16 flex w-full flex-col items-start gap-3 p-2 text-sm", children: pending ? (_jsxs("div", { className: "flex w-full flex-col items-center justify-center gap-2 p-4", children: [_jsx("span", { children: t('location.lookup', { name }) }), _jsx(
|
|
58
|
+
return (_jsxs(Label, { title: title, description: description, classes: "relative", children: [_jsxs("div", { className: cn('op-input-group grid grid-cols-[auto_1fr_auto] rounded-full'), children: [_jsx("div", { className: "op-input-group-shim", children: _jsx(MapPin, { className: "size-4" }) }), _jsx(Input, { value: name, type: "text", placeholder: placeholder ?? title, disabled: disabled, readOnly: readOnly, onChange: onTextChange })] }), (pending || suggestions) && (_jsx("div", { className: "op-card absolute bottom-16 flex w-full flex-col items-start gap-3 p-2 text-sm", children: pending ? (_jsxs("div", { className: "flex w-full flex-col items-center justify-center gap-2 p-4", children: [_jsx("span", { children: t('location.lookup', { name }) }), _jsx(LoadingSpinner, {})] })) : (_jsxs(_Fragment, { children: [_jsx(Button, { className: "border-border hover:bg-surface w-full border p-2 text-left", action: () => onSelection({ name }), children: name }), suggestions?.map((res, idx) => (_jsx(Button, { className: "border-border hover:bg-surface w-full border p-2 text-left", action: () => onSelection(res), children: res.name }, idx)))] })) }))] }));
|
|
59
59
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface TimeZoneSelectProps {
|
|
2
|
+
id?: string;
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (timeZone: string) => void;
|
|
5
|
+
optionLabel?: (timeZone: string) => string;
|
|
6
|
+
}
|
|
7
|
+
export declare function TimeZoneSelect({ id, value, onChange, optionLabel, }: TimeZoneSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ianaTimeZones } from '@openpeepshq/common/lib';
|
|
3
|
+
export function TimeZoneSelect({ id, value, onChange, optionLabel, }) {
|
|
4
|
+
const zones = ianaTimeZones();
|
|
5
|
+
const options = value && !zones.includes(value) ? [value, ...zones] : zones;
|
|
6
|
+
return (_jsx("select", { id: id, className: "bg-background w-full rounded-md border px-3 py-2 text-sm", value: value, onChange: (e) => onChange(e.target.value), children: options.map((tz) => (_jsx("option", { value: tz, children: optionLabel ? optionLabel(tz) : tz }, tz))) }));
|
|
7
|
+
}
|