@openpeepshq/rn-components 0.7.2 → 0.8.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.
Files changed (70) hide show
  1. package/README.md +1 -1
  2. package/package.json +12 -7
  3. package/src/components/custom/navigation/side-menu.tsx +59 -11
  4. package/src/components/icons/iconWithClassName.tsx +21 -0
  5. package/src/components/jams/JamActionsFooter.tsx +8 -2
  6. package/src/components/jams/JamCapacityGate.tsx +1 -1
  7. package/src/components/jams/JamCard.tsx +8 -4
  8. package/src/components/jams/JamConference.tsx +6 -1
  9. package/src/components/jams/JamParticipantConference.tsx +2 -0
  10. package/src/components/jams/JamRoom.tsx +2 -3
  11. package/src/components/jams/LiveJamsSection.tsx +12 -1
  12. package/src/components/jams/LivekitUnavailableNotice.tsx +25 -0
  13. package/src/components/jams/index.ts +1 -0
  14. package/src/components/markdown/MarkdownOverlay.tsx +75 -0
  15. package/src/components/markdown/OpenpeepsMarkdown.tsx +3 -1
  16. package/src/components/markdown/extensions/link.tsx +34 -0
  17. package/src/components/markdown/index.ts +2 -0
  18. package/src/components/navigation/tab-navigator.tsx +39 -17
  19. package/src/components/notifications/NotificationItem.tsx +27 -2
  20. package/src/components/notifications/types/JamStarted.tsx +13 -3
  21. package/src/components/notifications/types/Reply.tsx +1 -5
  22. package/src/components/notifications/types/WaitlistOffer.tsx +61 -0
  23. package/src/components/notifications/types/index.ts +1 -0
  24. package/src/components/post/CompactReplyParent.tsx +16 -15
  25. package/src/components/post/TruncatedMarkdown.tsx +60 -0
  26. package/src/components/post/helpers.ts +2 -2
  27. package/src/components/post/index.ts +2 -0
  28. package/src/components/post/pieces/EventRsvpButton.tsx +99 -5
  29. package/src/components/post/pieces/EventRsvpList.tsx +46 -0
  30. package/src/components/post/pieces/EventRsvpScopeDialog.tsx +30 -19
  31. package/src/components/post/pieces/EventWaitlistJoinDialog.tsx +62 -0
  32. package/src/components/post/pieces/PollContent.tsx +7 -7
  33. package/src/components/post/pieces/PostActions.tsx +89 -23
  34. package/src/components/post/pieces/ShareMenu.tsx +2 -2
  35. package/src/components/post/post-form/DescriptionEditModal.tsx +1 -0
  36. package/src/components/post/post-form/EventForm.tsx +50 -10
  37. package/src/components/post/post-form/ResourceForm.tsx +115 -5
  38. package/src/components/post/types/Article.tsx +6 -2
  39. package/src/components/post/types/Poll.tsx +4 -1
  40. package/src/components/post/types/event/CardEvent.tsx +101 -76
  41. package/src/components/post/types/event/FullEvent.tsx +60 -23
  42. package/src/components/post/types/event/ProfileEventRelationship.tsx +2 -0
  43. package/src/components/post/types/resource/FullResource.tsx +9 -1
  44. package/src/components/preview-link/LocalPreviewLink.tsx +4 -1
  45. package/src/components/preview-link/helpers.ts +5 -1
  46. package/src/components/preview-link/index.ts +1 -0
  47. package/src/components/preview-link/local/WelcomePreview.tsx +59 -0
  48. package/src/components/profile/Avatar.tsx +0 -1
  49. package/src/components/profile/EditProfileForm.tsx +23 -2
  50. package/src/components/profile/ProfileSheet.tsx +1 -1
  51. package/src/components/resources/ResourceCard.tsx +62 -14
  52. package/src/components/resources/ResourceLibrary.tsx +2 -2
  53. package/src/components/ui/badge.tsx +2 -3
  54. package/src/components/ui/bottom-sheet.tsx +0 -6
  55. package/src/components/ui/popup-menu-button.tsx +2 -2
  56. package/src/components/ui/popup-menu-separator.tsx +1 -1
  57. package/src/components/ui/popup-menu.tsx +2 -2
  58. package/src/lib/utils.ts +10 -3
  59. package/src/pages/auth/Register.tsx +34 -4
  60. package/src/pages/conversations/Show.tsx +38 -7
  61. package/src/pages/feeds/Bookmarks.tsx +1 -1
  62. package/src/pages/jams/Index.tsx +6 -4
  63. package/src/pages/posts/New.tsx +1 -1
  64. package/src/pages/resources/Edit.tsx +2 -1
  65. package/src/pages/resources/New.tsx +6 -1
  66. package/src/pages/settings/Account.tsx +46 -2
  67. package/src/pages/settings/Index.tsx +3 -4
  68. package/src/pages/settings/NotificationPreferences.tsx +3 -3
  69. package/src/pages/settings/Theme.tsx +1 -1
  70. package/src/components/icons/iconWithClassName.ts +0 -12
