@openpeepshq/rn-components 0.3.6 โ 0.3.7
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/empty-state-container.tsx +42 -114
- package/src/components/custom/headers/tab-screens-header.tsx +3 -4
- package/src/components/custom/navigation/side-menu.tsx +2 -2
- package/src/components/navigation/auth-wrapper.tsx +1 -1
- package/src/components/notifications/NotificationItem.tsx +1 -1
- package/src/components/notifications/NotificationsList.tsx +5 -1
- package/src/components/post/Feed.tsx +3 -1
- package/src/components/post/FeedPost.tsx +32 -37
- package/src/components/post/FeedPostContent.tsx +6 -8
- package/src/components/post/feed/events/EventsFeed.tsx +1 -0
- package/src/components/post/pieces/PostActions.tsx +46 -121
- package/src/components/post/pieces/PostInfoHeader.tsx +9 -5
- package/src/components/post/post-form/Footer.tsx +47 -64
- package/src/components/post/post-form/OpenpeepsMarkdownInput.tsx +3 -0
- package/src/components/post/post-form/PollComposerFields.tsx +2 -2
- package/src/components/post/post-form/PostForm.tsx +133 -129
- package/src/components/post/types/Note.tsx +1 -1
- package/src/components/post/types/Poll.tsx +1 -1
- package/src/components/post/types/article/CardArticle.tsx +1 -1
- package/src/components/post/types/event/CardEvent.tsx +1 -1
- package/src/components/post/types/event/FullEvent.tsx +21 -20
- package/src/components/profile/ProfileCard.tsx +1 -1
- package/src/components/profile/ProfileHeader.tsx +8 -10
- package/src/pages/Explore.tsx +30 -5
- package/src/pages/Members.tsx +2 -2
- package/src/pages/conversations/Index.tsx +1 -1
- package/src/pages/conversations/New.tsx +8 -1
- package/src/pages/groups/Index.tsx +8 -1
- package/src/pages/groups/Info.tsx +4 -4
- package/src/pages/groups/Show.tsx +42 -3
- package/src/pages/posts/Edit.tsx +43 -5
- package/src/pages/posts/New.tsx +121 -74
- package/src/pages/posts/Reply.tsx +77 -49
- package/src/pages/profile/Followers.tsx +4 -1
- package/src/pages/profile/Following.tsx +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/rn-components",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
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",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { View } from 'react-native';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
3
4
|
import { ThemedText } from '../../ui/themed-text';
|
|
4
5
|
import {
|
|
5
6
|
BellOffIcon,
|
|
@@ -10,121 +11,48 @@ import {
|
|
|
10
11
|
UserRoundXIcon,
|
|
11
12
|
} from '../../icons/index';
|
|
12
13
|
import { EmptyStateContainerType } from '../../../types';
|
|
14
|
+
|
|
13
15
|
interface EmptyStateContainerProps {
|
|
14
16
|
type: EmptyStateContainerType;
|
|
17
|
+
copyKey: string;
|
|
18
|
+
defaultValue?: string;
|
|
15
19
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<View className="flex flex-1 h-64 items-center justify-center">
|
|
56
|
-
<UserRoundXIcon size={64} className="text-foreground" />
|
|
57
|
-
<ThemedText className="mt-6">No followers yet</ThemedText>
|
|
58
|
-
</View>
|
|
59
|
-
);
|
|
60
|
-
case 'following':
|
|
61
|
-
return (
|
|
62
|
-
<View className="flex flex-1 h-64 items-center justify-center">
|
|
63
|
-
<UserRoundXIcon size={64} className="text-foreground" />
|
|
64
|
-
<ThemedText className="mt-6">No followings yet</ThemedText>
|
|
65
|
-
</View>
|
|
66
|
-
);
|
|
67
|
-
case 'messages':
|
|
68
|
-
return (
|
|
69
|
-
<View className="flex flex-1 h-64 items-center justify-center">
|
|
70
|
-
<MessageSquareOffIcon size={64} className="text-foreground" />
|
|
71
|
-
<ThemedText className="mt-6">No conversations here</ThemedText>
|
|
72
|
-
</View>
|
|
73
|
-
);
|
|
74
|
-
case 'notifications':
|
|
75
|
-
return (
|
|
76
|
-
<View className="flex flex-1 h-64 items-center justify-center">
|
|
77
|
-
<BellOffIcon size={64} className="text-foreground" />
|
|
78
|
-
<ThemedText className="mt-6">No Notifications yet</ThemedText>
|
|
79
|
-
</View>
|
|
80
|
-
);
|
|
81
|
-
case 'live-jams':
|
|
82
|
-
return (
|
|
83
|
-
<View className="flex flex-1 h-64 items-center justify-center">
|
|
84
|
-
<PhoneOffIcon size={64} className="text-foreground" />
|
|
85
|
-
<ThemedText className="mt-6">No live jam to join yet</ThemedText>
|
|
86
|
-
</View>
|
|
87
|
-
);
|
|
88
|
-
case 'upcoming-jams':
|
|
89
|
-
return (
|
|
90
|
-
<View className="flex flex-1 h-64 items-center justify-center">
|
|
91
|
-
<PhoneOffIcon size={64} className="text-foreground" />
|
|
92
|
-
<ThemedText className="mt-6">No upcoming jams yet</ThemedText>
|
|
93
|
-
</View>
|
|
94
|
-
);
|
|
95
|
-
case 'my-jams':
|
|
96
|
-
return (
|
|
97
|
-
<View className="flex flex-1 h-64 items-center justify-center">
|
|
98
|
-
<PhoneOffIcon size={64} className="text-foreground" />
|
|
99
|
-
<ThemedText className="mt-6">No jams yet</ThemedText>
|
|
100
|
-
</View>
|
|
101
|
-
);
|
|
102
|
-
case 'recorded-jams':
|
|
103
|
-
return (
|
|
104
|
-
<View className="flex flex-1 h-64 items-center justify-center">
|
|
105
|
-
<PhoneOffIcon size={64} className="text-foreground" />
|
|
106
|
-
<ThemedText className="mt-6">No jams yet</ThemedText>
|
|
107
|
-
</View>
|
|
108
|
-
);
|
|
109
|
-
case 'event-attendees':
|
|
110
|
-
return (
|
|
111
|
-
<View className="flex flex-1 h-64 items-center justify-center">
|
|
112
|
-
<UserRoundXIcon size={64} className="text-foreground" />
|
|
113
|
-
<ThemedText className="mt-6">No attendees yet</ThemedText>
|
|
114
|
-
</View>
|
|
115
|
-
);
|
|
116
|
-
case 'event-description':
|
|
117
|
-
return (
|
|
118
|
-
<View className="flex flex-1 h-64 items-center justify-center">
|
|
119
|
-
<RssIcon size={64} className="text-foreground" />
|
|
120
|
-
<ThemedText className="mt-6">No description added</ThemedText>
|
|
121
|
-
</View>
|
|
122
|
-
);
|
|
123
|
-
default:
|
|
124
|
-
return (
|
|
125
|
-
<View className="flex flex-1 h-64 items-center justify-center">
|
|
126
|
-
<ThemedText className="mt-6">Empty State Container</ThemedText>
|
|
127
|
-
</View>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
20
|
+
|
|
21
|
+
export const EmptyStateContainer = ({
|
|
22
|
+
type,
|
|
23
|
+
copyKey,
|
|
24
|
+
defaultValue,
|
|
25
|
+
}: EmptyStateContainerProps) => {
|
|
26
|
+
const { t } = useTranslation();
|
|
27
|
+
const iconClass = 'text-muted-foreground';
|
|
28
|
+
const icon =
|
|
29
|
+
type === 'events' ? (
|
|
30
|
+
<CalendarXIcon size={80} className={iconClass} />
|
|
31
|
+
) : type === 'messages' ? (
|
|
32
|
+
<MessageSquareOffIcon size={80} className={iconClass} />
|
|
33
|
+
) : type === 'notifications' ? (
|
|
34
|
+
<BellOffIcon size={80} className={iconClass} />
|
|
35
|
+
) : type === 'live-jams' ||
|
|
36
|
+
type === 'upcoming-jams' ||
|
|
37
|
+
type === 'my-jams' ||
|
|
38
|
+
type === 'recorded-jams' ? (
|
|
39
|
+
<PhoneOffIcon size={80} className={iconClass} />
|
|
40
|
+
) : type === 'groups' ||
|
|
41
|
+
type === 'profiles' ||
|
|
42
|
+
type === 'followers' ||
|
|
43
|
+
type === 'following' ||
|
|
44
|
+
type === 'event-attendees' ? (
|
|
45
|
+
<UserRoundXIcon size={80} className={iconClass} />
|
|
46
|
+
) : (
|
|
47
|
+
<RssIcon size={80} className={iconClass} />
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<View className="h-96 w-full flex-col items-center justify-center gap-y-4 bg-surface">
|
|
52
|
+
{icon}
|
|
53
|
+
<ThemedText className="text-xl">
|
|
54
|
+
{t(copyKey, defaultValue ? { defaultValue } : undefined)}
|
|
55
|
+
</ThemedText>
|
|
56
|
+
</View>
|
|
57
|
+
);
|
|
130
58
|
};
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
import { ThemedText } from '../../ui/themed-text';
|
|
12
12
|
import { Avatar, AvatarImage, AvatarFallback } from '../../ui/avatar';
|
|
13
13
|
import { Button } from '../../ui/button';
|
|
14
|
-
import { BellIcon } from '../../icons/index';
|
|
15
|
-
import { User } from 'lucide-react-native';
|
|
14
|
+
import { BellIcon, UserIcon } from '../../icons/index';
|
|
16
15
|
import { useDrawer } from '../../../contexts/drawer-context';
|
|
17
16
|
import { formatBadgeCount } from '@openpeepshq/common';
|
|
18
17
|
import { useOpenpeeps } from '@openpeepshq/react';
|
|
@@ -104,7 +103,7 @@ export const TabScreensHeader = ({
|
|
|
104
103
|
<SafeAreaView edges={['top']} className="">
|
|
105
104
|
{!isProduction && (
|
|
106
105
|
<View className="mb-2 w-full rounded-lg bg-white/50 p-2">
|
|
107
|
-
<ThemedText className="text-center text-
|
|
106
|
+
<ThemedText className="text-center text-destructive">
|
|
108
107
|
Test Backend ({BASE_URL})
|
|
109
108
|
</ThemedText>
|
|
110
109
|
</View>
|
|
@@ -125,7 +124,7 @@ export const TabScreensHeader = ({
|
|
|
125
124
|
<AvatarImage source={{ uri: currentProfile.avatar }} />
|
|
126
125
|
) : (
|
|
127
126
|
<AvatarFallback className="h-6 w-6 -bottom-2 -right-2 bg-black">
|
|
128
|
-
<
|
|
127
|
+
<UserIcon size={20} className="text-muted-foreground" />
|
|
129
128
|
</AvatarFallback>
|
|
130
129
|
)}
|
|
131
130
|
</Avatar>
|
|
@@ -242,8 +242,8 @@ export const SideMenu = ({
|
|
|
242
242
|
close?.();
|
|
243
243
|
}}
|
|
244
244
|
>
|
|
245
|
-
<LogOutIcon size={20} className="
|
|
246
|
-
<ThemedText className="
|
|
245
|
+
<LogOutIcon size={20} className="mr-5 text-destructive" />
|
|
246
|
+
<ThemedText className="-mt-1 tracking-wider text-destructive native:text-lg">
|
|
247
247
|
{t('navigation.logOut')}
|
|
248
248
|
</ThemedText>
|
|
249
249
|
</Button>
|
|
@@ -13,7 +13,7 @@ import { toAbsoluteMediaUrl } from '../../lib/media-url';
|
|
|
13
13
|
const DevBanner = () =>
|
|
14
14
|
(!isProduction && (
|
|
15
15
|
<View className="absolute bg-white/80 z-10 ml-8 mr-8 w-auto top-64 p-4 rounded-lg">
|
|
16
|
-
<ThemedText className="text-
|
|
16
|
+
<ThemedText className="text-center text-destructive">
|
|
17
17
|
Test Backend ({BASE_URL})
|
|
18
18
|
</ThemedText>
|
|
19
19
|
</View>
|
|
@@ -64,7 +64,7 @@ export const NotificationItem: React.FC<NotificationComponentProps> = ({
|
|
|
64
64
|
if (!NotificationToRender) {
|
|
65
65
|
return (
|
|
66
66
|
<View className="p-4">
|
|
67
|
-
<ThemedText className="
|
|
67
|
+
<ThemedText className="font-bold text-destructive">
|
|
68
68
|
Unknown notification type: {notification.type}
|
|
69
69
|
</ThemedText>
|
|
70
70
|
</View>
|
|
@@ -61,7 +61,11 @@ export const NotificationsList = ({
|
|
|
61
61
|
{query.isFetchingNextPage && <ActivityIndicator size={'small'} />}
|
|
62
62
|
</>
|
|
63
63
|
) : (
|
|
64
|
-
<EmptyStateContainer
|
|
64
|
+
<EmptyStateContainer
|
|
65
|
+
type="notifications"
|
|
66
|
+
copyKey="notification.empty"
|
|
67
|
+
defaultValue="No notifications"
|
|
68
|
+
/>
|
|
65
69
|
)}
|
|
66
70
|
</>
|
|
67
71
|
)}
|
|
@@ -82,7 +82,9 @@ export const Feed = ({
|
|
|
82
82
|
);
|
|
83
83
|
})}
|
|
84
84
|
</View>
|
|
85
|
-
{allPosts.length === 0 &&
|
|
85
|
+
{allPosts.length === 0 && !pinnedPostId && (
|
|
86
|
+
<EmptyStateContainer type={type} copyKey="feed.empty" />
|
|
87
|
+
)}
|
|
86
88
|
{query.isFetchingNextPage && <CustomLoader page="community" />}
|
|
87
89
|
</>
|
|
88
90
|
)}
|
|
@@ -2,6 +2,7 @@ import { type PublicPost } from '@openpeepshq/common';
|
|
|
2
2
|
import { useFeedPostPresentation } from '@openpeepshq/react';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
5
|
+
import { Pressable } from 'react-native';
|
|
5
6
|
import { MainStackParamList } from '../navigation/types/index';
|
|
6
7
|
import {
|
|
7
8
|
PostInfoHeader,
|
|
@@ -73,45 +74,39 @@ export const FeedPost = ({
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
return (
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
<Pressable disabled={previewMode} onPress={handlePostPress}>
|
|
78
|
+
<ThemedView
|
|
79
|
+
ref={postViewRef}
|
|
80
|
+
className="relative border-b border-border p-4"
|
|
81
|
+
>
|
|
82
|
+
<UnreadPostIndicator show={isUnread} />
|
|
83
|
+
{hasReactionHeader && (
|
|
84
|
+
<PostReactionHeader
|
|
85
|
+
post={post}
|
|
86
|
+
inGroup={inGroup}
|
|
87
|
+
hideReply={hideReply}
|
|
88
|
+
previewMode={previewMode}
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
91
|
+
{showsReplyTo && displayedPost.replyTo ? (
|
|
92
|
+
<CompactReplyParent post={displayedPost.replyTo as PublicPost} />
|
|
93
|
+
) : null}
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
<PostInfoHeader
|
|
96
|
+
post={displayedPost}
|
|
97
|
+
showMenu={!hasReactionHeader && !previewMode && showMenu}
|
|
98
|
+
deleteCallback={deleteCallback}
|
|
99
|
+
/>
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</ThemedView>
|
|
102
|
-
{hasStats && (
|
|
103
|
-
<ThemedView className="px-5">
|
|
104
|
-
<FeedPostStats post={displayedPost} />
|
|
101
|
+
<ThemedView>
|
|
102
|
+
{content ?? <FeedPostContent post={displayedPost} />}
|
|
105
103
|
</ThemedView>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
<FeedThreadPreview post={displayedPost} />
|
|
114
|
-
) : null}
|
|
115
|
-
</ThemedView>
|
|
104
|
+
{hasStats && <FeedPostStats post={displayedPost} />}
|
|
105
|
+
<PostActions post={displayedPost} previewMode={previewMode} />
|
|
106
|
+
{!hideReply && showThreadPreview ? (
|
|
107
|
+
<FeedThreadPreview post={displayedPost} />
|
|
108
|
+
) : null}
|
|
109
|
+
</ThemedView>
|
|
110
|
+
</Pressable>
|
|
116
111
|
);
|
|
117
112
|
};
|
|
@@ -25,7 +25,11 @@ export const FeedPostContent = ({ post }: FeedPostContentProps) => {
|
|
|
25
25
|
}
|
|
26
26
|
if (post.deletedAt) {
|
|
27
27
|
return (
|
|
28
|
-
<View
|
|
28
|
+
<View>
|
|
29
|
+
<ThemedText className="text-sm text-muted-foreground">
|
|
30
|
+
{t('posts.compact.deleted')}
|
|
31
|
+
</ThemedText>
|
|
32
|
+
</View>
|
|
29
33
|
);
|
|
30
34
|
}
|
|
31
35
|
if (post.type === 'note') {
|
|
@@ -40,11 +44,5 @@ export const FeedPostContent = ({ post }: FeedPostContentProps) => {
|
|
|
40
44
|
if (post.type === 'article') {
|
|
41
45
|
return <FeedArticle {...{ post }} />;
|
|
42
46
|
}
|
|
43
|
-
return
|
|
44
|
-
<View>
|
|
45
|
-
<ThemedText className="text-red-500">
|
|
46
|
-
This post type is not supported.
|
|
47
|
-
</ThemedText>
|
|
48
|
-
</View>
|
|
49
|
-
);
|
|
47
|
+
return null;
|
|
50
48
|
};
|
|
@@ -1,38 +1,24 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { View
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
import { Button } from '../../ui/button';
|
|
4
4
|
import { ThemedText } from '../../ui/themed-text';
|
|
5
|
-
import {
|
|
6
|
-
Repeat2Icon,
|
|
7
|
-
MessageSquareIcon,
|
|
8
|
-
ThumbsUpIcon,
|
|
9
|
-
} from '../../icons/index';
|
|
10
|
-
import { Separator } from '../../ui/separator';
|
|
5
|
+
import { Repeat2Icon, ReplyIcon, ThumbsUpIcon } from '../../icons/index';
|
|
11
6
|
import { type PublicPost } from '@openpeepshq/common';
|
|
12
|
-
import { getReactionCount } from '@openpeepshq/common';
|
|
13
7
|
import { useTranslation } from 'react-i18next';
|
|
14
|
-
import { useNavigation } from '@react-navigation/native';
|
|
15
|
-
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
16
|
-
import { MainStackParamList } from '../../navigation/types/index';
|
|
17
8
|
import { useFeedPostActions } from '@openpeepshq/react';
|
|
18
9
|
|
|
19
10
|
interface PostActionsProps {
|
|
20
11
|
post: PublicPost;
|
|
21
12
|
previewMode?: boolean;
|
|
22
|
-
onPostPress?: () => void;
|
|
23
13
|
}
|
|
24
14
|
|
|
25
15
|
export const PostActions = ({
|
|
26
16
|
post,
|
|
27
|
-
onPostPress,
|
|
28
17
|
previewMode = false,
|
|
29
18
|
}: PostActionsProps) => {
|
|
30
19
|
const { t } = useTranslation();
|
|
31
|
-
const [isReacting, setIsReacting] = useState(false);
|
|
32
|
-
const [isReposting, setIsReposting] = useState(false);
|
|
33
|
-
const navigation =
|
|
34
|
-
useNavigation<NativeStackNavigationProp<MainStackParamList>>();
|
|
35
20
|
const {
|
|
21
|
+
me,
|
|
36
22
|
myRepost,
|
|
37
23
|
iReacted,
|
|
38
24
|
canReply,
|
|
@@ -42,113 +28,52 @@ export const PostActions = ({
|
|
|
42
28
|
toggleRepost,
|
|
43
29
|
toggleReaction,
|
|
44
30
|
} = useFeedPostActions(post);
|
|
45
|
-
const hasReposted = !!myRepost;
|
|
46
31
|
|
|
47
|
-
|
|
32
|
+
if (!me) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
48
35
|
|
|
49
|
-
const
|
|
50
|
-
reply();
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const handleRepost = async () => {
|
|
54
|
-
setIsReposting(true);
|
|
55
|
-
try {
|
|
56
|
-
await toggleRepost();
|
|
57
|
-
} finally {
|
|
58
|
-
setIsReposting(false);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const handleFavorite = async () => {
|
|
63
|
-
setIsReacting(true);
|
|
64
|
-
try {
|
|
65
|
-
await toggleReaction();
|
|
66
|
-
} finally {
|
|
67
|
-
setIsReacting(false);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const handleSeeThread = () => {
|
|
72
|
-
onPostPress ? onPostPress() : navigation.navigate('Post', { id: post.id });
|
|
73
|
-
};
|
|
36
|
+
const actionClass = 'flex-1 flex-row items-center gap-2 native:p-2';
|
|
74
37
|
|
|
75
38
|
return (
|
|
76
|
-
<View className="
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
{isReacting ? (
|
|
115
|
-
<ActivityIndicator size="small" />
|
|
116
|
-
) : (
|
|
117
|
-
<ThemedText className={iReacted ? 'text-destructive' : ''}>
|
|
118
|
-
{reactionCount['๐']}
|
|
119
|
-
</ThemedText>
|
|
120
|
-
)}
|
|
121
|
-
</Button>
|
|
122
|
-
|
|
123
|
-
<Button
|
|
124
|
-
onPress={handleRepost}
|
|
125
|
-
variant="ghost"
|
|
126
|
-
disabled={isReposting || previewMode || !canRepost}
|
|
127
|
-
className="flex-row items-center native:p-0 gap-2"
|
|
128
|
-
>
|
|
129
|
-
{hasReposted ? (
|
|
130
|
-
<>
|
|
131
|
-
<Repeat2Icon size={18} className="text-foreground" fill="green" />
|
|
132
|
-
{isReposting && <ActivityIndicator size="small" />}
|
|
133
|
-
{!isReposting && (
|
|
134
|
-
<ThemedText className="text-xl text-green-500 font-semibold">
|
|
135
|
-
{post.repostCount}
|
|
136
|
-
</ThemedText>
|
|
137
|
-
)}
|
|
138
|
-
</>
|
|
139
|
-
) : (
|
|
140
|
-
<>
|
|
141
|
-
<Repeat2Icon size={18} className="text-foreground" />
|
|
142
|
-
{isReposting && <ActivityIndicator size="small" />}
|
|
143
|
-
{!isReposting && (
|
|
144
|
-
<ThemedText className="text-xl font-semibold">
|
|
145
|
-
{post.repostCount}
|
|
146
|
-
</ThemedText>
|
|
147
|
-
)}
|
|
148
|
-
</>
|
|
149
|
-
)}
|
|
150
|
-
</Button>
|
|
151
|
-
</View>
|
|
39
|
+
<View className="w-full flex-row items-center py-2">
|
|
40
|
+
<Button
|
|
41
|
+
variant="ghost"
|
|
42
|
+
disabled={previewMode || !canReply}
|
|
43
|
+
onPress={() => reply()}
|
|
44
|
+
className={`${actionClass} justify-start`}
|
|
45
|
+
>
|
|
46
|
+
<ReplyIcon size={16} className="text-foreground" />
|
|
47
|
+
<ThemedText className="text-sm">{t('posts.footer.reply')}</ThemedText>
|
|
48
|
+
</Button>
|
|
49
|
+
<Button
|
|
50
|
+
variant="ghost"
|
|
51
|
+
disabled={previewMode || !canRepost}
|
|
52
|
+
onPress={() => void toggleRepost()}
|
|
53
|
+
className={`${actionClass} justify-center`}
|
|
54
|
+
>
|
|
55
|
+
<Repeat2Icon
|
|
56
|
+
size={16}
|
|
57
|
+
className={myRepost ? 'text-primary' : 'text-foreground'}
|
|
58
|
+
/>
|
|
59
|
+
<ThemedText className={`text-sm ${myRepost ? 'text-primary' : ''}`}>
|
|
60
|
+
{t('posts.footer.repost')}
|
|
61
|
+
</ThemedText>
|
|
62
|
+
</Button>
|
|
63
|
+
<Button
|
|
64
|
+
variant="ghost"
|
|
65
|
+
disabled={previewMode || !canReact}
|
|
66
|
+
onPress={() => void toggleReaction()}
|
|
67
|
+
className={`${actionClass} justify-end`}
|
|
68
|
+
>
|
|
69
|
+
<ThumbsUpIcon
|
|
70
|
+
size={16}
|
|
71
|
+
className={iReacted ? 'text-primary' : 'text-foreground'}
|
|
72
|
+
/>
|
|
73
|
+
<ThemedText className={`text-sm ${iReacted ? 'text-primary' : ''}`}>
|
|
74
|
+
{t('posts.footer.like')}
|
|
75
|
+
</ThemedText>
|
|
76
|
+
</Button>
|
|
152
77
|
</View>
|
|
153
78
|
);
|
|
154
79
|
};
|
|
@@ -8,6 +8,7 @@ import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
|
8
8
|
import { MainStackParamList } from '../../navigation/types/index';
|
|
9
9
|
import { ProfileAvatar } from '../../profile/Avatar';
|
|
10
10
|
import { ProfileHandle, ProfileName } from '../../profile/ProfilePieces';
|
|
11
|
+
import { ThemedText } from '../../ui/themed-text';
|
|
11
12
|
import { ThemedView } from '../../ui/themed-view';
|
|
12
13
|
|
|
13
14
|
interface PostHeaderProps {
|
|
@@ -25,8 +26,8 @@ export const PostInfoHeader = ({
|
|
|
25
26
|
useNavigation<NativeStackNavigationProp<MainStackParamList>>();
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
|
-
<ThemedView className="flex-row
|
|
29
|
-
<ThemedView className="flex-row gap-
|
|
29
|
+
<ThemedView className="flex-row items-center justify-between py-2">
|
|
30
|
+
<ThemedView className="flex-row gap-2">
|
|
30
31
|
<TouchableOpacity
|
|
31
32
|
onPress={() =>
|
|
32
33
|
navigation.navigate('Profile', {
|
|
@@ -34,12 +35,15 @@ export const PostInfoHeader = ({
|
|
|
34
35
|
})
|
|
35
36
|
}
|
|
36
37
|
>
|
|
37
|
-
<ProfileAvatar profile={post.profile} className="size-
|
|
38
|
+
<ProfileAvatar profile={post.profile} className="size-10" />
|
|
38
39
|
</TouchableOpacity>
|
|
39
40
|
<ThemedView>
|
|
40
41
|
<ProfileName profile={[post.profile]} />
|
|
41
|
-
<
|
|
42
|
-
|
|
42
|
+
<ThemedView className="flex-row items-center gap-1">
|
|
43
|
+
<ProfileHandle profile={[post.profile]} />
|
|
44
|
+
<ThemedText className="text-xs text-muted-foreground">ยท</ThemedText>
|
|
45
|
+
<UpdatingDate date={post.createdAt as string} />
|
|
46
|
+
</ThemedView>
|
|
43
47
|
</ThemedView>
|
|
44
48
|
</ThemedView>
|
|
45
49
|
{showMenu && <PostMenu post={post} deleteCallback={deleteCallback} />}
|