@openpeepshq/react 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accounts/SignUpLoginModal.js +2 -2
- package/dist/components/configuration/ConfigMenuButton.d.ts +10 -0
- package/dist/components/configuration/ConfigMenuButton.js +12 -0
- package/dist/components/configuration/ConfigurationTree.js +1 -1
- package/dist/components/configuration/index.d.ts +2 -0
- package/dist/components/configuration/index.js +1 -0
- package/dist/components/conversations/ConversationMessageBubble.d.ts +2 -1
- package/dist/components/conversations/ConversationMessageBubble.js +4 -5
- package/dist/components/conversations/CreateNewConversation.js +10 -42
- package/dist/components/conversations/DirectMessagesHeaderActions.js +1 -1
- package/dist/components/conversations/MessageInThread.js +1 -2
- package/dist/components/form/ImageEditModal.js +2 -4
- package/dist/components/form/ImageInput.js +13 -8
- package/dist/components/form/LocationInput.js +1 -1
- package/dist/components/groups/AddGroupMembersButton.d.ts +1 -1
- package/dist/components/groups/AddGroupMembersButton.js +2 -2
- package/dist/components/groups/ChangeGroupRolesModal.js +1 -1
- package/dist/components/groups/ConfirmGroupExitModal.js +2 -2
- package/dist/components/groups/ConfirmMemberRemovalModal.js +1 -1
- package/dist/components/groups/DeleteGroupModal.js +1 -1
- package/dist/components/groups/GroupAvatar.js +4 -4
- package/dist/components/groups/GroupCard.js +3 -3
- package/dist/components/groups/GroupHeader.js +1 -1
- package/dist/components/groups/GroupMembersList.js +2 -3
- package/dist/components/groups/GroupOptionsMenu.js +12 -6
- package/dist/components/groups/JoinGroupButton.js +3 -20
- package/dist/components/jams/CreateNewJam.js +4 -4
- package/dist/components/jams/JamCallParticipant.js +17 -7
- package/dist/components/jams/JamCapacityGate.js +1 -1
- package/dist/components/jams/JamChatDrawer.js +2 -2
- package/dist/components/jams/JamConference.js +1 -1
- package/dist/components/jams/JamContext.d.ts +4 -0
- package/dist/components/jams/JamContext.js +17 -2
- package/dist/components/jams/JamDetailsDrawer.js +1 -1
- package/dist/components/jams/JamDeviceSelectors.d.ts +15 -0
- package/dist/components/jams/JamDeviceSelectors.js +4 -3
- package/dist/components/jams/JamFooter.js +15 -16
- package/dist/components/jams/JamGuestForm.js +2 -2
- package/dist/components/jams/JamLobby.js +9 -19
- package/dist/components/jams/JamObserverShell.js +1 -1
- package/dist/components/jams/JamParticipantConference.js +1 -1
- package/dist/components/jams/JamPeopleDrawer.js +17 -13
- package/dist/components/jams/JamReactionMenu.js +1 -1
- package/dist/components/jams/JamRequestJoin.js +1 -1
- package/dist/components/jams/JamRoom.js +84 -4
- package/dist/components/jams/JamToolbarButton.d.ts +21 -0
- package/dist/components/jams/JamToolbarButton.js +19 -0
- package/dist/components/jams/JamVideoCall.js +8 -3
- package/dist/components/jams/JamVideoLayout.js +16 -5
- package/dist/components/jams/LeaveCloseButton.js +9 -44
- package/dist/components/jams/LiveJamsSection.js +1 -1
- package/dist/components/jams/constants.js +4 -0
- package/dist/components/jams/useParticipantConnection.d.ts +7 -0
- package/dist/components/jams/useParticipantConnection.js +11 -0
- package/dist/components/layout/Auth.js +1 -1
- package/dist/components/layout/Infos.js +2 -2
- package/dist/components/layout/OpenpeepsContextProvider.js +4 -3
- package/dist/components/layout/OpenpeepsThemeProvider.d.ts +3 -4
- package/dist/components/layout/OpenpeepsThemeProvider.js +23 -9
- package/dist/components/layout/Root.js +1 -1
- package/dist/components/markdown/CompiledMarkdown.js +15 -1
- package/dist/components/markdown/classes.d.ts +2 -0
- package/dist/components/markdown/classes.js +2 -0
- package/dist/components/markdown/index.d.ts +1 -1
- package/dist/components/markdown/index.js +1 -1
- package/dist/components/navigation/ContentHeader.js +1 -1
- package/dist/components/navigation/FooterMobile.js +5 -1
- package/dist/components/navigation/HeaderMobile.js +1 -1
- package/dist/components/navigation/MobileMenuItem.js +1 -1
- package/dist/components/navigation/PageHeaderAction.js +1 -1
- package/dist/components/navigation/PlusButton.js +1 -1
- package/dist/components/navigation/SideBar.js +6 -1
- package/dist/components/navigation/breadcrumbs/Breadcrumbs.js +5 -1
- package/dist/components/navigation/sideBarNavLinkClass.js +1 -1
- package/dist/components/notifications/NotificationHeaderActions.js +2 -2
- package/dist/components/notifications/NotificationWrapper.js +1 -1
- package/dist/components/notifications/NotificationsList.js +3 -3
- package/dist/components/notifications/TypedNotification.js +3 -3
- package/dist/components/post/Feed.js +3 -3
- package/dist/components/post/FeedPost.d.ts +2 -1
- package/dist/components/post/FeedPost.js +11 -6
- package/dist/components/post/FeedPostContent.js +1 -1
- package/dist/components/post/FullPostLayout.js +11 -4
- package/dist/components/post/NewEventButton.js +1 -1
- package/dist/components/post/NewNoteButton.js +1 -1
- package/dist/components/post/PinnedPost.js +1 -1
- package/dist/components/post/ReplyBox.js +1 -1
- package/dist/components/post/feed/events/EventsFeed.js +3 -3
- package/dist/components/post/feed/threaded/ThreadPost.js +1 -1
- package/dist/components/post/feed/threaded/ThreadedFeed.d.ts +3 -1
- package/dist/components/post/feed/threaded/ThreadedFeed.js +3 -3
- package/dist/components/post/pieces/Attachments.js +3 -3
- package/dist/components/post/pieces/EventMenu.js +1 -1
- package/dist/components/post/pieces/EventRsvpButton.js +3 -3
- package/dist/components/post/pieces/FeedPostStats.js +2 -2
- package/dist/components/post/pieces/GalleryModal.js +36 -5
- package/dist/components/post/pieces/PollContent.js +33 -14
- package/dist/components/post/pieces/PostActions.js +6 -45
- package/dist/components/post/pieces/PostInfoHeader.js +1 -1
- package/dist/components/post/pieces/PostMenu.js +35 -9
- package/dist/components/post/pieces/PostReactionHeader.js +1 -1
- package/dist/components/post/pieces/ShareMenu.js +4 -2
- package/dist/components/post/pieces/UnreadPostIndicator.d.ts +5 -3
- package/dist/components/post/pieces/UnreadPostIndicator.js +4 -3
- package/dist/components/post/pieces/modals/DeletePostModal.js +1 -1
- package/dist/components/post/pieces/modals/RepostModal.d.ts +5 -3
- package/dist/components/post/pieces/modals/RepostModal.js +8 -7
- package/dist/components/post/post-form/AttachmentCard.js +2 -2
- package/dist/components/post/post-form/ComposeAttachments.js +1 -1
- package/dist/components/post/post-form/DescriptionEditModal.js +1 -1
- package/dist/components/post/post-form/EditPostModal.js +22 -12
- package/dist/components/post/post-form/EventForm.js +2 -2
- package/dist/components/post/post-form/EventTypeSwitcher.js +1 -1
- package/dist/components/post/post-form/NewPostModal.d.ts +1 -1
- package/dist/components/post/post-form/NewPostModal.js +10 -10
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.js +2 -2
- package/dist/components/post/post-form/PollComposerFields.d.ts +2 -0
- package/dist/components/post/post-form/PollComposerFields.js +12 -8
- package/dist/components/post/post-form/PostAudienceSelector.js +3 -3
- package/dist/components/post/post-form/PostTypeSwitcher.js +1 -1
- package/dist/components/post/post-form/ReplyModal.js +9 -8
- package/dist/components/post/post-form/VisibilitySelector.js +1 -1
- package/dist/components/post/types/Article.js +2 -1
- package/dist/components/post/types/Event.js +1 -1
- package/dist/components/post/types/Note.js +2 -1
- package/dist/components/post/types/Poll.js +2 -1
- package/dist/components/post/types/event/CardEvent.js +2 -2
- package/dist/components/post/types/event/FullEvent.js +8 -8
- package/dist/components/post/types/event/ProfileEventRelationship.d.ts +1 -1
- package/dist/components/post/types/event/ProfileEventRelationship.js +38 -18
- package/dist/components/preview-link/LocalPreviewLink.js +1 -1
- package/dist/components/preview-link/RemotePreviewLink.js +5 -1
- package/dist/components/profile/Avatar.js +3 -2
- package/dist/components/profile/FollowUnfollowButton.js +2 -2
- package/dist/components/profile/ProfileBadge.js +1 -1
- package/dist/components/profile/ProfileCard.js +1 -1
- package/dist/components/profile/ProfileHeader.js +1 -1
- package/dist/components/profile/ProfilePageAction.js +3 -3
- package/dist/components/profile/ProfilePostsAndReplies.js +3 -1
- package/dist/components/profile/ProfileSelector.js +3 -3
- package/dist/components/profile/ProfilesInput.js +1 -1
- package/dist/components/profile/ReportProfileOrPostModal.js +6 -4
- package/dist/components/server-data/context.d.ts +8 -0
- package/dist/contexts/openpeeps/hooks/admin.d.ts +63 -16774
- package/dist/contexts/openpeeps/hooks/admin.js +34 -14
- package/dist/contexts/openpeeps/hooks/conversations.d.ts +330 -0
- package/dist/contexts/openpeeps/hooks/jams.d.ts +110 -0
- package/dist/contexts/openpeeps/hooks/jams.js +1 -1
- package/dist/contexts/openpeeps/hooks/other.d.ts +8 -0
- package/dist/contexts/openpeeps/hooks/posts.d.ts +933 -53
- package/dist/contexts/openpeeps/hooks/profiles.d.ts +220 -0
- package/dist/contexts/openpeeps/hooks/search.d.ts +330 -0
- package/dist/contexts/openpeeps/index.d.ts +1 -1
- package/dist/contexts/openpeeps/index.js +10 -2
- package/dist/contexts/router/index.d.ts +8 -3
- package/dist/contexts/router/index.js +7 -3
- package/dist/hooks/conversations/useCreateConversation.d.ts +124 -0
- package/dist/hooks/conversations/useCreateConversation.js +56 -0
- package/dist/hooks/groups/useJoinGroup.d.ts +8 -0
- package/dist/hooks/groups/useJoinGroup.js +23 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/jams/useLeaveCloseJam.d.ts +20 -0
- package/dist/hooks/jams/useLeaveCloseJam.js +59 -0
- package/dist/hooks/posts/useFeedPostActions.d.ts +18 -0
- package/dist/hooks/posts/useFeedPostActions.js +51 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/lib/Markdown.d.ts +14 -0
- package/dist/lib/Markdown.js +16 -0
- package/dist/lib/analyticsClicks.d.ts +12 -0
- package/dist/lib/analyticsClicks.js +64 -0
- package/dist/lib/auth.d.ts +8 -0
- package/dist/lib/auth.js +27 -0
- package/dist/lib/canvasUtils.d.ts +6 -0
- package/dist/lib/canvasUtils.js +62 -1
- package/dist/lib/groupCapabilityHelpers.d.ts +1 -1
- package/dist/lib/passwordStrength.d.ts +6 -0
- package/dist/lib/passwordStrength.js +26 -0
- package/dist/lib/postUnread.d.ts +7 -0
- package/dist/lib/postUnread.js +7 -0
- package/dist/lib/postViewCounter.d.ts +1 -1
- package/dist/lib/postViewCounter.js +3 -1
- package/dist/lib/routeHandles.d.ts +2 -0
- package/dist/lib/routeHandles.js +2 -0
- package/dist/lib/svgCover.d.ts +2 -0
- package/dist/lib/svgCover.js +18 -0
- package/dist/navigation/index.d.ts +11 -0
- package/dist/navigation/index.js +2 -0
- package/dist/navigation/menuItems.d.ts +8 -0
- package/dist/navigation/menuItems.js +83 -0
- package/dist/navigation/targets.d.ts +94 -0
- package/dist/navigation/targets.js +12 -0
- package/dist/pages/About.d.ts +1 -0
- package/dist/pages/About.js +19 -0
- package/dist/pages/CodeOfConduct.d.ts +1 -0
- package/dist/pages/CodeOfConduct.js +14 -0
- package/dist/pages/Explore.d.ts +1 -0
- package/dist/pages/Explore.js +132 -0
- package/dist/pages/Home.d.ts +6 -0
- package/dist/pages/Home.js +31 -0
- package/dist/pages/Members.d.ts +1 -0
- package/dist/pages/Members.js +35 -0
- package/dist/pages/NotFound.d.ts +1 -0
- package/dist/pages/NotFound.js +9 -0
- package/dist/pages/Notifications.d.ts +1 -0
- package/dist/pages/Notifications.js +8 -0
- package/dist/pages/PostDetail.d.ts +1 -0
- package/dist/pages/PostDetail.js +27 -0
- package/dist/pages/Profile.d.ts +1 -0
- package/dist/pages/Profile.js +20 -0
- package/dist/pages/Tags.d.ts +1 -0
- package/dist/pages/Tags.js +14 -0
- package/dist/pages/Welcome.d.ts +1 -0
- package/dist/pages/Welcome.js +89 -0
- package/dist/pages/admin/Analytics.d.ts +11 -0
- package/dist/pages/admin/Analytics.js +11 -0
- package/dist/pages/admin/ApiKeys.d.ts +1 -0
- package/dist/pages/admin/ApiKeys.js +141 -0
- package/dist/pages/admin/Backups.d.ts +1 -0
- package/dist/pages/admin/Backups.js +39 -0
- package/dist/pages/admin/ConfigEditor.d.ts +14 -0
- package/dist/pages/admin/ConfigEditor.js +91 -0
- package/dist/pages/admin/Configuration.d.ts +1 -0
- package/dist/pages/admin/Configuration.js +8 -0
- package/dist/pages/admin/ConfigurationCommunity.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunity.js +7 -0
- package/dist/pages/admin/ConfigurationCommunityLanguage.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunityLanguage.js +71 -0
- package/dist/pages/admin/ConfigurationEmail.d.ts +1 -0
- package/dist/pages/admin/ConfigurationEmail.js +97 -0
- package/dist/pages/admin/ConfigurationI18n.d.ts +1 -0
- package/dist/pages/admin/ConfigurationI18n.js +51 -0
- package/dist/pages/admin/Dashboard.d.ts +1 -0
- package/dist/pages/admin/Dashboard.js +40 -0
- package/dist/pages/admin/Db.d.ts +1 -0
- package/dist/pages/admin/Db.js +238 -0
- package/dist/pages/admin/Diagnostics.d.ts +1 -0
- package/dist/pages/admin/Diagnostics.js +8 -0
- package/dist/pages/admin/DiagnosticsEmail.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsEmail.js +65 -0
- package/dist/pages/admin/DiagnosticsJob.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsJob.js +51 -0
- package/dist/pages/admin/DiagnosticsLogs.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsLogs.js +62 -0
- package/dist/pages/admin/DiagnosticsPerformance.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsPerformance.js +34 -0
- package/dist/pages/admin/GroupMembers.d.ts +1 -0
- package/dist/pages/admin/GroupMembers.js +109 -0
- package/dist/pages/admin/Groups.d.ts +1 -0
- package/dist/pages/admin/Groups.js +61 -0
- package/dist/pages/admin/Invites.d.ts +1 -0
- package/dist/pages/admin/Invites.js +72 -0
- package/dist/pages/admin/Members.d.ts +1 -0
- package/dist/pages/admin/Members.js +49 -0
- package/dist/pages/admin/Moderation.d.ts +1 -0
- package/dist/pages/admin/Moderation.js +62 -0
- package/dist/pages/admin/Reports.d.ts +1 -0
- package/dist/pages/admin/Reports.js +178 -0
- package/dist/pages/admin/analytics/AnalyticsLayout.d.ts +14 -0
- package/dist/pages/admin/analytics/AnalyticsLayout.js +104 -0
- package/dist/pages/admin/analytics/AnalyticsRangeContext.d.ts +9 -0
- package/dist/pages/admin/analytics/AnalyticsRangeContext.js +9 -0
- package/dist/pages/admin/analytics/Content.d.ts +1 -0
- package/dist/pages/admin/analytics/Content.js +117 -0
- package/dist/pages/admin/analytics/Engagement.d.ts +1 -0
- package/dist/pages/admin/analytics/Engagement.js +220 -0
- package/dist/pages/admin/analytics/Groups.d.ts +1 -0
- package/dist/pages/admin/analytics/Groups.js +139 -0
- package/dist/pages/admin/analytics/Members.d.ts +1 -0
- package/dist/pages/admin/analytics/Members.js +96 -0
- package/dist/pages/admin/analytics/Overview.d.ts +1 -0
- package/dist/pages/admin/analytics/Overview.js +165 -0
- package/dist/pages/admin/analytics/ReportSettings.d.ts +1 -0
- package/dist/pages/admin/analytics/ReportSettings.js +62 -0
- package/dist/pages/admin/analytics/analyticsInfo.d.ts +3 -0
- package/dist/pages/admin/analytics/analyticsInfo.js +4 -0
- package/dist/pages/admin/analytics/downloadCsv.d.ts +2 -0
- package/dist/pages/admin/analytics/downloadCsv.js +20 -0
- package/dist/pages/admin/community/CommunityFavicons.d.ts +1 -0
- package/dist/pages/admin/community/CommunityFavicons.js +47 -0
- package/dist/pages/admin/community/CommunityInfo.d.ts +1 -0
- package/dist/pages/admin/community/CommunityInfo.js +35 -0
- package/dist/pages/admin/community/CommunityLinks.d.ts +1 -0
- package/dist/pages/admin/community/CommunityLinks.js +35 -0
- package/dist/pages/admin/community/CommunityMarkdownPage.d.ts +8 -0
- package/dist/pages/admin/community/CommunityMarkdownPage.js +35 -0
- package/dist/pages/admin/community/CommunityProfileFields.d.ts +1 -0
- package/dist/pages/admin/community/CommunityProfileFields.js +50 -0
- package/dist/pages/admin/community/CommunityRoles.d.ts +1 -0
- package/dist/pages/admin/community/CommunityRoles.js +109 -0
- package/dist/pages/admin/community/CommunityTheme.d.ts +1 -0
- package/dist/pages/admin/community/CommunityTheme.js +56 -0
- package/dist/pages/admin/community/useCommunityConfig.d.ts +168 -0
- package/dist/pages/admin/community/useCommunityConfig.js +28 -0
- package/dist/pages/admin/components/AdminCharts.d.ts +22 -0
- package/dist/pages/admin/components/AdminCharts.js +29 -0
- package/dist/pages/admin/components/AdminGroupCard.d.ts +6 -0
- package/dist/pages/admin/components/AdminGroupCard.js +42 -0
- package/dist/pages/admin/components/AdminInviteActions.d.ts +1 -0
- package/dist/pages/admin/components/AdminInviteActions.js +23 -0
- package/dist/pages/admin/components/InviteWithEmailModal.d.ts +3 -0
- package/dist/pages/admin/components/InviteWithEmailModal.js +82 -0
- package/dist/pages/admin/components/InviteWithLinkModal.d.ts +22 -0
- package/dist/pages/admin/components/InviteWithLinkModal.js +98 -0
- package/dist/pages/admin/components/ProfileRowActions.d.ts +5 -0
- package/dist/pages/admin/components/ProfileRowActions.js +131 -0
- package/dist/pages/admin/components/RestoreBackupModal.d.ts +4 -0
- package/dist/pages/admin/components/RestoreBackupModal.js +33 -0
- package/dist/pages/admin/components/RestoreTestBackupModal.d.ts +4 -0
- package/dist/pages/admin/components/RestoreTestBackupModal.js +36 -0
- package/dist/pages/articles/Edit.d.ts +1 -0
- package/dist/pages/articles/Edit.js +60 -0
- package/dist/pages/articles/Index.d.ts +1 -0
- package/dist/pages/articles/Index.js +18 -0
- package/dist/pages/articles/New.d.ts +1 -0
- package/dist/pages/articles/New.js +48 -0
- package/dist/pages/auth/Closed.d.ts +1 -0
- package/dist/pages/auth/Closed.js +14 -0
- package/dist/pages/auth/Login.d.ts +1 -0
- package/dist/pages/auth/Login.js +74 -0
- package/dist/pages/auth/OidcCallback.d.ts +5 -0
- package/dist/pages/auth/OidcCallback.js +31 -0
- package/dist/pages/auth/OidcPending.d.ts +5 -0
- package/dist/pages/auth/OidcPending.js +39 -0
- package/dist/pages/auth/Register.d.ts +4 -0
- package/dist/pages/auth/Register.js +124 -0
- package/dist/pages/auth/RegisterInvitation.d.ts +1 -0
- package/dist/pages/auth/RegisterInvitation.js +5 -0
- package/dist/pages/auth/RequestResetPassword.d.ts +1 -0
- package/dist/pages/auth/RequestResetPassword.js +50 -0
- package/dist/pages/auth/ResetPassword.d.ts +1 -0
- package/dist/pages/auth/ResetPassword.js +40 -0
- package/dist/pages/auth/SsoCallback.d.ts +1 -0
- package/dist/pages/auth/SsoCallback.js +34 -0
- package/dist/pages/auth/ValidateEmail.d.ts +6 -0
- package/dist/pages/auth/ValidateEmail.js +64 -0
- package/dist/pages/conversations/Index.d.ts +1 -0
- package/dist/pages/conversations/Index.js +58 -0
- package/dist/pages/conversations/Info.d.ts +1 -0
- package/dist/pages/conversations/Info.js +26 -0
- package/dist/pages/conversations/New.d.ts +1 -0
- package/dist/pages/conversations/New.js +8 -0
- package/dist/pages/conversations/Show.d.ts +1 -0
- package/dist/pages/conversations/Show.js +100 -0
- package/dist/pages/events/Edit.d.ts +1 -0
- package/dist/pages/events/Edit.js +69 -0
- package/dist/pages/events/Index.d.ts +1 -0
- package/dist/pages/events/Index.js +23 -0
- package/dist/pages/events/My.d.ts +1 -0
- package/dist/pages/events/My.js +24 -0
- package/dist/pages/events/New.d.ts +1 -0
- package/dist/pages/events/New.js +66 -0
- package/dist/pages/feeds/Bookmarks.d.ts +1 -0
- package/dist/pages/feeds/Bookmarks.js +10 -0
- package/dist/pages/feeds/Local.d.ts +1 -0
- package/dist/pages/feeds/Local.js +14 -0
- package/dist/pages/feeds/My.d.ts +1 -0
- package/dist/pages/feeds/My.js +12 -0
- package/dist/pages/groups/Edit.d.ts +1 -0
- package/dist/pages/groups/Edit.js +57 -0
- package/dist/pages/groups/Index.d.ts +1 -0
- package/dist/pages/groups/Index.js +50 -0
- package/dist/pages/groups/Info.d.ts +1 -0
- package/dist/pages/groups/Info.js +21 -0
- package/dist/pages/groups/Members.d.ts +1 -0
- package/dist/pages/groups/Members.js +28 -0
- package/dist/pages/groups/New.d.ts +1 -0
- package/dist/pages/groups/New.js +68 -0
- package/dist/pages/groups/Show.d.ts +1 -0
- package/dist/pages/groups/Show.js +64 -0
- package/dist/pages/index.d.ts +94 -0
- package/dist/pages/index.js +94 -0
- package/dist/pages/jams/Event.d.ts +8 -0
- package/dist/pages/jams/Event.js +57 -0
- package/dist/pages/jams/Index.d.ts +6 -0
- package/dist/pages/jams/Index.js +44 -0
- package/dist/pages/payment/Success.d.ts +1 -0
- package/dist/pages/payment/Success.js +30 -0
- package/dist/pages/plugins/Index.d.ts +1 -0
- package/dist/pages/plugins/Index.js +69 -0
- package/dist/pages/profile/Followers.d.ts +6 -0
- package/dist/pages/profile/Followers.js +28 -0
- package/dist/pages/settings/AccessTokens.d.ts +1 -0
- package/dist/pages/settings/AccessTokens.js +149 -0
- package/dist/pages/settings/Account.d.ts +1 -0
- package/dist/pages/settings/Account.js +81 -0
- package/dist/pages/settings/Billing.d.ts +1 -0
- package/dist/pages/settings/Billing.js +82 -0
- package/dist/pages/settings/Index.d.ts +1 -0
- package/dist/pages/settings/Index.js +13 -0
- package/dist/pages/settings/Language.d.ts +1 -0
- package/dist/pages/settings/Language.js +54 -0
- package/dist/pages/settings/NotificationPreferences.d.ts +1 -0
- package/dist/pages/settings/NotificationPreferences.js +180 -0
- package/dist/pages/settings/Notifications.d.ts +1 -0
- package/dist/pages/settings/Notifications.js +10 -0
- package/dist/pages/settings/PublicProfile.d.ts +1 -0
- package/dist/pages/settings/PublicProfile.js +135 -0
- package/dist/pages/settings/PushEnabledDevices.d.ts +1 -0
- package/dist/pages/settings/PushEnabledDevices.js +67 -0
- package/dist/pages/settings/Theme.d.ts +1 -0
- package/dist/pages/settings/Theme.js +37 -0
- package/dist/pages/test/Error.d.ts +1 -0
- package/dist/pages/test/Error.js +10 -0
- package/dist/pages/test/Markdown.d.ts +1 -0
- package/dist/pages/test/Markdown.js +32 -0
- package/dist/pwa/InstallPrompt.js +1 -1
- package/dist/pwa/NotificationPermissionPrompt.js +2 -2
- package/dist/pwa/UpdatePrompt.js +1 -1
- package/dist/react-native.d.ts +1 -0
- package/dist/react-native.js +1 -0
- package/dist/session/useSessionEvents.d.ts +3 -0
- package/dist/session/useSessionEvents.js +64 -0
- package/dist/stores/newPosts.d.ts +8 -8
- package/package.json +14 -9
- package/dist/components/jams/useJamLiveKitTheme.d.ts +0 -3
- package/dist/components/jams/useJamLiveKitTheme.js +0 -10
|
@@ -9,5 +9,5 @@ export function MobileMenuItem({ action, icon: Icon, title, }) {
|
|
|
9
9
|
action();
|
|
10
10
|
else
|
|
11
11
|
router.navigate(action);
|
|
12
|
-
}, children: _jsx("span", { className: cn('flex items-center gap-x-2', active ? 'text-primary
|
|
12
|
+
}, children: _jsx("span", { className: cn('flex items-center gap-x-2', active ? 'text-primary font-bold' : 'text-foreground/70'), children: _jsx(Icon, { className: "mr-1 h-5 w-5" }) }) }));
|
|
13
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from '@openpeepshq/react-ui';
|
|
3
3
|
export function PageHeaderAction({ title, action }) {
|
|
4
|
-
return (_jsx(Button, { title: title, className: "h-6 w-fit text-sm", variant: "
|
|
4
|
+
return (_jsx(Button, { title: title, className: "h-6 w-fit text-sm", variant: "outline", action: action
|
|
5
5
|
? () => Promise.resolve(action()).then(() => undefined)
|
|
6
6
|
: undefined, children: _jsx("span", { children: title }) }));
|
|
7
7
|
}
|
|
@@ -7,5 +7,5 @@ export function PlusButton() {
|
|
|
7
7
|
if (!plusButton || Array.isArray(plusButton))
|
|
8
8
|
return null;
|
|
9
9
|
const Icon = plusButton.icon ?? Plus;
|
|
10
|
-
return (_jsx("div", { className: "sticky bottom-1 flex w-full justify-end sm:bottom-4", children: _jsx(Button, { compact: true, title: plusButton.title ?? '', variant: "
|
|
10
|
+
return (_jsx("div", { className: "sticky bottom-1 flex w-full justify-end sm:bottom-4", children: _jsx(Button, { compact: true, title: plusButton.title ?? '', variant: "default", action: plusButton.action, className: "z-10 mr-4 size-16 rounded-full sm:mb-4", "data-testid": "posts-new-post-button", children: _jsx(Icon, { size: 24 }) }) }));
|
|
11
11
|
}
|
|
@@ -4,6 +4,7 @@ import { Button, Link } from '@openpeepshq/react-ui';
|
|
|
4
4
|
import { getTheme } from '@openpeepshq/common';
|
|
5
5
|
import { useServerInfo } from '../server-data/index.js';
|
|
6
6
|
import { useCurrentProfile, useCurrentProfileSettings, } from '../layout/IdentityContext.js';
|
|
7
|
+
import { useHrefOf } from '../../contexts/router/index.js';
|
|
7
8
|
import { useT } from '../../i18n/index.js';
|
|
8
9
|
/**
|
|
9
10
|
* Translation of @openpeepshq/svelte/components/navigation/SideBar.svelte.
|
|
@@ -18,7 +19,11 @@ export function SideBar({ onClose, mainMenu, profileMenu } = {}) {
|
|
|
18
19
|
const profileSettings = useCurrentProfileSettings();
|
|
19
20
|
const profile = useCurrentProfile();
|
|
20
21
|
const t = useT();
|
|
22
|
+
const hrefOf = useHrefOf();
|
|
21
23
|
const logoSmall = getTheme(serverInfo.communityConfig, profileSettings).logoSmall;
|
|
22
24
|
const { name, tagLine } = serverInfo.communityConfig?.info ?? {};
|
|
23
|
-
|
|
25
|
+
const homeHref = hrefOf({ type: 'home' });
|
|
26
|
+
const registerHref = hrefOf({ type: 'auth', mode: 'register' });
|
|
27
|
+
const loginHref = hrefOf({ type: 'auth', mode: 'login' });
|
|
28
|
+
return (_jsxs("div", { className: "bg-background text-foreground relative h-screen w-full pt-3 md:h-full", children: [_jsxs("div", { className: "h-[90%] overflow-y-auto", children: [_jsxs("div", { className: "flex w-full items-center justify-between px-4 md:items-start", children: [_jsx("a", { href: homeHref, children: logoSmall && (_jsx("img", { src: logoSmall, alt: "logo", className: "h-10 object-contain" })) }), onClose && (_jsx("button", { type: "button", title: t('common.close'), className: "flex md:hidden", onClick: onClose, children: _jsx(X, {}) }))] }), profile?.type === 'local' ? (_jsxs(_Fragment, { children: [profileMenu, mainMenu] })) : (_jsx("div", { className: "mt-4 px-4", children: _jsxs("div", { className: "flex h-full flex-col items-center justify-center space-y-4", children: [name && (_jsx("p", { className: "text-center text-lg font-semibold", children: t('navigation.welcome', { name }) })), tagLine && _jsx("p", { className: "px-2 text-center text-sm", children: tagLine }), _jsx(Button, { title: t('navigation.joinCommunity'), variant: "default", action: registerHref, children: t('navigation.joinCommunity') }), _jsxs("span", { className: "text-sm", children: [t('navigation.haveAccount'), ' ', _jsx(Link, { action: loginHref, children: t('navigation.logIn') })] })] }) }))] }), _jsx("footer", { className: "bg-background absolute bottom-3", children: _jsx("p", { className: "ml-4 text-center", children: t('navigation.poweredBy') }) })] }));
|
|
24
29
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
3
|
import { useBreadcrumbs } from '../../../stores/index.js';
|
|
4
|
+
import { useT } from '../../../i18n/index.js';
|
|
4
5
|
import { CrumbItem } from './Crumb.js';
|
|
5
6
|
export function Breadcrumbs() {
|
|
6
7
|
const breadcrumbs = useBreadcrumbs();
|
|
8
|
+
const t = useT();
|
|
7
9
|
if (breadcrumbs.length === 0)
|
|
8
10
|
return null;
|
|
9
|
-
return (_jsx("
|
|
11
|
+
return (_jsx("nav", { "aria-label": t('navigation.breadcrumbs', {
|
|
12
|
+
defaultValue: 'Breadcrumbs',
|
|
13
|
+
}), children: _jsx("ol", { className: "text-muted-foreground mb-3 flex flex-wrap items-center gap-1 px-4 text-sm", children: breadcrumbs.map((crumb, idx) => (_jsxs(Fragment, { children: [idx > 0 && (_jsx("li", { className: "op-crumb-separator", "aria-hidden": "true", children: "\u203A" })), _jsx(CrumbItem, { crumb: crumb })] }, `${crumb.text}-${idx}`))) }) }));
|
|
10
14
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { cn } from '@openpeepshq/react-ui';
|
|
2
2
|
/** Active/inactive classes for sidebar nav links (parity with Svelte `MenuItem.svelte`). */
|
|
3
|
-
export const sideBarNavLinkClass = ({ isActive }) => cn('flex items-center gap-2 rounded-md px-3 py-2 hover:bg-
|
|
3
|
+
export const sideBarNavLinkClass = ({ isActive }) => cn('flex items-center gap-2 rounded-md px-3 py-2 hover:bg-surface', isActive ? 'text-primary font-bold' : 'text-foreground/70');
|
|
@@ -29,7 +29,7 @@ export function NotificationHeaderActions() {
|
|
|
29
29
|
};
|
|
30
30
|
return (_jsxs(_Fragment, { children: [_jsx(Button, { title: t('settings.notifications.feedPreferences.markAllRead', {
|
|
31
31
|
defaultValue: 'Mark all as read',
|
|
32
|
-
}), action: markAllRead, variant: "
|
|
32
|
+
}), action: markAllRead, variant: "outline", children: _jsx(CheckCheck, { size: 18 }) }), _jsx(Button, { title: t('settings.notifications.headerPreferencesTitle', {
|
|
33
33
|
defaultValue: 'Notification preferences',
|
|
34
|
-
}), action: "/settings/notifications/preferences", variant: "
|
|
34
|
+
}), action: "/settings/notifications/preferences", variant: "outline", children: _jsx(Settings2, { size: 18 }) })] }));
|
|
35
35
|
}
|
|
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Dot, User, Users } from 'lucide-react';
|
|
3
3
|
import { Avatar, ProfileLink } from '../profile/index.js';
|
|
4
4
|
export function NotificationWrapper({ profile, seen = true, isGroup = false, showProfile = true, children, }) {
|
|
5
|
-
return (_jsxs("
|
|
5
|
+
return (_jsxs("article", { className: "hover:bg-surface w-full items-start gap-3 overflow-hidden border-b px-4 py-5", children: [_jsx("div", { className: "flex justify-end", children: !seen ? _jsx(Dot, { className: "h-3 w-3" }) : null }), showProfile ? (_jsxs("div", { className: "flex items-center gap-4 px-6", children: [isGroup ? (_jsx(Users, { className: "text-muted-foreground h-8 w-8" })) : (_jsx(User, { className: "text-muted-foreground h-8 w-8" })), _jsx(ProfileLink, { profile: profile, children: _jsx(Avatar, { profile: profile, size: 3.5 }) })] })) : null, _jsx("div", { className: "flex flex-1 flex-col", children: children })] }));
|
|
6
6
|
}
|
|
@@ -79,10 +79,10 @@ export function NotificationsList({ pageSize = 15 }) {
|
|
|
79
79
|
return () => observer.disconnect();
|
|
80
80
|
}, [query]);
|
|
81
81
|
if (query.isLoading) {
|
|
82
|
-
return (_jsx("div", { className: "flex h-32 items-center justify-center text-sm
|
|
82
|
+
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: _jsx(LoadingSpinner, {}) }));
|
|
83
83
|
}
|
|
84
84
|
if (notifications.length === 0) {
|
|
85
|
-
return (_jsx("p", { className: "px-5 py-8 text-sm
|
|
85
|
+
return (_jsx("p", { className: "text-muted-foreground px-5 py-8 text-sm", children: t('notification.empty', { defaultValue: 'No notifications' }) }));
|
|
86
86
|
}
|
|
87
|
-
return (_jsxs("div", { className: "relative overflow-hidden", children: [notifications.map((n) => (_jsx(NotificationItem, { notification: n }, n.id))), _jsx("div", { ref: sentinelRef, "aria-hidden": "true", className: "h-8" }), query.isFetchingNextPage && (_jsx("div", { className: "flex justify-center py-4 text-sm
|
|
87
|
+
return (_jsxs("div", { role: "feed", "aria-busy": query.isFetchingNextPage || undefined, className: "relative overflow-hidden", children: [notifications.map((n) => (_jsx(NotificationItem, { notification: n }, n.id))), _jsx("div", { ref: sentinelRef, "aria-hidden": "true", className: "h-8" }), query.isFetchingNextPage && (_jsx("div", { className: "text-muted-foreground flex justify-center py-4 text-sm", children: _jsx(LoadingSpinner, {}) }))] }));
|
|
88
88
|
}
|
|
@@ -100,7 +100,7 @@ function NewGroupInvitationNotification({ notification, }) {
|
|
|
100
100
|
const t = useT();
|
|
101
101
|
const profile = notification.senderProfile;
|
|
102
102
|
const group = notification.group;
|
|
103
|
-
return (_jsx(NotificationWrapper, { profile: profile, seen: notification.seen, showProfile: false, children: _jsxs("div", { className: "w-full px-4 py-2", children: [_jsxs("div", { className: "mb-2 flex items-center gap-4", children: [_jsx(Users, { className: "text-
|
|
103
|
+
return (_jsx(NotificationWrapper, { profile: profile, seen: notification.seen, showProfile: false, children: _jsxs("div", { className: "w-full px-4 py-2", children: [_jsxs("div", { className: "mb-2 flex items-center gap-4", children: [_jsx(Users, { className: "text-muted-foreground size-8" }), _jsx(GroupAvatarThumb, { group: group })] }), _jsxs("p", { className: "text-sm", children: [t('notification.newGroupInvitation.text', {
|
|
104
104
|
defaultValue: 'You were invited to',
|
|
105
105
|
}), ' ', _jsx("a", { href: `/groups/@${group.handle}`, className: "font-semibold", children: groupName(group) }), _jsx("span", { className: "text-muted-foreground ml-2 text-xs", children: _jsx(UpdatingDate, { date: notification.createdAt }) })] })] }) }));
|
|
106
106
|
}
|
|
@@ -108,7 +108,7 @@ function NewGroupMemberNotification({ notification, }) {
|
|
|
108
108
|
const t = useT();
|
|
109
109
|
const profile = notification.senderProfile;
|
|
110
110
|
const group = notification.group;
|
|
111
|
-
return (_jsx(NotificationWrapper, { profile: profile, seen: notification.seen, showProfile: false, children: _jsxs("div", { className: "w-full px-4 py-2", children: [_jsxs("div", { className: "mb-2 flex items-center gap-4", children: [_jsx(Users, { className: "text-
|
|
111
|
+
return (_jsx(NotificationWrapper, { profile: profile, seen: notification.seen, showProfile: false, children: _jsxs("div", { className: "w-full px-4 py-2", children: [_jsxs("div", { className: "mb-2 flex items-center gap-4", children: [_jsx(Users, { className: "text-muted-foreground size-8" }), _jsx(GroupAvatarThumb, { group: group })] }), _jsxs("p", { className: "text-sm", children: [t('notification.newGroupMember.text', {
|
|
112
112
|
defaultValue: '{{profileName}} joined',
|
|
113
113
|
profileName: profileName(profile),
|
|
114
114
|
}), ' ', _jsx("a", { href: `/groups/@${group.handle}`, className: "font-semibold", children: groupName(group) }), _jsx("span", { className: "text-muted-foreground ml-2 text-xs", children: _jsx(UpdatingDate, { date: notification.createdAt }) })] })] }) }));
|
|
@@ -117,7 +117,7 @@ function GroupMemberExitNotification({ notification, }) {
|
|
|
117
117
|
const t = useT();
|
|
118
118
|
const profile = notification.senderProfile;
|
|
119
119
|
const group = notification.group;
|
|
120
|
-
return (_jsx(NotificationWrapper, { profile: profile, seen: notification.seen, showProfile: false, children: _jsxs("div", { className: "w-full px-4 py-2", children: [_jsxs("div", { className: "mb-2 flex items-center gap-4", children: [_jsx(Users, { className: "text-
|
|
120
|
+
return (_jsx(NotificationWrapper, { profile: profile, seen: notification.seen, showProfile: false, children: _jsxs("div", { className: "w-full px-4 py-2", children: [_jsxs("div", { className: "mb-2 flex items-center gap-4", children: [_jsx(Users, { className: "text-muted-foreground size-8" }), _jsx(GroupAvatarThumb, { group: group })] }), _jsxs("p", { className: "text-sm", children: [t('notification.groupMemberExit.text', {
|
|
121
121
|
defaultValue: '{{profileName}} left {{groupName}}',
|
|
122
122
|
profileName: profileName(profile),
|
|
123
123
|
groupName: groupName(group),
|
|
@@ -54,10 +54,10 @@ export function Feed({ query, inGroup = false, pinnedPostId }) {
|
|
|
54
54
|
query.data?.pages,
|
|
55
55
|
]);
|
|
56
56
|
if (query.isLoading) {
|
|
57
|
-
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: _jsx(LoadingSpinner, {}) }));
|
|
57
|
+
return (_jsx("div", { className: "bg-surface text-muted-foreground flex h-32 items-center justify-center text-sm", children: _jsx(LoadingSpinner, {}) }));
|
|
58
58
|
}
|
|
59
59
|
if (posts.length === 0 && !pinnedPostId) {
|
|
60
|
-
return (_jsxs("div", { className: "flex h-96 w-full flex-col items-center justify-center gap-y-4", children: [_jsx(Rss, { className: "text-
|
|
60
|
+
return (_jsxs("div", { className: "bg-surface flex h-96 w-full flex-col items-center justify-center gap-y-4", children: [_jsx(Rss, { className: "text-muted-foreground size-20" }), _jsx("p", { className: "text-xl", children: t('feed.empty', { defaultValue: 'No posts yet.' }) })] }));
|
|
61
61
|
}
|
|
62
|
-
return (_jsxs("div", { className: "relative", children: [pinnedPostId ? (_jsx(PinnedPost, { pinnedPostId: pinnedPostId, inGroup: inGroup })) : null, posts.map((post) => (_jsx("a", { href: `/posts/${post.repost ? post.repost.id : post.id}`, className: "block", children: _jsx(FeedPost, { post: post, inGroup: inGroup, showReplyTo: true }) }, post.id))), _jsx("div", { ref: sentinelRef, "aria-hidden": "true", className: "h-8" }), query.isFetchingNextPage && (_jsx("div", { className: "text-muted-foreground flex justify-center py-4 text-sm", children: _jsx(LoadingSpinner, {}) }))] }));
|
|
62
|
+
return (_jsxs("div", { role: "feed", "aria-busy": query.isFetchingNextPage || undefined, className: "bg-surface relative flex min-h-full flex-col gap-0.5", children: [pinnedPostId ? (_jsx(PinnedPost, { pinnedPostId: pinnedPostId, inGroup: inGroup })) : null, posts.map((post) => (_jsx("a", { href: `/posts/${post.repost ? post.repost.id : post.id}`, className: "block", children: _jsx(FeedPost, { post: post, inGroup: inGroup, showReplyTo: true, className: "border-b-0" }) }, post.id))), _jsx("div", { ref: sentinelRef, "aria-hidden": "true", className: "h-8" }), query.isFetchingNextPage && (_jsx("div", { className: "text-muted-foreground flex justify-center py-4 text-sm", children: _jsx(LoadingSpinner, {}) }))] }));
|
|
63
63
|
}
|
|
@@ -8,10 +8,11 @@ export interface FeedPostProps {
|
|
|
8
8
|
showReplyTo?: boolean;
|
|
9
9
|
/** Optional override for the body (used when threading). */
|
|
10
10
|
content?: ReactNode;
|
|
11
|
+
className?: string;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Single post card for the chronological feed:
|
|
14
15
|
* shows a small reaction/reply/group banner, the author header, the body,
|
|
15
16
|
* stats and actions. The body component dispatches on `post.type`.
|
|
16
17
|
*/
|
|
17
|
-
export declare function FeedPost({ post, deleteCallback, noReactionHeader, inGroup, showReplyTo, content, }: FeedPostProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function FeedPost({ post, deleteCallback, noReactionHeader, inGroup, showReplyTo, content, className, }: FeedPostProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '@openpeepshq/react-ui';
|
|
2
3
|
import { usePostViewRef } from '../../lib/postViewCounter.js';
|
|
3
|
-
import {
|
|
4
|
+
import { isUnreadFeedActivityForViewer } from '../../lib/postUnread.js';
|
|
4
5
|
import { useCurrentProfile } from '../layout/IdentityContext.js';
|
|
5
6
|
import { FeedPostContent } from './FeedPostContent.js';
|
|
6
7
|
import { PostInfoHeader } from './pieces/PostInfoHeader.js';
|
|
@@ -14,18 +15,22 @@ import { UnreadPostIndicator } from './pieces/UnreadPostIndicator.js';
|
|
|
14
15
|
* shows a small reaction/reply/group banner, the author header, the body,
|
|
15
16
|
* stats and actions. The body component dispatches on `post.type`.
|
|
16
17
|
*/
|
|
17
|
-
export function FeedPost({ post, deleteCallback, noReactionHeader = false, inGroup = false, showReplyTo = false, content, }) {
|
|
18
|
+
export function FeedPost({ post, deleteCallback, noReactionHeader = false, inGroup = false, showReplyTo = false, content, className, }) {
|
|
18
19
|
const me = useCurrentProfile();
|
|
19
20
|
const displayedPost = post.repost ?? post;
|
|
20
|
-
const isUnread =
|
|
21
|
-
const postViewRef = usePostViewRef(
|
|
22
|
-
groupId:
|
|
21
|
+
const isUnread = isUnreadFeedActivityForViewer(post, me?.id);
|
|
22
|
+
const postViewRef = usePostViewRef(post.id, {
|
|
23
|
+
groupId: post.groupId,
|
|
23
24
|
adjustUnread: isUnread,
|
|
24
25
|
});
|
|
25
26
|
const hasReactionHeader = !noReactionHeader &&
|
|
26
27
|
(!!post.repost || !!post.inReplyToId || (!!post.groupId && !inGroup));
|
|
28
|
+
const showsReplyTo = !!(showReplyTo && displayedPost.replyTo);
|
|
27
29
|
const hasStats = !!(displayedPost?.repostCount ||
|
|
28
30
|
displayedPost?.reactions?.length ||
|
|
29
31
|
displayedPost?.replyCount);
|
|
30
|
-
return (_jsxs("
|
|
32
|
+
return (_jsxs("article", { ref: postViewRef, className: cn('bg-background border-border relative min-w-0 border-b p-4', className), children: [_jsx(UnreadPostIndicator, { show: isUnread, variant: "corner" }), hasReactionHeader && (_jsx(PostReactionHeader, { post: post, inGroup: inGroup, deleteCallback: deleteCallback })), showsReplyTo && displayedPost.replyTo && (
|
|
33
|
+
// ThreadPost carries its own `p-2`, so pull it back to line its avatar
|
|
34
|
+
// and rail up with this post's avatar.
|
|
35
|
+
_jsx("a", { href: `/posts/${displayedPost.replyTo.id}`, className: "-ml-2 block", children: _jsx(ThreadPost, { post: displayedPost.replyTo, isParent: true, noActions: true, noMenu: true }) })), _jsxs("div", { className: "relative", children: [showsReplyTo && (_jsx("div", { className: "bg-border-2 pointer-events-none absolute left-6 top-0 h-2 w-px" })), _jsx(PostInfoHeader, { post: displayedPost, showMenu: !hasReactionHeader, deleteCallback: deleteCallback }), _jsx("div", { className: "min-w-0 pb-2", children: content ?? _jsx(FeedPostContent, { post: displayedPost }) }), hasStats && _jsx(FeedPostStats, { post: displayedPost })] }), _jsx(PostActions, { post: displayedPost })] }));
|
|
31
36
|
}
|
|
@@ -5,7 +5,7 @@ import { FeedNote } from './types/Note.js';
|
|
|
5
5
|
import { FeedPoll } from './types/Poll.js';
|
|
6
6
|
export function FeedPostContent({ post }) {
|
|
7
7
|
if (post.deletedAt) {
|
|
8
|
-
return (_jsx("div", { className: "text-
|
|
8
|
+
return (_jsx("div", { className: "text-muted-foreground text-sm", children: "This post has been deleted." }));
|
|
9
9
|
}
|
|
10
10
|
switch (post.type) {
|
|
11
11
|
case 'note':
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useRef, useEffect } from 'react';
|
|
3
3
|
import { buildThreads } from '@openpeepshq/common/lib';
|
|
4
4
|
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
@@ -6,18 +6,25 @@ import { useT } from '../../i18n/index.js';
|
|
|
6
6
|
import { FeedPost } from './FeedPost.js';
|
|
7
7
|
import { ThreadedFeed } from './feed/threaded/ThreadedFeed.js';
|
|
8
8
|
import { ReplyBox } from './ReplyBox.js';
|
|
9
|
+
/**
|
|
10
|
+
* Shifts the compact thread rail (`p-2` + half a 3rem avatar = 2rem) onto the
|
|
11
|
+
* main post card's rail (`p-4` + half a 3rem avatar = 2.5rem).
|
|
12
|
+
*/
|
|
13
|
+
const threadIndent = 'pl-2';
|
|
9
14
|
export function FullPostLayout({ post, deleteCallback, children, }) {
|
|
10
15
|
const t = useT();
|
|
11
16
|
const { openpeepsApi } = useOpenpeeps();
|
|
12
17
|
const contextQuery = openpeepsApi.usePostContext(post.id);
|
|
13
18
|
const postRef = useRef(null);
|
|
14
|
-
const ancestryThread = useMemo(() =>
|
|
19
|
+
const ancestryThread = useMemo(() => contextQuery.data
|
|
20
|
+
? buildThreads(contextQuery.data.ancestors)[0]
|
|
21
|
+
: undefined, [contextQuery.data]);
|
|
15
22
|
const descendentThreads = useMemo(() => (contextQuery.data && buildThreads(contextQuery.data.descendants)) || [], [contextQuery.data]);
|
|
16
23
|
useEffect(() => {
|
|
17
24
|
postRef.current?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
18
25
|
}, [post.id]);
|
|
19
26
|
if (contextQuery.isLoading) {
|
|
20
|
-
return (_jsx("div", { className: "flex h-32 items-center justify-center text-sm
|
|
27
|
+
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: t('common.loading', { defaultValue: 'Loading…' }) }));
|
|
21
28
|
}
|
|
22
|
-
return (_jsxs(_Fragment, { children: [ancestryThread ? _jsx(ThreadedFeed, { thread: ancestryThread, isAncestors: true }) : null,
|
|
29
|
+
return (_jsxs(_Fragment, { children: [ancestryThread ? (_jsx("div", { className: threadIndent, children: _jsx(ThreadedFeed, { thread: ancestryThread, isAncestors: true }) })) : null, _jsxs("div", { ref: postRef, className: "relative", children: [children ?? (_jsx(FeedPost, { post: post, deleteCallback: deleteCallback, noReactionHeader: true })), ancestryThread ? (_jsx("div", { className: "bg-border-2 pointer-events-none absolute left-10 top-0 h-6 w-px" })) : null] }), _jsx(ReplyBox, { post: post }), descendentThreads.map((thread, index) => (_jsx("div", { className: threadIndent, children: _jsx(ThreadedFeed, { thread: thread, isDescendants: true, continuesBelow: index < descendentThreads.length - 1 }) }, thread.id))), _jsx("div", { className: "h-[70vh]" })] }));
|
|
23
30
|
}
|
|
@@ -35,5 +35,5 @@ export function NewEventButton({ visibility, currentProfile, group, onNavigate,
|
|
|
35
35
|
if (!canPost || !showButton) {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
return (_jsx("div", { className: "mb-4 p-4 pb-0", children: _jsxs(Button, { title: t('events.form.title', { defaultValue: 'New event' }), variant: "
|
|
38
|
+
return (_jsx("div", { className: "mb-4 p-4 pb-0", children: _jsxs(Button, { title: t('events.form.title', { defaultValue: 'New event' }), variant: "default", action: openNewEvent, "data-testid": "events-new-event-button", children: [_jsx(CalendarPlus, { className: "mr-1 size-4" }), t('events.form.title', { defaultValue: 'New event' })] }) }));
|
|
39
39
|
}
|
|
@@ -34,5 +34,5 @@ export function NewNoteButton({ visibility, currentProfile, group, inline = fals
|
|
|
34
34
|
if (!canPost || !inline) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
return (_jsx("div", { className: "mb-4", children: _jsxs(Button, { title: t('posts.form.title', { defaultValue: 'New post' }), variant: "
|
|
37
|
+
return (_jsx("div", { className: "mb-4", children: _jsxs(Button, { title: t('posts.form.title', { defaultValue: 'New post' }), variant: "default", action: openNewPost, "data-testid": "posts-new-post-button", children: [_jsx(Plus, { className: "mr-1 size-4" }), t('posts.form.newNote', { defaultValue: 'New post' })] }) }));
|
|
38
38
|
}
|
|
@@ -11,5 +11,5 @@ export function PinnedPost({ pinnedPostId, inGroup = false }) {
|
|
|
11
11
|
if (postQuery.isLoading || !post)
|
|
12
12
|
return null;
|
|
13
13
|
const href = `/posts/${post.repost ? post.repost.id : post.id}`;
|
|
14
|
-
return (_jsxs("a", { href: href, className: "bg-surface
|
|
14
|
+
return (_jsxs("a", { href: href, className: "bg-surface block", children: [_jsxs("div", { className: "px-5 pt-3 text-sm", children: [_jsx(Pin, { className: "mr-1 inline-block size-4" }), t('feed.pinned', { defaultValue: 'Pinned post' })] }), _jsx(FeedPost, { post: post, inGroup: inGroup, className: "bg-surface border-b-0" })] }));
|
|
15
15
|
}
|
|
@@ -24,7 +24,7 @@ export function ReplyBox({ post }) {
|
|
|
24
24
|
? t('posts.replyBox.reply', { defaultValue: 'Reply' })
|
|
25
25
|
: t('posts.replyBox.logInToReply', {
|
|
26
26
|
defaultValue: 'Log in to reply',
|
|
27
|
-
}), onClick: handleClick, className: "flex w-full items-center gap-x-2 border-b-2 p-5", children: [_jsx(Avatar, { profile: profile, size: 2.5 }), _jsxs("span", { className: "bg-surface-
|
|
27
|
+
}), onClick: handleClick, className: "flex w-full items-center gap-x-2 border-b-2 p-5", children: [_jsx(Avatar, { profile: profile, size: 2.5 }), _jsxs("span", { className: "bg-surface-2 hover:bg-border-2 flex h-max w-full items-center justify-between rounded-full border-b border-t p-5", children: [_jsx("span", { children: t('posts.replyBox.addReplyPlaceholder', {
|
|
28
28
|
defaultValue: 'Add a reply…',
|
|
29
29
|
}) }), _jsx(Image, { size: 24 })] })] }));
|
|
30
30
|
}
|
|
@@ -35,10 +35,10 @@ export function EventsFeed({ query }) {
|
|
|
35
35
|
return () => observer.disconnect();
|
|
36
36
|
}, [query]);
|
|
37
37
|
if (query.isLoading) {
|
|
38
|
-
return (_jsx("div", { className: "flex h-32 items-center justify-center text-sm
|
|
38
|
+
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: _jsx(LoadingSpinner, {}) }));
|
|
39
39
|
}
|
|
40
40
|
if (posts.length === 0) {
|
|
41
|
-
return (_jsxs("div", { className: "flex h-96 w-full flex-col items-center justify-center gap-y-4", children: [_jsx(Rss, { className: "text-
|
|
41
|
+
return (_jsxs("div", { className: "flex h-96 w-full flex-col items-center justify-center gap-y-4", children: [_jsx(Rss, { className: "text-muted-foreground size-20" }), _jsx("p", { className: "text-xl", children: t('feed.empty', { defaultValue: 'No events yet.' }) })] }));
|
|
42
42
|
}
|
|
43
|
-
return (_jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [posts.map((post) => (_jsx(CardEvent, { post: post }, post.id))), _jsx("div", { ref: sentinelRef, "aria-hidden": "true", className: "col-span-full h-8" }), query.isFetchingNextPage ? (_jsx("div", { className: "col-span-full flex justify-center py-4 text-sm
|
|
43
|
+
return (_jsxs("div", { role: "feed", "aria-busy": query.isFetchingNextPage || undefined, className: "grid gap-4 sm:grid-cols-2", children: [posts.map((post) => (_jsx(CardEvent, { post: post }, post.id))), _jsx("div", { ref: sentinelRef, "aria-hidden": "true", className: "col-span-full h-8" }), query.isFetchingNextPage ? (_jsx("div", { className: "text-muted-foreground col-span-full flex justify-center py-4 text-sm", children: _jsx(LoadingSpinner, {}) })) : null] }));
|
|
44
44
|
}
|
|
@@ -15,5 +15,5 @@ export function ThreadPost({ post, isParent = false, isChild = false, noActions
|
|
|
15
15
|
groupId: post.groupId,
|
|
16
16
|
adjustUnread: isUnread,
|
|
17
17
|
});
|
|
18
|
-
return (_jsxs("
|
|
18
|
+
return (_jsxs("article", { ref: postViewRef, className: "relative flex flex-row gap-2 p-2", children: [_jsx(UnreadPostIndicator, { show: isUnread, className: "left-0.5 top-5" }), _jsxs("div", { className: "relative w-12 shrink-0", children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(Avatar, { profile: post.profile, size: 3 }) }), isParent ? (_jsx("div", { className: "bg-border-2 absolute left-6 top-12 h-[calc(100%-2.5rem)] w-px" })) : null, isChild ? (_jsx("div", { className: "bg-border-2 absolute -top-2 left-6 h-2 w-px" })) : null] }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "bg-surface rounded-xl p-2", children: [_jsxs("div", { className: "mb-2 flex items-start justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx(ProfileLink, { profile: post.profile, className: "text-sm font-semibold hover:underline", children: post.profile.displayName || `@${post.profile.handle}` }), _jsxs("span", { className: "text-muted-foreground ml-2 text-xs", children: ["@", post.profile.handle] })] }), _jsxs("div", { className: "flex shrink-0 items-start gap-2", children: [_jsx("span", { className: "text-sm font-extralight", children: _jsx(UpdatingDate, { date: post.createdAt }) }), !noMenu ? _jsx(PostMenu, { post: post }) : null] })] }), _jsx(FeedPostContent, { post: post })] }), !noActions ? _jsx(PostActions, { post: post, compact: true }) : null] })] }));
|
|
19
19
|
}
|
|
@@ -6,5 +6,7 @@ export interface ThreadedFeedProps {
|
|
|
6
6
|
};
|
|
7
7
|
isAncestors?: boolean;
|
|
8
8
|
isDescendants?: boolean;
|
|
9
|
+
/** Another sibling thread follows, so the last post keeps its rail running down. */
|
|
10
|
+
continuesBelow?: boolean;
|
|
9
11
|
}
|
|
10
|
-
export declare function ThreadedFeed({ thread, pathSelector, isAncestors, isDescendants, }: ThreadedFeedProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function ThreadedFeed({ thread, pathSelector, isAncestors, isDescendants, continuesBelow, }: ThreadedFeedProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { collectPath, lastLongestPathSelector } from '../../../../lib/threadHelpers.js';
|
|
3
|
+
import { collectPath, lastLongestPathSelector, } from '../../../../lib/threadHelpers.js';
|
|
4
4
|
import { ThreadPost } from './ThreadPost.js';
|
|
5
|
-
export function ThreadedFeed({ thread, pathSelector = lastLongestPathSelector, isAncestors = false, isDescendants = false, }) {
|
|
5
|
+
export function ThreadedFeed({ thread, pathSelector = lastLongestPathSelector, isAncestors = false, isDescendants = false, continuesBelow = false, }) {
|
|
6
6
|
const postList = useMemo(() => collectPath(pathSelector(thread)), [thread, pathSelector]);
|
|
7
|
-
return (_jsx("div", { className: "w-full", children: postList.map((post, index) => (_jsx("a", { href: `/posts/${post.id}`, className: "block w-full", children: _jsx(ThreadPost, { post: post, isParent: index !== postList.length - 1 || isAncestors, isChild: index !== 0 || isDescendants }) }, post.id))) }));
|
|
7
|
+
return (_jsx("div", { className: "w-full", children: postList.map((post, index) => (_jsx("a", { href: `/posts/${post.id}`, className: "block w-full", children: _jsx(ThreadPost, { post: post, isParent: index !== postList.length - 1 || isAncestors || continuesBelow, isChild: index !== 0 || isDescendants }) }, post.id))) }));
|
|
8
8
|
}
|
|
@@ -31,11 +31,11 @@ export function Attachments({ post }) {
|
|
|
31
31
|
? 'max-h-[600px] w-full object-contain'
|
|
32
32
|
: 'h-full w-full object-cover';
|
|
33
33
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: `mt-2 w-full gap-1 overflow-hidden rounded-md ${cols} ${height}`, children: attachments.map((att, idx) => {
|
|
34
|
-
const tile = (_jsx(_Fragment, { children: isImage(att) && (att.previewUrl || att.url) ? (_jsx("img", { src: att.previewUrl ?? att.url ?? '', alt: att.description ?? `attachment ${idx + 1}`, className: mediaClass })) : isVideo(att) && (att.previewUrl || att.url) ? (_jsxs("div", { className: "relative h-full w-full", children: [_jsx("img", { src: att.previewUrl ?? att.url ?? '', alt: att.description ?? `attachment ${idx + 1}`, className: mediaClass }), _jsx(VideoPlayOverlay, { video: true })] })) : (_jsxs("div", { className: "flex min-h-24 w-full flex-col items-center justify-center gap-1 p-4 text-center text-xs
|
|
34
|
+
const tile = (_jsx(_Fragment, { children: isImage(att) && (att.previewUrl || att.url) ? (_jsx("img", { src: att.previewUrl ?? att.url ?? '', alt: att.description ?? `attachment ${idx + 1}`, className: mediaClass })) : isVideo(att) && (att.previewUrl || att.url) ? (_jsxs("div", { className: "relative h-full w-full", children: [_jsx("img", { src: att.previewUrl ?? att.url ?? '', alt: att.description ?? `attachment ${idx + 1}`, className: mediaClass }), _jsx(VideoPlayOverlay, { video: true })] })) : (_jsxs("div", { className: "text-muted-foreground flex min-h-24 w-full flex-col items-center justify-center gap-1 p-4 text-center text-xs", children: [_jsx("span", { className: "text-foreground break-all font-medium", children: att.filename ?? att.description ?? `Attachment ${idx + 1}` }), att.meta?.mimetype ? (_jsx("span", { className: "uppercase", children: att.meta.mimetype })) : null] })) }));
|
|
35
35
|
if (staticRender) {
|
|
36
|
-
return (_jsx("div", { className: `${tileClass}
|
|
36
|
+
return (_jsx("div", { className: `${tileClass} bg-surface overflow-hidden`, children: tile }, `${att.url ?? idx}-${idx}`));
|
|
37
37
|
}
|
|
38
|
-
return (_jsx("button", { type: "button", className: `${tileClass}
|
|
38
|
+
return (_jsx("button", { type: "button", className: `${tileClass} bg-surface overflow-hidden`, onClick: (e) => {
|
|
39
39
|
e.preventDefault();
|
|
40
40
|
e.stopPropagation();
|
|
41
41
|
setGalleryIndex(idx);
|
|
@@ -29,7 +29,7 @@ export function EventMenu({ post, menuButton }) {
|
|
|
29
29
|
groupId: post.groupId,
|
|
30
30
|
mentions: post.mentions,
|
|
31
31
|
};
|
|
32
|
-
navigate('
|
|
32
|
+
navigate({ type: 'events', view: 'new' });
|
|
33
33
|
};
|
|
34
34
|
return (_jsxs(_Fragment, { children: [_jsxs(PopupMenu, { menuButton: menuButton, title: t('events.menu.title', { defaultValue: 'Event options' }), children: [_jsx(PopupMenuButton, { title: t('common.actions.edit', { defaultValue: 'Edit' }), text: t('common.actions.edit', { defaultValue: 'Edit' }), icon: Pencil, action: `/events/${post.id}/edit` }), canDeletePost ? (_jsx(PopupMenuButton, { title: t('common.actions.delete', { defaultValue: 'Delete' }), text: t('common.actions.delete', { defaultValue: 'Delete' }), icon: Trash, danger: true, action: () => setShowDelete(true) })) : null, _jsx(PopupMenuButton, { title: t('common.actions.duplicate', { defaultValue: 'Duplicate' }), text: t('common.actions.duplicate', { defaultValue: 'Duplicate' }), icon: CopyPlus, action: duplicate })] }), _jsx(DeletePostModal, { post: post, open: showDelete, onClose: () => setShowDelete(false), deleteCallback: () => window.history.back() })] }));
|
|
35
35
|
}
|
|
@@ -44,7 +44,7 @@ export function EventRsvpButton({ post }) {
|
|
|
44
44
|
}
|
|
45
45
|
const full = atCapacity && myRsvp?.response !== 'yes';
|
|
46
46
|
if (myRsvp && myRsvp.response !== 'no') {
|
|
47
|
-
return (_jsxs("div", { className: "w-full", children: [_jsx(Button, { variant: "
|
|
47
|
+
return (_jsxs("div", { className: "w-full", children: [_jsx(Button, { variant: "outline", className: "text-error w-full", action: () => respond('no'), children: t('posts.rsvp.cancelRegistration', {
|
|
48
48
|
defaultValue: 'Cancel registration',
|
|
49
49
|
}) }), _jsx("p", { className: "mt-2 text-center text-sm", children: myRsvp.response === 'yes'
|
|
50
50
|
? t('posts.rsvp.attendingMessage', {
|
|
@@ -54,7 +54,7 @@ export function EventRsvpButton({ post }) {
|
|
|
54
54
|
defaultValue: 'You responded maybe.',
|
|
55
55
|
}) }), error ? (_jsx("p", { className: "text-error mt-2 text-center text-sm", children: error })) : null] }));
|
|
56
56
|
}
|
|
57
|
-
return (_jsxs("div", { className: "mt-4 w-full", children: [_jsxs("div", { className: "flex w-full gap-x-2", children: [_jsx(Button, { variant: "
|
|
57
|
+
return (_jsxs("div", { className: "mt-4 w-full", children: [_jsxs("div", { className: "flex w-full gap-x-2", children: [_jsx(Button, { variant: "default", className: "w-[70%]", disabled: full, action: () => respond('yes'), children: full
|
|
58
58
|
? t('events.rsvp.full', { defaultValue: 'Event is full' })
|
|
59
|
-
: t('posts.rsvp.register', { defaultValue: 'Register' }) }), !capacityEvent ? (_jsx(Button, { variant: "
|
|
59
|
+
: t('posts.rsvp.register', { defaultValue: 'Register' }) }), !capacityEvent ? (_jsx(Button, { variant: "ghost", action: () => respond('tentative'), children: t('posts.rsvp.maybe', { defaultValue: 'Maybe' }) })) : null, _jsx(Button, { variant: "outline", action: () => respond('no'), children: t('posts.rsvp.no', { defaultValue: 'No' }) })] }), error ? (_jsx("p", { className: "text-error mt-2 text-center text-sm", children: error })) : null] }));
|
|
60
60
|
}
|
|
@@ -13,7 +13,7 @@ export function FeedPostStats({ post }) {
|
|
|
13
13
|
e.stopPropagation();
|
|
14
14
|
handler();
|
|
15
15
|
};
|
|
16
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex justify-between pb-2 text-xs
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "text-muted-foreground flex justify-between pb-2 text-xs", children: [_jsx("div", { children: post?.reactions?.length ? (_jsx("button", { type: "button", title: t('posts.stats.viewReactions', {
|
|
17
17
|
defaultValue: 'View reactions',
|
|
18
18
|
}), className: "hover:underline", onClick: stop(() => setModal('reactions')), children: stats })) : null }), _jsxs("div", { className: "flex w-fit items-center gap-1", children: [post?.replyCount ? (_jsx("span", { children: t('posts.stats.repliesCount', {
|
|
19
19
|
defaultValue: `${post.replyCount} replies`,
|
|
@@ -23,5 +23,5 @@ export function FeedPostStats({ post }) {
|
|
|
23
23
|
}), className: "hover:underline", onClick: stop(() => setModal('reposts')), children: t('posts.stats.repostsCount', {
|
|
24
24
|
defaultValue: `${post.repostCount} reposts`,
|
|
25
25
|
count: post.repostCount,
|
|
26
|
-
}) })) : null] })] }), _jsx(ReactionsModal, { reactions: post.reactions ?? [], open: modal === 'reactions', onClose: () => setModal(null) }), _jsx(RepostModal, { post: post, open: modal === 'reposts', onClose: () => setModal(null) })] }));
|
|
26
|
+
}) })) : null] })] }), _jsx(ReactionsModal, { reactions: post.reactions ?? [], open: modal === 'reactions', onClose: () => setModal(null) }), _jsx(RepostModal, { reposts: post.reposts ?? [], repostCount: post.repostCount ?? 0, open: modal === 'reposts', onClose: () => setModal(null) })] }));
|
|
27
27
|
}
|
|
@@ -1,16 +1,47 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
3
4
|
import { useT } from '../../../i18n/index.js';
|
|
4
5
|
import { VideoPlayer } from './VideoPlayer.js';
|
|
6
|
+
const stop = (e) => {
|
|
7
|
+
e.preventDefault();
|
|
8
|
+
e.stopPropagation();
|
|
9
|
+
};
|
|
5
10
|
export function GalleryModal({ attachments, initialIndex = 0, onClose, }) {
|
|
6
11
|
const t = useT();
|
|
7
12
|
const [index, setIndex] = useState(initialIndex);
|
|
8
13
|
const attachment = attachments[index];
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const onKey = (e) => {
|
|
16
|
+
if (e.key === 'Escape')
|
|
17
|
+
onClose();
|
|
18
|
+
};
|
|
19
|
+
document.addEventListener('keydown', onKey);
|
|
20
|
+
return () => document.removeEventListener('keydown', onKey);
|
|
21
|
+
}, [onClose]);
|
|
9
22
|
if (!attachment)
|
|
10
23
|
return null;
|
|
11
|
-
const prev = () =>
|
|
12
|
-
|
|
13
|
-
|
|
24
|
+
const prev = (e) => {
|
|
25
|
+
stop(e);
|
|
26
|
+
setIndex((i) => (i === 0 ? attachments.length - 1 : i - 1));
|
|
27
|
+
};
|
|
28
|
+
const next = (e) => {
|
|
29
|
+
stop(e);
|
|
30
|
+
setIndex((i) => (i === attachments.length - 1 ? 0 : i + 1));
|
|
31
|
+
};
|
|
32
|
+
const modal = (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/80", role: "dialog", "aria-modal": true, onClick: (e) => {
|
|
33
|
+
stop(e);
|
|
34
|
+
onClose();
|
|
35
|
+
}, children: [attachments.length > 1 ? (_jsx("button", { type: "button", title: t('posts.gallery.previous', { defaultValue: 'Previous' }), className: "rounded-button absolute left-2 top-1/2 z-50 -translate-y-1/2 bg-white/15 p-4 text-xl font-bold shadow-xl md:left-4", onClick: prev, children: "\u2190" })) : null, _jsx("div", { className: "max-h-[90vh] max-w-[90vw] overflow-auto p-4", onClick: (e) => e.stopPropagation(), children: attachment.type === 'video' ||
|
|
36
|
+
attachment.meta?.mimetype?.startsWith('video/') ? (_jsx(VideoPlayer, { attachment: attachment, className: "max-h-[85vh] max-w-full" }, attachment.url)) : attachment.type === 'audio' ||
|
|
37
|
+
attachment.meta?.mimetype?.startsWith('audio/') ? (_jsx("audio", { src: attachment.url, controls: true, className: "w-full min-w-[280px]" })) : attachment.type === 'image' ||
|
|
38
|
+
attachment.meta?.mimetype?.startsWith('image/') ? (_jsx("img", { src: attachment.url ?? attachment.previewUrl ?? '', alt: attachment.description ?? '', className: "max-h-[85vh] max-w-full object-contain" })) : (_jsxs("div", { className: "bg-surface space-y-3 rounded-md p-6 text-center", children: [_jsx("p", { className: "font-medium", children: attachment.filename ?? attachment.description ?? 'Document' }), attachment.url ? (_jsx("a", { href: attachment.url, target: "_blank", rel: "noreferrer", className: "text-primary underline", children: t('posts.gallery.openDocument', {
|
|
14
39
|
defaultValue: 'Open file',
|
|
15
|
-
}) })) : null] })) }), attachments.length > 1 ? (_jsx("button", { type: "button", title: t('posts.gallery.next', { defaultValue: 'Next' }), className: "absolute right-2 top-1/2 z-50 -translate-y-1/2
|
|
40
|
+
}) })) : null] })) }), attachments.length > 1 ? (_jsx("button", { type: "button", title: t('posts.gallery.next', { defaultValue: 'Next' }), className: "rounded-button absolute right-2 top-1/2 z-50 -translate-y-1/2 bg-white/15 p-4 text-xl font-bold shadow-xl md:right-4", onClick: next, children: "\u2192" })) : null, _jsx("button", { type: "button", title: t('posts.gallery.close', { defaultValue: 'Close' }), className: "rounded-button bg-primary text-primary-foreground fixed right-4 top-4 z-50 px-3 py-2 text-lg font-bold shadow-xl", onClick: (e) => {
|
|
41
|
+
stop(e);
|
|
42
|
+
onClose();
|
|
43
|
+
}, children: "\u00D7" })] }));
|
|
44
|
+
return typeof document === 'undefined'
|
|
45
|
+
? modal
|
|
46
|
+
: createPortal(modal, document.body);
|
|
16
47
|
}
|
|
@@ -22,7 +22,7 @@ import { useAuthData, useCurrentProfile } from '../../layout/IdentityContext.js'
|
|
|
22
22
|
import { useToast } from '../../layout/ToastProvider.js';
|
|
23
23
|
import { useCapabilities } from '../../server-data/index.js';
|
|
24
24
|
import { Avatar } from '../../profile/index.js';
|
|
25
|
-
import { Button } from '@openpeepshq/react-ui';
|
|
25
|
+
import { Button, cn } from '@openpeepshq/react-ui';
|
|
26
26
|
export function PollContent({ post }) {
|
|
27
27
|
const t = useT();
|
|
28
28
|
const { openpeepsApi } = useOpenpeeps();
|
|
@@ -38,9 +38,10 @@ export function PollContent({ post }) {
|
|
|
38
38
|
const pollData = post.data;
|
|
39
39
|
const { votes, voteCounts } = collectVotes(post);
|
|
40
40
|
const hasPollEnded = !!(pollData.expiresAt && isPast(pollData.expiresAt));
|
|
41
|
-
const
|
|
42
|
-
(votes.find((v) => v?.profile?.id === currentProfile.id)?.selection
|
|
43
|
-
|
|
41
|
+
const ownSelection = currentProfile
|
|
42
|
+
? (votes.find((v) => v?.profile?.id === currentProfile.id)?.selection ?? [])
|
|
43
|
+
: [];
|
|
44
|
+
const hasVoted = ownSelection.length > 0;
|
|
44
45
|
const canVote = !!(currentProfile && !hasPollEnded && !hasVoted);
|
|
45
46
|
const totalVotes = votes.length || 1;
|
|
46
47
|
const handleVote = async () => {
|
|
@@ -90,20 +91,38 @@ export function PollContent({ post }) {
|
|
|
90
91
|
}));
|
|
91
92
|
}
|
|
92
93
|
};
|
|
94
|
+
// The feed wraps each post in a link, so clicks inside the poll must not
|
|
95
|
+
// reach it. Clicks on the option controls are exempt: cancelling those
|
|
96
|
+
// reverts the checkbox/radio the browser just ticked, so a pending selection
|
|
97
|
+
// would never show. They are their own activation target, so the surrounding
|
|
98
|
+
// link does not navigate. Key events only stop propagation for the same
|
|
99
|
+
// reason — cancelling them swallows keyboard activation.
|
|
93
100
|
const stopFeedNavigation = (e) => {
|
|
94
|
-
e.
|
|
101
|
+
const target = e.target;
|
|
102
|
+
if (!target?.closest('input,label'))
|
|
103
|
+
e.preventDefault();
|
|
95
104
|
e.stopPropagation();
|
|
96
105
|
};
|
|
97
|
-
return (_jsxs("div", { className: "bg-surface
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
return (_jsxs("div", { className: "bg-surface rounded-lg px-4 py-4", onClick: stopFeedNavigation, onKeyDown: (e) => e.stopPropagation(), role: "presentation", children: [_jsx("div", { className: "space-y-4", children: pollData.options.map((option, index) => {
|
|
107
|
+
const optionId = `poll-${post.id}-option-${index}`;
|
|
108
|
+
const isOwnChoice = ownSelection.includes(index);
|
|
109
|
+
// Kept visible (checked, disabled) once the viewer has voted so their
|
|
110
|
+
// own selection stays readable while the results show.
|
|
111
|
+
const hasControl = canVote || hasVoted;
|
|
112
|
+
const labelClass = cn('text-base', isOwnChoice && 'font-medium', canVote && 'cursor-pointer');
|
|
113
|
+
return (_jsxs("div", { className: "flex items-center gap-2 py-2", children: [hasControl ? (pollData.multiple ? (_jsx("input", { type: "checkbox", id: optionId, disabled: !canVote, checked: canVote
|
|
114
|
+
? selectedPollOptions.includes(index)
|
|
115
|
+
: isOwnChoice, onChange: () => setSelectedPollOptions((prev) => prev.includes(index)
|
|
116
|
+
? prev.filter((i) => i !== index)
|
|
117
|
+
: [...prev, index]) })) : (_jsx("input", { type: "radio", id: optionId, name: `poll-${post.id}`, disabled: !canVote, checked: canVote ? selectedPollOption === index : isOwnChoice, onChange: () => setSelectedPollOption(index) }))) : null, _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [hasControl ? (_jsx("label", { htmlFor: optionId, className: labelClass, children: option.content })) : (_jsx("span", { className: labelClass, children: option.content })), _jsxs("div", { className: "flex items-center gap-2", children: [pollData.votersVisible ? (_jsx("div", { className: "flex -space-x-2", children: votes
|
|
118
|
+
.filter((v) => v.selection.includes(index))
|
|
119
|
+
.slice(0, 2)
|
|
120
|
+
.map((vote) => (_jsx(Avatar, { profile: vote.profile, size: 1.5 }, vote.profile.id))) })) : null, _jsx("span", { children: voteCounts?.[index] ?? 0 })] })] }), _jsx("div", { className: "bg-surface mt-2 h-2 overflow-hidden rounded-full", children: _jsx("div", { className: "bg-primary h-full rounded-full transition-all", style: {
|
|
121
|
+
width: `${((voteCounts[index] ?? 0) / totalVotes) * 100}%`,
|
|
122
|
+
} }) })] })] }, `${option.content}-${index}`));
|
|
123
|
+
}) }), canVote ? (_jsx(Button, { variant: "default", className: "mt-4", title: t('posts.poll.vote', { defaultValue: 'Vote' }), action: handleVote, children: t('posts.form.poll.submit', { defaultValue: 'Vote' }) })) : null, _jsxs("div", { className: "text-muted-foreground mt-4 flex flex-wrap items-center gap-3 text-sm", children: [_jsxs("span", { children: [votes.length || 0, " ", t('posts.vote.count', { defaultValue: 'votes' })] }), pollData.expiresAt ? (_jsx("span", { children: hasPollEnded
|
|
105
124
|
? t('posts.poll.ended', { defaultValue: 'Poll ended' })
|
|
106
|
-
: `${formatDistanceToNow(pollData.expiresAt)} ${t('posts.poll.timeLeft', { defaultValue: 'left' })}` })) : null, hasVoted && !hasPollEnded ? (_jsx(Button, { variant: "
|
|
125
|
+
: `${formatDistanceToNow(pollData.expiresAt)} ${t('posts.poll.timeLeft', { defaultValue: 'left' })}` })) : null, hasVoted && !hasPollEnded ? (_jsx(Button, { variant: "ghost", className: "h-auto min-h-0 px-0 font-semibold", title: t('posts.poll.undoVoteTitle', {
|
|
107
126
|
defaultValue: 'Undo your vote',
|
|
108
127
|
}), action: handleClearVote, children: t('posts.poll.undoVote', { defaultValue: 'Undo vote' }) })) : null] })] }));
|
|
109
128
|
}
|