@openpeepshq/rn-components 0.3.7 → 0.3.8
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 +1 -1
- package/src/components/custom/common/index.ts +1 -0
- package/src/components/custom/common/plus-fab.tsx +23 -0
- package/src/components/custom/navigation/side-menu.tsx +38 -76
- package/src/components/icons/index.ts +6 -0
- package/src/components/jams/CreateNewJam.tsx +3 -4
- package/src/components/post/NewEventButton.tsx +3 -8
- package/src/components/post/NewNoteButton.tsx +3 -5
- package/src/pages/Tags.tsx +8 -2
- package/src/pages/articles/Index.tsx +18 -2
- package/src/pages/conversations/Index.tsx +20 -3
- package/src/pages/feeds/Local.tsx +8 -2
- package/src/pages/feeds/My.tsx +13 -3
- package/src/pages/groups/Index.tsx +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/rn-components",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
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",
|
|
@@ -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,47 @@ import { Image, TouchableOpacity, View } from 'react-native';
|
|
|
5
5
|
import { Button } from '../../ui/button';
|
|
6
6
|
import {
|
|
7
7
|
BellIcon,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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,
|
|
20
|
+
SquarePenIcon,
|
|
17
21
|
UsersIcon,
|
|
18
22
|
XIcon,
|
|
19
|
-
SearchIcon,
|
|
20
|
-
ScrollTextIcon,
|
|
21
|
-
BookmarkIcon,
|
|
22
23
|
} from '../../icons/index';
|
|
23
24
|
import { ThemedText } from '../../ui/themed-text';
|
|
24
25
|
import { useWindowSize } from '../../../hooks/helper';
|
|
25
26
|
import { useAppImagesStore } from '../../../stores/useAppImagesStore';
|
|
26
27
|
import { formatBadgeCount } from '@openpeepshq/common';
|
|
27
|
-
import { useOpenpeeps } from '@openpeepshq/react';
|
|
28
|
-
import { LucideProps, SquarePenIcon } from 'lucide-react-native';
|
|
28
|
+
import { buildMainNavItems, useOpenpeeps } from '@openpeepshq/react';
|
|
29
29
|
import { useTranslation } from 'react-i18next';
|
|
30
30
|
import { ProfileAvatar } from '../../profile/Avatar';
|
|
31
31
|
import type { GotoHandlerParams } from '../../../types/goto';
|
|
32
|
+
import type { LucideProps } from 'lucide-react-native';
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const menuIcons: Record<string, React.ComponentType<LucideProps>> = {
|
|
35
|
+
community: HomeIcon,
|
|
36
|
+
welcome: BookCheckIcon,
|
|
37
|
+
explore: SearchIcon,
|
|
38
|
+
myFeed: NewspaperIcon,
|
|
39
|
+
jams: PhoneCallIcon,
|
|
40
|
+
groups: UsersIcon,
|
|
41
|
+
events: CalendarDaysIcon,
|
|
42
|
+
articles: ScrollTextIcon,
|
|
43
|
+
messages: MessageSquareTextIcon,
|
|
44
|
+
members: BookUserIcon,
|
|
45
|
+
bookmarks: BookmarkIcon,
|
|
46
|
+
settings: SettingsIcon,
|
|
36
47
|
};
|
|
37
48
|
|
|
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
49
|
interface SideMenuProps {
|
|
90
50
|
handleNavigation: ({
|
|
91
51
|
target,
|
|
@@ -126,6 +86,11 @@ export const SideMenu = ({
|
|
|
126
86
|
messages: unreadConversationThreads,
|
|
127
87
|
};
|
|
128
88
|
|
|
89
|
+
const menuItems = buildMainNavItems({
|
|
90
|
+
jamsEnabled: !!serverInfo?.jams.livekit.enabled,
|
|
91
|
+
showAdmin: false,
|
|
92
|
+
});
|
|
93
|
+
|
|
129
94
|
const { t } = useTranslation();
|
|
130
95
|
|
|
131
96
|
const [currentRoute, setCurrentRoute] = React.useState<string | undefined>(
|
|
@@ -136,7 +101,6 @@ export const SideMenu = ({
|
|
|
136
101
|
(currentProfile && (
|
|
137
102
|
<View className="sm:w-56 md:w-80 bg-background flex-1">
|
|
138
103
|
<TouchableOpacity onPress={onProfilePress} className="mt-12 mb-6 px-4">
|
|
139
|
-
{/* Header: Logo + Avatar + Name */}
|
|
140
104
|
<View className="w-full flex-row items-center justify-between">
|
|
141
105
|
<Image
|
|
142
106
|
source={{ uri: logoSmall! }}
|
|
@@ -182,29 +146,28 @@ export const SideMenu = ({
|
|
|
182
146
|
className="flex-row gap-4 items-center text-black mb-4 justify-center px-4 w-full"
|
|
183
147
|
>
|
|
184
148
|
<SquarePenIcon size={20} />
|
|
185
|
-
<ThemedText>
|
|
149
|
+
<ThemedText>{t('posts.form.title')}</ThemedText>
|
|
186
150
|
</Button>
|
|
187
151
|
)}
|
|
188
152
|
|
|
189
153
|
<Separator />
|
|
190
154
|
|
|
191
|
-
{/* Scrollable Content */}
|
|
192
155
|
<View className="flex-1">
|
|
193
156
|
<ScrollView contentContainerClassName="grow" className="mt-5 px-4">
|
|
194
|
-
{menuItems.map((item
|
|
195
|
-
const isActive = currentRoute === item.
|
|
196
|
-
const Icon = item.
|
|
197
|
-
if (!
|
|
157
|
+
{menuItems.map((item) => {
|
|
158
|
+
const isActive = currentRoute === item.id;
|
|
159
|
+
const Icon = menuIcons[item.id];
|
|
160
|
+
if (!Icon) {
|
|
198
161
|
return null;
|
|
199
162
|
}
|
|
200
163
|
return (
|
|
201
164
|
<Button
|
|
202
|
-
key={
|
|
165
|
+
key={item.id}
|
|
203
166
|
variant="ghost"
|
|
204
167
|
className="flex-row items-center w-full mb-4 justify-start p-4"
|
|
205
168
|
onPress={() => {
|
|
206
|
-
setCurrentRoute(item.
|
|
207
|
-
handleNavigation({ target: item.
|
|
169
|
+
setCurrentRoute(item.id);
|
|
170
|
+
handleNavigation({ target: item.id });
|
|
208
171
|
}}
|
|
209
172
|
>
|
|
210
173
|
<View className="flex-row items-center flex-1 justify-between">
|
|
@@ -220,13 +183,13 @@ export const SideMenu = ({
|
|
|
220
183
|
className={`
|
|
221
184
|
${isActive ? 'text-foreground' : 'text-muted-foreground'}`}
|
|
222
185
|
>
|
|
223
|
-
{t(
|
|
186
|
+
{t(item.labelKey)}
|
|
224
187
|
</ThemedText>
|
|
225
188
|
</View>
|
|
226
|
-
{(menuUnreadCounts[item.
|
|
189
|
+
{(menuUnreadCounts[item.id] ?? 0) > 0 ? (
|
|
227
190
|
<View className="bg-destructive size-5 min-w-5 items-center justify-center rounded-full px-1">
|
|
228
191
|
<ThemedText className="text-xs font-semibold text-destructive-foreground">
|
|
229
|
-
{formatBadgeCount(menuUnreadCounts[item.
|
|
192
|
+
{formatBadgeCount(menuUnreadCounts[item.id] ?? 0)}
|
|
230
193
|
</ThemedText>
|
|
231
194
|
</View>
|
|
232
195
|
) : null}
|
|
@@ -250,7 +213,6 @@ export const SideMenu = ({
|
|
|
250
213
|
</ScrollView>
|
|
251
214
|
</View>
|
|
252
215
|
|
|
253
|
-
{/* Footer */}
|
|
254
216
|
<Separator />
|
|
255
217
|
<View className="pl-6 pr-4 pt-4 pb-12">
|
|
256
218
|
<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
|
-
<
|
|
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
|
-
</
|
|
17
|
+
</PlusFab>
|
|
19
18
|
);
|
|
20
19
|
};
|
|
@@ -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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
42
|
+
</PlusFab>
|
|
45
43
|
);
|
|
46
44
|
};
|
package/src/pages/Tags.tsx
CHANGED
|
@@ -3,14 +3,18 @@ import {
|
|
|
3
3
|
MainStackParamList,
|
|
4
4
|
TabStackParamList,
|
|
5
5
|
} from '../components/navigation/types/index';
|
|
6
|
-
import {
|
|
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">
|
|
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 {
|
|
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 {
|
|
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
|
};
|
package/src/pages/feeds/My.tsx
CHANGED
|
@@ -4,30 +4,40 @@ import {
|
|
|
4
4
|
TabStackParamList,
|
|
5
5
|
MainStackParamList,
|
|
6
6
|
} from '../../components/navigation/types/index';
|
|
7
|
-
import {
|
|
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 {
|
|
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">
|
|
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
|
};
|