@openpeepshq/rn-components 0.6.11 → 0.7.0
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/package.json +3 -3
- package/LICENSE.md +0 -21
- package/README.md +0 -63
- package/metro/css-interop-observable.js +0 -41
- package/metro/resolve-asset-source.js +0 -19
- package/metro.js +0 -67
- package/react-native.config.js +0 -5
- package/src/assets/audio/click-notification.wav +0 -0
- package/src/assets/images/audio-container.png +0 -0
- package/src/assets/images/black-ambition-2025-hero.png +0 -0
- package/src/assets/images/default-group-avatar.png +0 -0
- package/src/assets/images/event-placeholder.png +0 -0
- package/src/assets/images/group-header-placeholder.png +0 -0
- package/src/assets/images/jam-placeholder.png +0 -0
- package/src/assets/images/logo.webp +0 -0
- package/src/assets/images/profile-background-placeholder.png +0 -0
- package/src/assets/images/success.webp +0 -0
- package/src/assets/images/welcome-bg.webp +0 -0
- package/src/components/CapabilityMatrix.tsx +0 -218
- package/src/components/configuration/ConfigMenuButton.tsx +0 -48
- package/src/components/configuration/index.ts +0 -1
- package/src/components/conversations/ConversationMessageBubble.tsx +0 -51
- package/src/components/conversations/ConversationParticipantsModal.tsx +0 -46
- package/src/components/conversations/ConversationPreviewCard.tsx +0 -158
- package/src/components/conversations/ConversationProfileHeader.tsx +0 -28
- package/src/components/conversations/ConversationSettingsSheet.tsx +0 -81
- package/src/components/conversations/CreateNewConversationContext.tsx +0 -71
- package/src/components/conversations/DirectMessagesHeaderActions.tsx +0 -24
- package/src/components/conversations/MessageInThread.tsx +0 -131
- package/src/components/conversations/index.ts +0 -8
- package/src/components/custom/common/Loader.tsx +0 -67
- package/src/components/custom/common/agenda-tabs.tsx +0 -47
- package/src/components/custom/common/audio-player.tsx +0 -219
- package/src/components/custom/common/cached-image.tsx +0 -34
- package/src/components/custom/common/cached-video-player.tsx +0 -497
- package/src/components/custom/common/empty-state-container.tsx +0 -58
- package/src/components/custom/common/image-grid.tsx +0 -95
- package/src/components/custom/common/index.ts +0 -12
- package/src/components/custom/common/infinite-scroll-container.tsx +0 -99
- package/src/components/custom/common/media-upload-progress.tsx +0 -109
- package/src/components/custom/common/participant-avatar.tsx +0 -34
- package/src/components/custom/common/popover.tsx +0 -268
- package/src/components/custom/common/select.tsx +0 -215
- package/src/components/custom/date/formatter.ts +0 -24
- package/src/components/custom/date/index.ts +0 -3
- package/src/components/custom/date/timespan.tsx +0 -49
- package/src/components/custom/date/updating-date.tsx +0 -31
- package/src/components/custom/index.ts +0 -4
- package/src/components/custom/modals/common/base-sheet.tsx +0 -104
- package/src/components/custom/modals/common/index.ts +0 -3
- package/src/components/custom/modals/common/sheet-backdrop.tsx +0 -14
- package/src/components/custom/modals/common/sheet-footer.tsx +0 -59
- package/src/components/custom/modals/index.ts +0 -3
- package/src/components/custom/modals/media/alt-text-sheet.tsx +0 -90
- package/src/components/custom/modals/media/audio-picker-sheet.tsx +0 -180
- package/src/components/custom/modals/media/document-picker-sheet.tsx +0 -384
- package/src/components/custom/modals/media/image-picker-sheet.tsx +0 -200
- package/src/components/custom/modals/media/index.ts +0 -7
- package/src/components/custom/modals/media/record-audio-sheet.tsx +0 -227
- package/src/components/custom/modals/media/send-media-sheet.tsx +0 -278
- package/src/components/custom/modals/media/video-picker-sheet.tsx +0 -109
- package/src/components/custom/modals/settings/edit-notifications-sheet.tsx +0 -184
- package/src/components/custom/modals/settings/index.ts +0 -1
- package/src/components/custom/navigation/side-menu.tsx +0 -223
- package/src/components/form/HeaderAvatarInput.tsx +0 -108
- package/src/components/form/ImageInput.tsx +0 -86
- package/src/components/form/RadioSelect.tsx +0 -58
- package/src/components/form/TimeZoneSelect.tsx +0 -97
- package/src/components/form/index.ts +0 -4
- package/src/components/groups/AddGroupMemberModal.tsx +0 -58
- package/src/components/groups/AddGroupMembersButton.tsx +0 -39
- package/src/components/groups/ChangeGroupRolesModal.tsx +0 -121
- package/src/components/groups/ConfirmGroupExitModal.tsx +0 -66
- package/src/components/groups/ConfirmMemberRemovalModal.tsx +0 -73
- package/src/components/groups/DeleteGroupModal.tsx +0 -68
- package/src/components/groups/GroupAvatar.tsx +0 -73
- package/src/components/groups/GroupCapabilityMatrix.tsx +0 -40
- package/src/components/groups/GroupCard.tsx +0 -84
- package/src/components/groups/GroupFeed.tsx +0 -25
- package/src/components/groups/GroupForm.tsx +0 -148
- package/src/components/groups/GroupHeader.tsx +0 -72
- package/src/components/groups/GroupMembersList.tsx +0 -194
- package/src/components/groups/GroupNameFromId.tsx +0 -17
- package/src/components/groups/GroupOptionsMenu.tsx +0 -183
- package/src/components/groups/GroupShareMenu.tsx +0 -96
- package/src/components/groups/JoinGroupButton.tsx +0 -42
- package/src/components/groups/index.ts +0 -17
- package/src/components/icons/iconWithClassName.ts +0 -12
- package/src/components/icons/index.ts +0 -289
- package/src/components/icons/types.ts +0 -4
- package/src/components/index.ts +0 -12
- package/src/components/jams/CreateNewJam.tsx +0 -20
- package/src/components/jams/CreateNewJamContext.tsx +0 -36
- package/src/components/jams/DeleteJamModal.tsx +0 -69
- package/src/components/jams/JamActionsFooter.tsx +0 -85
- package/src/components/jams/JamAnimatedEmoji.tsx +0 -112
- package/src/components/jams/JamCallParticipant.tsx +0 -348
- package/src/components/jams/JamCapacityGate.tsx +0 -88
- package/src/components/jams/JamCard.tsx +0 -72
- package/src/components/jams/JamChatDrawer.tsx +0 -114
- package/src/components/jams/JamChatMessage.tsx +0 -86
- package/src/components/jams/JamConference.tsx +0 -69
- package/src/components/jams/JamDesktopFooter.tsx +0 -182
- package/src/components/jams/JamDetailsDrawer.tsx +0 -187
- package/src/components/jams/JamDeviceSelectors.tsx +0 -243
- package/src/components/jams/JamDrawer.tsx +0 -37
- package/src/components/jams/JamFooter.tsx +0 -241
- package/src/components/jams/JamGuestForm.tsx +0 -120
- package/src/components/jams/JamLobby.tsx +0 -203
- package/src/components/jams/JamObserverShell.tsx +0 -43
- package/src/components/jams/JamParticipantConference.tsx +0 -146
- package/src/components/jams/JamPeopleDrawer.tsx +0 -183
- package/src/components/jams/JamReactionMenu.tsx +0 -120
- package/src/components/jams/JamRequestJoin.tsx +0 -46
- package/src/components/jams/JamRoom.tsx +0 -194
- package/src/components/jams/JamRoomIndicators.tsx +0 -73
- package/src/components/jams/JamRoomPanel.tsx +0 -35
- package/src/components/jams/JamToolbarButton.tsx +0 -89
- package/src/components/jams/JamVideoCall.tsx +0 -50
- package/src/components/jams/JamVideoLayout.tsx +0 -401
- package/src/components/jams/LeaveCloseButton.tsx +0 -60
- package/src/components/jams/LiveJamsSection.tsx +0 -53
- package/src/components/jams/index.ts +0 -28
- package/src/components/jams/useParticipantConnection.ts +0 -43
- package/src/components/layout/AuthLayout.tsx +0 -156
- package/src/components/layout/ContentHeader.tsx +0 -62
- package/src/components/layout/HeaderActionButton.tsx +0 -23
- package/src/components/layout/HeaderMobile.tsx +0 -106
- package/src/components/layout/PlusButton.tsx +0 -34
- package/src/components/layout/RootLayout.tsx +0 -30
- package/src/components/layout/index.ts +0 -13
- package/src/components/layout/pageChrome.test.tsx +0 -147
- package/src/components/layout/pageChrome.tsx +0 -112
- package/src/components/markdown/OpenpeepsMarkdown.tsx +0 -129
- package/src/components/markdown/extensions/codeBlock.tsx +0 -63
- package/src/components/markdown/extensions/codeInline.tsx +0 -82
- package/src/components/markdown/extensions/hashtag.tsx +0 -77
- package/src/components/markdown/extensions/html.test.tsx +0 -172
- package/src/components/markdown/extensions/html.tsx +0 -116
- package/src/components/markdown/extensions/mention.tsx +0 -92
- package/src/components/markdown/index.ts +0 -2
- package/src/components/markdown/theme.ts +0 -59
- package/src/components/markdown/utils.ts +0 -34
- package/src/components/navigation/Base.tsx +0 -21
- package/src/components/navigation/auth-navigator.tsx +0 -47
- package/src/components/navigation/helpers.ts +0 -100
- package/src/components/navigation/index.tsx +0 -157
- package/src/components/navigation/main-navigator.tsx +0 -176
- package/src/components/navigation/nativeRouter.tsx +0 -255
- package/src/components/navigation/parent-back.ts +0 -139
- package/src/components/navigation/side-menu-drawer.tsx +0 -69
- package/src/components/navigation/side-menu-wrapper.tsx +0 -82
- package/src/components/navigation/tab-navigator.tsx +0 -254
- package/src/components/navigation/types/auth.ts +0 -23
- package/src/components/navigation/types/index.ts +0 -4
- package/src/components/navigation/types/main.ts +0 -154
- package/src/components/navigation/types/root.ts +0 -13
- package/src/components/navigation/types/tabs.ts +0 -51
- package/src/components/notifications/NotificationErrorBoundary.tsx +0 -40
- package/src/components/notifications/NotificationHeaderActions.tsx +0 -55
- package/src/components/notifications/NotificationItem.tsx +0 -80
- package/src/components/notifications/NotificationWrapper.tsx +0 -57
- package/src/components/notifications/NotificationsList.tsx +0 -103
- package/src/components/notifications/index.ts +0 -6
- package/src/components/notifications/types/Announcement.tsx +0 -51
- package/src/components/notifications/types/DirectMessage.tsx +0 -55
- package/src/components/notifications/types/Follow.tsx +0 -54
- package/src/components/notifications/types/GroupMemberExit.tsx +0 -52
- package/src/components/notifications/types/JamModerator.tsx +0 -38
- package/src/components/notifications/types/JamSpeaker.tsx +0 -38
- package/src/components/notifications/types/JamStarted.tsx +0 -39
- package/src/components/notifications/types/Mention.tsx +0 -56
- package/src/components/notifications/types/NewGroupInvitation.tsx +0 -53
- package/src/components/notifications/types/NewGroupMember.tsx +0 -57
- package/src/components/notifications/types/NewGroupPost.tsx +0 -41
- package/src/components/notifications/types/NewProfile.tsx +0 -53
- package/src/components/notifications/types/PollEnded.tsx +0 -55
- package/src/components/notifications/types/PollVote.tsx +0 -50
- package/src/components/notifications/types/Reaction.tsx +0 -49
- package/src/components/notifications/types/Reply.tsx +0 -52
- package/src/components/notifications/types/Repost.tsx +0 -49
- package/src/components/notifications/types/Rsvp.tsx +0 -48
- package/src/components/notifications/types/RsvpCanceled.tsx +0 -72
- package/src/components/notifications/types/index.ts +0 -19
- package/src/components/post/CompactReplyParent.tsx +0 -273
- package/src/components/post/EventViewSwitch.tsx +0 -42
- package/src/components/post/Feed.tsx +0 -110
- package/src/components/post/FeedFormatSwitch.tsx +0 -47
- package/src/components/post/FeedPost.tsx +0 -115
- package/src/components/post/FeedPostContent.tsx +0 -52
- package/src/components/post/FullPostLayout.tsx +0 -54
- package/src/components/post/Markdown.tsx +0 -8
- package/src/components/post/NewEventButton.tsx +0 -61
- package/src/components/post/NewNoteButton.tsx +0 -48
- package/src/components/post/NewResourceButton.tsx +0 -57
- package/src/components/post/PinnedPost.tsx +0 -42
- package/src/components/post/PostDetail.tsx +0 -55
- package/src/components/post/ReplyBox.tsx +0 -36
- package/src/components/post/VideoPlayOverlay.tsx +0 -23
- package/src/components/post/feed/events/EventsCalendar.tsx +0 -213
- package/src/components/post/feed/events/EventsFeed.tsx +0 -91
- package/src/components/post/feed/events/EventsView.tsx +0 -30
- package/src/components/post/feed/events/index.ts +0 -3
- package/src/components/post/feed/threaded/ThreadPost.tsx +0 -76
- package/src/components/post/feed/threaded/ThreadedFeed.tsx +0 -47
- package/src/components/post/feed/threaded/index.ts +0 -2
- package/src/components/post/helpers.ts +0 -54
- package/src/components/post/index.ts +0 -21
- package/src/components/post/pieces/Attachments.tsx +0 -153
- package/src/components/post/pieces/AudioAttachment.tsx +0 -57
- package/src/components/post/pieces/DocumentAttachment.tsx +0 -41
- package/src/components/post/pieces/EventLocation.tsx +0 -46
- package/src/components/post/pieces/EventMenu.tsx +0 -126
- package/src/components/post/pieces/EventOccurrenceList.tsx +0 -131
- package/src/components/post/pieces/EventRsvpButton.tsx +0 -177
- package/src/components/post/pieces/EventRsvpList.tsx +0 -277
- package/src/components/post/pieces/EventRsvpScopeDialog.tsx +0 -238
- package/src/components/post/pieces/FeedPostStats.tsx +0 -75
- package/src/components/post/pieces/FeedThreadPreview.tsx +0 -88
- package/src/components/post/pieces/GalleryModal.tsx +0 -115
- package/src/components/post/pieces/ParticipantsCard.tsx +0 -20
- package/src/components/post/pieces/PollContent.tsx +0 -219
- package/src/components/post/pieces/PostActions.tsx +0 -81
- package/src/components/post/pieces/PostInfoHeader.tsx +0 -52
- package/src/components/post/pieces/PostMenu.tsx +0 -477
- package/src/components/post/pieces/PostReactionHeader.tsx +0 -120
- package/src/components/post/pieces/ShareMenu.tsx +0 -127
- package/src/components/post/pieces/UnreadPostIndicator.tsx +0 -34
- package/src/components/post/pieces/VideoPlayer.tsx +0 -30
- package/src/components/post/pieces/VisibilityDisplay.tsx +0 -43
- package/src/components/post/pieces/gallery/GalleryAudio.tsx +0 -20
- package/src/components/post/pieces/gallery/GalleryDocument.tsx +0 -35
- package/src/components/post/pieces/gallery/GalleryImage.tsx +0 -15
- package/src/components/post/pieces/gallery/GalleryVideo.tsx +0 -39
- package/src/components/post/pieces/gallery/index.ts +0 -4
- package/src/components/post/pieces/index.ts +0 -24
- package/src/components/post/pieces/modals/CancelEventModal.tsx +0 -60
- package/src/components/post/pieces/modals/DeleteEventModal.tsx +0 -60
- package/src/components/post/pieces/modals/DeletePostModal.tsx +0 -54
- package/src/components/post/pieces/modals/PostOptionsSheet.tsx +0 -59
- package/src/components/post/pieces/modals/ReactionsModal.tsx +0 -45
- package/src/components/post/pieces/modals/RepostModal.tsx +0 -56
- package/src/components/post/pieces/modals/index.ts +0 -6
- package/src/components/post/post-form/ArticleForm.tsx +0 -101
- package/src/components/post/post-form/ArticlePreviewSheet.tsx +0 -24
- package/src/components/post/post-form/AttachmentCard.tsx +0 -119
- package/src/components/post/post-form/ComposeAttachments.tsx +0 -126
- package/src/components/post/post-form/ComposePreviewLinks.tsx +0 -21
- package/src/components/post/post-form/DateSheet.tsx +0 -154
- package/src/components/post/post-form/DescriptionEditModal.tsx +0 -58
- package/src/components/post/post-form/EditPostModalContext.tsx +0 -49
- package/src/components/post/post-form/EventForm.tsx +0 -416
- package/src/components/post/post-form/EventTypeSwitcher.tsx +0 -164
- package/src/components/post/post-form/Footer.tsx +0 -61
- package/src/components/post/post-form/NewPostModalContext.tsx +0 -77
- package/src/components/post/post-form/OpenpeepsMarkdownInput.tsx +0 -218
- package/src/components/post/post-form/PollComposerFields.tsx +0 -141
- package/src/components/post/post-form/PostAudienceSelector.tsx +0 -82
- package/src/components/post/post-form/PostForm.tsx +0 -187
- package/src/components/post/post-form/PostTypeSwitcher.tsx +0 -125
- package/src/components/post/post-form/ReplyModal.tsx +0 -40
- package/src/components/post/post-form/ReplyModalContext.tsx +0 -24
- package/src/components/post/post-form/ResourceForm.tsx +0 -241
- package/src/components/post/post-form/VisibilitySelector.tsx +0 -60
- package/src/components/post/post-form/VisibilitySheet.tsx +0 -239
- package/src/components/post/post-form/constants.ts +0 -47
- package/src/components/post/post-form/index.ts +0 -23
- package/src/components/post/types/Article.tsx +0 -55
- package/src/components/post/types/Event.tsx +0 -79
- package/src/components/post/types/Note.tsx +0 -29
- package/src/components/post/types/Poll.tsx +0 -34
- package/src/components/post/types/article/CardArticle.tsx +0 -44
- package/src/components/post/types/article/FullArticle.tsx +0 -56
- package/src/components/post/types/article/index.ts +0 -2
- package/src/components/post/types/event/CardEvent.tsx +0 -138
- package/src/components/post/types/event/FullEvent.tsx +0 -755
- package/src/components/post/types/event/ProfileEventRelationship.tsx +0 -56
- package/src/components/post/types/event/index.ts +0 -3
- package/src/components/post/types/index.ts +0 -9
- package/src/components/post/types/note/FullNote.tsx +0 -15
- package/src/components/post/types/note/index.ts +0 -1
- package/src/components/post/types/poll/FullPoll.tsx +0 -26
- package/src/components/post/types/poll/index.ts +0 -1
- package/src/components/post/types/resource/FullResource.tsx +0 -177
- package/src/components/preview-link/AccessDenied.tsx +0 -44
- package/src/components/preview-link/LocalPreviewLink.tsx +0 -40
- package/src/components/preview-link/PreviewLink.tsx +0 -27
- package/src/components/preview-link/RemotePreviewLink.tsx +0 -76
- package/src/components/preview-link/helpers.ts +0 -38
- package/src/components/preview-link/index.ts +0 -7
- package/src/components/preview-link/local/GroupPreview.tsx +0 -57
- package/src/components/preview-link/local/JamPreview.tsx +0 -40
- package/src/components/preview-link/local/PostPreview.tsx +0 -40
- package/src/components/profile/Avatar.tsx +0 -90
- package/src/components/profile/AvatarWithName.tsx +0 -18
- package/src/components/profile/EditProfileForm.tsx +0 -380
- package/src/components/profile/FollowUnfollowButton.tsx +0 -83
- package/src/components/profile/ProfileActivitySummary.tsx +0 -129
- package/src/components/profile/ProfileBadge.tsx +0 -52
- package/src/components/profile/ProfileCard.tsx +0 -122
- package/src/components/profile/ProfileFromId.tsx +0 -23
- package/src/components/profile/ProfileHeader.tsx +0 -107
- package/src/components/profile/ProfileLink.tsx +0 -35
- package/src/components/profile/ProfilePageAction.tsx +0 -193
- package/src/components/profile/ProfilePieces.tsx +0 -191
- package/src/components/profile/ProfilePostsAndReplies.tsx +0 -108
- package/src/components/profile/ProfileSelector.tsx +0 -210
- package/src/components/profile/ProfileSheet.tsx +0 -48
- package/src/components/profile/ProfileStats.tsx +0 -47
- package/src/components/profile/ProfileWithActionCard.tsx +0 -35
- package/src/components/profile/ProfilesInput.tsx +0 -81
- package/src/components/profile/ReportProfileOrPostModal.tsx +0 -228
- package/src/components/profile/index.ts +0 -19
- package/src/components/resources/ResourceCard.tsx +0 -289
- package/src/components/resources/ResourceLibrary.tsx +0 -371
- package/src/components/resources/index.ts +0 -4
- package/src/components/ui/alert.tsx +0 -87
- package/src/components/ui/avatar.tsx +0 -91
- package/src/components/ui/badge.tsx +0 -36
- package/src/components/ui/bottom-sheet.tsx +0 -253
- package/src/components/ui/button.tsx +0 -101
- package/src/components/ui/calendar.tsx +0 -117
- package/src/components/ui/card.tsx +0 -87
- package/src/components/ui/checkbox.tsx +0 -35
- package/src/components/ui/combobox.tsx +0 -229
- package/src/components/ui/dropdown-menu.tsx +0 -350
- package/src/components/ui/form.tsx +0 -716
- package/src/components/ui/index.ts +0 -49
- package/src/components/ui/input.tsx +0 -25
- package/src/components/ui/label.tsx +0 -33
- package/src/components/ui/loading-spinner.tsx +0 -24
- package/src/components/ui/popup-menu-button.tsx +0 -99
- package/src/components/ui/popup-menu-section.tsx +0 -21
- package/src/components/ui/popup-menu-separator.tsx +0 -10
- package/src/components/ui/popup-menu.tsx +0 -75
- package/src/components/ui/progress.tsx +0 -83
- package/src/components/ui/radio-group.tsx +0 -42
- package/src/components/ui/select.tsx +0 -200
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/skeleton.tsx +0 -39
- package/src/components/ui/svg-image.tsx +0 -89
- package/src/components/ui/switch.tsx +0 -95
- package/src/components/ui/tabs.tsx +0 -93
- package/src/components/ui/text.tsx +0 -28
- package/src/components/ui/textarea.tsx +0 -39
- package/src/components/ui/themed-safe-area-view.tsx +0 -25
- package/src/components/ui/themed-text.tsx +0 -28
- package/src/components/ui/themed-view.tsx +0 -24
- package/src/components/ui/tooltip.tsx +0 -41
- package/src/contexts/drawer-context.tsx +0 -38
- package/src/contexts/openpeeps-provider.tsx +0 -135
- package/src/global.css +0 -53
- package/src/hooks/helper.ts +0 -26
- package/src/hooks/index.ts +0 -5
- package/src/hooks/use-cached-media-uri.ts +0 -59
- package/src/hooks/use-controlled-sheet.ts +0 -16
- package/src/hooks/use-notification-badge-reset.ts +0 -93
- package/src/hooks/use-post-view-ref.ts +0 -65
- package/src/i18n/index.ts +0 -49
- package/src/index.ts +0 -42
- package/src/lib/attachmentHelpers.ts +0 -15
- package/src/lib/auth.ts +0 -17
- package/src/lib/bottom-sheet-ref.ts +0 -30
- package/src/lib/constants.ts +0 -14
- package/src/lib/credentialsStore.ts +0 -20
- package/src/lib/downloadFile.ts +0 -12
- package/src/lib/livekit/useStableLiveKitRoom.ts +0 -172
- package/src/lib/media-permissions.ts +0 -90
- package/src/lib/media-url.ts +0 -51
- package/src/lib/mediaUriHelpers.ts +0 -94
- package/src/lib/notification-helpers.ts +0 -17
- package/src/lib/notifications-screen-state.ts +0 -21
- package/src/lib/polyfills/customEvent.ts +0 -40
- package/src/lib/post.ts +0 -175
- package/src/lib/push-notification-navigation.ts +0 -11
- package/src/lib/push-notifications-background.ts +0 -13
- package/src/lib/push-notifications.ts +0 -247
- package/src/lib/uploadMedia.ts +0 -191
- package/src/lib/utils.ts +0 -236
- package/src/nativewind-env.d.ts +0 -1
- package/src/pages/About.tsx +0 -27
- package/src/pages/CodeOfConduct.tsx +0 -24
- package/src/pages/Explore.tsx +0 -297
- package/src/pages/Members.tsx +0 -118
- package/src/pages/NotFound.tsx +0 -36
- package/src/pages/Notifications.tsx +0 -39
- package/src/pages/PostDetail.tsx +0 -61
- package/src/pages/Profile.tsx +0 -77
- package/src/pages/Tags.tsx +0 -114
- package/src/pages/VideoPlayer.tsx +0 -16
- package/src/pages/Welcome.tsx +0 -214
- package/src/pages/articles/Edit.tsx +0 -72
- package/src/pages/articles/Index.tsx +0 -31
- package/src/pages/articles/New.tsx +0 -55
- package/src/pages/auth/Login.tsx +0 -148
- package/src/pages/auth/Register.tsx +0 -271
- package/src/pages/auth/RegisterInvitation.tsx +0 -8
- package/src/pages/auth/RequestResetPassword.tsx +0 -102
- package/src/pages/auth/ResetPassword.tsx +0 -48
- package/src/pages/auth/Success.tsx +0 -104
- package/src/pages/auth/ValidateEmail.tsx +0 -80
- package/src/pages/auth/Welcome.tsx +0 -64
- package/src/pages/conversations/Index.tsx +0 -168
- package/src/pages/conversations/Info.tsx +0 -99
- package/src/pages/conversations/New.tsx +0 -135
- package/src/pages/conversations/NewDraft.tsx +0 -102
- package/src/pages/conversations/Show.tsx +0 -261
- package/src/pages/events/Edit.tsx +0 -74
- package/src/pages/events/Index.tsx +0 -99
- package/src/pages/events/My.tsx +0 -60
- package/src/pages/events/New.tsx +0 -51
- package/src/pages/feeds/Bookmarks.tsx +0 -47
- package/src/pages/feeds/Local.tsx +0 -45
- package/src/pages/feeds/My.tsx +0 -37
- package/src/pages/groups/Edit.tsx +0 -58
- package/src/pages/groups/EditInfo.tsx +0 -79
- package/src/pages/groups/EditRoles.tsx +0 -84
- package/src/pages/groups/Index.tsx +0 -159
- package/src/pages/groups/Info.tsx +0 -197
- package/src/pages/groups/Members.tsx +0 -55
- package/src/pages/groups/New.tsx +0 -80
- package/src/pages/groups/Show.tsx +0 -203
- package/src/pages/index.ts +0 -66
- package/src/pages/jams/Event.tsx +0 -49
- package/src/pages/jams/Index.tsx +0 -137
- package/src/pages/jams/My.tsx +0 -4
- package/src/pages/jams/New.tsx +0 -121
- package/src/pages/posts/Edit.tsx +0 -157
- package/src/pages/posts/New.tsx +0 -334
- package/src/pages/posts/Reply.tsx +0 -351
- package/src/pages/profile/Followers.tsx +0 -45
- package/src/pages/profile/Following.tsx +0 -44
- package/src/pages/resources/Edit.tsx +0 -72
- package/src/pages/resources/Index.tsx +0 -25
- package/src/pages/resources/New.tsx +0 -55
- package/src/pages/settings/AccessTokens.tsx +0 -276
- package/src/pages/settings/Account.tsx +0 -272
- package/src/pages/settings/Blocked.tsx +0 -81
- package/src/pages/settings/Feed.tsx +0 -78
- package/src/pages/settings/Index.tsx +0 -75
- package/src/pages/settings/Language.tsx +0 -81
- package/src/pages/settings/NotificationPreferences.tsx +0 -131
- package/src/pages/settings/Notifications.tsx +0 -36
- package/src/pages/settings/PublicProfile.tsx +0 -20
- package/src/pages/settings/PushEnabledDevices.tsx +0 -151
- package/src/pages/settings/Theme.tsx +0 -106
- package/src/pages/settings/Timezone.tsx +0 -75
- package/src/stores/useAppImagesStore.ts +0 -15
- package/src/stores/useLocalPostStore.ts +0 -62
- package/src/stores/useNewConversationStore.ts +0 -39
- package/src/theme/OpenPeepsThemeProvider.tsx +0 -98
- package/src/theme/defaults.ts +0 -40
- package/src/theme/types.ts +0 -37
- package/src/theme/utils.ts +0 -62
- package/src/types/env.d.ts +0 -11
- package/src/types/goto.ts +0 -9
- package/src/types/markdown-plugin.ts +0 -17
- package/src/types/react-native-convert-ph-asset.d.ts +0 -24
- package/src/types.ts +0 -56
- package/src/utils/media-cache.ts +0 -178
- package/tailwind.config.js +0 -128
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
createContext,
|
|
3
|
-
useCallback,
|
|
4
|
-
useContext,
|
|
5
|
-
useMemo,
|
|
6
|
-
type ReactNode,
|
|
7
|
-
} from 'react';
|
|
8
|
-
import type { GroupWithMeta, VisibilityType } from '@openpeepshq/common';
|
|
9
|
-
import { navigationRef } from '../../navigation/nativeRouter';
|
|
10
|
-
import {
|
|
11
|
-
postDataDefaults,
|
|
12
|
-
useLocalPostStore,
|
|
13
|
-
} from '../../../stores/useLocalPostStore';
|
|
14
|
-
|
|
15
|
-
export interface NewPostOptions {
|
|
16
|
-
visibility?: VisibilityType;
|
|
17
|
-
group?: GroupWithMeta;
|
|
18
|
-
initialContent?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface NewPostModalContextValue {
|
|
22
|
-
openNewPost: (options?: NewPostOptions) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const NewPostModalContext = createContext<NewPostModalContextValue | null>(
|
|
26
|
-
null
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Native counterpart of the web modal: seeds the composer store and opens the
|
|
31
|
-
* full-screen `NewPost` tab instead of rendering a dialog.
|
|
32
|
-
*/
|
|
33
|
-
export const NewPostModalProvider = ({ children }: { children: ReactNode }) => {
|
|
34
|
-
const setPostData = useLocalPostStore((state) => state.setPostData);
|
|
35
|
-
|
|
36
|
-
const openNewPost = useCallback(
|
|
37
|
-
(options?: NewPostOptions) => {
|
|
38
|
-
const base = postDataDefaults();
|
|
39
|
-
setPostData({
|
|
40
|
-
...base,
|
|
41
|
-
visibility: options?.group
|
|
42
|
-
? 'group'
|
|
43
|
-
: (options?.visibility ?? base.visibility),
|
|
44
|
-
groupId: options?.group?.id,
|
|
45
|
-
data: { type: 'note', content: options?.initialContent ?? '' },
|
|
46
|
-
});
|
|
47
|
-
if (!navigationRef.isReady()) return;
|
|
48
|
-
navigationRef.navigate('Main', {
|
|
49
|
-
screen: 'TabNavigator',
|
|
50
|
-
params: {
|
|
51
|
-
screen: 'NewPost',
|
|
52
|
-
params: {
|
|
53
|
-
originatorId: options?.group?.id,
|
|
54
|
-
triggeredFrom: options?.group ? 'group' : undefined,
|
|
55
|
-
withContent: !!options?.initialContent,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
[setPostData]
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const value = useMemo(() => ({ openNewPost }), [openNewPost]);
|
|
64
|
-
return (
|
|
65
|
-
<NewPostModalContext.Provider value={value}>
|
|
66
|
-
{children}
|
|
67
|
-
</NewPostModalContext.Provider>
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const useNewPostModal = () => {
|
|
72
|
-
const ctx = useContext(NewPostModalContext);
|
|
73
|
-
if (!ctx) {
|
|
74
|
-
throw new Error('useNewPostModal must be used within NewPostModalProvider');
|
|
75
|
-
}
|
|
76
|
-
return ctx;
|
|
77
|
-
};
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Linking,
|
|
4
|
-
Pressable,
|
|
5
|
-
ScrollView,
|
|
6
|
-
View,
|
|
7
|
-
type NativeSyntheticEvent,
|
|
8
|
-
type TextInputSelectionChangeEventData,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import type { PublicProfile } from '@openpeepshq/common';
|
|
11
|
-
import { useOpenpeeps } from '@openpeepshq/react';
|
|
12
|
-
import { useTranslation } from 'react-i18next';
|
|
13
|
-
import { OpenpeepsMarkdown } from '../../markdown/index';
|
|
14
|
-
import { ProfileAvatar } from '../../profile/Avatar';
|
|
15
|
-
import { Button } from '../../ui/button';
|
|
16
|
-
import { Textarea } from '../../ui/textarea';
|
|
17
|
-
import { ThemedText } from '../../ui/themed-text';
|
|
18
|
-
import { toAbsoluteMediaUrl } from '../../../lib/media-url';
|
|
19
|
-
import { cn, maxContentLength } from '../../../lib/utils';
|
|
20
|
-
|
|
21
|
-
export interface OpenpeepsMarkdownInputProps {
|
|
22
|
-
value: string;
|
|
23
|
-
onChange: (value: string) => void;
|
|
24
|
-
/** Character budget; the counter turns red once exceeded. */
|
|
25
|
-
maxLength?: number;
|
|
26
|
-
placeholder?: string;
|
|
27
|
-
rows?: number;
|
|
28
|
-
/** Show the preview toggle button (mirrors web `previewButton`). */
|
|
29
|
-
previewButton?: boolean;
|
|
30
|
-
/** Extra classes for the textarea. */
|
|
31
|
-
className?: string;
|
|
32
|
-
testId?: string;
|
|
33
|
-
autoFocus?: boolean;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const mentionQueryFrom = (text: string, cursor: number) => {
|
|
37
|
-
const match = text.slice(0, cursor).match(/@([a-zA-Z0-9_-]*)$/);
|
|
38
|
-
return match ? (match[1] ?? '') : null;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Markdown editor mirroring the web `OpenpeepsMarkdownInput`: a textarea
|
|
43
|
-
* with @-mention autocomplete, a preview toggle that renders the markdown,
|
|
44
|
-
* and a character counter.
|
|
45
|
-
*/
|
|
46
|
-
export const OpenpeepsMarkdownInput = ({
|
|
47
|
-
value,
|
|
48
|
-
onChange,
|
|
49
|
-
maxLength = maxContentLength,
|
|
50
|
-
placeholder,
|
|
51
|
-
rows = 5,
|
|
52
|
-
previewButton = true,
|
|
53
|
-
className,
|
|
54
|
-
testId,
|
|
55
|
-
autoFocus = false,
|
|
56
|
-
}: OpenpeepsMarkdownInputProps) => {
|
|
57
|
-
const { t } = useTranslation();
|
|
58
|
-
const { openpeepsApi } = useOpenpeeps();
|
|
59
|
-
const [query, setQuery] = useState('');
|
|
60
|
-
const [open, setOpen] = useState(false);
|
|
61
|
-
const [showPreview, setShowPreview] = useState(false);
|
|
62
|
-
const valueRef = useRef(value);
|
|
63
|
-
const cursorRef = useRef(value.length);
|
|
64
|
-
|
|
65
|
-
valueRef.current = value;
|
|
66
|
-
|
|
67
|
-
const profilesQuery = openpeepsApi.useSearchProfiles(query);
|
|
68
|
-
|
|
69
|
-
const profiles = useMemo(
|
|
70
|
-
() =>
|
|
71
|
-
(profilesQuery.data?.pages ?? [])
|
|
72
|
-
.flat()
|
|
73
|
-
.map((item) => item.data)
|
|
74
|
-
.slice(0, 6),
|
|
75
|
-
[profilesQuery.data]
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const showMentions = open && query.length >= 1 && profiles.length > 0;
|
|
79
|
-
|
|
80
|
-
const updateMentionState = (text: string, cursor: number) => {
|
|
81
|
-
const mentionQuery = mentionQueryFrom(text, cursor);
|
|
82
|
-
if (mentionQuery !== null) {
|
|
83
|
-
setQuery(mentionQuery);
|
|
84
|
-
setOpen(true);
|
|
85
|
-
} else {
|
|
86
|
-
setOpen(false);
|
|
87
|
-
setQuery('');
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const handleChange = (next: string) => {
|
|
92
|
-
onChange(next);
|
|
93
|
-
valueRef.current = next;
|
|
94
|
-
const cursor = Math.min(
|
|
95
|
-
next.length,
|
|
96
|
-
Math.max(0, cursorRef.current + (next.length - value.length))
|
|
97
|
-
);
|
|
98
|
-
cursorRef.current = cursor;
|
|
99
|
-
updateMentionState(next, cursor);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const handleSelectionChange = (
|
|
103
|
-
event: NativeSyntheticEvent<TextInputSelectionChangeEventData>
|
|
104
|
-
) => {
|
|
105
|
-
const cursor = event.nativeEvent.selection.start;
|
|
106
|
-
cursorRef.current = cursor;
|
|
107
|
-
updateMentionState(valueRef.current, cursor);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const insertMention = (profile: PublicProfile) => {
|
|
111
|
-
const cursor = cursorRef.current;
|
|
112
|
-
const before = value.slice(0, cursor);
|
|
113
|
-
const after = value.slice(cursor);
|
|
114
|
-
const replaced = before.replace(
|
|
115
|
-
/@([a-zA-Z0-9_-]*)$/,
|
|
116
|
-
`@${profile.handle} `
|
|
117
|
-
);
|
|
118
|
-
onChange(`${replaced}${after}`);
|
|
119
|
-
setOpen(false);
|
|
120
|
-
setQuery('');
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const openMarkdownHelp = () => {
|
|
124
|
-
const url = toAbsoluteMediaUrl('/docs/user/markdown');
|
|
125
|
-
if (url) {
|
|
126
|
-
void Linking.openURL(url);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const overLimit = value.length > maxLength;
|
|
131
|
-
|
|
132
|
-
return (
|
|
133
|
-
<View className="relative w-full">
|
|
134
|
-
{showPreview ? (
|
|
135
|
-
<View className="min-h-[80px] rounded-md border border-border bg-background p-3">
|
|
136
|
-
<Button
|
|
137
|
-
size="sm"
|
|
138
|
-
variant="outline"
|
|
139
|
-
className="mb-3 self-start"
|
|
140
|
-
onPress={() => setShowPreview(false)}
|
|
141
|
-
>
|
|
142
|
-
<ThemedText>
|
|
143
|
-
{t('form.edit', { defaultValue: 'Back to Editing' })}
|
|
144
|
-
</ThemedText>
|
|
145
|
-
</Button>
|
|
146
|
-
<OpenpeepsMarkdown source={value} linkPreviewMode="none" />
|
|
147
|
-
</View>
|
|
148
|
-
) : (
|
|
149
|
-
<>
|
|
150
|
-
<View className="flex-row items-center gap-3 pb-2">
|
|
151
|
-
{previewButton ? (
|
|
152
|
-
<Button
|
|
153
|
-
size="sm"
|
|
154
|
-
variant="outline"
|
|
155
|
-
onPress={() => setShowPreview(true)}
|
|
156
|
-
>
|
|
157
|
-
<ThemedText>
|
|
158
|
-
{t('form.preview', { defaultValue: 'Preview' })}
|
|
159
|
-
</ThemedText>
|
|
160
|
-
</Button>
|
|
161
|
-
) : null}
|
|
162
|
-
<Pressable onPress={openMarkdownHelp} accessibilityRole="link">
|
|
163
|
-
<ThemedText className="text-sm text-primary">
|
|
164
|
-
{t('form.markdownHelp', { defaultValue: 'Formatting help' })}
|
|
165
|
-
</ThemedText>
|
|
166
|
-
</Pressable>
|
|
167
|
-
</View>
|
|
168
|
-
|
|
169
|
-
{showMentions ? (
|
|
170
|
-
<ScrollView
|
|
171
|
-
keyboardShouldPersistTaps="handled"
|
|
172
|
-
className="mb-2 max-h-48 rounded-md border border-border bg-surface"
|
|
173
|
-
nestedScrollEnabled
|
|
174
|
-
>
|
|
175
|
-
{profiles.map((profile) => (
|
|
176
|
-
<Pressable
|
|
177
|
-
key={profile.id}
|
|
178
|
-
className="flex-row items-center gap-x-2 px-3 py-2"
|
|
179
|
-
onPress={() => insertMention(profile)}
|
|
180
|
-
>
|
|
181
|
-
<ProfileAvatar profile={profile} className="size-8" />
|
|
182
|
-
<View>
|
|
183
|
-
<ThemedText className="font-semibold">
|
|
184
|
-
{profile.displayName || profile.handle}
|
|
185
|
-
</ThemedText>
|
|
186
|
-
<ThemedText className="text-sm text-muted-foreground">
|
|
187
|
-
@{profile.handle}
|
|
188
|
-
</ThemedText>
|
|
189
|
-
</View>
|
|
190
|
-
</Pressable>
|
|
191
|
-
))}
|
|
192
|
-
</ScrollView>
|
|
193
|
-
) : null}
|
|
194
|
-
|
|
195
|
-
<Textarea
|
|
196
|
-
autoFocus={autoFocus}
|
|
197
|
-
numberOfLines={rows}
|
|
198
|
-
value={value}
|
|
199
|
-
maxLength={maxLength}
|
|
200
|
-
placeholder={placeholder ?? t('posts.form.content')}
|
|
201
|
-
onChangeText={handleChange}
|
|
202
|
-
onSelectionChange={handleSelectionChange}
|
|
203
|
-
testID={testId}
|
|
204
|
-
className={cn('min-h-[80px]', className)}
|
|
205
|
-
/>
|
|
206
|
-
</>
|
|
207
|
-
)}
|
|
208
|
-
|
|
209
|
-
<View className="w-full px-2 pt-1">
|
|
210
|
-
<ThemedText
|
|
211
|
-
className={cn('text-right text-sm', overLimit && 'text-destructive')}
|
|
212
|
-
>
|
|
213
|
-
{value.length} / {maxLength}
|
|
214
|
-
</ThemedText>
|
|
215
|
-
</View>
|
|
216
|
-
</View>
|
|
217
|
-
);
|
|
218
|
-
};
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
2
|
-
import { View, TouchableOpacity } from 'react-native';
|
|
3
|
-
import { FormField, FormInput, FormCheckbox } from '../../ui/form';
|
|
4
|
-
import { Button } from '../../ui/button';
|
|
5
|
-
import { ThemedText } from '../../ui/themed-text';
|
|
6
|
-
import { UseFormReturn } from 'react-hook-form';
|
|
7
|
-
import { PlusIcon, MinusIcon } from '../../icons/index';
|
|
8
|
-
import { formatDateTime } from '../../../lib/utils';
|
|
9
|
-
import { useTranslation } from 'react-i18next';
|
|
10
|
-
import { POLL_OPTION_MAX_LENGTH, PostCreationData } from '@openpeepshq/common';
|
|
11
|
-
import { DateSheet } from './DateSheet';
|
|
12
|
-
import { BottomSheetModal } from '@gorhom/bottom-sheet';
|
|
13
|
-
|
|
14
|
-
interface PollFormProps {
|
|
15
|
-
form: UseFormReturn<PostCreationData>;
|
|
16
|
-
postData: PostCreationData;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const PollComposerFields: React.FC<PollFormProps> = ({
|
|
20
|
-
form,
|
|
21
|
-
postData,
|
|
22
|
-
}) => {
|
|
23
|
-
const options =
|
|
24
|
-
postData.data.type === 'question' ? postData.data.options : [];
|
|
25
|
-
const expiresAt =
|
|
26
|
-
postData.data.type === 'question' ? postData.data.expiresAt : '';
|
|
27
|
-
const { t } = useTranslation();
|
|
28
|
-
const pollExpirationModalRef = useRef<BottomSheetModal>(null);
|
|
29
|
-
const handlePollExpirationModal = () => {
|
|
30
|
-
pollExpirationModalRef.current?.present();
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<View className="pt-4 w-full flex flex-col gap-4">
|
|
35
|
-
{options?.map((_, index) => (
|
|
36
|
-
<View key={index} className="flex-row gap-x-1 items-center w-full">
|
|
37
|
-
<FormField
|
|
38
|
-
control={form.control}
|
|
39
|
-
name={`data.options.${index}.content`}
|
|
40
|
-
render={({ field }) => (
|
|
41
|
-
<FormInput
|
|
42
|
-
containerClassName="flex-grow"
|
|
43
|
-
className="px-4 py-2 w-full rounded-lg"
|
|
44
|
-
maxLength={POLL_OPTION_MAX_LENGTH}
|
|
45
|
-
placeholder={t('posts.form.poll.option', { number: index + 1 })}
|
|
46
|
-
{...field}
|
|
47
|
-
/>
|
|
48
|
-
)}
|
|
49
|
-
/>
|
|
50
|
-
<View className="flex-0 w-10">
|
|
51
|
-
{index === options.length - 2 && options.length > 2 && (
|
|
52
|
-
<Button
|
|
53
|
-
onPress={() =>
|
|
54
|
-
form.setValue(
|
|
55
|
-
'data.options',
|
|
56
|
-
options.filter((_option, i) => i !== index)
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
variant={'ghost'}
|
|
60
|
-
size={'sm'}
|
|
61
|
-
>
|
|
62
|
-
<MinusIcon size={20} className="text-foreground" />
|
|
63
|
-
</Button>
|
|
64
|
-
)}
|
|
65
|
-
{index === options.length - 1 && (
|
|
66
|
-
<Button
|
|
67
|
-
onPress={() =>
|
|
68
|
-
form.setValue('data.options', [
|
|
69
|
-
...options,
|
|
70
|
-
{ type: 'note', content: '' },
|
|
71
|
-
])
|
|
72
|
-
}
|
|
73
|
-
variant={'ghost'}
|
|
74
|
-
size={'sm'}
|
|
75
|
-
>
|
|
76
|
-
<PlusIcon size={20} className="text-foreground" />
|
|
77
|
-
</Button>
|
|
78
|
-
)}
|
|
79
|
-
</View>
|
|
80
|
-
</View>
|
|
81
|
-
))}
|
|
82
|
-
|
|
83
|
-
<View className="mt-6">
|
|
84
|
-
<ThemedText className="text-base mb-2">
|
|
85
|
-
{t('posts.form.poll.duration')}
|
|
86
|
-
</ThemedText>
|
|
87
|
-
|
|
88
|
-
<TouchableOpacity
|
|
89
|
-
onPress={handlePollExpirationModal}
|
|
90
|
-
className="h-14 px-4 border border-input rounded-lg justify-center"
|
|
91
|
-
>
|
|
92
|
-
<ThemedText className="text-muted-foreground">
|
|
93
|
-
{expiresAt
|
|
94
|
-
? formatDateTime(new Date(expiresAt))
|
|
95
|
-
: t('posts.form.poll.expiresAt')}
|
|
96
|
-
</ThemedText>
|
|
97
|
-
</TouchableOpacity>
|
|
98
|
-
</View>
|
|
99
|
-
|
|
100
|
-
<View className="flex w-full h-[38px] mt-2 relative flex-row items-center gap-3 pr-7">
|
|
101
|
-
<FormField
|
|
102
|
-
control={form.control}
|
|
103
|
-
name="data.multiple"
|
|
104
|
-
render={({ field }) => (
|
|
105
|
-
<FormCheckbox
|
|
106
|
-
checked={!!field.value}
|
|
107
|
-
onCheckedChange={field.onChange}
|
|
108
|
-
{...field}
|
|
109
|
-
custom={false}
|
|
110
|
-
label={t('posts.form.poll.multipleChoice')}
|
|
111
|
-
/>
|
|
112
|
-
)}
|
|
113
|
-
/>
|
|
114
|
-
</View>
|
|
115
|
-
<View className="flex w-full h-[38px] mt-2 relative flex-row items-center gap-3 pr-7">
|
|
116
|
-
<FormField
|
|
117
|
-
control={form.control}
|
|
118
|
-
name="data.votersVisible"
|
|
119
|
-
render={({ field }) => (
|
|
120
|
-
<FormCheckbox
|
|
121
|
-
checked={!!field.value}
|
|
122
|
-
onCheckedChange={field.onChange}
|
|
123
|
-
{...field}
|
|
124
|
-
custom={false}
|
|
125
|
-
label={t('posts.form.poll.seeWhoVoted')}
|
|
126
|
-
/>
|
|
127
|
-
)}
|
|
128
|
-
/>
|
|
129
|
-
</View>
|
|
130
|
-
|
|
131
|
-
<DateSheet
|
|
132
|
-
ref={pollExpirationModalRef}
|
|
133
|
-
value={expiresAt}
|
|
134
|
-
onChange={(dateString) => {
|
|
135
|
-
form.setValue('data.expiresAt', new Date(dateString).toISOString());
|
|
136
|
-
}}
|
|
137
|
-
onClose={() => pollExpirationModalRef.current?.close()}
|
|
138
|
-
/>
|
|
139
|
-
</View>
|
|
140
|
-
);
|
|
141
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
TouchableOpacity,
|
|
6
|
-
Image,
|
|
7
|
-
ImageSourcePropType,
|
|
8
|
-
} from 'react-native';
|
|
9
|
-
import { BottomSheetModal } from '@gorhom/bottom-sheet';
|
|
10
|
-
import { useOpenpeeps } from '@openpeepshq/react';
|
|
11
|
-
import { type GroupWithMeta, getGroupAvatar } from '@openpeepshq/common';
|
|
12
|
-
import { ThemedText } from '../../ui/themed-text';
|
|
13
|
-
import { BaseSheet, SheetFooter } from '../../custom/modals/common';
|
|
14
|
-
import { useTranslation } from 'react-i18next';
|
|
15
|
-
import { bottomSheetClose } from '../../../lib/bottom-sheet-ref';
|
|
16
|
-
|
|
17
|
-
interface GroupSelectionSheetProps {
|
|
18
|
-
onSelect: (group: GroupWithMeta) => void;
|
|
19
|
-
selectedGroup?: GroupWithMeta;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const PostAudienceSelector = forwardRef<
|
|
23
|
-
BottomSheetModal,
|
|
24
|
-
GroupSelectionSheetProps
|
|
25
|
-
>(({ onSelect, selectedGroup }, ref) => {
|
|
26
|
-
const { openpeepsApi } = useOpenpeeps();
|
|
27
|
-
const { data: groups } = openpeepsApi.useGroups();
|
|
28
|
-
const { data: server } = openpeepsApi.useServerInfo();
|
|
29
|
-
const { t } = useTranslation();
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<BaseSheet ref={ref} scrollable>
|
|
33
|
-
<View className="flex-1 p-4">
|
|
34
|
-
<ThemedText className="text-xl font-bold text-center mb-6">
|
|
35
|
-
{t('groups.selection.title')}
|
|
36
|
-
</ThemedText>
|
|
37
|
-
|
|
38
|
-
{groups?.map((group) => (
|
|
39
|
-
<TouchableOpacity
|
|
40
|
-
key={group.id}
|
|
41
|
-
className="flex-row items-center justify-between py-3"
|
|
42
|
-
onPress={() => onSelect(group)}
|
|
43
|
-
>
|
|
44
|
-
<View className="flex-row items-center flex-1">
|
|
45
|
-
<Image
|
|
46
|
-
source={
|
|
47
|
-
(server
|
|
48
|
-
? getGroupAvatar(group, server.communityConfig)
|
|
49
|
-
: group.avatar) as ImageSourcePropType
|
|
50
|
-
}
|
|
51
|
-
className="w-12 h-12 rounded-full mr-3"
|
|
52
|
-
/>
|
|
53
|
-
<View className="flex-1">
|
|
54
|
-
<Text className="text-base font-semibold text-foreground">
|
|
55
|
-
{group.displayName}
|
|
56
|
-
</Text>
|
|
57
|
-
</View>
|
|
58
|
-
</View>
|
|
59
|
-
<View
|
|
60
|
-
className={`w-6 h-6 rounded-full items-center justify-center border-2 ${
|
|
61
|
-
selectedGroup?.id === group.id
|
|
62
|
-
? 'border-foreground'
|
|
63
|
-
: 'border-muted-foreground'
|
|
64
|
-
}`}
|
|
65
|
-
>
|
|
66
|
-
<View
|
|
67
|
-
className={`w-4 h-4 rounded-full ${
|
|
68
|
-
selectedGroup?.id === group.id && 'bg-primary'
|
|
69
|
-
}`}
|
|
70
|
-
/>
|
|
71
|
-
</View>
|
|
72
|
-
</TouchableOpacity>
|
|
73
|
-
))}
|
|
74
|
-
|
|
75
|
-
<SheetFooter
|
|
76
|
-
onCancel={() => bottomSheetClose(ref)}
|
|
77
|
-
onConfirm={() => bottomSheetClose(ref)}
|
|
78
|
-
/>
|
|
79
|
-
</View>
|
|
80
|
-
</BaseSheet>
|
|
81
|
-
);
|
|
82
|
-
});
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
|
-
import { Pressable, View } from 'react-native';
|
|
3
|
-
import { UseFormReturn } from 'react-hook-form';
|
|
4
|
-
import { BottomSheetModal } from '@gorhom/bottom-sheet';
|
|
5
|
-
import { AudienceSetting, type PostCreationData } from '@openpeepshq/common';
|
|
6
|
-
import { audienceSummary, useOpenpeeps } from '@openpeepshq/react';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
-
import { ProfileAvatar } from '../../profile/Avatar';
|
|
9
|
-
import { ThemedText } from '../../ui/themed-text';
|
|
10
|
-
import { Switch } from '../../ui/switch';
|
|
11
|
-
import { ChevronDownIcon, MegaphoneIcon } from '../../icons/index';
|
|
12
|
-
import { ComposeAttachments } from './ComposeAttachments';
|
|
13
|
-
import { ComposePreviewLinks } from './ComposePreviewLinks';
|
|
14
|
-
import { OpenpeepsMarkdownInput } from './OpenpeepsMarkdownInput';
|
|
15
|
-
import { PollComposerFields } from './PollComposerFields';
|
|
16
|
-
import { VisibilitySheet } from './VisibilitySheet';
|
|
17
|
-
|
|
18
|
-
interface PostFormProps {
|
|
19
|
-
autoFocus?: boolean;
|
|
20
|
-
canEditVisibility?: boolean;
|
|
21
|
-
postData: PostCreationData;
|
|
22
|
-
setPostData: (postData: PostCreationData) => void;
|
|
23
|
-
form: UseFormReturn<PostCreationData>;
|
|
24
|
-
showNotify?: boolean;
|
|
25
|
-
notify?: boolean;
|
|
26
|
-
onNotifyChange?: (value: boolean) => void;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const PostForm = ({
|
|
30
|
-
autoFocus = false,
|
|
31
|
-
canEditVisibility = false,
|
|
32
|
-
postData,
|
|
33
|
-
setPostData,
|
|
34
|
-
form,
|
|
35
|
-
showNotify = false,
|
|
36
|
-
notify = false,
|
|
37
|
-
onNotifyChange,
|
|
38
|
-
}: PostFormProps) => {
|
|
39
|
-
const { currentProfile } = useOpenpeeps();
|
|
40
|
-
const { t } = useTranslation();
|
|
41
|
-
const visibilityModalRef = useRef<BottomSheetModal>(null);
|
|
42
|
-
const { subscribe } = form;
|
|
43
|
-
|
|
44
|
-
useEffect(
|
|
45
|
-
() =>
|
|
46
|
-
subscribe({
|
|
47
|
-
formState: {
|
|
48
|
-
values: true,
|
|
49
|
-
},
|
|
50
|
-
callback: ({ values }: { values: PostCreationData }) => {
|
|
51
|
-
setPostData(values);
|
|
52
|
-
},
|
|
53
|
-
}),
|
|
54
|
-
[subscribe, setPostData]
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const handleAudienceSelect = useCallback(
|
|
58
|
-
(audienceSetting: AudienceSetting) => {
|
|
59
|
-
const newPostData = { ...postData, ...audienceSetting };
|
|
60
|
-
form.reset(newPostData);
|
|
61
|
-
setPostData(newPostData);
|
|
62
|
-
},
|
|
63
|
-
[postData, form, setPostData]
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const selectedGroupName = useMemo(() => {
|
|
67
|
-
if (!postData.groupId) {
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
return currentProfile?.memberships?.find(
|
|
71
|
-
(membership) => membership.group.id === postData.groupId
|
|
72
|
-
)?.group.displayName;
|
|
73
|
-
}, [currentProfile?.memberships, postData.groupId]);
|
|
74
|
-
|
|
75
|
-
const content = form.watch('data.content') ?? '';
|
|
76
|
-
const isQuestion = postData.data.type === 'question';
|
|
77
|
-
const isNote = postData.data.type === 'note';
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<View className="px-4 pb-4">
|
|
81
|
-
{currentProfile ? (
|
|
82
|
-
<Pressable
|
|
83
|
-
disabled={!canEditVisibility}
|
|
84
|
-
accessibilityLabel={t('posts.form.changeAudience')}
|
|
85
|
-
onPress={() => visibilityModalRef.current?.present()}
|
|
86
|
-
className="mb-3 w-full flex-row items-center gap-3 rounded-md border border-border p-3"
|
|
87
|
-
>
|
|
88
|
-
<ProfileAvatar className="size-10" profile={currentProfile} />
|
|
89
|
-
<View className="min-w-0 flex-1">
|
|
90
|
-
<View className="flex-row items-center gap-1">
|
|
91
|
-
<ThemedText className="font-medium" numberOfLines={1}>
|
|
92
|
-
{currentProfile.displayName ?? currentProfile.handle}
|
|
93
|
-
</ThemedText>
|
|
94
|
-
{canEditVisibility ? (
|
|
95
|
-
<ChevronDownIcon size={16} className="text-muted-foreground" />
|
|
96
|
-
) : null}
|
|
97
|
-
</View>
|
|
98
|
-
<ThemedText className="text-sm text-muted-foreground">
|
|
99
|
-
{audienceSummary(
|
|
100
|
-
postData.visibility,
|
|
101
|
-
t,
|
|
102
|
-
selectedGroupName,
|
|
103
|
-
postData.audience?.length
|
|
104
|
-
)}
|
|
105
|
-
</ThemedText>
|
|
106
|
-
</View>
|
|
107
|
-
</Pressable>
|
|
108
|
-
) : null}
|
|
109
|
-
|
|
110
|
-
<OpenpeepsMarkdownInput
|
|
111
|
-
autoFocus={autoFocus}
|
|
112
|
-
value={content}
|
|
113
|
-
onChange={(text) => form.setValue('data.content', text)}
|
|
114
|
-
placeholder={
|
|
115
|
-
isQuestion
|
|
116
|
-
? t('posts.form.poll.question')
|
|
117
|
-
: t('posts.form.note.placeholder')
|
|
118
|
-
}
|
|
119
|
-
/>
|
|
120
|
-
|
|
121
|
-
<ComposePreviewLinks content={content} />
|
|
122
|
-
|
|
123
|
-
{isNote && (postData.data.attachments?.length ?? 0) > 0 ? (
|
|
124
|
-
<ComposeAttachments
|
|
125
|
-
attachments={postData.data.attachments ?? []}
|
|
126
|
-
removeAttachment={(index) => {
|
|
127
|
-
const newPostData = {
|
|
128
|
-
...postData,
|
|
129
|
-
data: {
|
|
130
|
-
...postData.data,
|
|
131
|
-
attachments: postData.data.attachments?.filter(
|
|
132
|
-
(_, i) => i !== index
|
|
133
|
-
),
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
form.reset(newPostData);
|
|
137
|
-
setPostData(newPostData);
|
|
138
|
-
}}
|
|
139
|
-
updateAttachment={(index, attachment) => {
|
|
140
|
-
const newPostData = {
|
|
141
|
-
...postData,
|
|
142
|
-
data: {
|
|
143
|
-
...postData.data,
|
|
144
|
-
attachments: postData.data.attachments?.map((item, i) =>
|
|
145
|
-
i === index ? attachment : item
|
|
146
|
-
),
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
form.reset(newPostData);
|
|
150
|
-
setPostData(newPostData);
|
|
151
|
-
}}
|
|
152
|
-
/>
|
|
153
|
-
) : null}
|
|
154
|
-
|
|
155
|
-
{isQuestion ? (
|
|
156
|
-
<PollComposerFields form={form} postData={postData} />
|
|
157
|
-
) : null}
|
|
158
|
-
|
|
159
|
-
{showNotify ? (
|
|
160
|
-
<View className="flex-row items-center justify-between py-3">
|
|
161
|
-
<View className="flex-row items-center gap-2">
|
|
162
|
-
<MegaphoneIcon size={20} className="text-foreground" />
|
|
163
|
-
<ThemedText className="text-base">
|
|
164
|
-
{t('posts.form.notifyEveryone')}
|
|
165
|
-
</ThemedText>
|
|
166
|
-
</View>
|
|
167
|
-
<Switch
|
|
168
|
-
checked={notify}
|
|
169
|
-
onCheckedChange={onNotifyChange ?? (() => undefined)}
|
|
170
|
-
/>
|
|
171
|
-
</View>
|
|
172
|
-
) : null}
|
|
173
|
-
|
|
174
|
-
<VisibilitySheet
|
|
175
|
-
type="post"
|
|
176
|
-
ref={visibilityModalRef}
|
|
177
|
-
showDirect
|
|
178
|
-
audienceSetting={{
|
|
179
|
-
visibility: postData.visibility,
|
|
180
|
-
groupId: postData.groupId || undefined,
|
|
181
|
-
audience: postData.audience || [],
|
|
182
|
-
}}
|
|
183
|
-
onSubmit={handleAudienceSelect}
|
|
184
|
-
/>
|
|
185
|
-
</View>
|
|
186
|
-
);
|
|
187
|
-
};
|