@openpeepshq/rn-components 0.7.2 → 0.8.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/README.md +1 -1
- package/package.json +11 -6
- package/src/components/custom/modals/media/audio-picker-sheet.tsx +21 -25
- package/src/components/custom/modals/media/document-picker-sheet.tsx +22 -16
- package/src/components/custom/modals/media/video-picker-sheet.tsx +4 -2
- package/src/components/custom/navigation/side-menu.tsx +59 -11
- package/src/components/icons/iconWithClassName.tsx +21 -0
- package/src/components/jams/JamActionsFooter.tsx +8 -2
- package/src/components/jams/JamCapacityGate.tsx +1 -1
- package/src/components/jams/JamCard.tsx +8 -4
- package/src/components/jams/JamConference.tsx +6 -1
- package/src/components/jams/JamParticipantConference.tsx +2 -0
- package/src/components/jams/JamRoom.tsx +2 -3
- package/src/components/jams/LiveJamsSection.tsx +12 -1
- package/src/components/jams/LivekitUnavailableNotice.tsx +25 -0
- package/src/components/jams/index.ts +1 -0
- package/src/components/markdown/MarkdownOverlay.tsx +75 -0
- package/src/components/markdown/OpenpeepsMarkdown.tsx +3 -1
- package/src/components/markdown/extensions/link.tsx +34 -0
- package/src/components/markdown/index.ts +2 -0
- package/src/components/navigation/tab-navigator.tsx +39 -17
- package/src/components/notifications/NotificationItem.tsx +27 -2
- package/src/components/notifications/types/JamStarted.tsx +13 -3
- package/src/components/notifications/types/Reply.tsx +1 -5
- package/src/components/notifications/types/WaitlistOffer.tsx +61 -0
- package/src/components/notifications/types/index.ts +1 -0
- package/src/components/post/CompactReplyParent.tsx +16 -15
- package/src/components/post/TruncatedMarkdown.tsx +60 -0
- package/src/components/post/helpers.ts +2 -2
- package/src/components/post/index.ts +2 -0
- package/src/components/post/pieces/EventRsvpButton.tsx +99 -5
- package/src/components/post/pieces/EventRsvpList.tsx +46 -0
- package/src/components/post/pieces/EventRsvpScopeDialog.tsx +30 -19
- package/src/components/post/pieces/EventWaitlistJoinDialog.tsx +62 -0
- package/src/components/post/pieces/PollContent.tsx +7 -7
- package/src/components/post/pieces/PostActions.tsx +89 -23
- package/src/components/post/pieces/ShareMenu.tsx +2 -2
- package/src/components/post/post-form/DescriptionEditModal.tsx +1 -0
- package/src/components/post/post-form/EventForm.tsx +50 -10
- package/src/components/post/post-form/ResourceForm.tsx +131 -8
- package/src/components/post/types/Article.tsx +6 -2
- package/src/components/post/types/Poll.tsx +4 -1
- package/src/components/post/types/event/CardEvent.tsx +101 -76
- package/src/components/post/types/event/FullEvent.tsx +60 -23
- package/src/components/post/types/event/ProfileEventRelationship.tsx +2 -0
- package/src/components/post/types/resource/FullResource.tsx +9 -1
- package/src/components/preview-link/LocalPreviewLink.tsx +4 -1
- package/src/components/preview-link/helpers.ts +5 -1
- package/src/components/preview-link/index.ts +1 -0
- package/src/components/preview-link/local/WelcomePreview.tsx +59 -0
- package/src/components/profile/Avatar.tsx +0 -1
- package/src/components/profile/EditProfileForm.tsx +23 -2
- package/src/components/profile/ProfileSheet.tsx +1 -1
- package/src/components/resources/ResourceCard.tsx +62 -14
- package/src/components/resources/ResourceLibrary.tsx +2 -2
- package/src/components/ui/badge.tsx +2 -3
- package/src/components/ui/bottom-sheet.tsx +0 -6
- package/src/components/ui/popup-menu-button.tsx +2 -2
- package/src/components/ui/popup-menu-separator.tsx +1 -1
- package/src/components/ui/popup-menu.tsx +2 -2
- package/src/lib/utils.ts +10 -3
- package/src/pages/auth/Register.tsx +34 -4
- package/src/pages/conversations/Show.tsx +38 -7
- package/src/pages/feeds/Bookmarks.tsx +1 -1
- package/src/pages/jams/Index.tsx +6 -4
- package/src/pages/posts/New.tsx +1 -1
- package/src/pages/resources/Edit.tsx +2 -1
- package/src/pages/resources/New.tsx +6 -1
- package/src/pages/settings/Account.tsx +46 -2
- package/src/pages/settings/Index.tsx +3 -4
- package/src/pages/settings/NotificationPreferences.tsx +3 -3
- package/src/pages/settings/Theme.tsx +1 -1
- package/src/components/icons/iconWithClassName.ts +0 -12
|
@@ -10,13 +10,17 @@ export const isJamPath = (path: string) =>
|
|
|
10
10
|
path.endsWith('/jam');
|
|
11
11
|
export const isGroupPath = (path: string) => path.startsWith('/groups/@');
|
|
12
12
|
|
|
13
|
+
export const isWelcomePath = (path: string) =>
|
|
14
|
+
path === '/welcome' || path === '/welcome/';
|
|
15
|
+
|
|
13
16
|
export const isLocalLink = (url: string, origin: string) => {
|
|
14
17
|
const urlObj = new URL(url);
|
|
15
18
|
return (
|
|
16
19
|
urlObj.origin === origin &&
|
|
17
20
|
(isPostPath(urlObj.pathname) ||
|
|
18
21
|
isJamPath(urlObj.pathname) ||
|
|
19
|
-
isGroupPath(urlObj.pathname)
|
|
22
|
+
isGroupPath(urlObj.pathname) ||
|
|
23
|
+
isWelcomePath(urlObj.pathname))
|
|
20
24
|
);
|
|
21
25
|
};
|
|
22
26
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useColorScheme, View } from 'react-native';
|
|
2
|
+
import { useWelcomePreview } from '@openpeepshq/react';
|
|
3
|
+
import { stripMarkdownImages, truncateMarkdown } from '@openpeepshq/common/lib';
|
|
4
|
+
import { CachedImage } from '../../custom/common';
|
|
5
|
+
import { ThemedText } from '../../ui/themed-text';
|
|
6
|
+
import { toAbsoluteMediaUrl } from '../../../lib/media-url';
|
|
7
|
+
import { TruncatedMarkdown } from '../../post/TruncatedMarkdown';
|
|
8
|
+
|
|
9
|
+
export const WelcomePreview = () => {
|
|
10
|
+
const systemColorScheme = useColorScheme();
|
|
11
|
+
const systemScheme = systemColorScheme === 'dark' ? 'dark' : 'light';
|
|
12
|
+
const { eyebrow, title, description, markdown, imageUrl, imageFit } =
|
|
13
|
+
useWelcomePreview(systemScheme);
|
|
14
|
+
const resolvedImage = toAbsoluteMediaUrl(imageUrl);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<View
|
|
18
|
+
testID="welcome-preview-card"
|
|
19
|
+
className="flex w-full flex-row items-center gap-4"
|
|
20
|
+
>
|
|
21
|
+
{resolvedImage ? (
|
|
22
|
+
<View className="h-24 w-24 flex-shrink-0 overflow-hidden rounded-md">
|
|
23
|
+
<CachedImage
|
|
24
|
+
url={resolvedImage}
|
|
25
|
+
className="h-full w-full"
|
|
26
|
+
resizeMode={imageFit}
|
|
27
|
+
/>
|
|
28
|
+
</View>
|
|
29
|
+
) : null}
|
|
30
|
+
<View className="min-w-0 flex-1 gap-1">
|
|
31
|
+
{eyebrow ? (
|
|
32
|
+
<ThemedText
|
|
33
|
+
className="text-muted-foreground text-xs"
|
|
34
|
+
numberOfLines={1}
|
|
35
|
+
>
|
|
36
|
+
{eyebrow}
|
|
37
|
+
</ThemedText>
|
|
38
|
+
) : null}
|
|
39
|
+
<ThemedText className="font-semibold" numberOfLines={2}>
|
|
40
|
+
{title}
|
|
41
|
+
</ThemedText>
|
|
42
|
+
{markdown ? (
|
|
43
|
+
<TruncatedMarkdown
|
|
44
|
+
source={markdown}
|
|
45
|
+
snippet={truncateMarkdown(stripMarkdownImages(markdown), 2, 240)}
|
|
46
|
+
maxLines={2}
|
|
47
|
+
/>
|
|
48
|
+
) : description ? (
|
|
49
|
+
<ThemedText
|
|
50
|
+
className="text-muted-foreground text-sm"
|
|
51
|
+
numberOfLines={3}
|
|
52
|
+
>
|
|
53
|
+
{description}
|
|
54
|
+
</ThemedText>
|
|
55
|
+
) : null}
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
3
3
|
import { ThemedView } from '../ui/themed-view';
|
|
4
|
-
import { useOpenpeeps } from '@openpeepshq/react';
|
|
4
|
+
import { useOpenpeeps, useServerInfo } from '@openpeepshq/react';
|
|
5
5
|
import { ThemedText } from '../ui/themed-text';
|
|
6
6
|
import { useForm } from 'react-hook-form';
|
|
7
7
|
import {
|
|
8
8
|
getTheme,
|
|
9
|
+
HANDLE_RESERVED_MESSAGE,
|
|
10
|
+
isForbiddenHandle,
|
|
9
11
|
MediaAttachment,
|
|
10
12
|
Profile,
|
|
11
13
|
ProfileData,
|
|
@@ -31,6 +33,7 @@ type EditProfileFormProps = {
|
|
|
31
33
|
export const EditProfileForm: React.FC<EditProfileFormProps> = ({ handle }) => {
|
|
32
34
|
const { openpeepsApi, queryClient } = useOpenpeeps();
|
|
33
35
|
const { data: serverInfo } = openpeepsApi.useServerInfo();
|
|
36
|
+
const communitySettings = useServerInfo().communityConfig?.settings;
|
|
34
37
|
const {
|
|
35
38
|
data: profileData,
|
|
36
39
|
isLoading,
|
|
@@ -84,6 +87,22 @@ export const EditProfileForm: React.FC<EditProfileFormProps> = ({ handle }) => {
|
|
|
84
87
|
const updateProfileDetails = openpeepsApi.updateCurrentProfileAction();
|
|
85
88
|
|
|
86
89
|
const onSubmit = async (values: ProfileData) => {
|
|
90
|
+
const additionalForbiddenHandles =
|
|
91
|
+
communitySettings?.additionalForbiddenHandles;
|
|
92
|
+
if (
|
|
93
|
+
values.handle &&
|
|
94
|
+
isForbiddenHandle(values.handle, additionalForbiddenHandles)
|
|
95
|
+
) {
|
|
96
|
+
const message = t('profile.form.handleReserved');
|
|
97
|
+
form.setError('handle', { message });
|
|
98
|
+
Toast.show({
|
|
99
|
+
type: 'error',
|
|
100
|
+
text1: t('common.errors.error'),
|
|
101
|
+
text2: message,
|
|
102
|
+
});
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
87
106
|
setIsSubmitting(true);
|
|
88
107
|
|
|
89
108
|
values.type = profileData?.type || 'local';
|
|
@@ -122,7 +141,9 @@ export const EditProfileForm: React.FC<EditProfileFormProps> = ({ handle }) => {
|
|
|
122
141
|
? t('profiles.handleExists', {
|
|
123
142
|
defaultValue: 'This handle is already in use by someone else.',
|
|
124
143
|
})
|
|
125
|
-
:
|
|
144
|
+
: message === HANDLE_RESERVED_MESSAGE
|
|
145
|
+
? t('profile.form.handleReserved')
|
|
146
|
+
: err.message,
|
|
126
147
|
});
|
|
127
148
|
})
|
|
128
149
|
.finally(() => {
|
|
@@ -26,7 +26,7 @@ export const ProfileSheet = forwardRef<BottomSheetModal, ProfileSheetProps>(
|
|
|
26
26
|
<View className="items-center pt-6">
|
|
27
27
|
<TouchableOpacity
|
|
28
28
|
onPress={() => {
|
|
29
|
-
// @ts-
|
|
29
|
+
// @ts-expect-error ref.current may be null
|
|
30
30
|
ref?.current?.close();
|
|
31
31
|
navigation.navigate('Profile', {
|
|
32
32
|
handle: profile[0].handle,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import { Linking, Pressable, View } from 'react-native';
|
|
4
|
+
import { useNavigation } from '@react-navigation/native';
|
|
5
|
+
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
4
6
|
import { useTranslation } from 'react-i18next';
|
|
5
7
|
import type {
|
|
6
8
|
MediaAttachmentData,
|
|
@@ -10,13 +12,16 @@ import type {
|
|
|
10
12
|
import {
|
|
11
13
|
attachmentMediaKind,
|
|
12
14
|
formatSize,
|
|
15
|
+
groupName,
|
|
13
16
|
normalizeResourceTags,
|
|
14
|
-
truncateMarkdown,
|
|
15
17
|
} from '@openpeepshq/common/lib';
|
|
16
18
|
import { useOpenpeeps } from '@openpeepshq/react';
|
|
19
|
+
import type { MainStackParamList } from '../navigation/types/index';
|
|
17
20
|
import { CachedImage } from '../custom/common';
|
|
18
21
|
import { ThemedText } from '../ui/themed-text';
|
|
19
22
|
import { VideoPlayOverlay } from '../post/VideoPlayOverlay';
|
|
23
|
+
import { TruncatedMarkdown } from '../post/TruncatedMarkdown';
|
|
24
|
+
import { buildGoto } from '../navigation/helpers';
|
|
20
25
|
import {
|
|
21
26
|
BookmarkPlusIcon,
|
|
22
27
|
BookmarkMinusIcon,
|
|
@@ -28,6 +33,10 @@ export interface ResourceCardProps {
|
|
|
28
33
|
post: PublicPost;
|
|
29
34
|
layout?: 'card' | 'list';
|
|
30
35
|
preview?: ReactNode;
|
|
36
|
+
/** Set false when the full description is rendered by the surrounding layout (e.g. the post detail page). */
|
|
37
|
+
showDescription?: boolean;
|
|
38
|
+
/** When true, hides the group label (already shown by the group context). */
|
|
39
|
+
inGroup?: boolean;
|
|
31
40
|
}
|
|
32
41
|
|
|
33
42
|
const visualAttachments = (attachments: MediaAttachmentData[]) =>
|
|
@@ -55,8 +64,13 @@ export const ResourceCard = ({
|
|
|
55
64
|
post,
|
|
56
65
|
layout = 'card',
|
|
57
66
|
preview,
|
|
67
|
+
showDescription = true,
|
|
68
|
+
inGroup = false,
|
|
58
69
|
}: ResourceCardProps) => {
|
|
59
70
|
const { t } = useTranslation();
|
|
71
|
+
const navigation =
|
|
72
|
+
useNavigation<NativeStackNavigationProp<MainStackParamList>>();
|
|
73
|
+
const goto = buildGoto(navigation);
|
|
60
74
|
const { openpeepsApi } = useOpenpeeps();
|
|
61
75
|
const { data: currentProfile } = openpeepsApi.useCurrentProfile();
|
|
62
76
|
const bookmarkedIdsQuery = openpeepsApi.useCurrentProfileBookmarkedIds();
|
|
@@ -74,7 +88,6 @@ export const ResourceCard = ({
|
|
|
74
88
|
!!resource && resource.resourceKind === 'gallery' && visuals.length > 1;
|
|
75
89
|
const tiles = isGallery ? visuals.slice(0, 4) : visuals.slice(0, 1);
|
|
76
90
|
const extra = isGallery ? Math.max(0, visuals.length - 4) : 0;
|
|
77
|
-
const excerpt = resource ? truncateMarkdown(resource.content, 2, 240) : null;
|
|
78
91
|
const tags = resource ? normalizeResourceTags(resource.tags) : [];
|
|
79
92
|
const actionLabel = resource
|
|
80
93
|
? primaryActionLabel(resource.resourceKind, (key, opts) => t(key, opts))
|
|
@@ -108,6 +121,9 @@ export const ResourceCard = ({
|
|
|
108
121
|
|
|
109
122
|
if (!resource) return null;
|
|
110
123
|
|
|
124
|
+
const group = post.group;
|
|
125
|
+
const groupLabel = group ? groupName(group) : null;
|
|
126
|
+
|
|
111
127
|
const toggleBookmark = () => {
|
|
112
128
|
if (!currentProfile) return;
|
|
113
129
|
if (isBookmarked) {
|
|
@@ -131,6 +147,23 @@ export const ResourceCard = ({
|
|
|
131
147
|
</Pressable>
|
|
132
148
|
);
|
|
133
149
|
|
|
150
|
+
const renderGroupLabel = () => {
|
|
151
|
+
if (!group || !groupLabel || inGroup) return null;
|
|
152
|
+
return (
|
|
153
|
+
<Pressable
|
|
154
|
+
onPress={() => navigation.navigate('Group', { handle: group.handle })}
|
|
155
|
+
className="rounded-full bg-muted px-2 py-0.5"
|
|
156
|
+
>
|
|
157
|
+
<ThemedText className="text-xs text-muted-foreground">
|
|
158
|
+
{t('resources.group.inGroup', {
|
|
159
|
+
defaultValue: 'in {{groupName}}',
|
|
160
|
+
groupName: groupLabel,
|
|
161
|
+
})}
|
|
162
|
+
</ThemedText>
|
|
163
|
+
</Pressable>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
|
|
134
167
|
const renderThumbnail = () => {
|
|
135
168
|
if (thumbSrc) {
|
|
136
169
|
return (
|
|
@@ -160,10 +193,15 @@ export const ResourceCard = ({
|
|
|
160
193
|
{resource.categoryPath.join(' / ')}
|
|
161
194
|
</ThemedText>
|
|
162
195
|
) : null}
|
|
163
|
-
{
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
196
|
+
{renderGroupLabel()}
|
|
197
|
+
{showDescription ? (
|
|
198
|
+
<TruncatedMarkdown
|
|
199
|
+
source={resource.content ?? ''}
|
|
200
|
+
maxBlocks={2}
|
|
201
|
+
maxChars={240}
|
|
202
|
+
maxLines={2}
|
|
203
|
+
className="text-sm text-muted-foreground"
|
|
204
|
+
/>
|
|
167
205
|
) : null}
|
|
168
206
|
{metaText ? (
|
|
169
207
|
<ThemedText className="text-xs text-muted-foreground">
|
|
@@ -264,10 +302,15 @@ export const ResourceCard = ({
|
|
|
264
302
|
{resource.categoryPath.join(' / ')}
|
|
265
303
|
</ThemedText>
|
|
266
304
|
) : null}
|
|
267
|
-
{
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
305
|
+
{renderGroupLabel()}
|
|
306
|
+
{showDescription ? (
|
|
307
|
+
<TruncatedMarkdown
|
|
308
|
+
source={resource.content ?? ''}
|
|
309
|
+
maxBlocks={2}
|
|
310
|
+
maxChars={240}
|
|
311
|
+
maxLines={2}
|
|
312
|
+
className="text-sm text-muted-foreground"
|
|
313
|
+
/>
|
|
271
314
|
) : null}
|
|
272
315
|
{metaText ? (
|
|
273
316
|
<ThemedText className="text-xs text-muted-foreground">
|
|
@@ -277,12 +320,17 @@ export const ResourceCard = ({
|
|
|
277
320
|
{tags.length ? (
|
|
278
321
|
<View className="flex-row flex-wrap gap-1">
|
|
279
322
|
{tags.map((value) => (
|
|
280
|
-
<
|
|
323
|
+
<Pressable
|
|
281
324
|
key={value}
|
|
282
|
-
|
|
325
|
+
onPress={() =>
|
|
326
|
+
goto({ target: 'HashtagPosts', params: { tag: value } })
|
|
327
|
+
}
|
|
328
|
+
className="rounded-full bg-muted px-2 py-0.5"
|
|
283
329
|
>
|
|
284
|
-
|
|
285
|
-
|
|
330
|
+
<ThemedText className="text-xs text-muted-foreground">
|
|
331
|
+
#{value}
|
|
332
|
+
</ThemedText>
|
|
333
|
+
</Pressable>
|
|
286
334
|
))}
|
|
287
335
|
</View>
|
|
288
336
|
) : null}
|
|
@@ -366,7 +366,7 @@ export const ResourceLibrary = ({ groupId }: ResourceLibraryProps) => {
|
|
|
366
366
|
onPress={() => navigation.navigate('Post', { id: post.id })}
|
|
367
367
|
className="border-b border-border"
|
|
368
368
|
>
|
|
369
|
-
<ResourceCard post={post} layout="list" />
|
|
369
|
+
<ResourceCard post={post} layout="list" inGroup={!!groupId} />
|
|
370
370
|
</Pressable>
|
|
371
371
|
))}
|
|
372
372
|
</View>
|
|
@@ -377,7 +377,7 @@ export const ResourceLibrary = ({ groupId }: ResourceLibraryProps) => {
|
|
|
377
377
|
key={post.id}
|
|
378
378
|
onPress={() => navigation.navigate('Post', { id: post.id })}
|
|
379
379
|
>
|
|
380
|
-
<ResourceCard post={post} layout="card" />
|
|
380
|
+
<ResourceCard post={post} layout="card" inGroup={!!groupId} />
|
|
381
381
|
</Pressable>
|
|
382
382
|
))}
|
|
383
383
|
</ScrollView>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
|
-
import {
|
|
4
|
+
import {} from './themed-text';
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
6
6
|
|
|
7
7
|
const badgeVariants = cva(
|
|
@@ -23,8 +23,7 @@ const badgeVariants = cva(
|
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
export interface BadgeProps
|
|
26
|
-
extends
|
|
27
|
-
React.ComponentPropsWithoutRef<typeof View>,
|
|
26
|
+
extends React.ComponentPropsWithoutRef<typeof View>,
|
|
28
27
|
VariantProps<typeof badgeVariants> {}
|
|
29
28
|
|
|
30
29
|
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
@@ -25,12 +25,6 @@ import { cn } from '../../lib/utils';
|
|
|
25
25
|
type BottomSheetRef = React.ElementRef<typeof View>;
|
|
26
26
|
type BottomSheetProps = React.ComponentPropsWithoutRef<typeof View>;
|
|
27
27
|
|
|
28
|
-
interface BottomSheetContext {
|
|
29
|
-
sheetRef: React.RefObject<BottomSheetModal>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const BottomSheetContext = React.createContext({} as BottomSheetContext);
|
|
33
|
-
|
|
34
28
|
const BottomSheet = React.forwardRef<BottomSheetRef, BottomSheetProps>(
|
|
35
29
|
({ ...props }, ref) => {
|
|
36
30
|
return <View ref={ref} {...props} />;
|
|
@@ -38,11 +38,11 @@ const baseClass =
|
|
|
38
38
|
export const PopupMenuButton = ({
|
|
39
39
|
action,
|
|
40
40
|
text = '',
|
|
41
|
-
loadingText = '',
|
|
41
|
+
loadingText: _loadingText = '',
|
|
42
42
|
icon: Icon,
|
|
43
43
|
danger = false,
|
|
44
44
|
compact = false,
|
|
45
|
-
title = '',
|
|
45
|
+
title: _title = '',
|
|
46
46
|
textSlot,
|
|
47
47
|
closeOnPress = true,
|
|
48
48
|
disabled,
|
|
@@ -27,7 +27,7 @@ const DEFAULT_ICON_SIZE = 22;
|
|
|
27
27
|
* surface as @openpeepshq/react-ui's PopupMenu.
|
|
28
28
|
*/
|
|
29
29
|
export const PopupMenu = ({
|
|
30
|
-
className,
|
|
30
|
+
className: _className,
|
|
31
31
|
iconSize = DEFAULT_ICON_SIZE,
|
|
32
32
|
compact = false,
|
|
33
33
|
menuButton,
|
|
@@ -36,7 +36,7 @@ export const PopupMenu = ({
|
|
|
36
36
|
triggerIcon,
|
|
37
37
|
}: PopupMenuProps) => {
|
|
38
38
|
const actionName = title;
|
|
39
|
-
const [
|
|
39
|
+
const [_open, setOpen] = React.useState(false);
|
|
40
40
|
|
|
41
41
|
const TriggerIcon = () => {
|
|
42
42
|
if (triggerIcon) return <>{triggerIcon}</>;
|
package/src/lib/utils.ts
CHANGED
|
@@ -130,8 +130,12 @@ export const handleInternalURLNavigation = (
|
|
|
130
130
|
const hash = hashStart === -1 ? '' : path.slice(hashStart);
|
|
131
131
|
const pathWithoutHash = hashStart === -1 ? path : path.slice(0, hashStart);
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
const pathname = pathWithoutHash.split('?')[0] ?? pathWithoutHash;
|
|
134
|
+
if (isWelcomePath(pathname)) {
|
|
135
|
+
goto({ target: 'welcome' });
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
if (isGroupPath(pathname)) {
|
|
135
139
|
goto({
|
|
136
140
|
target: 'group',
|
|
137
141
|
params: {
|
|
@@ -204,6 +208,8 @@ export const handleInternalURLNavigation = (
|
|
|
204
208
|
};
|
|
205
209
|
|
|
206
210
|
export const isProfilePath = (path: string) => path.startsWith('/@');
|
|
211
|
+
export const isWelcomePath = (path: string) =>
|
|
212
|
+
path === '/welcome' || path === '/welcome/';
|
|
207
213
|
export const isGroupPath = (path: string) => path.startsWith('/groups/@');
|
|
208
214
|
export const isJamPath = (path: string) =>
|
|
209
215
|
path.startsWith('/events/') && path.endsWith('/jam');
|
|
@@ -217,7 +223,8 @@ export const isLocalLink = (url: string, origin: string) => {
|
|
|
217
223
|
urlObj.origin === origin &&
|
|
218
224
|
(isPostPath(urlObj.pathname) ||
|
|
219
225
|
isJamPath(urlObj.pathname) ||
|
|
220
|
-
isGroupPath(urlObj.pathname)
|
|
226
|
+
isGroupPath(urlObj.pathname) ||
|
|
227
|
+
isWelcomePath(urlObj.pathname))
|
|
221
228
|
);
|
|
222
229
|
} catch {
|
|
223
230
|
return false;
|
|
@@ -6,6 +6,9 @@ import { useForm } from 'react-hook-form';
|
|
|
6
6
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
7
7
|
import { NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
8
8
|
import {
|
|
9
|
+
accountNameSchema,
|
|
10
|
+
HANDLE_RESERVED_MESSAGE,
|
|
11
|
+
isForbiddenHandle,
|
|
9
12
|
registerRequestSchema,
|
|
10
13
|
type RegisterRequest,
|
|
11
14
|
} from '@openpeepshq/common';
|
|
@@ -31,7 +34,10 @@ const INVITE_INACTIVE_MESSAGES = new Set([
|
|
|
31
34
|
'Invalid Invite Code',
|
|
32
35
|
]);
|
|
33
36
|
|
|
34
|
-
const buildRegisterFormSchema = (
|
|
37
|
+
const buildRegisterFormSchema = (
|
|
38
|
+
t: TFunction,
|
|
39
|
+
additionalForbiddenHandles: readonly string[] = []
|
|
40
|
+
) =>
|
|
35
41
|
registerRequestSchema
|
|
36
42
|
.refine((d) => d.password === d.confirmPassword, {
|
|
37
43
|
message: t('auth.register.passwordsDoNotMatch'),
|
|
@@ -40,12 +46,25 @@ const buildRegisterFormSchema = (t: TFunction) =>
|
|
|
40
46
|
.refine((d) => d.privacyPolicyAccepted, {
|
|
41
47
|
message: t('auth.register.mustAgreePrivacyPolicy'),
|
|
42
48
|
path: ['privacyPolicyAccepted'],
|
|
49
|
+
})
|
|
50
|
+
.superRefine((data, ctx) => {
|
|
51
|
+
if (!isForbiddenHandle(data.handle, additionalForbiddenHandles)) return;
|
|
52
|
+
if (!accountNameSchema.safeParse(data.handle).success) return;
|
|
53
|
+
ctx.addIssue({
|
|
54
|
+
code: 'custom',
|
|
55
|
+
path: ['handle'],
|
|
56
|
+
message: t('profile.form.handleReserved'),
|
|
57
|
+
});
|
|
43
58
|
});
|
|
44
59
|
|
|
45
|
-
const registerErrorCopy = (raw: string, t: TFunction) =>
|
|
46
|
-
|
|
60
|
+
const registerErrorCopy = (raw: string, t: TFunction) => {
|
|
61
|
+
if (raw === HANDLE_RESERVED_MESSAGE) {
|
|
62
|
+
return t('profile.form.handleReserved');
|
|
63
|
+
}
|
|
64
|
+
return INVITE_INACTIVE_MESSAGES.has(raw)
|
|
47
65
|
? t('auth.register.inviteInactive')
|
|
48
66
|
: t(raw);
|
|
67
|
+
};
|
|
49
68
|
|
|
50
69
|
type RegisterProps = NativeStackScreenProps<
|
|
51
70
|
AuthStackParamList,
|
|
@@ -60,7 +79,12 @@ export const Register = ({
|
|
|
60
79
|
const { t } = useTranslation();
|
|
61
80
|
const { register } = useRegisterAccount();
|
|
62
81
|
const serverInfo = useServerInfo();
|
|
63
|
-
const
|
|
82
|
+
const additionalForbiddenHandles =
|
|
83
|
+
serverInfo.communityConfig?.settings?.additionalForbiddenHandles;
|
|
84
|
+
const registerFormSchema = useMemo(
|
|
85
|
+
() => buildRegisterFormSchema(t, additionalForbiddenHandles ?? []),
|
|
86
|
+
[t, additionalForbiddenHandles]
|
|
87
|
+
);
|
|
64
88
|
|
|
65
89
|
const form = useForm<RegisterRequest>({
|
|
66
90
|
resolver: zodResolver(registerFormSchema),
|
|
@@ -201,6 +225,12 @@ export const Register = ({
|
|
|
201
225
|
)}
|
|
202
226
|
/>
|
|
203
227
|
|
|
228
|
+
{password && password.length > 0 && (
|
|
229
|
+
<ThemedText className="text-xs text-muted-foreground">
|
|
230
|
+
{t('auth.register.passwordRules')}
|
|
231
|
+
</ThemedText>
|
|
232
|
+
)}
|
|
233
|
+
|
|
204
234
|
{(password ?? '').length > 0 && (confirmPassword ?? '').length === 0 ? (
|
|
205
235
|
<View className="w-full items-center rounded border border-border py-2">
|
|
206
236
|
<ThemedText>
|
|
@@ -23,14 +23,38 @@ import { OpenpeepsMarkdownInput } from '../../components/post/post-form/Openpeep
|
|
|
23
23
|
import { maxContentLength } from '../../lib/utils';
|
|
24
24
|
import { DropdownMenu } from '../../components/ui/dropdown-menu';
|
|
25
25
|
import { Button } from '../../components/ui/button';
|
|
26
|
+
import { ProfileAvatar } from '../../components/profile/Avatar';
|
|
26
27
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
27
28
|
import {
|
|
28
29
|
ConversationParticipantsModal,
|
|
29
30
|
ConversationProfileHeader,
|
|
30
31
|
MessageInThread,
|
|
31
32
|
} from '../../components/conversations/index';
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Shows handle + bio for a 1:1 conversation participant, without a
|
|
36
|
+
* duplicate avatar (the header already renders it).
|
|
37
|
+
*/
|
|
38
|
+
const ConversationParticipantDetail = ({
|
|
39
|
+
profile,
|
|
40
|
+
}: {
|
|
41
|
+
profile: import('@openpeepshq/common').Profile;
|
|
42
|
+
}) => {
|
|
43
|
+
const truncate = (text: string | null | undefined, max: number) =>
|
|
44
|
+
!text ? '' : text.length > max ? text.slice(0, max) + '…' : text;
|
|
45
|
+
return (
|
|
46
|
+
<View className="gap-y-1 p-3">
|
|
47
|
+
<ThemedText className="text-muted-foreground text-xs">
|
|
48
|
+
@{profile.handle}
|
|
49
|
+
</ThemedText>
|
|
50
|
+
{profile.bio ? (
|
|
51
|
+
<ThemedText className="text-sm">
|
|
52
|
+
{truncate(profile.bio, 100)}
|
|
53
|
+
</ThemedText>
|
|
54
|
+
) : null}
|
|
55
|
+
</View>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
34
58
|
|
|
35
59
|
type ConversationProps = MainScreenProps<'Conversation'>;
|
|
36
60
|
|
|
@@ -100,6 +124,17 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
100
124
|
};
|
|
101
125
|
}, [id, client, queryClient, flushPostViews]);
|
|
102
126
|
|
|
127
|
+
// The URL may point at any root of a merged 1:1 conversation (e.g.
|
|
128
|
+
// notification links); unseen counts are merged under the pair's oldest
|
|
129
|
+
// root, so clear that key once the conversation's first message is known.
|
|
130
|
+
const firstMessageId = messages?.[0]?.id;
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
if (!id || !firstMessageId || firstMessageId === id) return;
|
|
133
|
+
adjustUnseenCounts(queryClient, client, {
|
|
134
|
+
clearConversation: firstMessageId,
|
|
135
|
+
});
|
|
136
|
+
}, [id, firstMessageId, client, queryClient]);
|
|
137
|
+
|
|
103
138
|
useEffect(() => {
|
|
104
139
|
if (!id || !currentProfile || isLoading || !messages) return;
|
|
105
140
|
const unseenIds = messages
|
|
@@ -142,11 +177,7 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
142
177
|
mirroring the web conversation Show page. */}
|
|
143
178
|
<View className="border-b border-border">
|
|
144
179
|
{participants.length === 1 && participants[0] ? (
|
|
145
|
-
<
|
|
146
|
-
profile={participants[0]}
|
|
147
|
-
showAction={false}
|
|
148
|
-
hasAction={false}
|
|
149
|
-
/>
|
|
180
|
+
<ConversationParticipantDetail profile={participants[0]} />
|
|
150
181
|
) : multipleParticipants ? (
|
|
151
182
|
<TouchableOpacity
|
|
152
183
|
onPress={() => setParticipantsOpen(true)}
|
|
@@ -15,7 +15,7 @@ type HomeScreenProps = CompositeScreenProps<
|
|
|
15
15
|
NativeStackScreenProps<TabStackParamList, 'Bookmarks'>,
|
|
16
16
|
NativeStackScreenProps<MainStackParamList>
|
|
17
17
|
>;
|
|
18
|
-
export const FeedsBookmarks: React.FC<HomeScreenProps> = (
|
|
18
|
+
export const FeedsBookmarks: React.FC<HomeScreenProps> = () => {
|
|
19
19
|
const { openpeepsApi } = useOpenpeeps();
|
|
20
20
|
const { t } = useTranslation();
|
|
21
21
|
|
package/src/pages/jams/Index.tsx
CHANGED
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
ChevronRightIcon,
|
|
11
11
|
MoreHorizontalIcon,
|
|
12
12
|
} from '../../components/icons/index';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
CreateNewJam,
|
|
15
|
+
LiveJamsSection,
|
|
16
|
+
LivekitUnavailableNotice,
|
|
17
|
+
} from '../../components/jams/index';
|
|
14
18
|
import { MainStackParamList } from '../../components/navigation/types/index';
|
|
15
19
|
import { EventsFeed } from '../../components/post/feed/events/EventsFeed';
|
|
16
20
|
import { Button } from '../../components/ui/button';
|
|
@@ -99,9 +103,7 @@ export const JamsIndex = ({ my = false }: Props) => {
|
|
|
99
103
|
className="w-full bg-background p-4"
|
|
100
104
|
>
|
|
101
105
|
{!livekitEnabled ? (
|
|
102
|
-
<
|
|
103
|
-
{t('jams.unavailable.message')}
|
|
104
|
-
</ThemedText>
|
|
106
|
+
<LivekitUnavailableNotice className="mb-4 text-sm text-destructive" />
|
|
105
107
|
) : null}
|
|
106
108
|
{!my && livekitEnabled ? <LiveJamsSection /> : null}
|
|
107
109
|
|
package/src/pages/posts/New.tsx
CHANGED
|
@@ -277,7 +277,7 @@ export const NewPost = ({ route, navigation }: PostProps) => {
|
|
|
277
277
|
if (route.params?.triggeredFrom === 'group') {
|
|
278
278
|
navigation.pop();
|
|
279
279
|
navigation.navigate('Group', {
|
|
280
|
-
id: route.params?.originatorId
|
|
280
|
+
id: route.params?.originatorId as string,
|
|
281
281
|
});
|
|
282
282
|
} else {
|
|
283
283
|
navigation.goBack();
|
|
@@ -21,6 +21,7 @@ export const EditResource: React.FC<EditResourceProps> = ({ route }) => {
|
|
|
21
21
|
postData,
|
|
22
22
|
setPostData,
|
|
23
23
|
resourceTitle,
|
|
24
|
+
canSubmit,
|
|
24
25
|
submitting,
|
|
25
26
|
error,
|
|
26
27
|
clearError,
|
|
@@ -46,7 +47,7 @@ export const EditResource: React.FC<EditResourceProps> = ({ route }) => {
|
|
|
46
47
|
: t('resources.update.title', { defaultValue: 'Update resource' })
|
|
47
48
|
}
|
|
48
49
|
onPress={() => void submit()}
|
|
49
|
-
disabled={submitting || !
|
|
50
|
+
disabled={submitting || !canSubmit}
|
|
50
51
|
loading={submitting}
|
|
51
52
|
/>
|
|
52
53
|
);
|