@@ -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
- {excerpt ? (
164
- <ThemedText className="text-sm text-muted-foreground">
165
- {excerpt}
166
- </ThemedText>
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
- {excerpt ? (
268
- <ThemedText className="text-sm text-muted-foreground">
269
- {excerpt}
270
- </ThemedText>
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
- <ThemedText
323
+ <Pressable
281
324
  key={value}
282
- className="rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground"
325
+ onPress={() =>
326
+ goto({ target: 'HashtagPosts', params: { tag: value } })
327
+ }
328
+ className="rounded-full bg-muted px-2 py-0.5"
283
329
  >
284
- #{value}
285
- </ThemedText>
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 { ThemedText } from './themed-text';
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,
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { View } from 'react-native';
2
+ import {} from 'react-native';
3
3
  import { DropdownMenuSeparator } from './dropdown-menu';
4
4
 
5
5
  /**
@@ -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 [open, setOpen] = React.useState(false);
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
- if (isGroupPath(pathWithoutHash)) {
134
- const pathname = pathWithoutHash.split('?')[0] ?? pathWithoutHash;
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 = (t: TFunction) =>
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
- INVITE_INACTIVE_MESSAGES.has(raw)
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 registerFormSchema = useMemo(() => buildRegisterFormSchema(t), [t]);
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
- import { ProfileAvatar } from '../../components/profile/Avatar';
33
- import { ProfileCard } from '../../components/profile/ProfileCard';
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
- <ProfileCard
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
 
@@ -10,7 +10,11 @@ import {
10
10
  ChevronRightIcon,
11
11
  MoreHorizontalIcon,
12
12
  } from '../../components/icons/index';
13
- import { CreateNewJam, LiveJamsSection } from '../../components/jams/index';
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
- <ThemedText className="mb-4 text-sm text-destructive">
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
 
@@ -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 || !postData}
50
+ disabled={submitting || !canSubmit}
50
51
  loading={submitting}
51
52
  />
52
53
  );
@@ -16,6 +16,7 @@ export const NewResource: React.FC<NewResourceProps> = () => {
16
16
  postData,
17
17
  setPostData,
18
18
  canSubmit,
19
+ groupOnly,
19
20
  submitting,
20
21
  error,
21
22
  clearError,
@@ -48,7 +49,11 @@ export const NewResource: React.FC<NewResourceProps> = () => {
48
49
  contentContainerClassName="grow"
49
50
  className="pb-12"
50
51
  >
51
- <ResourceForm postData={postData} onChange={setPostData} />
52
+ <ResourceForm
53
+ postData={postData}
54
+ onChange={setPostData}
55
+ groupOnly={groupOnly}
56
+ />
52
57
  </KeyboardAwareScrollView>
53
58
  </ThemedView>
54
59
  );
@@ -10,7 +10,7 @@ import Toast from 'react-native-toast-message';
10
10
  import { Button } from '../../components/ui/button';
11
11
  import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
12
12
  import { Account } from '@openpeepshq/common';
13
- import { View } from 'react-native';
13
+ import { ActivityIndicator, View } from 'react-native';
14
14
  import { useTranslation } from 'react-i18next';
15
15
 
16
16
  type AccountSettingsProps = MainScreenProps<'AccountSettings'>;
@@ -22,7 +22,7 @@ type AccountFormValues = {
22
22
  confirmPassword: string | undefined;
23
23
  };
24
24
 
25
- export const AccountSettings: React.FC<AccountSettingsProps> = ({}) => {
25
+ export const AccountSettings: React.FC<AccountSettingsProps> = () => {
26
26
  const { openpeepsApi, queryClient } = useOpenpeeps();
27
27
  const { data: currentAccount } = openpeepsApi.useCurrentAccount();
28
28
  const logout = openpeepsApi.logoutAction();
@@ -31,7 +31,9 @@ export const AccountSettings: React.FC<AccountSettingsProps> = ({}) => {
31
31
  const [isConfirmPasswordVisible, setIsConfirmPasswordVisible] =
32
32
  React.useState(false);
33
33
  const updateCurrentAccount = openpeepsApi.updateCurrentAccountAction();
34
+ const validateEmail = openpeepsApi.validationEmailAction();
34
35
  const [isSubmitting, setIsSubmitting] = useState(false);
36
+ const [verifying, setVerifying] = useState(false);
35
37
  const { t } = useTranslation();
36
38
 
37
39
  const form = useForm<AccountFormValues>({
@@ -116,6 +118,28 @@ export const AccountSettings: React.FC<AccountSettingsProps> = ({}) => {
116
118
  setIsSubmitting(false);
117
119
  });
118
120
  };
121
+ const handleVerifyEmail = async () => {
122
+ setVerifying(true);
123
+ try {
124
+ await validateEmail();
125
+ Toast.show({
126
+ type: 'success',
127
+ text1: t('settings.account.verifyEmailSent', {
128
+ defaultValue: 'Verification email sent',
129
+ }),
130
+ });
131
+ } catch {
132
+ Toast.show({
133
+ type: 'error',
134
+ text1: t('settings.account.verifyEmailError', {
135
+ defaultValue: 'Failed to send verification email',
136
+ }),
137
+ });
138
+ } finally {
139
+ setVerifying(false);
140
+ }
141
+ };
142
+
119
143
  const handleSubmit = async () => {
120
144
  const values = form.getValues();
121
145
  await onSubmit(values);
@@ -165,6 +189,26 @@ export const AccountSettings: React.FC<AccountSettingsProps> = ({}) => {
165
189
  )}
166
190
  />
167
191
  </View>
192
+ {!(currentAccount as Account)?.emailValidated ? (
193
+ <View className="w-full gap-y-2">
194
+ <ThemedText className="text-sm text-muted-foreground">
195
+ {t('settings.account.verifyEmailDescription')}
196
+ </ThemedText>
197
+ <Button
198
+ variant="outline"
199
+ onPress={() => void handleVerifyEmail()}
200
+ disabled={verifying}
201
+ >
202
+ {verifying ? (
203
+ <ActivityIndicator size={16} />
204
+ ) : (
205
+ <ThemedText className="text-sm">
206
+ {t('settings.account.verifyEmailButton')}
207
+ </ThemedText>
208
+ )}
209
+ </Button>
210
+ </View>
211
+ ) : null}
168
212
 
169
213
  <View className="relative w-full">
170
214
  <Button
@@ -15,10 +15,9 @@ import { ConfigMenuButton } from '../../components/configuration/index';
15
15
  import { useSetPageHeader } from '../../components/layout';
16
16
  import { ThemedView } from '../../components/ui/themed-view';
17
17
 
18
- export const Settings = ({}: NativeStackScreenProps<
19
- TabStackParamList,
20
- 'Settings'
21
- >) => {
18
+ export const Settings = (
19
+ _: NativeStackScreenProps<TabStackParamList, 'Settings'>
20
+ ) => {
22
21
  const profile = useCurrentProfile();
23
22
  const { t } = useTranslation();
24
23
  const navigation =
@@ -28,9 +28,9 @@ const notificationTypeDefaults: Record<
28
28
 
29
29
  type NotificationsSettingsProps = MainScreenProps<'NotificationsSettings'>;
30
30
 
31
- export const NotificationPreferences: React.FC<
32
- NotificationsSettingsProps
33
- > = ({}) => {
31
+ export const NotificationPreferences: React.FC<NotificationsSettingsProps> = (
32
+ _props
33
+ ) => {
34
34
  const { t } = useTranslation();
35
35
  const { types } = useNotificationPreferences();
36
36
 
@@ -16,7 +16,7 @@ import { toAbsoluteMediaUrl } from '../../lib/media-url';
16
16
 
17
17
  type ThemeSettingsProps = MainScreenProps<'ThemeSettings'>;
18
18
 
19
- export const ThemeSettings: React.FC<ThemeSettingsProps> = ({}) => {
19
+ export const ThemeSettings: React.FC<ThemeSettingsProps> = () => {
20
20
  const { theme, setTheme, submitting, save } = useThemePreference();
21
21
  const serverInfo = useServerInfo();
22
22
  const { refresh } = useOpenPeepsTheme();
@@ -1,12 +0,0 @@
1
- import type { LucideIcon } from 'lucide-react-native';
2
- import { cssInterop } from 'nativewind';
3
- export const iconWithClassName = (icon: LucideIcon) =>
4
- cssInterop(icon, {
5
- className: {
6
- target: 'style',
7
- nativeStyleToProp: {
8
- color: true,
9
- opacity: true,
10
- },
11
- },
12
- });