@openpeepshq/rn-components 0.12.5 → 0.13.1
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/src/components/icons/index.ts +2 -0
- package/src/components/jams/JamDeviceSelectors.tsx +31 -3
- package/src/components/jams/JamLobby.tsx +104 -5
- package/src/components/jams/JamVideoCall.tsx +157 -3
- package/src/components/jams/JamVideoLayout.tsx +9 -2
- package/src/components/jams/useLateTrackMediaStream.test.ts +145 -0
- package/src/components/jams/useLateTrackMediaStream.ts +61 -0
- package/src/components/post/feed/events/EventsCalendar.test.tsx +144 -0
- package/src/components/post/feed/events/EventsCalendar.tsx +4 -8
- package/src/components/post/feed/events/EventsView.tsx +5 -13
- package/src/components/post/pieces/PostMenu.tsx +29 -1
- package/src/components/post/pieces/modals/PostEditHistoryModal.tsx +166 -0
- package/src/components/post/pieces/modals/index.ts +1 -0
- package/src/components/post/post-form/OpenpeepsMarkdownInput.tsx +14 -5
- package/src/components/post/post-form/PostForm.tsx +1 -0
- package/src/lib/dmMessageGate.test.ts +58 -0
- package/src/lib/livekit/useStableLiveKitRoom.ts +23 -13
- package/src/lib/utils.ts +4 -1
- package/src/pages/conversations/NewDraft.tsx +2 -3
- package/src/pages/conversations/Show.tsx +4 -1
- package/src/pages/events/Index.tsx +1 -5
- package/src/pages/events/My.tsx +1 -2
- package/src/pages/groups/Show.tsx +10 -2
- package/src/pages/posts/Edit.tsx +16 -6
- package/src/pages/posts/New.tsx +15 -5
- package/src/pages/posts/Reply.tsx +15 -6
|
@@ -115,6 +115,7 @@ export const DraftMessage = ({ navigation }: DraftMessageProps) => {
|
|
|
115
115
|
) : null}
|
|
116
116
|
<OpenpeepsMarkdownInput
|
|
117
117
|
rows={5}
|
|
118
|
+
blockOverflow={false}
|
|
118
119
|
value={message}
|
|
119
120
|
onChange={setMessage}
|
|
120
121
|
maxLength={maxContentLength}
|
|
@@ -135,10 +136,8 @@ export const DraftMessage = ({ navigation }: DraftMessageProps) => {
|
|
|
135
136
|
</Button>
|
|
136
137
|
<TouchableOpacity
|
|
137
138
|
onPress={() => void send()}
|
|
139
|
+
className={`p-2 rounded-full ${canSend ? 'bg-primary' : 'bg-surface'}`}
|
|
138
140
|
disabled={!canSend}
|
|
139
|
-
className={`p-2 rounded-full ${
|
|
140
|
-
canSend ? 'bg-primary' : 'bg-surface'
|
|
141
|
-
}`}
|
|
142
141
|
>
|
|
143
142
|
{submitting ? (
|
|
144
143
|
<ActivityIndicator size={'small'} />
|
|
@@ -147,7 +147,9 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
147
147
|
}, []);
|
|
148
148
|
|
|
149
149
|
const handleSendMessage = async () => {
|
|
150
|
-
if (!canSend)
|
|
150
|
+
if (!canSend) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
151
153
|
|
|
152
154
|
try {
|
|
153
155
|
setIsSending(true);
|
|
@@ -367,6 +369,7 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
367
369
|
<View className="px-4 py-3 bg-background border-t border-border">
|
|
368
370
|
<OpenpeepsMarkdownInput
|
|
369
371
|
rows={3}
|
|
372
|
+
blockOverflow={false}
|
|
370
373
|
value={content}
|
|
371
374
|
onChange={setContent}
|
|
372
375
|
maxLength={maxContentLength}
|
|
@@ -88,11 +88,7 @@ export const EventsIndex = ({
|
|
|
88
88
|
},
|
|
89
89
|
]}
|
|
90
90
|
/>
|
|
91
|
-
<EventsView
|
|
92
|
-
query={activeQuery}
|
|
93
|
-
agenda={tab}
|
|
94
|
-
list={<EventsFeed query={activeQuery} />}
|
|
95
|
-
/>
|
|
91
|
+
<EventsView list={<EventsFeed query={activeQuery} />} />
|
|
96
92
|
<NewEventButton visibility={visibility} currentProfile={currentProfile} />
|
|
97
93
|
</ThemedView>
|
|
98
94
|
);
|
package/src/pages/events/My.tsx
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
} from '../../components/navigation/types/index';
|
|
25
25
|
import {
|
|
26
26
|
EventsFeed,
|
|
27
|
+
EventsView,
|
|
27
28
|
NewEventButton,
|
|
28
29
|
NewNoteButton,
|
|
29
30
|
NewResourceButton,
|
|
@@ -172,8 +173,15 @@ export const GroupShow = ({ route, navigation }: GroupProps) => {
|
|
|
172
173
|
</ThemedText>
|
|
173
174
|
</Pressable>
|
|
174
175
|
</View>
|
|
175
|
-
<
|
|
176
|
-
|
|
176
|
+
<EventsView
|
|
177
|
+
calendar={{ groupId: group.id }}
|
|
178
|
+
list={
|
|
179
|
+
<EventsFeed
|
|
180
|
+
query={
|
|
181
|
+
eventsTab === 'upcoming' ? upcomingEvents : pastEvents
|
|
182
|
+
}
|
|
183
|
+
/>
|
|
184
|
+
}
|
|
177
185
|
/>
|
|
178
186
|
</TabsContent>
|
|
179
187
|
<TabsContent value="resources" className="p-0">
|
package/src/pages/posts/Edit.tsx
CHANGED
|
@@ -7,10 +7,12 @@ import { PostForm } from '../../components/post/post-form/PostForm';
|
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
9
9
|
import {
|
|
10
|
-
PostCreationData,
|
|
11
10
|
pollOptionsWithinLimit,
|
|
11
|
+
PostCreationData,
|
|
12
12
|
postCreationDataSchema,
|
|
13
|
+
canSubmitPostContent,
|
|
13
14
|
resolvePollOptionContents,
|
|
15
|
+
visibleTextLength,
|
|
14
16
|
} from '@openpeepshq/common';
|
|
15
17
|
import { ActivityIndicator } from 'react-native';
|
|
16
18
|
import { useForm } from 'react-hook-form';
|
|
@@ -47,6 +49,7 @@ export const EditPost = ({ route, navigation }: PostProps) => {
|
|
|
47
49
|
const attachmentsProcessing = hasProcessingAttachments(postData);
|
|
48
50
|
|
|
49
51
|
const trimmedContent = (postData?.data.content ?? '').trim();
|
|
52
|
+
const visibleContentLength = visibleTextLength(trimmedContent);
|
|
50
53
|
const pollOptions =
|
|
51
54
|
postData?.data.type === 'question'
|
|
52
55
|
? postData.data.options.map((option) => option.content)
|
|
@@ -63,21 +66,28 @@ export const EditPost = ({ route, navigation }: PostProps) => {
|
|
|
63
66
|
return false;
|
|
64
67
|
}
|
|
65
68
|
if (postData.data.type === 'question') {
|
|
66
|
-
return
|
|
69
|
+
return canSubmitPostContent({
|
|
70
|
+
visibleContentLength,
|
|
71
|
+
attachmentsLength: postData.data.attachments?.length ?? 0,
|
|
72
|
+
composerType: 'question',
|
|
73
|
+
pollOptionsValid,
|
|
74
|
+
});
|
|
67
75
|
}
|
|
68
76
|
if (postData.type === 'article') {
|
|
69
77
|
return trimmedContent.length > 0;
|
|
70
78
|
}
|
|
71
|
-
return (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
return canSubmitPostContent({
|
|
80
|
+
visibleContentLength,
|
|
81
|
+
attachmentsLength: postData.data.attachments?.length ?? 0,
|
|
82
|
+
composerType: 'note',
|
|
83
|
+
});
|
|
75
84
|
}, [
|
|
76
85
|
attachmentsProcessing,
|
|
77
86
|
isPosting,
|
|
78
87
|
pollOptionsValid,
|
|
79
88
|
postData,
|
|
80
89
|
trimmedContent.length,
|
|
90
|
+
visibleContentLength,
|
|
81
91
|
]);
|
|
82
92
|
|
|
83
93
|
const handlePostUpdate = async () => {
|
package/src/pages/posts/New.tsx
CHANGED
|
@@ -26,8 +26,10 @@ import {
|
|
|
26
26
|
MediaAttachment,
|
|
27
27
|
pollOptionsWithinLimit,
|
|
28
28
|
PostCreationData,
|
|
29
|
+
canSubmitPostContent,
|
|
29
30
|
resolvePollOptionContents,
|
|
30
31
|
VisibilityType,
|
|
32
|
+
visibleTextLength,
|
|
31
33
|
} from '@openpeepshq/common';
|
|
32
34
|
import { CompositeScreenProps } from '@react-navigation/native';
|
|
33
35
|
import Toast from 'react-native-toast-message';
|
|
@@ -89,6 +91,7 @@ export const NewPost = ({ route, navigation }: PostProps) => {
|
|
|
89
91
|
canNotify && isCommunityWideVisibility(postData.visibility);
|
|
90
92
|
|
|
91
93
|
const trimmedContent = (postData.data.content ?? '').trim();
|
|
94
|
+
const visibleContentLength = visibleTextLength(trimmedContent);
|
|
92
95
|
const pollOptions =
|
|
93
96
|
postData.data.type === 'question'
|
|
94
97
|
? postData.data.options.map((option) => option.content)
|
|
@@ -111,15 +114,21 @@ export const NewPost = ({ route, navigation }: PostProps) => {
|
|
|
111
114
|
return false;
|
|
112
115
|
}
|
|
113
116
|
if (postData.data.type === 'question') {
|
|
114
|
-
return
|
|
117
|
+
return canSubmitPostContent({
|
|
118
|
+
visibleContentLength,
|
|
119
|
+
attachmentsLength: postData.data.attachments?.length ?? 0,
|
|
120
|
+
composerType: 'question',
|
|
121
|
+
pollOptionsValid,
|
|
122
|
+
});
|
|
115
123
|
}
|
|
116
124
|
if (postData.type === 'article') {
|
|
117
125
|
return trimmedContent.length > 0;
|
|
118
126
|
}
|
|
119
|
-
return (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
127
|
+
return canSubmitPostContent({
|
|
128
|
+
visibleContentLength,
|
|
129
|
+
attachmentsLength: postData.data.attachments?.length ?? 0,
|
|
130
|
+
composerType: 'note',
|
|
131
|
+
});
|
|
123
132
|
}, [
|
|
124
133
|
attachmentsProcessing,
|
|
125
134
|
isPosting,
|
|
@@ -131,6 +140,7 @@ export const NewPost = ({ route, navigation }: PostProps) => {
|
|
|
131
140
|
postData.type,
|
|
132
141
|
postData.visibility,
|
|
133
142
|
trimmedContent.length,
|
|
143
|
+
visibleContentLength,
|
|
134
144
|
]);
|
|
135
145
|
|
|
136
146
|
const handlePostCreation = async () => {
|
|
@@ -18,8 +18,10 @@ import {
|
|
|
18
18
|
MediaAttachment,
|
|
19
19
|
pollOptionsWithinLimit,
|
|
20
20
|
PostCreationData,
|
|
21
|
+
canSubmitPostContent,
|
|
21
22
|
PublicPost,
|
|
22
23
|
resolvePollOptionContents,
|
|
24
|
+
visibleTextLength,
|
|
23
25
|
} from '@openpeepshq/common';
|
|
24
26
|
import Toast from 'react-native-toast-message';
|
|
25
27
|
import {
|
|
@@ -90,7 +92,6 @@ export const ReplyPost = ({ route, navigation }: PostProps) => {
|
|
|
90
92
|
setPostData(newPostData as PostCreationData);
|
|
91
93
|
form.reset(newPostData);
|
|
92
94
|
}
|
|
93
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
94
95
|
}, [post]);
|
|
95
96
|
|
|
96
97
|
useEffect(() => {
|
|
@@ -118,6 +119,7 @@ export const ReplyPost = ({ route, navigation }: PostProps) => {
|
|
|
118
119
|
}, [isPostLoading, post, postData]);
|
|
119
120
|
|
|
120
121
|
const trimmedContent = (postData?.data.content ?? '').trim();
|
|
122
|
+
const visibleContentLength = visibleTextLength(trimmedContent);
|
|
121
123
|
const pollOptions =
|
|
122
124
|
postData?.data.type === 'question'
|
|
123
125
|
? postData.data.options.map((option) => option.content)
|
|
@@ -134,12 +136,18 @@ export const ReplyPost = ({ route, navigation }: PostProps) => {
|
|
|
134
136
|
return false;
|
|
135
137
|
}
|
|
136
138
|
if (postData.data.type === 'question') {
|
|
137
|
-
return
|
|
139
|
+
return canSubmitPostContent({
|
|
140
|
+
visibleContentLength,
|
|
141
|
+
attachmentsLength: postData.data.attachments?.length ?? 0,
|
|
142
|
+
composerType: 'question',
|
|
143
|
+
pollOptionsValid,
|
|
144
|
+
});
|
|
138
145
|
}
|
|
139
|
-
return (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
146
|
+
return canSubmitPostContent({
|
|
147
|
+
visibleContentLength,
|
|
148
|
+
attachmentsLength: postData.data.attachments?.length ?? 0,
|
|
149
|
+
composerType: 'note',
|
|
150
|
+
});
|
|
143
151
|
}, [
|
|
144
152
|
attachmentsProcessing,
|
|
145
153
|
isPosting,
|
|
@@ -147,6 +155,7 @@ export const ReplyPost = ({ route, navigation }: PostProps) => {
|
|
|
147
155
|
post,
|
|
148
156
|
postData,
|
|
149
157
|
trimmedContent.length,
|
|
158
|
+
visibleContentLength,
|
|
150
159
|
]);
|
|
151
160
|
|
|
152
161
|
const handlePostCreation = async () => {
|