@openpeepshq/rn-components 0.3.7 → 0.3.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/rn-components",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "React Native community screens and shared UI (extracted from the Black Ambition app) for the OpenPeeps stack.",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./src/index.ts",
@@ -140,8 +140,8 @@
140
140
  "timezones-list": "^3.1.0",
141
141
  "validator": "^13.15.23",
142
142
  "zustand": "^5.0.3",
143
- "@openpeepshq/common": "^0.2.0",
144
- "@openpeepshq/react": "^0.3.1"
143
+ "@openpeepshq/react": "^0.3.1",
144
+ "@openpeepshq/common": "^0.2.0"
145
145
  },
146
146
  "devDependencies": {
147
147
  "@babel/core": "^7.26.7",
@@ -8,5 +8,6 @@ export * from './infinite-scroll-container';
8
8
  export * from './Loader';
9
9
  export * from './media-upload-progress';
10
10
  export * from './participant-avatar';
11
+ export * from './plus-fab';
11
12
  export * from './popover';
12
13
  export * from './select';
@@ -0,0 +1,23 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import { Pressable } from 'react-native';
3
+
4
+ interface PlusFabProps {
5
+ accessibilityLabel: string;
6
+ onPress: () => void;
7
+ children: ReactNode;
8
+ }
9
+
10
+ export const PlusFab = ({
11
+ accessibilityLabel,
12
+ onPress,
13
+ children,
14
+ }: PlusFabProps) => (
15
+ <Pressable
16
+ accessibilityRole="button"
17
+ accessibilityLabel={accessibilityLabel}
18
+ onPress={onPress}
19
+ className="absolute bottom-10 right-6 z-20 size-16 items-center justify-center rounded-full bg-foreground"
20
+ >
21
+ {children}
22
+ </Pressable>
23
+ );
@@ -5,87 +5,46 @@ import { Image, TouchableOpacity, View } from 'react-native';
5
5
  import { Button } from '../../ui/button';
6
6
  import {
7
7
  BellIcon,
8
- BookTextIcon,
9
- CalendarIcon,
10
- DoorOpenIcon,
8
+ BookCheckIcon,
9
+ BookmarkIcon,
10
+ BookUserIcon,
11
+ CalendarDaysIcon,
11
12
  HomeIcon,
12
13
  LogOutIcon,
13
14
  MessageSquareTextIcon,
14
15
  NewspaperIcon,
15
16
  PhoneCallIcon,
17
+ ScrollTextIcon,
18
+ SearchIcon,
16
19
  SettingsIcon,
17
20
  UsersIcon,
18
21
  XIcon,
19
- SearchIcon,
20
- ScrollTextIcon,
21
- BookmarkIcon,
22
22
  } from '../../icons/index';
23
23
  import { ThemedText } from '../../ui/themed-text';
24
24
  import { useWindowSize } from '../../../hooks/helper';
25
25
  import { useAppImagesStore } from '../../../stores/useAppImagesStore';
26
26
  import { formatBadgeCount } from '@openpeepshq/common';
27
- import { useOpenpeeps } from '@openpeepshq/react';
28
- import { LucideProps, SquarePenIcon } from 'lucide-react-native';
27
+ import { buildMainNavItems, useOpenpeeps } from '@openpeepshq/react';
29
28
  import { useTranslation } from 'react-i18next';
30
29
  import { ProfileAvatar } from '../../profile/Avatar';
31
30
  import type { GotoHandlerParams } from '../../../types/goto';
31
+ import type { LucideProps } from 'lucide-react-native';
32
32
 
33
- type MenuItem = {
34
- icon: React.ComponentType<LucideProps>;
35
- target: string;
33
+ const menuIcons: Record<string, React.ComponentType<LucideProps>> = {
34
+ community: HomeIcon,
35
+ welcome: BookCheckIcon,
36
+ explore: SearchIcon,
37
+ myFeed: NewspaperIcon,
38
+ jams: PhoneCallIcon,
39
+ groups: UsersIcon,
40
+ events: CalendarDaysIcon,
41
+ articles: ScrollTextIcon,
42
+ messages: MessageSquareTextIcon,
43
+ members: BookUserIcon,
44
+ bookmarks: BookmarkIcon,
45
+ settings: SettingsIcon,
36
46
  };
37
47
 
38
- const menuItems: MenuItem[] = [
39
- {
40
- icon: HomeIcon,
41
- target: 'community',
42
- },
43
- {
44
- icon: SearchIcon,
45
- target: 'explore',
46
- },
47
- {
48
- icon: NewspaperIcon,
49
- target: 'myFeed',
50
- },
51
- {
52
- icon: DoorOpenIcon,
53
- target: 'welcome',
54
- },
55
- {
56
- icon: PhoneCallIcon,
57
- target: 'jams',
58
- },
59
- {
60
- icon: UsersIcon,
61
- target: 'groups',
62
- },
63
- {
64
- icon: CalendarIcon,
65
- target: 'events',
66
- },
67
- {
68
- icon: ScrollTextIcon,
69
- target: 'articles',
70
- },
71
- {
72
- icon: MessageSquareTextIcon,
73
- target: 'messages',
74
- },
75
- {
76
- icon: BookmarkIcon,
77
- target: 'bookmarks',
78
- },
79
- {
80
- icon: BookTextIcon,
81
- target: 'members',
82
- },
83
- {
84
- icon: SettingsIcon,
85
- target: 'settings',
86
- },
87
- ];
88
-
89
48
  interface SideMenuProps {
90
49
  handleNavigation: ({
91
50
  target,
@@ -97,14 +56,12 @@ interface SideMenuProps {
97
56
  onNotificationPress: () => void;
98
57
  onProfilePress: () => void;
99
58
  close?: () => void;
100
- handleNewPost: () => void;
101
59
  }
102
60
 
103
61
  export const SideMenu = ({
104
62
  handleNavigation,
105
63
  onNotificationPress,
106
64
  close,
107
- handleNewPost,
108
65
  onProfilePress,
109
66
  }: SideMenuProps) => {
110
67
  const { openpeepsApi, currentProfile } = useOpenpeeps();
@@ -126,6 +83,11 @@ export const SideMenu = ({
126
83
  messages: unreadConversationThreads,
127
84
  };
128
85
 
86
+ const menuItems = buildMainNavItems({
87
+ jamsEnabled: !!serverInfo?.jams.livekit.enabled,
88
+ showAdmin: false,
89
+ });
90
+
129
91
  const { t } = useTranslation();
130
92
 
131
93
  const [currentRoute, setCurrentRoute] = React.useState<string | undefined>(
@@ -136,7 +98,6 @@ export const SideMenu = ({
136
98
  (currentProfile && (
137
99
  <View className="sm:w-56 md:w-80 bg-background flex-1">
138
100
  <TouchableOpacity onPress={onProfilePress} className="mt-12 mb-6 px-4">
139
- {/* Header: Logo + Avatar + Name */}
140
101
  <View className="w-full flex-row items-center justify-between">
141
102
  <Image
142
103
  source={{ uri: logoSmall! }}
@@ -176,35 +137,24 @@ export const SideMenu = ({
176
137
  </View>
177
138
  </TouchableOpacity>
178
139
 
179
- {isMediumScreenOrLarger && (
180
- <Button
181
- onPress={handleNewPost}
182
- className="flex-row gap-4 items-center text-black mb-4 justify-center px-4 w-full"
183
- >
184
- <SquarePenIcon size={20} />
185
- <ThemedText>New Post</ThemedText>
186
- </Button>
187
- )}
188
-
189
140
  <Separator />
190
141
 
191
- {/* Scrollable Content */}
192
142
  <View className="flex-1">
193
143
  <ScrollView contentContainerClassName="grow" className="mt-5 px-4">
194
- {menuItems.map((item, index) => {
195
- const isActive = currentRoute === item.target;
196
- const Icon = item.icon;
197
- if (!serverInfo?.jams.livekit.enabled && item.target === 'jams') {
144
+ {menuItems.map((item) => {
145
+ const isActive = currentRoute === item.id;
146
+ const Icon = menuIcons[item.id];
147
+ if (!Icon) {
198
148
  return null;
199
149
  }
200
150
  return (
201
151
  <Button
202
- key={`drawer-${index}`}
152
+ key={item.id}
203
153
  variant="ghost"
204
154
  className="flex-row items-center w-full mb-4 justify-start p-4"
205
155
  onPress={() => {
206
- setCurrentRoute(item.target);
207
- handleNavigation({ target: item.target });
156
+ setCurrentRoute(item.id);
157
+ handleNavigation({ target: item.id });
208
158
  }}
209
159
  >
210
160
  <View className="flex-row items-center flex-1 justify-between">
@@ -220,13 +170,13 @@ export const SideMenu = ({
220
170
  className={`
221
171
  ${isActive ? 'text-foreground' : 'text-muted-foreground'}`}
222
172
  >
223
- {t(`navigation.${item.target}`)}
173
+ {t(item.labelKey)}
224
174
  </ThemedText>
225
175
  </View>
226
- {(menuUnreadCounts[item.target] ?? 0) > 0 ? (
176
+ {(menuUnreadCounts[item.id] ?? 0) > 0 ? (
227
177
  <View className="bg-destructive size-5 min-w-5 items-center justify-center rounded-full px-1">
228
178
  <ThemedText className="text-xs font-semibold text-destructive-foreground">
229
- {formatBadgeCount(menuUnreadCounts[item.target] ?? 0)}
179
+ {formatBadgeCount(menuUnreadCounts[item.id] ?? 0)}
230
180
  </ThemedText>
231
181
  </View>
232
182
  ) : null}
@@ -250,7 +200,6 @@ export const SideMenu = ({
250
200
  </ScrollView>
251
201
  </View>
252
202
 
253
- {/* Footer */}
254
203
  <Separator />
255
204
  <View className="pl-6 pr-4 pt-4 pb-12">
256
205
  <ThemedText className="text-muted-foreground text-base tracking-wider">
@@ -31,7 +31,10 @@ import {
31
31
  User,
32
32
  MessageSquareText,
33
33
  Settings,
34
+ BookCheck,
34
35
  BookText,
36
+ BookUser,
37
+ FilePlus,
35
38
  LogOut,
36
39
  Heart,
37
40
  MessageSquare,
@@ -158,7 +161,10 @@ export const SquarePlusIcon = iconWithClassName(SquarePlus);
158
161
  export const XIcon = iconWithClassName(X);
159
162
  export const EllipsisIcon = iconWithClassName(Ellipsis);
160
163
  export const DotIcon = iconWithClassName(Dot);
164
+ export const BookCheckIcon = iconWithClassName(BookCheck);
161
165
  export const BookTextIcon = iconWithClassName(BookText);
166
+ export const BookUserIcon = iconWithClassName(BookUser);
167
+ export const FilePlusIcon = iconWithClassName(FilePlus);
162
168
  export const LogOutIcon = iconWithClassName(LogOut);
163
169
  export const HeartIcon = iconWithClassName(Heart);
164
170
  export const CornerUpLeftIcon = iconWithClassName(CornerUpLeft);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { Pressable } from 'react-native';
3
2
  import { useTranslation } from 'react-i18next';
3
+ import { PlusFab } from '../custom/common/plus-fab';
4
4
  import { PhoneCallIcon } from '../icons/index';
5
5
  import { useCreateNewJam } from './CreateNewJamContext';
6
6
 
@@ -9,12 +9,11 @@ export const CreateNewJam = () => {
9
9
  const { openCreateJam } = useCreateNewJam();
10
10
 
11
11
  return (
12
- <Pressable
12
+ <PlusFab
13
13
  accessibilityLabel={t('jams.create.title')}
14
14
  onPress={openCreateJam}
15
- className="z-20 absolute bottom-10 right-6 size-16 flex items-center justify-center bg-foreground rounded-full"
16
15
  >
17
16
  <PhoneCallIcon size={24} className="text-background" />
18
- </Pressable>
17
+ </PlusFab>
19
18
  );
20
19
  };
@@ -34,11 +34,6 @@ export const SideMenuDrawer = ({ children }: SideMenuDrawerProps) => {
34
34
  goto({ target, params });
35
35
  };
36
36
 
37
- const handleNewPost = () => {
38
- closeDrawer();
39
- goto({ target: 'newPost' });
40
- };
41
-
42
37
  const onNotificationPress = () => {
43
38
  closeDrawer();
44
39
  goto({ target: 'notifications' });
@@ -63,7 +58,6 @@ export const SideMenuDrawer = ({ children }: SideMenuDrawerProps) => {
63
58
  handleNavigation={handleNavigation}
64
59
  onNotificationPress={onNotificationPress}
65
60
  close={closeDrawer}
66
- handleNewPost={handleNewPost}
67
61
  onProfilePress={onProfilePress}
68
62
  />
69
63
  );
@@ -30,10 +30,6 @@ export const MenuWrapper = ({ children }: { children: React.ReactNode }) => {
30
30
  goto({ target, params });
31
31
  };
32
32
 
33
- const handleNewPost = () => {
34
- goto({ target: 'newPost' });
35
- };
36
-
37
33
  const onNotificationPress = () => {
38
34
  goto({ target: 'notifications' });
39
35
  };
@@ -58,7 +54,6 @@ export const MenuWrapper = ({ children }: { children: React.ReactNode }) => {
58
54
  handleNavigation={handleNavigation}
59
55
  onNotificationPress={onNotificationPress}
60
56
  onProfilePress={onProfilePress}
61
- handleNewPost={handleNewPost}
62
57
  />
63
58
  </View>
64
59
  <View className="flex-grow flex-1">{children}</View>
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { Pressable } from 'react-native';
3
2
  import { useTranslation } from 'react-i18next';
4
3
  import { useNavigation } from '@react-navigation/native';
5
4
  import { NativeStackNavigationProp } from '@react-navigation/native-stack';
@@ -10,6 +9,7 @@ import {
10
9
  type VisibilityType,
11
10
  } from '@openpeepshq/common';
12
11
  import { getNewPostStores, useAuthData } from '@openpeepshq/react';
12
+ import { PlusFab } from '../custom/common/plus-fab';
13
13
  import { PlusIcon } from '../icons/index';
14
14
  import { MainStackParamList } from '../navigation/types/index';
15
15
 
@@ -43,13 +43,8 @@ export const NewEventButton = ({
43
43
  };
44
44
 
45
45
  return (
46
- <Pressable
47
- accessibilityRole="button"
48
- accessibilityLabel={t('events.form.title')}
49
- onPress={openNewEvent}
50
- className="absolute bottom-10 right-6 z-20 size-16 items-center justify-center rounded-full bg-foreground"
51
- >
46
+ <PlusFab accessibilityLabel={t('events.form.title')} onPress={openNewEvent}>
52
47
  <PlusIcon size={24} className="text-background" />
53
- </Pressable>
48
+ </PlusFab>
54
49
  );
55
50
  };
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { Pressable } from 'react-native';
3
2
  import { useTranslation } from 'react-i18next';
4
3
  import {
5
4
  canCreatePost,
@@ -8,6 +7,7 @@ import {
8
7
  type VisibilityType,
9
8
  } from '@openpeepshq/common';
10
9
  import { useAuthData } from '@openpeepshq/react';
10
+ import { PlusFab } from '../custom/common/plus-fab';
11
11
  import { PencilLineIcon } from '../icons/index';
12
12
  import { useNewPostModal } from './post-form/NewPostModalContext';
13
13
 
@@ -34,13 +34,11 @@ export const NewNoteButton = ({
34
34
  if (!canPost) return null;
35
35
 
36
36
  return (
37
- <Pressable
38
- accessibilityRole="button"
37
+ <PlusFab
39
38
  accessibilityLabel={t('posts.form.title')}
40
39
  onPress={() => openNewPost({ visibility, group })}
41
- className="absolute bottom-10 right-6 z-20 size-16 items-center justify-center rounded-full bg-foreground"
42
40
  >
43
41
  <PencilLineIcon size={24} className="text-background" />
44
- </Pressable>
42
+ </PlusFab>
45
43
  );
46
44
  };
@@ -3,14 +3,18 @@ import {
3
3
  MainStackParamList,
4
4
  TabStackParamList,
5
5
  } from '../components/navigation/types/index';
6
- import { useFeedListParams, useOpenpeeps } from '@openpeepshq/react';
6
+ import {
7
+ useDefaultVisibility,
8
+ useFeedListParams,
9
+ useOpenpeeps,
10
+ } from '@openpeepshq/react';
7
11
  import { TabScreensHeader } from '../components/custom/index';
8
12
  import { ThemedText } from '../components/ui/themed-text';
9
13
  import { CompositeScreenProps } from '@react-navigation/native';
10
14
  import { NativeStackScreenProps } from '@react-navigation/native-stack';
11
15
  import { RefreshControl, ScrollView } from 'react-native';
12
16
 
13
- import { Feed } from '../components/post/index';
17
+ import { Feed, NewNoteButton } from '../components/post/index';
14
18
  type HomeScreenProps = CompositeScreenProps<
15
19
  NativeStackScreenProps<TabStackParamList, 'HashtagPosts'>,
16
20
  NativeStackScreenProps<MainStackParamList>
@@ -18,6 +22,7 @@ type HomeScreenProps = CompositeScreenProps<
18
22
  export const Tags: React.FC<HomeScreenProps> = ({ route }) => {
19
23
  const { openpeepsApi } = useOpenpeeps();
20
24
  const { tag } = route.params;
25
+ const visibility = useDefaultVisibility();
21
26
 
22
27
  const query = openpeepsApi.usePostsByHashtag(
23
28
  tag,
@@ -44,6 +49,7 @@ export const Tags: React.FC<HomeScreenProps> = ({ route }) => {
44
49
  >
45
50
  <Feed query={query} formatSwitch={false} />
46
51
  </ScrollView>
52
+ <NewNoteButton visibility={visibility} />
47
53
  </>
48
54
  );
49
55
  };
@@ -1,11 +1,19 @@
1
1
  import React from 'react';
2
+ import { useNavigation } from '@react-navigation/native';
3
+ import { NativeStackNavigationProp } from '@react-navigation/native-stack';
4
+ import { useTranslation } from 'react-i18next';
2
5
  import { useFeedListParams, useOpenpeeps } from '@openpeepshq/react';
3
- import { TabScreensHeader } from '../../components/custom/index';
6
+ import { PlusFab, TabScreensHeader } from '../../components/custom/index';
7
+ import { FilePlusIcon } from '../../components/icons/index';
8
+ import { MainStackParamList } from '../../components/navigation/types/index';
4
9
  import { ThemedText } from '../../components/ui/themed-text';
5
10
 
6
11
  import { Feed } from '../../components/post/index';
7
12
  export const ArticlesIndex = () => {
13
+ const { t } = useTranslation();
8
14
  const { openpeepsApi } = useOpenpeeps();
15
+ const navigation =
16
+ useNavigation<NativeStackNavigationProp<MainStackParamList>>();
9
17
 
10
18
  const articlesQuery = openpeepsApi.usePostsByType(
11
19
  'article',
@@ -16,10 +24,18 @@ export const ArticlesIndex = () => {
16
24
  <>
17
25
  <TabScreensHeader
18
26
  children={
19
- <ThemedText className="text-xl font-bold">Articles</ThemedText>
27
+ <ThemedText className="text-xl font-bold">
28
+ {t('navigation.articles')}
29
+ </ThemedText>
20
30
  }
21
31
  />
22
32
  <Feed query={articlesQuery} />
33
+ <PlusFab
34
+ accessibilityLabel={t('articles.new')}
35
+ onPress={() => navigation.navigate('NewArticle')}
36
+ >
37
+ <FilePlusIcon size={24} className="text-background" />
38
+ </PlusFab>
23
39
  </>
24
40
  );
25
41
  };
@@ -8,17 +8,22 @@ import React, { useEffect, useRef } from 'react';
8
8
  import {
9
9
  TabScreensHeader,
10
10
  EmptyStateContainer,
11
+ PlusFab,
11
12
  } from '../../components/custom/index';
12
13
  import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
13
- import { useOpenpeeps } from '@openpeepshq/react';
14
- import { XIcon, SearchIcon } from '../../components/icons/index';
14
+ import { useAuthData, useOpenpeeps } from '@openpeepshq/react';
15
+ import {
16
+ MessageSquarePlusIcon,
17
+ SearchIcon,
18
+ XIcon,
19
+ } from '../../components/icons/index';
15
20
  import { CompositeScreenProps } from '@react-navigation/native';
16
21
  import { NativeStackScreenProps } from '@react-navigation/native-stack';
17
22
  import {
18
23
  TabStackParamList,
19
24
  MainStackParamList,
20
25
  } from '../../components/navigation/types/index';
21
- import { PublicPost } from '@openpeepshq/common';
26
+ import { canCreatePost, PublicPost } from '@openpeepshq/common';
22
27
  import { Input } from '../../components/ui/input';
23
28
  import { ThemedText } from '../../components/ui/themed-text';
24
29
  import { profileMatchesQuery } from '../../lib/utils';
@@ -27,6 +32,7 @@ import { BottomSheetModal } from '@gorhom/bottom-sheet';
27
32
  import {
28
33
  ConversationPreviewCard,
29
34
  DirectMessagesHeaderActions,
35
+ useCreateNewConversation,
30
36
  } from '../../components/conversations/index';
31
37
  import { useTranslation } from 'react-i18next';
32
38
 
@@ -39,6 +45,9 @@ type MessagesProps = CompositeScreenProps<
39
45
  export const ConversationsIndex: React.FC<MessagesProps> = ({ navigation }) => {
40
46
  const { openpeepsApi } = useOpenpeeps();
41
47
  const { t } = useTranslation();
48
+ const authData = useAuthData();
49
+ const canCreate = canCreatePost(authData, 'note', 'direct');
50
+ const { openCreateConversation } = useCreateNewConversation();
42
51
  const settingsRef = useRef<BottomSheetModal>(null);
43
52
  const [refreshing, setRefreshing] = React.useState(false);
44
53
  const [filteredConversations, setFilteredConversations] = React.useState<
@@ -156,6 +165,14 @@ export const ConversationsIndex: React.FC<MessagesProps> = ({ navigation }) => {
156
165
  />
157
166
  ))}
158
167
  </KeyboardAwareScrollView>
168
+ {canCreate ? (
169
+ <PlusFab
170
+ accessibilityLabel={t('conversations.newMessage')}
171
+ onPress={() => openCreateConversation()}
172
+ >
173
+ <MessageSquarePlusIcon size={24} className="text-background" />
174
+ </PlusFab>
175
+ ) : null}
159
176
  <ConversationSettingsSheet
160
177
  ref={settingsRef}
161
178
  onMessageRequestChange={(value) => {
@@ -4,12 +4,16 @@ import {
4
4
  TabStackParamList,
5
5
  MainStackParamList,
6
6
  } from '../../components/navigation/types/index';
7
- import { useFeedListParams, useOpenpeeps } from '@openpeepshq/react';
7
+ import {
8
+ useDefaultVisibility,
9
+ useFeedListParams,
10
+ useOpenpeeps,
11
+ } from '@openpeepshq/react';
8
12
  import { CompositeScreenProps } from '@react-navigation/native';
9
13
  import { TabScreensHeader } from '../../components/custom/index';
10
14
  import { ThemedText } from '../../components/ui/themed-text';
11
15
  import { useTranslation } from 'react-i18next';
12
- import { Feed } from '../../components/post/index';
16
+ import { Feed, NewNoteButton } from '../../components/post/index';
13
17
 
14
18
  type HomeScreenProps = CompositeScreenProps<
15
19
  NativeStackScreenProps<TabStackParamList, 'Home'>,
@@ -23,6 +27,7 @@ export const FeedsLocal: React.FC<HomeScreenProps> = () => {
23
27
  openpeepsApi.useServerInfo();
24
28
 
25
29
  const pinnedPostId = serverInfo?.communityConfig?.content?.pinnedPost;
30
+ const visibility = useDefaultVisibility();
26
31
 
27
32
  const query = openpeepsApi.useLocalFeed(useFeedListParams({ limit: 15 }));
28
33
 
@@ -41,6 +46,7 @@ export const FeedsLocal: React.FC<HomeScreenProps> = () => {
41
46
  pinnedPostId={pinnedPostId}
42
47
  refetchServerInfo={refetchServerInfo}
43
48
  />
49
+ <NewNoteButton visibility={visibility} />
44
50
  </>
45
51
  );
46
52
  };
@@ -4,30 +4,40 @@ import {
4
4
  TabStackParamList,
5
5
  MainStackParamList,
6
6
  } from '../../components/navigation/types/index';
7
- import { useFeedListParams, useOpenpeeps } from '@openpeepshq/react';
7
+ import {
8
+ useDefaultVisibility,
9
+ useFeedListParams,
10
+ useOpenpeeps,
11
+ } from '@openpeepshq/react';
8
12
  import { CompositeScreenProps } from '@react-navigation/native';
9
13
  import { TabScreensHeader } from '../../components/custom/index';
10
14
  import { ThemedText } from '../../components/ui/themed-text';
11
15
 
12
- import { Feed } from '../../components/post/index';
16
+ import { useTranslation } from 'react-i18next';
17
+ import { Feed, NewNoteButton } from '../../components/post/index';
13
18
  type HomeScreenProps = CompositeScreenProps<
14
19
  NativeStackScreenProps<TabStackParamList, 'Feed'>,
15
20
  NativeStackScreenProps<MainStackParamList>
16
21
  >;
17
22
 
18
23
  export const FeedsMy: React.FC<HomeScreenProps> = () => {
24
+ const { t } = useTranslation();
19
25
  const { openpeepsApi } = useOpenpeeps();
20
26
 
21
27
  const query = openpeepsApi.useMyFeed(useFeedListParams({ limit: 15 }));
28
+ const visibility = useDefaultVisibility();
22
29
 
23
30
  return (
24
31
  <>
25
32
  <TabScreensHeader
26
33
  children={
27
- <ThemedText className="text-xl font-bold">My feed</ThemedText>
34
+ <ThemedText className="text-xl font-bold">
35
+ {t('navigation.myFeed')}
36
+ </ThemedText>
28
37
  }
29
38
  />
30
39
  <Feed query={query} />
40
+ <NewNoteButton visibility={visibility} />
31
41
  </>
32
42
  );
33
43
  };
@@ -9,14 +9,17 @@ import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view
9
9
  import { CompositeScreenProps } from '@react-navigation/native';
10
10
  import { NativeStackScreenProps } from '@react-navigation/native-stack';
11
11
 
12
+ import { checkRoleCapabilities } from '@openpeepshq/common';
12
13
  import {
13
14
  CheckIcon,
14
15
  MoreVerticalIcon,
16
+ PlusIcon,
15
17
  SearchIcon,
16
18
  XIcon,
17
19
  } from '../../components/icons/index';
18
20
  import {
19
21
  EmptyStateContainer,
22
+ PlusFab,
20
23
  TabScreensHeader,
21
24
  } from '../../components/custom/index';
22
25
  import { ThemedView } from '../../components/ui/themed-view';
@@ -29,6 +32,7 @@ import {
29
32
  DropdownMenuItem,
30
33
  DropdownMenuTrigger,
31
34
  } from '../../components/ui/dropdown-menu';
35
+ import { useTranslation } from 'react-i18next';
32
36
  import { useOpenpeeps } from '@openpeepshq/react';
33
37
  import {
34
38
  MainStackParamList,
@@ -42,6 +46,7 @@ type GroupsProps = CompositeScreenProps<
42
46
  >;
43
47
 
44
48
  export const GroupsIndex: React.FC<GroupsProps> = ({ navigation }) => {
49
+ const { t } = useTranslation();
45
50
  const { openpeepsApi, currentProfile } = useOpenpeeps();
46
51
  const { data: groups, refetch, isLoading } = openpeepsApi.useGroups();
47
52
  const unseenCountsQuery = openpeepsApi.useUnseenPostCounts();
@@ -176,6 +181,16 @@ export const GroupsIndex: React.FC<GroupsProps> = ({ navigation }) => {
176
181
  ))}
177
182
  <View className="mb-24" />
178
183
  </KeyboardAwareScrollView>
184
+ {checkRoleCapabilities(currentProfile?.roles ?? [], [
185
+ 'core-groups-create',
186
+ ]).success ? (
187
+ <PlusFab
188
+ accessibilityLabel={t('groups.new')}
189
+ onPress={() => navigation.navigate('CreateGroup')}
190
+ >
191
+ <PlusIcon size={24} className="text-background" />
192
+ </PlusFab>
193
+ ) : null}
179
194
  </ThemedView>
180
195
  );
181
196
  };