@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
|
@@ -1,64 +1,25 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { X } from 'lucide-react';
|
|
4
|
-
import { EVENT_HEADER_ASPECT_RATIO, parseEventMaxAttendeesInput,
|
|
4
|
+
import { EVENT_HEADER_ASPECT_RATIO, parseEventMaxAttendeesInput, utcIsoToZonedDateTime, zonedDateTimeToUtcIso, } from '@openpeepshq/common/lib';
|
|
5
5
|
import { Input, Label } from '@openpeepshq/react-ui';
|
|
6
6
|
import { useT } from '../../../i18n/index.js';
|
|
7
|
-
import {
|
|
7
|
+
import { EVENT_WEEKDAYS, useEventForm, } from '../../../hooks/events/useEventForm.js';
|
|
8
8
|
import { ImageInput } from '../../form/ImageInput.js';
|
|
9
9
|
import { OpenpeepsMarkdownInput } from './OpenpeepsMarkdownInput.js';
|
|
10
10
|
import { ComposePreviewLinks } from './ComposePreviewLinks.js';
|
|
11
11
|
import { EventTypeSwitcher } from './EventTypeSwitcher.js';
|
|
12
12
|
import { PostAudienceSelector } from './PostAudienceSelector.js';
|
|
13
13
|
import { VisibilitySelector } from './VisibilitySelector.js';
|
|
14
|
-
const dateToInputValue = (value) =>
|
|
15
|
-
|
|
16
|
-
return '';
|
|
17
|
-
const d = new Date(value);
|
|
18
|
-
if (Number.isNaN(d.getTime()))
|
|
19
|
-
return '';
|
|
20
|
-
const tz = d.getTimezoneOffset() * 60_000;
|
|
21
|
-
return new Date(d.getTime() - tz).toISOString().slice(0, 16);
|
|
22
|
-
};
|
|
23
|
-
const toIso = (value) => {
|
|
24
|
-
if (!value)
|
|
25
|
-
return undefined;
|
|
26
|
-
const d = new Date(value);
|
|
27
|
-
return Number.isNaN(d.getTime()) ? undefined : d.toISOString();
|
|
28
|
-
};
|
|
14
|
+
const dateToInputValue = (value, timeZone) => value ? utcIsoToZonedDateTime(value, timeZone) : '';
|
|
15
|
+
const toIso = (value, timeZone) => zonedDateTimeToUtcIso(value, timeZone);
|
|
29
16
|
const TIMEZONES = typeof Intl !== 'undefined' && 'supportedValuesOf' in Intl
|
|
30
17
|
? Intl.supportedValuesOf('timeZone')
|
|
31
18
|
: [Intl.DateTimeFormat().resolvedOptions().timeZone];
|
|
32
|
-
export
|
|
19
|
+
export const EventForm = ({ postData, onChange, isEdit = false, occurrenceEdit = false, }) => {
|
|
33
20
|
const t = useT();
|
|
34
|
-
const me = useCurrentProfile();
|
|
35
|
-
const event = postData.data;
|
|
36
|
-
const [showEndDate, setShowEndDate] = useState(event.end !== undefined);
|
|
37
21
|
const [audienceOpen, setAudienceOpen] = useState(false);
|
|
38
|
-
const patchEvent = (
|
|
39
|
-
let next = { ...event, ...patch };
|
|
40
|
-
if ('maxAttendees' in patch && patch.maxAttendees === undefined) {
|
|
41
|
-
next = withoutEventMaxAttendees(next);
|
|
42
|
-
}
|
|
43
|
-
onChange({
|
|
44
|
-
...postData,
|
|
45
|
-
data: next,
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
const setAudience = (settings) => {
|
|
49
|
-
const audience = settings.audience ?? undefined;
|
|
50
|
-
const includesMe = audience?.some((p) => p.id === me?.id);
|
|
51
|
-
onChange({
|
|
52
|
-
...postData,
|
|
53
|
-
visibility: settings.visibility,
|
|
54
|
-
groupId: settings.groupId ?? undefined,
|
|
55
|
-
audience: settings.visibility === 'direct'
|
|
56
|
-
? includesMe
|
|
57
|
-
? audience
|
|
58
|
-
: [...(audience ?? []), ...(me ? [me] : [])]
|
|
59
|
-
: undefined,
|
|
60
|
-
});
|
|
61
|
-
};
|
|
22
|
+
const { event, eventTimeZone, showEndDate, repeatFreq, repeatEnd, preview, patchEvent, setEvent, setAudience, applyFreq, toggleWeekday, applyRepeatEnd, setRepeatUntil, setRepeatCount, toggleEndDate, setTimeZone, } = useEventForm(postData, onChange);
|
|
62
23
|
return (_jsxs("div", { "data-testid": "events-form-basic-details", children: [_jsx(ImageInput, { usage: "event-header-image", url: event.image, onChange: (image) => patchEvent({ image }), aspectRatio: EVENT_HEADER_ASPECT_RATIO, className: "aspect-video !h-auto", text: t('events.form.imageDescription', {
|
|
63
24
|
defaultValue: 'Upload an image for your event',
|
|
64
25
|
}), specsText: t('events.form.imageSpecs', {
|
|
@@ -69,24 +30,43 @@ export function EventForm({ postData, onChange, isEdit = false, }) {
|
|
|
69
30
|
defaultValue: 'Describe your event',
|
|
70
31
|
}) }), _jsx(ComposePreviewLinks, { content: event.content }), _jsx("h2", { className: "text-lg", children: t('events.form.dateAndTimeTitle', {
|
|
71
32
|
defaultValue: 'Date and Time',
|
|
72
|
-
}) }), _jsx(Label, { title: t('events.form.startDate', { defaultValue: 'Start Date' }), htmlFor: "event-start", children: _jsx(Input, { id: "event-start", type: "datetime-local", step: 60, value: dateToInputValue(event.start), onChange: (e) => {
|
|
73
|
-
const start = toIso(e.target.value);
|
|
33
|
+
}) }), _jsx(Label, { title: t('events.form.startDate', { defaultValue: 'Start Date' }), htmlFor: "event-start", children: _jsx(Input, { id: "event-start", type: "datetime-local", step: 60, value: dateToInputValue(event.start, eventTimeZone), onChange: (e) => {
|
|
34
|
+
const start = toIso(e.target.value, eventTimeZone);
|
|
74
35
|
if (start)
|
|
75
36
|
patchEvent({ start });
|
|
76
37
|
}, "data-testid": "events-start-input" }) }), _jsx(Label, { description: t('events.form.addEndDate', {
|
|
77
38
|
defaultValue: 'Add end date and time',
|
|
78
|
-
}), forCheckbox: true, children: _jsx("input", { type: "checkbox", checked: showEndDate, onChange: (e) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
39
|
+
}), forCheckbox: true, children: _jsx("input", { type: "checkbox", checked: showEndDate, onChange: (e) => toggleEndDate(e.target.checked) }) }), showEndDate ? (_jsx(Label, { title: t('events.form.endDate', { defaultValue: 'End Date' }), htmlFor: "event-end", children: _jsx(Input, { id: "event-end", type: "datetime-local", step: 60, value: dateToInputValue(event.end, eventTimeZone), onChange: (e) => patchEvent({ end: toIso(e.target.value, eventTimeZone) }) }) })) : null, _jsx(Label, { title: t('events.form.timezone', { defaultValue: 'Timezone' }), htmlFor: "event-timezone", children: _jsx("select", { id: "event-timezone", className: "bg-background w-full rounded-md border px-3 py-2 text-sm", value: eventTimeZone, onChange: (e) => setTimeZone(e.target.value), children: TIMEZONES.map((tz) => (_jsx("option", { value: tz, children: tz }, tz))) }) }), !occurrenceEdit ? (_jsxs(_Fragment, { children: [_jsx(Label, { title: t('events.form.repeat.title', { defaultValue: 'Repeat' }), htmlFor: "event-repeat", children: _jsxs("select", { id: "event-repeat", className: "bg-background w-full rounded-md border px-3 py-2 text-sm", value: repeatFreq, onChange: (e) => applyFreq(e.target.value), "data-testid": "events-repeat-input", children: [_jsx("option", { value: "none", children: t('events.form.repeat.none', {
|
|
40
|
+
defaultValue: 'Does not repeat',
|
|
41
|
+
}) }), _jsx("option", { value: "DAILY", children: t('events.form.repeat.daily', { defaultValue: 'Daily' }) }), _jsx("option", { value: "WEEKLY", children: t('events.form.repeat.weekly', { defaultValue: 'Weekly' }) }), _jsx("option", { value: "MONTHLY", children: t('events.form.repeat.monthly', { defaultValue: 'Monthly' }) })] }) }), event.recurrence?.freq === 'WEEKLY' ? (_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm", children: t('events.form.repeat.weekdays', {
|
|
42
|
+
defaultValue: 'Repeat on',
|
|
43
|
+
}) }), _jsx("div", { className: "flex flex-wrap gap-2", children: EVENT_WEEKDAYS.map((day) => {
|
|
44
|
+
const selected = event.recurrence?.byDay?.includes(day);
|
|
45
|
+
return (_jsx("button", { type: "button", className: `rounded-md border px-2 py-1 text-sm ${selected
|
|
46
|
+
? 'bg-primary text-primary-foreground'
|
|
47
|
+
: 'bg-background'}`, onClick: () => toggleWeekday(day), children: t(`events.form.repeat.day.${day}`, {
|
|
48
|
+
defaultValue: day,
|
|
49
|
+
}) }, day));
|
|
50
|
+
}) })] })) : null, event.recurrence ? (_jsxs(_Fragment, { children: [_jsx(Label, { title: t('events.form.repeat.end', {
|
|
51
|
+
defaultValue: 'Ends',
|
|
52
|
+
}), htmlFor: "event-repeat-end", children: _jsxs("select", { id: "event-repeat-end", className: "bg-background w-full rounded-md border px-3 py-2 text-sm", value: repeatEnd, onChange: (e) => applyRepeatEnd(e.target.value), children: [_jsx("option", { value: "never", children: t('events.form.repeat.never', { defaultValue: 'Never' }) }), _jsx("option", { value: "until", children: t('events.form.repeat.onDate', {
|
|
53
|
+
defaultValue: 'On date',
|
|
54
|
+
}) }), _jsx("option", { value: "count", children: t('events.form.repeat.after', {
|
|
55
|
+
defaultValue: 'After a number of events',
|
|
56
|
+
}) })] }) }), repeatEnd === 'until' ? (_jsx(Label, { title: t('events.form.repeat.onDate', {
|
|
57
|
+
defaultValue: 'On date',
|
|
58
|
+
}), htmlFor: "event-repeat-until", children: _jsx(Input, { id: "event-repeat-until", type: "datetime-local", step: 60, value: dateToInputValue(event.recurrence.until, eventTimeZone), onChange: (e) => setRepeatUntil(toIso(e.target.value, eventTimeZone)) }) })) : null, repeatEnd === 'count' ? (_jsx(Label, { title: t('events.form.repeat.count', {
|
|
59
|
+
defaultValue: 'Number of events',
|
|
60
|
+
}), htmlFor: "event-repeat-count", children: _jsx(Input, { id: "event-repeat-count", type: "number", min: 1, value: event.recurrence.count ?? 10, onChange: (e) => setRepeatCount(e.target.value) }) })) : null, preview.length > 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('events.form.repeat.preview', {
|
|
61
|
+
defaultValue: 'Next dates: {{dates}}',
|
|
62
|
+
dates: preview
|
|
63
|
+
.map((occurrence) => new Date(occurrence.start).toLocaleDateString(undefined, {
|
|
64
|
+
weekday: 'short',
|
|
65
|
+
month: 'short',
|
|
66
|
+
day: 'numeric',
|
|
67
|
+
}))
|
|
68
|
+
.join(', '),
|
|
69
|
+
}) })) : null] })) : null] })) : null, _jsx("h2", { className: "text-lg", children: t('events.form.location', { defaultValue: 'Location' }) }), _jsx(EventTypeSwitcher, { event: event, isEdit: isEdit, onChange: setEvent }), _jsx("h2", { className: "text-lg", children: t('events.form.people', { defaultValue: 'People' }) }), _jsx(Label, { title: t('events.form.visibility', { defaultValue: 'Visibility' }), description: t('events.form.visibilityNotChangeable', {
|
|
90
70
|
defaultValue: "Note: The event visibility cannot be changed once the event is published. Make sure you're adding the right people or group.",
|
|
91
71
|
}), children: _jsx(VisibilitySelector, { postData: postData, onClick: () => setAudienceOpen(true), disabled: isEdit, showDirect: true }) }), _jsx(Label, { description: t('events.form.attendeeListPublic', {
|
|
92
72
|
defaultValue: 'Let an attendee see others attending this event',
|
|
@@ -101,4 +81,4 @@ export function EventForm({ postData, onChange, isEdit = false, }) {
|
|
|
101
81
|
} }), event.maxAttendees != null ? (_jsx("button", { type: "button", className: "op-input-group-shim hover:bg-surface/80", title: t('events.form.clearMaxAttendees', {
|
|
102
82
|
defaultValue: 'Remove capacity limit',
|
|
103
83
|
}), onClick: () => patchEvent({ maxAttendees: undefined }), children: _jsx(X, { className: "size-4" }) })) : null] }) })] }), !isEdit ? (_jsx(PostAudienceSelector, { open: audienceOpen, onClose: () => setAudienceOpen(false), type: "event", visibility: postData.visibility, groupId: postData.groupId ?? undefined, audience: postData.audience ?? [], showDirect: true, onConfirm: setAudience })) : null] }));
|
|
104
|
-
}
|
|
84
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Event } from '@openpeepshq/common/types';
|
|
2
|
-
export type EventFormat
|
|
2
|
+
export type { EventFormat } from '../../../hooks/events/useEventTypeSwitcher';
|
|
3
3
|
export interface EventTypeSwitcherProps {
|
|
4
4
|
event: Event;
|
|
5
5
|
isEdit?: boolean;
|
|
@@ -1,40 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
2
|
import { Link, MapPin } from 'lucide-react';
|
|
4
3
|
import { Input, Label } from '@openpeepshq/react-ui';
|
|
5
|
-
import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
|
|
6
4
|
import { useT } from '../../../i18n/index.js';
|
|
7
|
-
import {
|
|
8
|
-
import { useCurrentProfile } from '../../layout/IdentityContext.js';
|
|
5
|
+
import { useEventTypeSwitcher, useLocationSearch, } from '../../../hooks/events/useEventTypeSwitcher.js';
|
|
9
6
|
import { ProfilesInput } from '../../profile/index.js';
|
|
10
7
|
function SimpleLocationInput({ value, onChange, }) {
|
|
11
8
|
const t = useT();
|
|
12
|
-
const {
|
|
13
|
-
const [text, setText] = useState(value?.text ?? '');
|
|
14
|
-
const [suggestions, setSuggestions] = useState([]);
|
|
15
|
-
const debounceRef = useRef(null);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
setText(value?.text ?? '');
|
|
18
|
-
}, [value?.text]);
|
|
19
|
-
const search = (query) => {
|
|
20
|
-
if (debounceRef.current)
|
|
21
|
-
clearTimeout(debounceRef.current);
|
|
22
|
-
if (!query.trim()) {
|
|
23
|
-
setSuggestions([]);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
debounceRef.current = setTimeout(() => {
|
|
27
|
-
void openpeepsApi
|
|
28
|
-
.useGeocode(query.trim())
|
|
29
|
-
.then((result) => {
|
|
30
|
-
const items = Array.isArray(result)
|
|
31
|
-
? result
|
|
32
|
-
: (result.data ?? []);
|
|
33
|
-
setSuggestions(items);
|
|
34
|
-
})
|
|
35
|
-
.catch(() => setSuggestions([]));
|
|
36
|
-
}, 500);
|
|
37
|
-
};
|
|
9
|
+
const { text, setText, suggestions, clearSuggestions, search } = useLocationSearch(value);
|
|
38
10
|
return (_jsxs("div", { className: "relative space-y-1", children: [_jsx(Label, { children: t('events.form.location', { defaultValue: 'Location' }) }), _jsxs("div", { className: "relative", children: [_jsx(MapPin, { className: "text-muted-foreground absolute left-3 top-2.5 size-4" }), _jsx(Input, { className: "pl-9", value: text, placeholder: t('events.form.locationPlaceholder', {
|
|
39
11
|
defaultValue: 'Search for a place…',
|
|
40
12
|
}), onChange: (e) => {
|
|
@@ -47,119 +19,28 @@ function SimpleLocationInput({ value, onChange, }) {
|
|
|
47
19
|
text: item.name,
|
|
48
20
|
coordinates: item.center,
|
|
49
21
|
});
|
|
50
|
-
|
|
22
|
+
clearSuggestions();
|
|
51
23
|
}, children: item.name }, `${item.name}-${item.center.lat}-${item.center.lng}`))) })) : null] }));
|
|
52
24
|
}
|
|
53
25
|
export function EventTypeSwitcher({ event, isEdit = false, onChange, }) {
|
|
54
26
|
const t = useT();
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
? 'in-person'
|
|
63
|
-
: 'external';
|
|
64
|
-
const [eventFormat, setEventFormat] = useState(initialFormat);
|
|
65
|
-
const formats = useMemo(() => {
|
|
66
|
-
const items = [];
|
|
67
|
-
if (serverInfo.jams.livekit.enabled) {
|
|
68
|
-
items.push({
|
|
69
|
-
value: 'jam',
|
|
70
|
-
label: t('events.form.jamFormatLabel', { defaultValue: 'Jam session' }),
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
items.push({
|
|
74
|
-
value: 'external',
|
|
75
|
-
label: t('events.form.externalFormatLabel', {
|
|
76
|
-
defaultValue: 'External link',
|
|
77
|
-
}),
|
|
78
|
-
}, {
|
|
79
|
-
value: 'in-person',
|
|
80
|
-
label: t('events.form.inPersonFormatLabel', {
|
|
81
|
-
defaultValue: 'In person',
|
|
82
|
-
}),
|
|
83
|
-
});
|
|
84
|
-
return items;
|
|
85
|
-
}, [serverInfo.jams.livekit.enabled, t]);
|
|
86
|
-
const switchFormat = (value) => {
|
|
87
|
-
if (eventFormat === value)
|
|
88
|
-
return;
|
|
89
|
-
setEventFormat(value);
|
|
90
|
-
const origin = typeof window !== 'undefined' ? window.location.origin : '';
|
|
91
|
-
if (value === 'jam') {
|
|
92
|
-
onChange({
|
|
93
|
-
...event,
|
|
94
|
-
jam: {
|
|
95
|
-
type: 'video-call',
|
|
96
|
-
moderators: me?.id ? [me.id] : [],
|
|
97
|
-
videoEnabled: true,
|
|
98
|
-
speakers: [],
|
|
99
|
-
presenters: [],
|
|
100
|
-
waitingRoom: event.jam?.waitingRoom ?? false,
|
|
101
|
-
},
|
|
102
|
-
physicalLocation: undefined,
|
|
103
|
-
url: origin,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
else if (value === 'external') {
|
|
107
|
-
onChange({
|
|
108
|
-
...event,
|
|
109
|
-
jam: undefined,
|
|
110
|
-
physicalLocation: undefined,
|
|
111
|
-
url: event.url ?? '',
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
onChange({
|
|
116
|
-
...event,
|
|
117
|
-
jam: undefined,
|
|
118
|
-
physicalLocation: event.physicalLocation ?? { text: '' },
|
|
119
|
-
url: undefined,
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
const moderatorProfiles = useMemo(() => {
|
|
124
|
-
const ids = event.jam?.moderators ?? [];
|
|
125
|
-
const all = profilesQuery.data ?? [];
|
|
126
|
-
return ids
|
|
127
|
-
.map((id) => all.find((p) => p.id === id))
|
|
128
|
-
.filter((p) => Boolean(p));
|
|
129
|
-
}, [event.jam?.moderators, profilesQuery.data]);
|
|
130
|
-
const handleModeratorsChange = (profiles) => {
|
|
131
|
-
if (!event.jam)
|
|
132
|
-
return;
|
|
133
|
-
onChange({
|
|
134
|
-
...event,
|
|
135
|
-
jam: { ...event.jam, moderators: profiles.map((p) => p.id) },
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
useEffect(() => {
|
|
139
|
-
if (!isEdit &&
|
|
140
|
-
eventFormat === 'jam' &&
|
|
141
|
-
event.jam &&
|
|
142
|
-
event.jam.moderators.length === 0 &&
|
|
143
|
-
me?.id) {
|
|
144
|
-
onChange({
|
|
145
|
-
...event,
|
|
146
|
-
jam: { ...event.jam, moderators: [me.id] },
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}, [isEdit, eventFormat, me?.id]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
150
|
-
return (_jsxs("div", { className: "space-y-3", children: [_jsx(Label, { title: t('events.form.eventFormat', { defaultValue: 'Event format' }), children: _jsx("div", { className: "mt-2 flex flex-col gap-2", children: formats.map((format) => (_jsxs("label", { className: "flex w-fit items-center gap-2", children: [_jsx("input", { type: "radio", name: "eventFormat", checked: eventFormat === format.value, onChange: () => switchFormat(format.value) }), _jsx("span", { children: format.label })] }, format.value))) }) }), eventFormat === 'in-person' ? (_jsx(SimpleLocationInput, { value: event.physicalLocation, onChange: (physicalLocation) => onChange({ ...event, physicalLocation }) })) : null, eventFormat === 'external' ? (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "event-url", children: t('events.form.externalFormatLabel', {
|
|
27
|
+
const { eventFormat, formats, livekitEnabled, switchFormat, moderatorProfiles, setModerators, setWaitingRoom, setUrl, setPhysicalLocation, } = useEventTypeSwitcher({
|
|
28
|
+
event,
|
|
29
|
+
isEdit,
|
|
30
|
+
onChange,
|
|
31
|
+
origin: typeof window !== 'undefined' ? window.location.origin : '',
|
|
32
|
+
});
|
|
33
|
+
return (_jsxs("div", { className: "space-y-3", children: [_jsx(Label, { title: t('events.form.eventFormat', { defaultValue: 'Event format' }), children: _jsx("div", { className: "mt-2 flex flex-col gap-2", children: formats.map((format) => (_jsxs("label", { className: "flex w-fit items-center gap-2", children: [_jsx("input", { type: "radio", name: "eventFormat", checked: eventFormat === format.value, disabled: format.value === 'jam' && !livekitEnabled, onChange: () => switchFormat(format.value) }), _jsx("span", { children: format.label })] }, format.value))) }) }), eventFormat === 'in-person' ? (_jsx(SimpleLocationInput, { value: event.physicalLocation, onChange: setPhysicalLocation })) : null, eventFormat === 'external' ? (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "event-url", children: t('events.form.externalFormatLabel', {
|
|
151
34
|
defaultValue: 'External link',
|
|
152
35
|
}) }), _jsxs("div", { className: "relative", children: [_jsx(Link, { className: "text-muted-foreground absolute left-3 top-2.5 size-4" }), _jsx(Input, { id: "event-url", className: "pl-9", value: event.url ?? '', placeholder: t('events.form.externalEventUrlPlaceholder', {
|
|
153
36
|
defaultValue: 'https://…',
|
|
154
|
-
}), onChange: (e) =>
|
|
37
|
+
}), onChange: (e) => setUrl(e.target.value) })] })] })) : null, eventFormat === 'jam' ? (_jsxs(_Fragment, { children: [!livekitEnabled ? (_jsx("p", { role: "status", className: "text-destructive text-sm", children: t('jams.unavailable.message', {
|
|
38
|
+
defaultValue: 'Jams are unavailable because LiveKit is not connected.',
|
|
39
|
+
}) })) : null, _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: t('events.form.jamModerators', {
|
|
155
40
|
defaultValue: 'Jam moderators',
|
|
156
|
-
}) }), _jsx(ProfilesInput, { value: moderatorProfiles, onChange:
|
|
41
|
+
}) }), _jsx(ProfilesInput, { value: moderatorProfiles, onChange: setModerators, disabled: !livekitEnabled, placeholder: t('events.form.jamModeratorsDescription', {
|
|
157
42
|
defaultValue: 'Click to select jam moderators',
|
|
158
|
-
}) })] }), _jsxs("label", { className: "flex items-center gap-2", children: [_jsx("input", { type: "checkbox", checked: event.jam?.waitingRoom ?? false, onChange: (e) =>
|
|
159
|
-
onChange({
|
|
160
|
-
...event,
|
|
161
|
-
jam: { ...event.jam, waitingRoom: e.target.checked },
|
|
162
|
-
}) }), _jsx("span", { className: "text-sm", children: t('events.form.jamWaitingRoom', {
|
|
43
|
+
}) })] }), _jsxs("label", { className: "flex items-center gap-2", children: [_jsx("input", { type: "checkbox", checked: event.jam?.waitingRoom ?? false, disabled: !livekitEnabled, onChange: (e) => setWaitingRoom(e.target.checked) }), _jsx("span", { className: "text-sm", children: t('events.form.jamWaitingRoom', {
|
|
163
44
|
defaultValue: 'Enable waiting room',
|
|
164
45
|
}) })] })] })) : null] }));
|
|
165
46
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { ChevronDown, Image, Megaphone, Paperclip } from 'lucide-react';
|
|
4
|
-
import { checkRoleCapabilities, resolvePollOptionContents, } from '@openpeepshq/common';
|
|
5
|
-
import { Dialog, DialogContent, DialogHeader, DialogTitle,
|
|
3
|
+
import { AudioLines, ChevronDown, Image, Megaphone, Paperclip, } from 'lucide-react';
|
|
4
|
+
import { checkRoleCapabilities, pollOptionsWithinLimit, resolvePollOptionContents, } from '@openpeepshq/common';
|
|
5
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
6
6
|
import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
|
|
7
7
|
import { useT } from '../../../i18n/index.js';
|
|
8
8
|
import { useServerInfo } from '../../server-data/index.js';
|
|
@@ -144,6 +144,8 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
|
|
|
144
144
|
}, [serverInfo.publicContent, visibility]);
|
|
145
145
|
const trimmedContent = content.trim();
|
|
146
146
|
const resolvedPollOptions = resolvePollOptionContents(pollOptions, (index) => pollOptionLabel(index, t));
|
|
147
|
+
const pollOptionsValid = resolvedPollOptions.length >= 2 &&
|
|
148
|
+
pollOptionsWithinLimit(resolvedPollOptions);
|
|
147
149
|
// Mirrors the Svelte `isPostFormSubmittable`: block while uploading, and
|
|
148
150
|
// require enough content for the active composer type.
|
|
149
151
|
const canSubmit = useMemo(() => {
|
|
@@ -154,7 +156,7 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
|
|
|
154
156
|
if (visibility === 'group' && !group?.id && !groupId)
|
|
155
157
|
return false;
|
|
156
158
|
if (composerType === 'question') {
|
|
157
|
-
return trimmedContent.length > 0 &&
|
|
159
|
+
return trimmedContent.length > 0 && pollOptionsValid;
|
|
158
160
|
}
|
|
159
161
|
return ((trimmedContent.length > 0 && trimmedContent.length <= 500) ||
|
|
160
162
|
attachments.length > 0);
|
|
@@ -167,7 +169,7 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
|
|
|
167
169
|
groupId,
|
|
168
170
|
composerType,
|
|
169
171
|
trimmedContent,
|
|
170
|
-
|
|
172
|
+
pollOptionsValid,
|
|
171
173
|
attachments.length,
|
|
172
174
|
]);
|
|
173
175
|
const publish = async () => {
|
|
@@ -233,8 +235,10 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
|
|
|
233
235
|
defaultValue: 'Post created successfully',
|
|
234
236
|
}),
|
|
235
237
|
});
|
|
238
|
+
onClose();
|
|
236
239
|
}
|
|
237
240
|
catch {
|
|
241
|
+
// Keep the modal open on failure so the draft stays visible and editable.
|
|
238
242
|
onToast({
|
|
239
243
|
type: 'error',
|
|
240
244
|
message: t('posts.create.errorGeneric', {
|
|
@@ -244,7 +248,6 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
|
|
|
244
248
|
}
|
|
245
249
|
finally {
|
|
246
250
|
setSubmitting(false);
|
|
247
|
-
onClose();
|
|
248
251
|
}
|
|
249
252
|
};
|
|
250
253
|
const showNotify = canNotify && (visibility === 'public' || visibility === 'local');
|
|
@@ -258,11 +261,13 @@ export function NewPostModal({ visibility: initialVisibility, group, initialCont
|
|
|
258
261
|
defaultValue: 'What is on your mind?',
|
|
259
262
|
}) }), _jsx(ComposePreviewLinks, { content: content }), composerType === 'note' ? composeAttachments.previews : null, composerType === 'question' ? (_jsx(PollComposerFields, { options: pollOptions, onOptionsChange: setPollOptions, expiresAt: expiresAt, onExpiresAtChange: setExpiresAt, multiple: multiple, onMultipleChange: setMultiple, votersVisible: votersVisible, onVotersVisibleChange: setVotersVisible })) : null, showNotify ? (_jsxs("div", { className: "flex w-full items-center justify-between py-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Megaphone, { className: "size-5" }), _jsx("p", { className: "text-base", children: t('posts.form.notifyEveryone', {
|
|
260
263
|
defaultValue: 'Notify everyone',
|
|
261
|
-
}) })] }), _jsx("button", { type: "button", role: "switch", "aria-checked": notify, onClick: () => setNotify((v) => !v), className: `relative h-5 w-9 rounded-full transition ${notify ? 'bg-primary' : 'bg-input'}`, children: _jsx("span", { className: `absolute top-0.5 size-4 rounded-full bg-white transition ${notify ? 'left-4' : 'left-0.5'}` }) })] })) : null] }), _jsxs(
|
|
264
|
+
}) })] }), _jsx("button", { type: "button", role: "switch", "aria-checked": notify, onClick: () => setNotify((v) => !v), className: `relative h-5 w-9 rounded-full transition ${notify ? 'bg-primary' : 'bg-input'}`, children: _jsx("span", { className: `absolute top-0.5 size-4 rounded-full bg-white transition ${notify ? 'left-4' : 'left-0.5'}` }) })] })) : null] }), _jsxs(DialogFooter, { className: "flex-col items-stretch gap-0 border-t-0 px-6 py-4 sm:flex-col", children: [_jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-x-2", children: [_jsx("button", { type: "button", title: t('posts.form.addImage', {
|
|
262
265
|
defaultValue: 'Add Media',
|
|
263
|
-
}), onClick: composeAttachments.openImagePicker, className: "hover:bg-surface rounded-button p-2", children: _jsx(Image, { className: "size-5" }) }), _jsx("button", { type: "button", title: t('posts.form.
|
|
266
|
+
}), onClick: composeAttachments.openImagePicker, className: "hover:bg-surface rounded-button p-2", children: _jsx(Image, { className: "size-5" }) }), _jsx("button", { type: "button", title: t('posts.form.addAudio', {
|
|
267
|
+
defaultValue: 'Add audio',
|
|
268
|
+
}), onClick: composeAttachments.openAudioPicker, className: "hover:bg-surface rounded-button p-2", children: _jsx(AudioLines, { className: "size-5" }) }), _jsx("button", { type: "button", title: t('posts.form.addDocument', {
|
|
264
269
|
defaultValue: 'Add Document',
|
|
265
|
-
}), onClick: composeAttachments.openDocumentPicker, className: "hover:bg-surface rounded-button p-2", children: _jsx(Paperclip, { className: "size-5" }) })] }), _jsx(PostTypeSwitcher, { type: composerType, onSelect: selectComposerType, onClose: onClose })] }), _jsx("div", { className: "border-border-2 my-2 w-full border-t" }), _jsx("div", { className: "flex items-center justify-end gap-x-2", children: _jsx(Button, { variant: "default", action: publish, disabled: !canSubmit, "data-testid": "posts-composer-publish", children: submitting
|
|
270
|
+
}), onClick: composeAttachments.openDocumentPicker, className: "hover:bg-surface rounded-button p-2", children: _jsx(Paperclip, { className: "size-5" }) })] }), _jsx(PostTypeSwitcher, { type: composerType, onSelect: selectComposerType, onClose: onClose, visibility: group ? 'group' : visibility, groupId: group?.id ?? groupId })] }), _jsx("div", { className: "border-border-2 my-2 w-full border-t" }), _jsx("div", { className: "flex items-center justify-end gap-x-2", children: _jsx(Button, { variant: "default", action: publish, disabled: !canSubmit, "data-testid": "posts-composer-publish", children: submitting
|
|
266
271
|
? t('common.posting', { defaultValue: 'Posting…' })
|
|
267
272
|
: t('posts.create.submit', { defaultValue: 'Post' }) }) })] })] }) }), composeAttachments.inputs, !group ? (_jsx(PostAudienceSelector, { open: audienceOpen, onClose: () => setAudienceOpen(false), type: composerType, visibility: visibility, groupId: groupId, audience: audience, onConfirm: (settings) => {
|
|
268
273
|
setVisibility(settings.visibility);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useCallback, useContext, useState, } from 'react';
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo, useState, } from 'react';
|
|
3
3
|
import { useToast } from '../../layout/ToastProvider.js';
|
|
4
4
|
import { NewPostModal } from './NewPostModal.js';
|
|
5
5
|
const NewPostModalContext = createContext(null);
|
|
@@ -9,7 +9,11 @@ export function NewPostModalProvider({ children }) {
|
|
|
9
9
|
const openNewPost = useCallback((opts) => {
|
|
10
10
|
setOptions(opts ?? {});
|
|
11
11
|
}, []);
|
|
12
|
-
|
|
12
|
+
// Header updates re-render this provider. A fresh value object would
|
|
13
|
+
// re-render every consumer, including pages that write the header from
|
|
14
|
+
// a layout effect (hashtag follow button) and loop (React error 185).
|
|
15
|
+
const value = useMemo(() => ({ openNewPost }), [openNewPost]);
|
|
16
|
+
return (_jsxs(NewPostModalContext.Provider, { value: value, children: [children, options !== undefined ? (_jsx(NewPostModal, { visibility: options.visibility, group: options.group, initialContent: options.initialContent, onClose: () => setOptions(undefined), onToast: ({ type, message }) => type === 'error' ? error(message) : toast(message) })) : null] }));
|
|
13
17
|
}
|
|
14
18
|
export function useNewPostModal() {
|
|
15
19
|
const ctx = useContext(NewPostModalContext);
|
|
@@ -52,7 +52,7 @@ export function OpenpeepsMarkdownInput({ value, onChange, maxLength = 500, place
|
|
|
52
52
|
setQuery('');
|
|
53
53
|
};
|
|
54
54
|
const overLimit = value.length > maxLength;
|
|
55
|
-
return (_jsxs("div", { className: "relative w-full", children: [showPreview ? (_jsxs("div", { className: "bg-background border-border absolute inset-0 z-10 overflow-y-auto rounded-md border p-4 pt-16", children: [_jsx(Button, { compact: true, variant: "outline", className: "absolute left-2 top-2", action: () => setShowPreview(false), children: t('form.edit', { defaultValue: 'Back to Editing' }) }), _jsx(OpenpeepsMarkdown, { source: value, linkPreviewMode: "none" })] })) : null,
|
|
55
|
+
return (_jsxs("div", { className: "relative w-full", children: [showPreview ? (_jsxs("div", { className: "bg-background border-border absolute inset-0 z-10 overflow-y-auto rounded-md border p-4 pt-16", children: [_jsx(Button, { compact: true, variant: "outline", className: "absolute left-2 top-2", action: () => setShowPreview(false), children: t('form.edit', { defaultValue: 'Back to Editing' }) }), _jsx(OpenpeepsMarkdown, { source: value, linkPreviewMode: "none" })] })) : null, _jsxs("div", { className: "flex w-full items-center gap-3 pb-2", children: [previewButton ? (_jsx(Button, { compact: true, variant: "outline", action: () => setShowPreview(true), children: t('form.preview', { defaultValue: 'Preview' }) })) : null, _jsx("a", { href: "/docs/user/markdown", target: "_blank", rel: "noopener noreferrer", className: "op-anchor text-sm", children: t('form.markdownHelp', { defaultValue: 'Formatting help' }) })] }), _jsxs(Popover, { open: showMentions, modal: false, children: [_jsx(PopoverAnchor, { asChild: true, children: _jsx("div", { ref: anchorRef, className: "w-full", children: _jsx(Textarea, { ref: textareaRef, rows: rows, value: value, maxLength: maxLength, placeholder: placeholder ?? t('posts.form.content'), onChange: (e) => handleChange(e.target.value), "data-testid": testId, className: cn('resize-y', className) }) }) }), _jsx(PopoverContent, { align: "start", side: "bottom", sideOffset: 4, onOpenAutoFocus: (e) => e.preventDefault(), onCloseAutoFocus: (e) => e.preventDefault(),
|
|
56
56
|
// Keep the list open while the user keeps typing in the anchored field.
|
|
57
57
|
onPointerDownOutside: (e) => {
|
|
58
58
|
if (anchorRef.current?.contains(e.target)) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { POLL_OPTION_MAX_LENGTH } from '@openpeepshq/common';
|
|
2
3
|
import { Button, Input, Label } from '@openpeepshq/react-ui';
|
|
3
4
|
import { useT } from '../../../i18n/index.js';
|
|
4
5
|
export const pollOptionLabel = (index, t) => t('posts.form.poll.option', {
|
|
@@ -10,11 +11,12 @@ export function PollComposerFields({ options, onOptionsChange, expiresAt, onExpi
|
|
|
10
11
|
const t = useT();
|
|
11
12
|
return (_jsxs("div", { className: "space-y-2", children: [options.map((opt, index) => {
|
|
12
13
|
const label = pollOptionLabel(index, t);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const overLimit = opt.trim().length > POLL_OPTION_MAX_LENGTH;
|
|
15
|
+
return (_jsxs(Label, { title: label, htmlFor: `poll-option-${index + 1}`, children: [_jsx(Input, { id: `poll-option-${index + 1}`, value: opt, maxLength: POLL_OPTION_MAX_LENGTH, placeholder: label, "data-testid": `posts-poll-option-${index + 1}`, onChange: (e) => {
|
|
16
|
+
const next = [...options];
|
|
17
|
+
next[index] = e.target.value;
|
|
18
|
+
onOptionsChange(next);
|
|
19
|
+
} }), _jsxs("span", { className: "text-muted-foreground w-full px-2 text-right text-sm", children: [_jsx("span", { className: overLimit ? 'text-error' : undefined, children: opt.length }), ' ', "/ ", POLL_OPTION_MAX_LENGTH] })] }, index));
|
|
18
20
|
}), options.length < 6 ? (_jsx(Button, { variant: "ghost", action: () => onOptionsChange([...options, '']), children: t('posts.form.poll.addOption', { defaultValue: 'Add option' }) })) : null, _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "poll-expires", children: t('posts.form.poll.expiresAt', { defaultValue: 'Expires at' }) }), _jsx(Input, { id: "poll-expires", type: "datetime-local", value: expiresAt, onChange: (e) => onExpiresAtChange(e.target.value) })] }), onMultipleChange ? (_jsxs("label", { className: "flex items-start gap-2 text-sm", children: [_jsx("input", { type: "checkbox", checked: multiple, onChange: (e) => onMultipleChange(e.target.checked) }), _jsx("span", { children: t('posts.form.poll.multipleAnswers', {
|
|
19
21
|
defaultValue: 'Allow multiple answers',
|
|
20
22
|
}) })] })) : null, onVotersVisibleChange ? (_jsxs("label", { className: "flex items-start gap-2 text-sm", children: [_jsx("input", { type: "checkbox", checked: votersVisible, onChange: (e) => onVotersVisibleChange(e.target.checked) }), _jsx("span", { children: t('posts.form.poll.seeWhoVotedTitle', {
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { CheckCircle } from 'lucide-react';
|
|
4
4
|
import { checkGroupCapabilities } from '@openpeepshq/common/lib';
|
|
5
|
-
import {
|
|
5
|
+
import { Dialog, DialogActions, DialogContent, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
6
6
|
import { useT } from '../../../i18n/index.js';
|
|
7
7
|
import { useAuthData, useCurrentProfile } from '../../layout/IdentityContext.js';
|
|
8
8
|
import { useServerInfo } from '../../server-data/index.js';
|
|
@@ -71,7 +71,9 @@ export const PostAudienceSelector = ({ open, onClose, type = 'note', visibility,
|
|
|
71
71
|
return (_jsxs("button", { type: "button", "aria-pressed": draftVisibility === choice.value, className: `hover:bg-surface rounded-button flex w-full items-start gap-3 border p-3 text-left ${draftVisibility === choice.value ? 'border-primary' : ''}`, onClick: () => selectVisibility(choice.value), children: [_jsx("span", { className: "bg-surface flex size-10 shrink-0 items-center justify-center rounded-full", children: _jsx(Icon, { className: "size-5" }) }), _jsxs("span", { className: "flex-1", children: [_jsx("span", { className: "block font-medium", children: choice.title }), _jsx("span", { className: "text-muted-foreground block text-sm", children: choice.description }), choice.value === 'group' && draftGroupId ? (_jsx("span", { className: "text-primary mt-1 block text-xs", children: groups.find((g) => g.id === draftGroupId)
|
|
72
72
|
?.displayName ??
|
|
73
73
|
groups.find((g) => g.id === draftGroupId)?.handle })) : null, choice.value === 'direct' && draftAudience.length ? (_jsx("span", { className: "mt-1 flex flex-wrap gap-1", children: draftAudience.map((profile) => (_jsx(ProfileBadge, { profile: profile, onRemove: () => setDraftAudience((current) => current.filter((p) => p.id !== profile.id)) }, profile.id))) })) : null] })] }, choice.value));
|
|
74
|
-
}) })),
|
|
74
|
+
}) })), _jsx(DialogActions, { cancelLabel: view !== 'main'
|
|
75
|
+
? t('navigation.back', { defaultValue: 'Back' })
|
|
76
|
+
: t('common.cancel', { defaultValue: 'Cancel' }), onCancel: view !== 'main' ? () => setView('main') : onClose, actionLabel: t('common.done', { defaultValue: 'Done' }), onAction: confirm })] }) }), _jsx(ProfileSelector, { open: open && view === 'audience', onOpenChange: (next) => {
|
|
75
77
|
if (!next)
|
|
76
78
|
setView('main');
|
|
77
79
|
}, mode: "multiple", selectedProfiles: draftAudience, banlist: me ? [me] : [], onConfirm: (profiles) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PostType } from '@openpeepshq/common/types';
|
|
1
|
+
import type { PostType, VisibilityType } from '@openpeepshq/common/types';
|
|
2
2
|
export interface PostTypeSwitcherProps {
|
|
3
3
|
type: PostType;
|
|
4
4
|
/** Switch the in-modal composer between the note and poll forms. */
|
|
@@ -7,10 +7,13 @@ export interface PostTypeSwitcherProps {
|
|
|
7
7
|
onClose: () => void;
|
|
8
8
|
showEventType?: boolean;
|
|
9
9
|
showArticleType?: boolean;
|
|
10
|
+
/** Current composer audience, carried into article/event pages. */
|
|
11
|
+
visibility?: VisibilityType;
|
|
12
|
+
groupId?: string;
|
|
10
13
|
}
|
|
11
14
|
/**
|
|
12
15
|
* Icon switcher mirroring the Svelte `PostTypeSwitcher`. Note and poll swap the
|
|
13
16
|
* in-modal form; event and article navigate to their dedicated pages (events
|
|
14
17
|
* are gated to community owners, matching the Svelte role check).
|
|
15
18
|
*/
|
|
16
|
-
export declare function PostTypeSwitcher({ type, onSelect, onClose, showEventType, showArticleType, }: PostTypeSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function PostTypeSwitcher({ type, onSelect, onClose, showEventType, showArticleType, visibility, groupId, }: PostTypeSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,18 +3,36 @@ import { CalendarDays, ChartColumnBig, Notebook, ScrollText, } from 'lucide-reac
|
|
|
3
3
|
import { Button } from '@openpeepshq/react-ui';
|
|
4
4
|
import { useT } from '../../../i18n/index.js';
|
|
5
5
|
import { useNavigate } from '../../../contexts/router/index.js';
|
|
6
|
+
import { getNewPostStores } from '../../../stores/newPosts.js';
|
|
6
7
|
import { useCurrentProfile } from '../../layout/IdentityContext.js';
|
|
7
8
|
/**
|
|
8
9
|
* Icon switcher mirroring the Svelte `PostTypeSwitcher`. Note and poll swap the
|
|
9
10
|
* in-modal form; event and article navigate to their dedicated pages (events
|
|
10
11
|
* are gated to community owners, matching the Svelte role check).
|
|
11
12
|
*/
|
|
12
|
-
export function PostTypeSwitcher({ type, onSelect, onClose, showEventType = true, showArticleType = true, }) {
|
|
13
|
+
export function PostTypeSwitcher({ type, onSelect, onClose, showEventType = true, showArticleType = true, visibility, groupId, }) {
|
|
13
14
|
const t = useT();
|
|
14
15
|
const navigate = useNavigate();
|
|
15
16
|
const me = useCurrentProfile();
|
|
16
17
|
const isOwner = Boolean(me?.roles?.some((role) => role.key === 'owner'));
|
|
17
18
|
const goto = (path) => {
|
|
19
|
+
const stores = getNewPostStores();
|
|
20
|
+
if (path === '/articles/new') {
|
|
21
|
+
stores.article = {
|
|
22
|
+
...stores.article,
|
|
23
|
+
type: 'article',
|
|
24
|
+
visibility: visibility ?? stores.article.visibility,
|
|
25
|
+
groupId,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
stores.event = {
|
|
30
|
+
...stores.event,
|
|
31
|
+
type: 'event',
|
|
32
|
+
visibility: visibility ?? stores.event.visibility,
|
|
33
|
+
groupId,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
18
36
|
onClose();
|
|
19
37
|
navigate(path);
|
|
20
38
|
};
|