@openpeepshq/rn-components 0.3.8 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/components/conversations/ConversationMessageBubble.tsx +1 -1
- package/src/components/custom/headers/generic-header.tsx +27 -12
- package/src/components/custom/headers/tab-screens-header.tsx +7 -0
- package/src/components/custom/navigation/side-menu.tsx +2 -15
- package/src/components/groups/GroupOptionsMenu.tsx +13 -5
- package/src/components/jams/JamActionsFooter.tsx +37 -51
- package/src/components/jams/JamCard.tsx +5 -5
- package/src/components/jams/JamLobby.tsx +2 -1
- package/src/components/navigation/parent-back.ts +139 -0
- package/src/components/navigation/side-menu-drawer.tsx +0 -6
- package/src/components/navigation/side-menu-wrapper.tsx +0 -5
- package/src/components/notifications/types/JamStarted.tsx +8 -6
- package/src/components/notifications/types/Reply.tsx +7 -10
- package/src/components/post/pieces/EventRsvpButton.tsx +22 -18
- package/src/components/post/pieces/ParticipantsCard.tsx +4 -20
- package/src/components/post/types/Article.tsx +3 -1
- package/src/components/post/types/event/CardEvent.tsx +1 -1
- package/src/components/post/types/event/FullEvent.tsx +156 -37
- package/src/components/profile/ProfileCard.tsx +9 -2
- package/src/components/profile/ProfileFromId.tsx +1 -1
- package/src/components/ui/button.tsx +1 -1
- package/src/pages/PostDetail.tsx +12 -2
- package/src/pages/Tags.tsx +6 -5
- package/src/pages/conversations/Show.tsx +8 -2
- package/src/pages/settings/Index.tsx +14 -2
- package/src/theme/OpenPeepsThemeProvider.tsx +23 -12
- package/src/theme/utils.ts +10 -5
- package/tailwind.config.js +6 -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.11",
|
|
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/
|
|
144
|
-
"@openpeepshq/
|
|
143
|
+
"@openpeepshq/react": "^0.3.2",
|
|
144
|
+
"@openpeepshq/common": "^0.2.0"
|
|
145
145
|
},
|
|
146
146
|
"devDependencies": {
|
|
147
147
|
"@babel/core": "^7.26.7",
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { View, Pressable, ActivityIndicator } from 'react-native';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Button } from '../../ui/button';
|
|
4
|
-
import {
|
|
4
|
+
import { ChevronLeftIcon } from '../../icons/index';
|
|
5
5
|
import { ThemedText } from '../../ui/themed-text';
|
|
6
|
-
import { useNavigation } from '@react-navigation/native';
|
|
6
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
7
|
+
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
8
|
+
import { useCurrentProfile } from '@openpeepshq/react';
|
|
9
|
+
import { goToParentOrBack } from '../../navigation/parent-back';
|
|
10
|
+
import type { MainStackParamList } from '../../navigation/types';
|
|
7
11
|
|
|
8
12
|
interface GenericHeaderProps {
|
|
9
13
|
title?: string | React.ReactNode;
|
|
@@ -31,21 +35,32 @@ export const GenericHeader = ({
|
|
|
31
35
|
hideBackButton = false,
|
|
32
36
|
rightElement,
|
|
33
37
|
}: GenericHeaderProps) => {
|
|
34
|
-
const navigation =
|
|
38
|
+
const navigation =
|
|
39
|
+
useNavigation<NativeStackNavigationProp<MainStackParamList>>();
|
|
40
|
+
const route = useRoute();
|
|
41
|
+
const me = useCurrentProfile();
|
|
35
42
|
return (
|
|
36
43
|
<View className="sticky top-0 z-20 w-full px-4 py-2 flex flex-row justify-between items-center">
|
|
37
44
|
<View className="flex gap-4 mb-2 flex-row items-center">
|
|
38
45
|
{!hideBackButton && (
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
onPress={() =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
<Pressable
|
|
47
|
+
accessibilityRole="button"
|
|
48
|
+
onPress={() => {
|
|
49
|
+
if (handleGoBack) {
|
|
50
|
+
handleGoBack();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
goToParentOrBack({
|
|
54
|
+
navigation,
|
|
55
|
+
routeName: route.name,
|
|
56
|
+
params: route.params as Record<string, unknown> | undefined,
|
|
57
|
+
profileHandle: me?.handle,
|
|
58
|
+
});
|
|
59
|
+
}}
|
|
60
|
+
className="items-center justify-center p-2"
|
|
46
61
|
>
|
|
47
|
-
<
|
|
48
|
-
</
|
|
62
|
+
<ChevronLeftIcon size={28} className="text-foreground" />
|
|
63
|
+
</Pressable>
|
|
49
64
|
)}
|
|
50
65
|
{typeof title === 'string' ? (
|
|
51
66
|
<ThemedText className="text-xl tracking-wider font-semibold">
|
|
@@ -85,6 +85,13 @@ export const TabScreensHeader = ({
|
|
|
85
85
|
if (isMediumScreenOrLarger) {
|
|
86
86
|
return (
|
|
87
87
|
<ThemedSafeAreaView className="p-4 pb-6 pl-1">
|
|
88
|
+
<View className="mb-4 flex-row items-center">
|
|
89
|
+
<Image
|
|
90
|
+
source={{ uri: logoSmall! }}
|
|
91
|
+
resizeMode="contain"
|
|
92
|
+
className="h-12 w-48"
|
|
93
|
+
/>
|
|
94
|
+
</View>
|
|
88
95
|
{children}
|
|
89
96
|
</ThemedSafeAreaView>
|
|
90
97
|
);
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
ScrollTextIcon,
|
|
18
18
|
SearchIcon,
|
|
19
19
|
SettingsIcon,
|
|
20
|
-
SquarePenIcon,
|
|
21
20
|
UsersIcon,
|
|
22
21
|
XIcon,
|
|
23
22
|
} from '../../icons/index';
|
|
@@ -57,14 +56,12 @@ interface SideMenuProps {
|
|
|
57
56
|
onNotificationPress: () => void;
|
|
58
57
|
onProfilePress: () => void;
|
|
59
58
|
close?: () => void;
|
|
60
|
-
handleNewPost: () => void;
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
export const SideMenu = ({
|
|
64
62
|
handleNavigation,
|
|
65
63
|
onNotificationPress,
|
|
66
64
|
close,
|
|
67
|
-
handleNewPost,
|
|
68
65
|
onProfilePress,
|
|
69
66
|
}: SideMenuProps) => {
|
|
70
67
|
const { openpeepsApi, currentProfile } = useOpenpeeps();
|
|
@@ -104,8 +101,8 @@ export const SideMenu = ({
|
|
|
104
101
|
<View className="w-full flex-row items-center justify-between">
|
|
105
102
|
<Image
|
|
106
103
|
source={{ uri: logoSmall! }}
|
|
107
|
-
className="-mt-2"
|
|
108
|
-
resizeMode="
|
|
104
|
+
className="-mt-2 h-12 w-48"
|
|
105
|
+
resizeMode="contain"
|
|
109
106
|
/>
|
|
110
107
|
{!isMediumScreenOrLarger && (
|
|
111
108
|
<View className="md:hidden">
|
|
@@ -140,16 +137,6 @@ export const SideMenu = ({
|
|
|
140
137
|
</View>
|
|
141
138
|
</TouchableOpacity>
|
|
142
139
|
|
|
143
|
-
{isMediumScreenOrLarger && (
|
|
144
|
-
<Button
|
|
145
|
-
onPress={handleNewPost}
|
|
146
|
-
className="flex-row gap-4 items-center text-black mb-4 justify-center px-4 w-full"
|
|
147
|
-
>
|
|
148
|
-
<SquarePenIcon size={20} />
|
|
149
|
-
<ThemedText>{t('posts.form.title')}</ThemedText>
|
|
150
|
-
</Button>
|
|
151
|
-
)}
|
|
152
|
-
|
|
153
140
|
<Separator />
|
|
154
141
|
|
|
155
142
|
<View className="flex-1">
|
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
groupMembershipHasRole,
|
|
10
10
|
} from '@openpeepshq/common/lib';
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
invalidateUnseenCounts,
|
|
12
|
+
markGroupPostsRead,
|
|
14
13
|
useAuthData,
|
|
15
14
|
useCurrentProfile,
|
|
16
15
|
useNavigate,
|
|
@@ -79,11 +78,20 @@ export const GroupOptionsMenu = ({ group }: GroupOptionsMenuProps) => {
|
|
|
79
78
|
};
|
|
80
79
|
|
|
81
80
|
const handleMarkAllRead = async () => {
|
|
82
|
-
adjustUnseenCounts(queryClient, client, { clearGroup: group.id });
|
|
83
81
|
try {
|
|
84
|
-
await
|
|
82
|
+
await markGroupPostsRead(
|
|
83
|
+
queryClient,
|
|
84
|
+
client,
|
|
85
|
+
group.id,
|
|
86
|
+
markGroupPostsSeen
|
|
87
|
+
);
|
|
88
|
+
Toast.show({
|
|
89
|
+
type: 'success',
|
|
90
|
+
text1: t('groups.markAllRead.success', {
|
|
91
|
+
defaultValue: 'Group posts marked as read',
|
|
92
|
+
}),
|
|
93
|
+
});
|
|
85
94
|
} catch {
|
|
86
|
-
await invalidateUnseenCounts(queryClient, client);
|
|
87
95
|
Toast.show({ type: 'error', text1: t('groups.markAllRead.error') });
|
|
88
96
|
}
|
|
89
97
|
};
|
|
@@ -39,59 +39,45 @@ export const JamActionsFooter = ({ jamPost }: JamActionsFooterProps) => {
|
|
|
39
39
|
const isModerator = jam?.moderators.includes(currentProfile?.id as string);
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
|
-
<View className="">
|
|
43
|
-
<View className="
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
<View className="w-full gap-y-2">
|
|
43
|
+
<View className="flex-row items-center">
|
|
44
|
+
<Button
|
|
45
|
+
variant={'ghost'}
|
|
46
|
+
size={'icon'}
|
|
47
|
+
onPress={() => {
|
|
48
|
+
Share.share({
|
|
49
|
+
message: t('posts.actions.shareMessage'),
|
|
50
|
+
url: `${BASE_URL}/events/${jamPost.id}/jam`,
|
|
51
|
+
});
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<ShareIcon className="text-foreground" size={18} />
|
|
55
|
+
</Button>
|
|
56
|
+
{jamPost.profile.id === currentProfile?.id && (
|
|
57
|
+
<Button variant={'ghost'} size={'icon'} onPress={handleDeletePress}>
|
|
58
|
+
<Trash2Icon className="text-foreground" size={18} />
|
|
56
59
|
</Button>
|
|
57
|
-
|
|
58
|
-
<>
|
|
59
|
-
{/* <Button variant={'ghost'} size={'icon'} onPress={() => {}}>
|
|
60
|
-
<PencilLineIcon className="text-foreground" size={18} />
|
|
61
|
-
</Button> */}
|
|
62
|
-
|
|
63
|
-
<Button
|
|
64
|
-
variant={'ghost'}
|
|
65
|
-
size={'icon'}
|
|
66
|
-
onPress={handleDeletePress}
|
|
67
|
-
>
|
|
68
|
-
<Trash2Icon className="text-foreground" size={18} />
|
|
69
|
-
</Button>
|
|
70
|
-
</>
|
|
71
|
-
)}
|
|
72
|
-
</View>
|
|
73
|
-
{livekitEnabled === false ? (
|
|
74
|
-
<ThemedText className="text-destructive text-sm flex-1">
|
|
75
|
-
{t('jams.unavailable.message')}
|
|
76
|
-
</ThemedText>
|
|
77
|
-
) : livekitEnabled && (jamState?.active || isModerator) ? (
|
|
78
|
-
<Button
|
|
79
|
-
variant={'outline'}
|
|
80
|
-
onPress={() => {
|
|
81
|
-
navigation.navigate('JamSession', {
|
|
82
|
-
jamId: jamPost.id,
|
|
83
|
-
});
|
|
84
|
-
}}
|
|
85
|
-
className={`${isModerator ? 'flex-1' : ''}`}
|
|
86
|
-
>
|
|
87
|
-
<ThemedText>
|
|
88
|
-
{!jamState?.active
|
|
89
|
-
? t('jams.start.submit')
|
|
90
|
-
: t('jams.join.submit')}
|
|
91
|
-
</ThemedText>
|
|
92
|
-
</Button>
|
|
93
|
-
) : null}
|
|
60
|
+
)}
|
|
94
61
|
</View>
|
|
62
|
+
{livekitEnabled === false ? (
|
|
63
|
+
<ThemedText className="text-destructive text-sm">
|
|
64
|
+
{t('jams.unavailable.message')}
|
|
65
|
+
</ThemedText>
|
|
66
|
+
) : livekitEnabled && (jamState?.active || isModerator) ? (
|
|
67
|
+
<Button
|
|
68
|
+
variant={'outline'}
|
|
69
|
+
className="w-full"
|
|
70
|
+
onPress={() => {
|
|
71
|
+
navigation.navigate('JamSession', {
|
|
72
|
+
jamId: jamPost.id,
|
|
73
|
+
});
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<ThemedText numberOfLines={1}>
|
|
77
|
+
{!jamState?.active ? t('jams.start.submit') : t('jams.join.submit')}
|
|
78
|
+
</ThemedText>
|
|
79
|
+
</Button>
|
|
80
|
+
) : null}
|
|
95
81
|
|
|
96
82
|
<DeleteJamModal ref={deleteJamSheetRef} />
|
|
97
83
|
</View>
|
|
@@ -20,15 +20,15 @@ export const JamCard = ({ jamPost, type = 'upcoming' }: JamCardProps) => {
|
|
|
20
20
|
jamEvent && (
|
|
21
21
|
<>
|
|
22
22
|
{jamPost.data?.type === 'event' && (
|
|
23
|
-
<View className="
|
|
24
|
-
<View className="size-24">
|
|
23
|
+
<View className="mb-4 w-full flex-row gap-x-4">
|
|
24
|
+
<View className="size-24 shrink-0">
|
|
25
25
|
<Image
|
|
26
26
|
source={require('../../assets/images/jam-placeholder.png')}
|
|
27
|
-
className="
|
|
27
|
+
className="h-full w-full rounded-md"
|
|
28
28
|
/>
|
|
29
29
|
</View>
|
|
30
|
-
<View className=" flex flex-col gap-y-3
|
|
31
|
-
<View className="flex flex-
|
|
30
|
+
<View className="min-w-0 flex-1 flex-col gap-y-3">
|
|
31
|
+
<View className="flex-row flex-wrap items-center gap-x-1">
|
|
32
32
|
<ThemedText>Happening</ThemedText>
|
|
33
33
|
<UpdatingDate date={jamEvent?.start} />
|
|
34
34
|
</View>
|
|
@@ -183,10 +183,11 @@ export const JamLobby = ({ onJoin }: JamLobbyProps) => {
|
|
|
183
183
|
<View className="w-full items-center px-5 pb-4">
|
|
184
184
|
<Button
|
|
185
185
|
accessibilityLabel={t('jams.join.submit')}
|
|
186
|
+
className="min-w-[10rem]"
|
|
186
187
|
disabled={submitting}
|
|
187
188
|
onPress={handleJoin}
|
|
188
189
|
>
|
|
189
|
-
<ThemedText className="text-primary-foreground">
|
|
190
|
+
<ThemedText numberOfLines={1} className="text-primary-foreground">
|
|
190
191
|
{jamActive ? t('jams.join.ctaJoin') : t('jams.join.ctaStart')}
|
|
191
192
|
</ThemedText>
|
|
192
193
|
</Button>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { NavigatorScreenParams } from '@react-navigation/native';
|
|
2
|
+
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
3
|
+
import type { PublicPost } from '@openpeepshq/common/types';
|
|
4
|
+
import { MainStackParamList, TabStackParamList } from './types';
|
|
5
|
+
|
|
6
|
+
type Nav = NativeStackNavigationProp<MainStackParamList>;
|
|
7
|
+
|
|
8
|
+
const tabs = <S extends keyof TabStackParamList>(
|
|
9
|
+
navigation: Nav,
|
|
10
|
+
screen: S,
|
|
11
|
+
params?: TabStackParamList[S]
|
|
12
|
+
) =>
|
|
13
|
+
navigation.navigate('TabNavigator', {
|
|
14
|
+
screen,
|
|
15
|
+
params,
|
|
16
|
+
} as NavigatorScreenParams<TabStackParamList>);
|
|
17
|
+
|
|
18
|
+
/** Semantic parent when the stack has no in-app history (deep links). */
|
|
19
|
+
export const applySemanticParent = ({
|
|
20
|
+
navigation,
|
|
21
|
+
routeName,
|
|
22
|
+
params,
|
|
23
|
+
post,
|
|
24
|
+
profileHandle,
|
|
25
|
+
}: {
|
|
26
|
+
navigation: Nav;
|
|
27
|
+
routeName: string;
|
|
28
|
+
params?: Record<string, unknown>;
|
|
29
|
+
post?: PublicPost;
|
|
30
|
+
profileHandle?: string;
|
|
31
|
+
}) => {
|
|
32
|
+
switch (routeName) {
|
|
33
|
+
case 'Post':
|
|
34
|
+
case 'EventPage':
|
|
35
|
+
if (post?.replyTo?.type === 'event' && post.inReplyToId) {
|
|
36
|
+
navigation.navigate('Post', { id: post.inReplyToId });
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (post?.groupId) {
|
|
40
|
+
navigation.navigate('Group', {
|
|
41
|
+
id: post.groupId,
|
|
42
|
+
handle: post.group?.handle,
|
|
43
|
+
});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (post?.type === 'event') {
|
|
47
|
+
tabs(navigation, 'Events');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
tabs(navigation, 'Home');
|
|
51
|
+
return;
|
|
52
|
+
case 'Profile':
|
|
53
|
+
tabs(navigation, 'Directory');
|
|
54
|
+
return;
|
|
55
|
+
case 'EditProfile':
|
|
56
|
+
if (typeof params?.handle === 'string') {
|
|
57
|
+
navigation.navigate('Profile', { handle: params.handle });
|
|
58
|
+
} else if (profileHandle) {
|
|
59
|
+
navigation.navigate('Profile', { handle: profileHandle });
|
|
60
|
+
} else {
|
|
61
|
+
tabs(navigation, 'Directory');
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
case 'ProfileFollowers':
|
|
65
|
+
case 'ProfileFollowing':
|
|
66
|
+
tabs(navigation, 'Directory');
|
|
67
|
+
return;
|
|
68
|
+
case 'Conversation':
|
|
69
|
+
tabs(navigation, 'Messages');
|
|
70
|
+
return;
|
|
71
|
+
case 'ConversationInfo':
|
|
72
|
+
if (typeof params?.id === 'string') {
|
|
73
|
+
navigation.navigate('Conversation', { id: params.id });
|
|
74
|
+
} else {
|
|
75
|
+
tabs(navigation, 'Messages');
|
|
76
|
+
}
|
|
77
|
+
return;
|
|
78
|
+
case 'Group':
|
|
79
|
+
tabs(navigation, 'Groups');
|
|
80
|
+
return;
|
|
81
|
+
case 'GroupMembers':
|
|
82
|
+
case 'GroupInfo':
|
|
83
|
+
if (typeof params?.id === 'string') {
|
|
84
|
+
navigation.navigate('Group', { id: params.id });
|
|
85
|
+
} else {
|
|
86
|
+
tabs(navigation, 'Groups');
|
|
87
|
+
}
|
|
88
|
+
return;
|
|
89
|
+
case 'MyEvents':
|
|
90
|
+
case 'NewEvent':
|
|
91
|
+
case 'EditEvent':
|
|
92
|
+
tabs(navigation, 'Events');
|
|
93
|
+
return;
|
|
94
|
+
case 'MyJams':
|
|
95
|
+
case 'JamSession':
|
|
96
|
+
case 'CreateNewJam':
|
|
97
|
+
tabs(navigation, 'Jam');
|
|
98
|
+
return;
|
|
99
|
+
case 'NotificationSettings':
|
|
100
|
+
case 'NotificationsSettings':
|
|
101
|
+
case 'PushEnabledDevices':
|
|
102
|
+
case 'AccountSettings':
|
|
103
|
+
case 'AccessTokensSettings':
|
|
104
|
+
case 'ThemeSettings':
|
|
105
|
+
case 'FeedSettings':
|
|
106
|
+
case 'BlockedSettings':
|
|
107
|
+
case 'LanguageSettings':
|
|
108
|
+
case 'TimezoneSettings':
|
|
109
|
+
tabs(navigation, 'Settings');
|
|
110
|
+
return;
|
|
111
|
+
case 'Settings':
|
|
112
|
+
if (profileHandle) {
|
|
113
|
+
navigation.navigate('Profile', { handle: profileHandle });
|
|
114
|
+
} else {
|
|
115
|
+
tabs(navigation, 'Home');
|
|
116
|
+
}
|
|
117
|
+
return;
|
|
118
|
+
case 'Onboarding':
|
|
119
|
+
case 'HashtagPosts':
|
|
120
|
+
case 'About':
|
|
121
|
+
case 'CodeOfConduct':
|
|
122
|
+
default:
|
|
123
|
+
tabs(navigation, 'Home');
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const goToParentOrBack = (args: {
|
|
128
|
+
navigation: Nav;
|
|
129
|
+
routeName: string;
|
|
130
|
+
params?: Record<string, unknown>;
|
|
131
|
+
post?: PublicPost;
|
|
132
|
+
profileHandle?: string;
|
|
133
|
+
}) => {
|
|
134
|
+
if (args.navigation.canGoBack()) {
|
|
135
|
+
args.navigation.goBack();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
applySemanticParent(args);
|
|
139
|
+
};
|
|
@@ -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>
|
|
@@ -20,17 +20,19 @@ export const JamStarted: React.FC<NotificationTypeProps> = ({
|
|
|
20
20
|
return (
|
|
21
21
|
<NotificationWrapper profile={profile} seen={notification.seen}>
|
|
22
22
|
<View className="w-full">
|
|
23
|
-
<View className="mb-2
|
|
24
|
-
<ThemedText>
|
|
23
|
+
<View className="mb-2 min-w-0 flex-row flex-wrap items-center gap-2">
|
|
24
|
+
<ThemedText className="shrink">
|
|
25
25
|
{t('notification.jamStarted.text', {
|
|
26
26
|
profileName: profileName(profile),
|
|
27
|
-
})}
|
|
27
|
+
})}
|
|
28
28
|
</ThemedText>
|
|
29
29
|
<UpdatingDate date={notification.createdAt} />
|
|
30
30
|
</View>
|
|
31
|
-
{notification.post?.type === 'event'
|
|
32
|
-
<
|
|
33
|
-
|
|
31
|
+
{notification.post?.type === 'event' ? (
|
|
32
|
+
<View className="min-w-0">
|
|
33
|
+
<JamCard jamPost={notification.post} />
|
|
34
|
+
</View>
|
|
35
|
+
) : null}
|
|
34
36
|
</View>
|
|
35
37
|
</NotificationWrapper>
|
|
36
38
|
);
|
|
@@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
9
9
|
import { MainStackParamList } from '../../navigation/types/index';
|
|
10
10
|
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
11
11
|
import { useNavigation } from '@react-navigation/native';
|
|
12
|
-
import {
|
|
12
|
+
import { FeedPostContent } from '../../post/FeedPostContent';
|
|
13
13
|
|
|
14
14
|
interface NotificationTypeProps {
|
|
15
15
|
notification: PublicNotification;
|
|
@@ -25,7 +25,7 @@ export const Reply: React.FC<NotificationTypeProps> = ({ notification }) => {
|
|
|
25
25
|
<NotificationWrapper
|
|
26
26
|
profile={profile}
|
|
27
27
|
seen={notification.seen}
|
|
28
|
-
showProfile
|
|
28
|
+
showProfile
|
|
29
29
|
>
|
|
30
30
|
<Pressable
|
|
31
31
|
onPress={() => navigation.navigate('Post', { id: replyPost.id })}
|
|
@@ -41,14 +41,11 @@ export const Reply: React.FC<NotificationTypeProps> = ({ notification }) => {
|
|
|
41
41
|
</ThemedText>
|
|
42
42
|
</View>
|
|
43
43
|
</View>
|
|
44
|
-
{replyPost
|
|
45
|
-
<
|
|
46
|
-
post={replyPost}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
noReactionHeader
|
|
50
|
-
/>
|
|
51
|
-
)}
|
|
44
|
+
{replyPost ? (
|
|
45
|
+
<View className="min-w-0">
|
|
46
|
+
<FeedPostContent post={replyPost} />
|
|
47
|
+
</View>
|
|
48
|
+
) : null}
|
|
52
49
|
</Pressable>
|
|
53
50
|
</NotificationWrapper>
|
|
54
51
|
);
|
|
@@ -135,36 +135,40 @@ export const EventRsvpButton = ({
|
|
|
135
135
|
|
|
136
136
|
return (
|
|
137
137
|
<View className="mt-4 w-full">
|
|
138
|
-
<View className="w-full flex-
|
|
138
|
+
<View className="w-full flex-col gap-2">
|
|
139
139
|
<Button
|
|
140
|
-
className="w-
|
|
140
|
+
className="w-full"
|
|
141
141
|
disabled={full || submitting}
|
|
142
142
|
onPress={() => requestRespond('yes')}
|
|
143
143
|
>
|
|
144
|
-
<ThemedText>
|
|
144
|
+
<ThemedText numberOfLines={1}>
|
|
145
145
|
{full ? t('events.rsvp.full') : t('posts.rsvp.register')}
|
|
146
146
|
</ThemedText>
|
|
147
147
|
</Button>
|
|
148
|
-
|
|
148
|
+
<View className="w-full flex-row gap-x-2">
|
|
149
|
+
{!capacityEvent ? (
|
|
150
|
+
<Button
|
|
151
|
+
variant="ghost"
|
|
152
|
+
className="flex-1"
|
|
153
|
+
disabled={submitting}
|
|
154
|
+
onPress={() => requestRespond('tentative')}
|
|
155
|
+
>
|
|
156
|
+
<ThemedText numberOfLines={1} className="text-muted-foreground">
|
|
157
|
+
{t('posts.rsvp.maybe')}
|
|
158
|
+
</ThemedText>
|
|
159
|
+
</Button>
|
|
160
|
+
) : null}
|
|
149
161
|
<Button
|
|
150
|
-
variant="
|
|
162
|
+
variant="outline"
|
|
163
|
+
className="flex-1"
|
|
151
164
|
disabled={submitting}
|
|
152
|
-
onPress={() => requestRespond('
|
|
165
|
+
onPress={() => requestRespond('no')}
|
|
153
166
|
>
|
|
154
|
-
<ThemedText className="text-
|
|
155
|
-
{t('posts.rsvp.
|
|
167
|
+
<ThemedText numberOfLines={1} className="text-destructive">
|
|
168
|
+
{t('posts.rsvp.no')}
|
|
156
169
|
</ThemedText>
|
|
157
170
|
</Button>
|
|
158
|
-
|
|
159
|
-
<Button
|
|
160
|
-
variant="outline"
|
|
161
|
-
disabled={submitting}
|
|
162
|
-
onPress={() => requestRespond('no')}
|
|
163
|
-
>
|
|
164
|
-
<ThemedText className="text-destructive">
|
|
165
|
-
{t('posts.rsvp.no')}
|
|
166
|
-
</ThemedText>
|
|
167
|
-
</Button>
|
|
171
|
+
</View>
|
|
168
172
|
</View>
|
|
169
173
|
{errorText}
|
|
170
174
|
{scopeDialog}
|
|
@@ -11,26 +11,10 @@ export const ParticipantsCard: React.FC<ParticipantsCardProps> = ({
|
|
|
11
11
|
jamState,
|
|
12
12
|
}) => {
|
|
13
13
|
return (
|
|
14
|
-
<View className="flex
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
{jamState.participants.slice(0, 2).map((participant) => (
|
|
19
|
-
<>
|
|
20
|
-
<ProfileFromId id={participant} />
|
|
21
|
-
</>
|
|
22
|
-
))}
|
|
23
|
-
</>
|
|
24
|
-
) : (
|
|
25
|
-
<>
|
|
26
|
-
{jamState.participants.map((participant) => (
|
|
27
|
-
<>
|
|
28
|
-
<ProfileFromId id={participant} />
|
|
29
|
-
</>
|
|
30
|
-
))}
|
|
31
|
-
</>
|
|
32
|
-
)}
|
|
33
|
-
</View>
|
|
14
|
+
<View className="flex-row items-center">
|
|
15
|
+
{jamState.participants.slice(0, 2).map((participant) => (
|
|
16
|
+
<ProfileFromId key={participant} id={participant} />
|
|
17
|
+
))}
|
|
34
18
|
</View>
|
|
35
19
|
);
|
|
36
20
|
};
|
|
@@ -37,7 +37,9 @@ export const FeedArticle = ({ post }: Props) => {
|
|
|
37
37
|
resizeMode="cover"
|
|
38
38
|
/>
|
|
39
39
|
)}
|
|
40
|
-
<ThemedText className="text-xl font-bold">
|
|
40
|
+
<ThemedText className="text-xl font-bold text-foreground">
|
|
41
|
+
{article.title}
|
|
42
|
+
</ThemedText>
|
|
41
43
|
<OpenpeepsMarkdown source={previewContent} linkPreviewMode="none" />
|
|
42
44
|
<View className="w-full flex flex-row justify-end">
|
|
43
45
|
<Button
|
|
@@ -95,7 +95,7 @@ export const CardEvent = ({ post, showEventDate = true }: CardEventProps) => {
|
|
|
95
95
|
>
|
|
96
96
|
<View className="flex flex-row items-center gap-x-2">
|
|
97
97
|
{jamState?.participants?.length > 0 && (
|
|
98
|
-
<View className="-
|
|
98
|
+
<View className="flex-row items-center">
|
|
99
99
|
<ParticipantsCard jamState={jamState} />
|
|
100
100
|
</View>
|
|
101
101
|
)}
|
|
@@ -27,8 +27,13 @@ import {
|
|
|
27
27
|
Group,
|
|
28
28
|
GroupData,
|
|
29
29
|
buildThreads,
|
|
30
|
+
type JamRecording,
|
|
30
31
|
} from '@openpeepshq/common';
|
|
31
32
|
import { ProfileAvatar } from '../../../profile/Avatar';
|
|
33
|
+
import { ProfileFromId } from '../../../profile/ProfileFromId';
|
|
34
|
+
import { Button } from '../../../ui/button';
|
|
35
|
+
import { UpdatingDate } from '../../../custom/date/updating-date';
|
|
36
|
+
import { VideoPlayer } from '../../pieces/VideoPlayer';
|
|
32
37
|
import { profileName, truncateText } from '../../../../lib/utils';
|
|
33
38
|
import { useNavigation } from '@react-navigation/native';
|
|
34
39
|
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
@@ -48,6 +53,9 @@ import {
|
|
|
48
53
|
} from '../../../../lib/utils';
|
|
49
54
|
import { bottomSheetPresent } from '../../../../lib/bottom-sheet-ref';
|
|
50
55
|
import {
|
|
56
|
+
canAccessJamRecordings,
|
|
57
|
+
canModerateJam,
|
|
58
|
+
canViewJamAttendees,
|
|
51
59
|
effectiveEventTimes,
|
|
52
60
|
eventTimeZoneOptions,
|
|
53
61
|
formatEventClockTime,
|
|
@@ -117,7 +125,19 @@ export const FullEvent: React.FC<FullEventProps> = ({ post, occurrence }) => {
|
|
|
117
125
|
navigation.navigate('SelectPrivateMessageMembers');
|
|
118
126
|
};
|
|
119
127
|
|
|
120
|
-
const
|
|
128
|
+
const { data: serverInfo } = openpeepsApi.useServerInfo();
|
|
129
|
+
const livekitEnabled = !!serverInfo?.jams.livekit.enabled;
|
|
130
|
+
const myEvent = currentProfile?.id === post?.profile?.id;
|
|
131
|
+
const iAmModerator = canModerateJam(currentProfile, post);
|
|
132
|
+
const canExportAttendees = canViewJamAttendees(currentProfile, post);
|
|
133
|
+
const canViewRecordings = canAccessJamRecordings(currentProfile, post);
|
|
134
|
+
const jamAttendeesQuery = openpeepsApi.useJamAttendance(post.id);
|
|
135
|
+
const recordingsQuery = openpeepsApi.usePostRecordings(
|
|
136
|
+
post.id,
|
|
137
|
+
!!event.jam && canViewRecordings
|
|
138
|
+
);
|
|
139
|
+
const showJamAttendeesTab =
|
|
140
|
+
!!event.jam && canExportAttendees && jamAttendeesQuery.isSuccess;
|
|
121
141
|
|
|
122
142
|
let postContextQuery = openpeepsApi.usePostContext(post.id);
|
|
123
143
|
|
|
@@ -325,49 +345,93 @@ export const FullEvent: React.FC<FullEventProps> = ({ post, occurrence }) => {
|
|
|
325
345
|
/>
|
|
326
346
|
) : null}
|
|
327
347
|
<EventRsvpButton post={post as PublicPost} recurrenceId={occurrence} />
|
|
348
|
+
{event.jam && (myEvent || iAmModerator) ? (
|
|
349
|
+
livekitEnabled ? (
|
|
350
|
+
<Button
|
|
351
|
+
className="mt-2 w-full"
|
|
352
|
+
onPress={() =>
|
|
353
|
+
navigation.navigate('JamSession', { jamId: post.id })
|
|
354
|
+
}
|
|
355
|
+
>
|
|
356
|
+
<ThemedText numberOfLines={1}>
|
|
357
|
+
{t('events.jam.start', { defaultValue: 'Start jam' })}
|
|
358
|
+
</ThemedText>
|
|
359
|
+
</Button>
|
|
360
|
+
) : (
|
|
361
|
+
<ThemedText className="mt-2 text-sm text-destructive">
|
|
362
|
+
{t('jams.unavailable.message')}
|
|
363
|
+
</ThemedText>
|
|
364
|
+
)
|
|
365
|
+
) : null}
|
|
328
366
|
<Tabs
|
|
329
367
|
onValueChange={setTabValue}
|
|
330
368
|
value={tabValue}
|
|
331
|
-
className="w-full
|
|
369
|
+
className="mx-auto mt-5 w-full flex-col gap-1.5"
|
|
332
370
|
>
|
|
333
|
-
<TabsList className="
|
|
371
|
+
<TabsList className="w-full flex-row flex-wrap rounded-none border-b border-muted bg-transparent p-0 px-1">
|
|
334
372
|
{event?.content ? (
|
|
335
373
|
<TabsTrigger
|
|
336
374
|
value="description"
|
|
337
|
-
onPress={() =>
|
|
338
|
-
|
|
339
|
-
}}
|
|
340
|
-
className={`${
|
|
375
|
+
onPress={() => setTabValue('description')}
|
|
376
|
+
className={
|
|
341
377
|
tabValue === 'description' ? 'border-b-2 border-foreground' : ''
|
|
342
|
-
}
|
|
378
|
+
}
|
|
343
379
|
>
|
|
344
|
-
<ThemedText>
|
|
380
|
+
<ThemedText>
|
|
381
|
+
{t('events.tabs.description', { defaultValue: 'Description' })}
|
|
382
|
+
</ThemedText>
|
|
345
383
|
</TabsTrigger>
|
|
346
384
|
) : null}
|
|
347
385
|
<TabsTrigger
|
|
348
386
|
value="discussions"
|
|
349
|
-
className={
|
|
387
|
+
className={
|
|
350
388
|
tabValue === 'discussions' ? 'border-b-2 border-foreground' : ''
|
|
351
|
-
}
|
|
352
|
-
onPress={() =>
|
|
353
|
-
|
|
354
|
-
|
|
389
|
+
}
|
|
390
|
+
onPress={() => setTabValue('discussions')}
|
|
391
|
+
>
|
|
392
|
+
<ThemedText>
|
|
393
|
+
{t('events.tabs.discussion', { defaultValue: 'Discussion' })}
|
|
394
|
+
</ThemedText>
|
|
395
|
+
</TabsTrigger>
|
|
396
|
+
<TabsTrigger
|
|
397
|
+
value="rsvps"
|
|
398
|
+
className={
|
|
399
|
+
tabValue === 'rsvps' ? 'border-b-2 border-foreground' : ''
|
|
400
|
+
}
|
|
401
|
+
onPress={() => setTabValue('rsvps')}
|
|
355
402
|
>
|
|
356
|
-
<ThemedText>
|
|
403
|
+
<ThemedText>
|
|
404
|
+
{t('events.tabs.rsvps', { defaultValue: 'RSVPs' })}
|
|
405
|
+
</ThemedText>
|
|
357
406
|
</TabsTrigger>
|
|
358
|
-
{
|
|
407
|
+
{showJamAttendeesTab ? (
|
|
359
408
|
<TabsTrigger
|
|
360
409
|
value="attendees"
|
|
361
|
-
className={
|
|
410
|
+
className={
|
|
362
411
|
tabValue === 'attendees' ? 'border-b-2 border-foreground' : ''
|
|
363
|
-
}
|
|
364
|
-
onPress={() =>
|
|
365
|
-
setTabValue('attendees');
|
|
366
|
-
}}
|
|
412
|
+
}
|
|
413
|
+
onPress={() => setTabValue('attendees')}
|
|
367
414
|
>
|
|
368
|
-
<ThemedText>
|
|
415
|
+
<ThemedText>
|
|
416
|
+
{t('events.tabs.jamAttendees', {
|
|
417
|
+
defaultValue: 'Jam attendees',
|
|
418
|
+
})}
|
|
419
|
+
</ThemedText>
|
|
369
420
|
</TabsTrigger>
|
|
370
|
-
)}
|
|
421
|
+
) : null}
|
|
422
|
+
{event.jam ? (
|
|
423
|
+
<TabsTrigger
|
|
424
|
+
value="recordings"
|
|
425
|
+
className={
|
|
426
|
+
tabValue === 'recordings' ? 'border-b-2 border-foreground' : ''
|
|
427
|
+
}
|
|
428
|
+
onPress={() => setTabValue('recordings')}
|
|
429
|
+
>
|
|
430
|
+
<ThemedText>
|
|
431
|
+
{t('events.tabs.recordings', { defaultValue: 'Recordings' })}
|
|
432
|
+
</ThemedText>
|
|
433
|
+
</TabsTrigger>
|
|
434
|
+
) : null}
|
|
371
435
|
</TabsList>
|
|
372
436
|
{event?.content ? (
|
|
373
437
|
<TabsContent value="description" className="p-0">
|
|
@@ -380,22 +444,77 @@ export const FullEvent: React.FC<FullEventProps> = ({ post, occurrence }) => {
|
|
|
380
444
|
<ThreadedFeed key={thread.id} thread={thread} />
|
|
381
445
|
))}
|
|
382
446
|
</TabsContent>
|
|
383
|
-
|
|
447
|
+
<TabsContent value="rsvps" className="px-0 py-4">
|
|
448
|
+
<EventRsvpList
|
|
449
|
+
post={post as PublicPost}
|
|
450
|
+
occurrenceId={occurrence}
|
|
451
|
+
occurrences={upcomingOccurrences}
|
|
452
|
+
canManageRsvps={canManageRsvps}
|
|
453
|
+
onManage={(response, profileId, recurrenceId) =>
|
|
454
|
+
rsvpManage({ response, recurrenceId }, { id: post.id, profileId })
|
|
455
|
+
}
|
|
456
|
+
/>
|
|
457
|
+
</TabsContent>
|
|
458
|
+
{showJamAttendeesTab ? (
|
|
384
459
|
<TabsContent value="attendees" className="px-0 py-4">
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
{
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
460
|
+
{jamAttendeesQuery.data?.length ? (
|
|
461
|
+
jamAttendeesQuery.data.map((attendee) => (
|
|
462
|
+
<View
|
|
463
|
+
key={attendee.id}
|
|
464
|
+
className="flex-row items-center justify-between py-2"
|
|
465
|
+
>
|
|
466
|
+
<ProfileFromId id={attendee.profileId} />
|
|
467
|
+
<UpdatingDate date={attendee.createdAt} />
|
|
468
|
+
</View>
|
|
469
|
+
))
|
|
470
|
+
) : (
|
|
471
|
+
<ThemedText className="py-4 text-sm text-muted-foreground">
|
|
472
|
+
{t('events.noAttendees', { defaultValue: 'No attendees yet.' })}
|
|
473
|
+
</ThemedText>
|
|
474
|
+
)}
|
|
397
475
|
</TabsContent>
|
|
398
|
-
)}
|
|
476
|
+
) : null}
|
|
477
|
+
{event.jam ? (
|
|
478
|
+
<TabsContent value="recordings" className="px-0 py-4">
|
|
479
|
+
{!canViewRecordings ? (
|
|
480
|
+
<ThemedText className="py-4 text-center text-sm text-muted-foreground">
|
|
481
|
+
{t('error.jamRecordingForbidden', {
|
|
482
|
+
defaultValue:
|
|
483
|
+
"You don't have permission to view recordings for this jam.",
|
|
484
|
+
})}
|
|
485
|
+
</ThemedText>
|
|
486
|
+
) : recordingsQuery.isLoading ? (
|
|
487
|
+
<ThemedText className="py-4 text-sm text-muted-foreground">
|
|
488
|
+
{t('common.loading', { defaultValue: 'Loading…' })}
|
|
489
|
+
</ThemedText>
|
|
490
|
+
) : recordingsQuery.data?.length ? (
|
|
491
|
+
recordingsQuery.data.map((recording: JamRecording) => (
|
|
492
|
+
<View key={recording.id} className="gap-y-2 py-4">
|
|
493
|
+
<UpdatingDate date={recording.createdAt} />
|
|
494
|
+
{recording.status === 'completed' && recording.attachment ? (
|
|
495
|
+
<VideoPlayer attachment={recording.attachment} />
|
|
496
|
+
) : (
|
|
497
|
+
<ThemedText className="text-sm text-muted-foreground">
|
|
498
|
+
{recording.status === 'active'
|
|
499
|
+
? t('events.recordingInProgress', {
|
|
500
|
+
defaultValue: 'Recording in progress…',
|
|
501
|
+
})
|
|
502
|
+
: t('events.recordingProcessing', {
|
|
503
|
+
defaultValue: 'Processing recording…',
|
|
504
|
+
})}
|
|
505
|
+
</ThemedText>
|
|
506
|
+
)}
|
|
507
|
+
</View>
|
|
508
|
+
))
|
|
509
|
+
) : (
|
|
510
|
+
<ThemedText className="py-4 text-sm text-muted-foreground">
|
|
511
|
+
{t('events.noRecordings', {
|
|
512
|
+
defaultValue: 'No recordings yet.',
|
|
513
|
+
})}
|
|
514
|
+
</ThemedText>
|
|
515
|
+
)}
|
|
516
|
+
</TabsContent>
|
|
517
|
+
) : null}
|
|
399
518
|
</Tabs>
|
|
400
519
|
</ThemedView>
|
|
401
520
|
);
|
|
@@ -32,7 +32,11 @@ export const ProfileCard = ({
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<View
|
|
35
|
+
<View
|
|
36
|
+
className={`w-full flex-row items-center justify-between px-4 ${
|
|
37
|
+
actionType === 'select' ? 'mb-1 py-1' : 'mb-8'
|
|
38
|
+
}`}
|
|
39
|
+
>
|
|
36
40
|
<TouchableWithoutFeedback
|
|
37
41
|
onPress={() => {
|
|
38
42
|
if (actionType === 'select' && handleSelectProfile) {
|
|
@@ -44,7 +48,10 @@ export const ProfileCard = ({
|
|
|
44
48
|
}}
|
|
45
49
|
>
|
|
46
50
|
<View className="flex flex-row items-center gap-x-2">
|
|
47
|
-
<ProfileAvatar
|
|
51
|
+
<ProfileAvatar
|
|
52
|
+
profile={profile}
|
|
53
|
+
className={actionType === 'select' ? 'size-10' : 'size-16'}
|
|
54
|
+
/>
|
|
48
55
|
<View className="">
|
|
49
56
|
<ThemedText className="text-lg font-semibold">
|
|
50
57
|
{truncateText(profile.displayName, 18) || profile.handle}
|
|
@@ -16,7 +16,7 @@ export const ProfileFromId = ({ id }: AvatarFromIdProps) => {
|
|
|
16
16
|
<View>
|
|
17
17
|
{isLoading && <ActivityIndicator size={'small'} />}
|
|
18
18
|
{!isLoading && (
|
|
19
|
-
<ProfileAvatar className="
|
|
19
|
+
<ProfileAvatar className="-mr-2 size-8" profile={profile as Profile} />
|
|
20
20
|
)}
|
|
21
21
|
</View>
|
|
22
22
|
);
|
|
@@ -5,7 +5,7 @@ import { TextClassContext } from './themed-text';
|
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
6
6
|
|
|
7
7
|
const buttonVariants = cva(
|
|
8
|
-
'group flex items-center justify-center rounded-
|
|
8
|
+
'group flex items-center justify-center rounded-button web:ring-offset-background web:transition-colors web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
package/src/pages/PostDetail.tsx
CHANGED
|
@@ -6,12 +6,13 @@ import { useOpenpeeps, usePostDetailTitle } from '@openpeepshq/react';
|
|
|
6
6
|
import { GenericHeader } from '../components/custom/index';
|
|
7
7
|
import { ThemedSafeAreaView } from '../components/ui/themed-safe-area-view';
|
|
8
8
|
import { MainScreenProps } from '../components/navigation/types/index';
|
|
9
|
+
import { goToParentOrBack } from '../components/navigation/parent-back';
|
|
9
10
|
import { PostDetail as PostDetailComponent } from '../components/post/index';
|
|
10
11
|
import { FullEventActions } from '../components/post/types/event/FullEvent';
|
|
11
12
|
|
|
12
13
|
type PostProps = MainScreenProps<'Post'>;
|
|
13
14
|
|
|
14
|
-
export const PostDetail = ({ route }: PostProps) => {
|
|
15
|
+
export const PostDetail = ({ route, navigation }: PostProps) => {
|
|
15
16
|
const { t } = useTranslation();
|
|
16
17
|
const { openpeepsApi } = useOpenpeeps();
|
|
17
18
|
const { id, occurrence } = route.params;
|
|
@@ -29,18 +30,27 @@ export const PostDetail = ({ route }: PostProps) => {
|
|
|
29
30
|
? `${kindTitle} ${t('post.detail.inGroup')} ${groupLabel}`
|
|
30
31
|
: kindTitle;
|
|
31
32
|
|
|
33
|
+
const handleGoBack = () =>
|
|
34
|
+
goToParentOrBack({
|
|
35
|
+
navigation,
|
|
36
|
+
routeName: 'Post',
|
|
37
|
+
params: route.params,
|
|
38
|
+
post,
|
|
39
|
+
});
|
|
40
|
+
|
|
32
41
|
return (
|
|
33
42
|
<ThemedSafeAreaView className="flex-1">
|
|
34
43
|
{post?.type === 'event' ? (
|
|
35
44
|
<GenericHeader
|
|
36
45
|
title={title}
|
|
46
|
+
handleGoBack={handleGoBack}
|
|
37
47
|
rightType="icon"
|
|
38
48
|
rightButtonIcon={
|
|
39
49
|
<FullEventActions post={post} occurrence={occurrence} />
|
|
40
50
|
}
|
|
41
51
|
/>
|
|
42
52
|
) : (
|
|
43
|
-
<GenericHeader title={title} />
|
|
53
|
+
<GenericHeader title={title} handleGoBack={handleGoBack} />
|
|
44
54
|
)}
|
|
45
55
|
<KeyboardAwareScrollView
|
|
46
56
|
className="w-full flex bg-background relative"
|
package/src/pages/Tags.tsx
CHANGED
|
@@ -8,18 +8,18 @@ import {
|
|
|
8
8
|
useFeedListParams,
|
|
9
9
|
useOpenpeeps,
|
|
10
10
|
} from '@openpeepshq/react';
|
|
11
|
-
import {
|
|
12
|
-
import { ThemedText } from '../components/ui/themed-text';
|
|
11
|
+
import { GenericHeader } from '../components/custom/index';
|
|
13
12
|
import { CompositeScreenProps } from '@react-navigation/native';
|
|
14
13
|
import { NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
15
14
|
import { RefreshControl, ScrollView } from 'react-native';
|
|
16
15
|
|
|
17
16
|
import { Feed, NewNoteButton } from '../components/post/index';
|
|
17
|
+
import { TAB_ROUTES } from '../components/navigation/types/index';
|
|
18
18
|
type HomeScreenProps = CompositeScreenProps<
|
|
19
19
|
NativeStackScreenProps<TabStackParamList, 'HashtagPosts'>,
|
|
20
20
|
NativeStackScreenProps<MainStackParamList>
|
|
21
21
|
>;
|
|
22
|
-
export const Tags: React.FC<HomeScreenProps> = ({ route }) => {
|
|
22
|
+
export const Tags: React.FC<HomeScreenProps> = ({ route, navigation }) => {
|
|
23
23
|
const { openpeepsApi } = useOpenpeeps();
|
|
24
24
|
const { tag } = route.params;
|
|
25
25
|
const visibility = useDefaultVisibility();
|
|
@@ -38,8 +38,9 @@ export const Tags: React.FC<HomeScreenProps> = ({ route }) => {
|
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
40
|
<>
|
|
41
|
-
<
|
|
42
|
-
|
|
41
|
+
<GenericHeader
|
|
42
|
+
title={`#${tag}`}
|
|
43
|
+
handleGoBack={() => navigation.navigate(TAB_ROUTES.HOME)}
|
|
43
44
|
/>
|
|
44
45
|
<ScrollView
|
|
45
46
|
className="bg-background"
|
|
@@ -133,7 +133,7 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
133
133
|
>
|
|
134
134
|
<ScrollView
|
|
135
135
|
ref={scrollViewRef}
|
|
136
|
-
className="flex-1 pb-
|
|
136
|
+
className="flex-1 pb-8"
|
|
137
137
|
onContentSizeChange={() =>
|
|
138
138
|
scrollViewRef.current?.scrollToEnd({ animated: true })
|
|
139
139
|
}
|
|
@@ -226,7 +226,13 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
226
226
|
{isSending ? (
|
|
227
227
|
<ActivityIndicator size="small" />
|
|
228
228
|
) : (
|
|
229
|
-
<SendHorizonalIcon
|
|
229
|
+
<SendHorizonalIcon
|
|
230
|
+
className={
|
|
231
|
+
content.trim() && content.length <= maxContentLength
|
|
232
|
+
? 'text-primary-foreground'
|
|
233
|
+
: 'text-muted-foreground'
|
|
234
|
+
}
|
|
235
|
+
/>
|
|
230
236
|
)}
|
|
231
237
|
</TouchableOpacity>
|
|
232
238
|
</View>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { Pressable, View } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import {
|
|
5
5
|
NativeStackNavigationProp,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from '../../components/navigation/types/index';
|
|
14
14
|
import { ConfigMenuButton } from '../../components/configuration/index';
|
|
15
15
|
import { TabScreensHeader } from '../../components/custom/index';
|
|
16
|
+
import { ChevronLeftIcon } from '../../components/icons/index';
|
|
16
17
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
17
18
|
import { ThemedView } from '../../components/ui/themed-view';
|
|
18
19
|
|
|
@@ -29,7 +30,18 @@ export const Settings = ({}: NativeStackScreenProps<
|
|
|
29
30
|
<ThemedView className="flex-1 relative">
|
|
30
31
|
<TabScreensHeader
|
|
31
32
|
children={
|
|
32
|
-
<View className="p-2">
|
|
33
|
+
<View className="flex-row items-center p-2">
|
|
34
|
+
{profile ? (
|
|
35
|
+
<Pressable
|
|
36
|
+
accessibilityRole="button"
|
|
37
|
+
onPress={() =>
|
|
38
|
+
navigation.navigate('Profile', { handle: profile.handle })
|
|
39
|
+
}
|
|
40
|
+
className="mr-1 p-1"
|
|
41
|
+
>
|
|
42
|
+
<ChevronLeftIcon size={28} className="text-foreground" />
|
|
43
|
+
</Pressable>
|
|
44
|
+
) : null}
|
|
33
45
|
<ThemedText className="text-2xl font-semibold">
|
|
34
46
|
{t('settings.menu')}
|
|
35
47
|
</ThemedText>
|
|
@@ -21,28 +21,39 @@ export const OpenPeepsThemeProvider = ({
|
|
|
21
21
|
const { data: profileSettings, refetch: refetchProfileSettings } =
|
|
22
22
|
openpeepsApi.useCurrentProfileSettings();
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const resolvedTheme = useMemo(() => {
|
|
25
25
|
const schemeForTheme =
|
|
26
26
|
systemColorScheme === 'dark' || systemColorScheme === 'light'
|
|
27
27
|
? systemColorScheme
|
|
28
28
|
: undefined;
|
|
29
|
-
|
|
29
|
+
return getTheme(
|
|
30
30
|
serverInfo?.communityConfig ??
|
|
31
31
|
({ theme: { base: 'OpenpeepsDark' } } as CommunityConfig),
|
|
32
32
|
profileSettings,
|
|
33
33
|
schemeForTheme ?? 'light'
|
|
34
34
|
);
|
|
35
|
-
|
|
36
|
-
refetchProfileSettings();
|
|
37
|
-
});
|
|
38
|
-
}, [
|
|
39
|
-
profileSettings,
|
|
40
|
-
refetchProfileSettings,
|
|
41
|
-
serverInfo?.communityConfig,
|
|
42
|
-
systemColorScheme,
|
|
43
|
-
]);
|
|
35
|
+
}, [profileSettings, serverInfo?.communityConfig, systemColorScheme]);
|
|
44
36
|
|
|
45
|
-
const
|
|
37
|
+
const theme = useMemo(
|
|
38
|
+
() =>
|
|
39
|
+
buildTheme(resolvedTheme.dark, resolvedTheme.primaryHex, () => {
|
|
40
|
+
refetchProfileSettings();
|
|
41
|
+
}),
|
|
42
|
+
[refetchProfileSettings, resolvedTheme.dark, resolvedTheme.primaryHex]
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const themeVars = useMemo(
|
|
46
|
+
() =>
|
|
47
|
+
getThemeVars(theme.colors, {
|
|
48
|
+
buttonRadius: resolvedTheme.buttonRadius,
|
|
49
|
+
radius: resolvedTheme.radius,
|
|
50
|
+
}),
|
|
51
|
+
[
|
|
52
|
+
resolvedTheme.buttonRadius,
|
|
53
|
+
resolvedTheme.radius,
|
|
54
|
+
theme.colors,
|
|
55
|
+
]
|
|
56
|
+
);
|
|
46
57
|
|
|
47
58
|
useEffect(() => {
|
|
48
59
|
// nativewind maps colorScheme.set('system') to Appearance.setColorScheme(null),
|
package/src/theme/utils.ts
CHANGED
|
@@ -2,12 +2,17 @@ import { vars } from 'nativewind';
|
|
|
2
2
|
import { mapColors } from './defaults';
|
|
3
3
|
import type { OpenPeepsTheme } from './types';
|
|
4
4
|
|
|
5
|
-
export const getThemeVars = (
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export const getThemeVars = (
|
|
6
|
+
colors: OpenPeepsTheme['colors'],
|
|
7
|
+
radii?: { buttonRadius?: string; radius?: string }
|
|
8
|
+
) =>
|
|
9
|
+
vars({
|
|
10
|
+
...Object.fromEntries(
|
|
8
11
|
Object.entries(colors).map(([key, value]) => [`--${key}`, value])
|
|
9
|
-
)
|
|
10
|
-
|
|
12
|
+
),
|
|
13
|
+
'--theme-rounded-base': radii?.buttonRadius || '9999px',
|
|
14
|
+
'--theme-rounded-container': radii?.radius || '0.5rem',
|
|
15
|
+
});
|
|
11
16
|
|
|
12
17
|
export const buildTheme = (
|
|
13
18
|
isDark: boolean,
|
package/tailwind.config.js
CHANGED
|
@@ -47,6 +47,12 @@ export default {
|
|
|
47
47
|
borderWidth: {
|
|
48
48
|
hairline: hairlineWidth(),
|
|
49
49
|
},
|
|
50
|
+
borderRadius: {
|
|
51
|
+
button: 'var(--theme-rounded-base)',
|
|
52
|
+
lg: 'var(--theme-rounded-container, 0.5rem)',
|
|
53
|
+
md: 'calc(var(--theme-rounded-container, 0.5rem) - 2px)',
|
|
54
|
+
sm: 'calc(var(--theme-rounded-container, 0.5rem) - 4px)',
|
|
55
|
+
},
|
|
50
56
|
},
|
|
51
57
|
},
|
|
52
58
|
plugins: [require('tailwindcss-animate')],
|