@openpeepshq/rn-components 0.4.0 → 0.5.1
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 +2 -2
- package/src/assets/audio/click-notification.wav +0 -0
- package/src/components/groups/GroupAvatar.tsx +41 -12
- package/src/components/jams/JamCallParticipant.tsx +25 -1
- package/src/components/navigation/tab-navigator.tsx +11 -8
- package/src/components/post/pieces/PostActions.tsx +2 -0
- package/src/components/post/pieces/PostMenu.tsx +315 -340
- package/src/components/post/pieces/ShareMenu.tsx +68 -67
- package/src/components/profile/Avatar.tsx +24 -8
- package/src/components/profile/FollowUnfollowButton.tsx +4 -2
- package/src/components/profile/ProfileCard.tsx +48 -18
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/index.ts +6 -0
- package/src/components/ui/loading-spinner.tsx +24 -0
- package/src/components/ui/popup-menu-button.tsx +99 -0
- package/src/components/ui/popup-menu-section.tsx +21 -0
- package/src/components/ui/popup-menu-separator.tsx +10 -0
- package/src/components/ui/popup-menu.tsx +75 -0
- package/src/lib/utils.ts +11 -23
- package/src/pages/Members.tsx +1 -1
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { View, Pressable, Share, ActivityIndicator } from 'react-native';
|
|
2
1
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
import {
|
|
4
|
-
EllipsisIcon,
|
|
5
4
|
PencilIcon,
|
|
6
|
-
LinkIcon,
|
|
7
5
|
Trash2Icon,
|
|
8
6
|
FlagIcon,
|
|
9
7
|
UserXIcon,
|
|
@@ -11,36 +9,33 @@ import {
|
|
|
11
9
|
PinIcon,
|
|
12
10
|
BookmarkPlusIcon,
|
|
13
11
|
BookmarkMinusIcon,
|
|
12
|
+
Repeat2Icon,
|
|
13
|
+
ThumbsUpIcon,
|
|
14
14
|
} from '../../icons/index';
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
type DropdownMenuRef,
|
|
18
|
-
DropdownMenuContent,
|
|
19
|
-
DropdownMenuGroup,
|
|
20
|
-
DropdownMenuItem,
|
|
21
|
-
DropdownMenuTrigger,
|
|
22
|
-
} from '../../ui/dropdown-menu';
|
|
23
|
-
import { ThemedText } from '../../ui/themed-text';
|
|
24
|
-
import Clipboard from '@react-native-clipboard/clipboard';
|
|
25
|
-
import Toast from 'react-native-toast-message';
|
|
26
|
-
import { BASE_URL } from '../../../lib/constants';
|
|
15
|
+
import { PopupMenu, PopupMenuButton, PopupSeparator } from '../../ui';
|
|
16
|
+
import { useOpenpeeps } from '@openpeepshq/react';
|
|
27
17
|
import {
|
|
28
18
|
checkGroupCapabilities,
|
|
29
|
-
|
|
30
|
-
PublicPost,
|
|
19
|
+
checkPostCapabilities,
|
|
31
20
|
} from '@openpeepshq/common';
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import { BottomSheetModal } from '@gorhom/bottom-sheet';
|
|
35
|
-
import { DeletePostModal } from './modals/DeletePostModal';
|
|
21
|
+
import { checkRoleCapabilities } from '@openpeepshq/common/lib';
|
|
22
|
+
import type { PublicPost } from '@openpeepshq/common/types';
|
|
36
23
|
import { useEditPostModal } from '../post-form/EditPostModalContext';
|
|
37
24
|
import { useTranslation } from 'react-i18next';
|
|
25
|
+
import { BottomSheetModal } from '@gorhom/bottom-sheet';
|
|
26
|
+
import { DeletePostModal } from './modals/DeletePostModal';
|
|
38
27
|
import { ReportProfileOrPostModal } from '../../profile/ReportProfileOrPostModal';
|
|
39
|
-
import {
|
|
40
|
-
|
|
28
|
+
import { RepostModal } from './modals/RepostModal';
|
|
29
|
+
import { ReactionsModal } from './modals/ReactionsModal';
|
|
30
|
+
import { BASE_URL } from '../../../lib/constants';
|
|
31
|
+
import { truncateText } from '../../../lib/utils';
|
|
32
|
+
import Toast from 'react-native-toast-message';
|
|
33
|
+
|
|
34
|
+
export interface PostMenuProps {
|
|
41
35
|
post: PublicPost;
|
|
42
36
|
deleteCallback?: () => void;
|
|
43
37
|
}
|
|
38
|
+
|
|
44
39
|
export const PostMenu = ({ post, deleteCallback }: PostMenuProps) => {
|
|
45
40
|
const { t } = useTranslation();
|
|
46
41
|
const { openpeepsApi, queryClient } = useOpenpeeps();
|
|
@@ -50,11 +45,13 @@ export const PostMenu = ({ post, deleteCallback }: PostMenuProps) => {
|
|
|
50
45
|
const { openEditPost } = useEditPostModal();
|
|
51
46
|
const reportProfileModalRef = useRef<BottomSheetModal>(null);
|
|
52
47
|
const reportPostModalRef = useRef<BottomSheetModal>(null);
|
|
53
|
-
|
|
54
|
-
const bookmarkActionInFlight = useRef(false);
|
|
48
|
+
|
|
55
49
|
const [isBookmarkActionPending, setIsBookmarkActionPending] =
|
|
56
50
|
React.useState(false);
|
|
57
51
|
const [isFollowing, setIsFollowing] = React.useState(false);
|
|
52
|
+
const [repostsModalOpen, setRepostsModalOpen] = React.useState(false);
|
|
53
|
+
const [reactionsModalOpen, setReactionsModalOpen] = React.useState(false);
|
|
54
|
+
|
|
58
55
|
const { data: serverInfo } = openpeepsApi.useServerInfo();
|
|
59
56
|
const canPinToGroup =
|
|
60
57
|
post.group &&
|
|
@@ -63,38 +60,32 @@ export const PostMenu = ({ post, deleteCallback }: PostMenuProps) => {
|
|
|
63
60
|
['core-groups-pin'],
|
|
64
61
|
post.group
|
|
65
62
|
).success;
|
|
66
|
-
const pinnedInGroup
|
|
67
|
-
const pinnedOnProfile
|
|
68
|
-
const canPinGlobally
|
|
69
|
-
(['public', 'local'].includes(post.visibility) &&
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const pinnedGlobally
|
|
63
|
+
const pinnedInGroup = post.group?.pinnedPostId === post.id;
|
|
64
|
+
const pinnedOnProfile = currentProfile?.pinnedPostId === post.id;
|
|
65
|
+
const canPinGlobally = !!(
|
|
66
|
+
(['public', 'local'] as string[]).includes(post.visibility) &&
|
|
67
|
+
currentProfile &&
|
|
68
|
+
checkRoleCapabilities(currentProfile.roles ?? [], ['core-config-update'])
|
|
69
|
+
.success
|
|
70
|
+
);
|
|
71
|
+
const pinnedGlobally =
|
|
75
72
|
serverInfo?.communityConfig?.content?.pinnedPost === post.id;
|
|
76
73
|
const { data: bookmarkedIdsStore, refetch: refetchBookmarkedIds } =
|
|
77
74
|
openpeepsApi.useCurrentProfileBookmarkedIds();
|
|
78
75
|
|
|
79
76
|
const bookmarkPostId = post.repost?.id ?? post.id;
|
|
80
|
-
|
|
81
77
|
const isBookmarked = bookmarkedIdsStore?.includes(bookmarkPostId);
|
|
82
78
|
|
|
83
79
|
const bookmarkPost = openpeepsApi.bookmarkPostAction({ id: bookmarkPostId });
|
|
84
80
|
const unbookmarkPost = openpeepsApi.unbookmarkPostAction({
|
|
85
81
|
id: bookmarkPostId,
|
|
86
82
|
});
|
|
87
|
-
|
|
88
|
-
const deletePost = openpeepsApi.deletePostAction({
|
|
89
|
-
id: post.id,
|
|
90
|
-
});
|
|
91
|
-
|
|
83
|
+
const deletePost = openpeepsApi.deletePostAction({ id: post.id });
|
|
92
84
|
const updateGroup = openpeepsApi.updateGroupAction({
|
|
93
|
-
id: post.group?.id
|
|
85
|
+
id: post.group?.id ?? '',
|
|
94
86
|
});
|
|
95
87
|
const pinGloballyMutation = openpeepsApi.admin.pinPostGloballyAction();
|
|
96
88
|
const pinOnProfileMutation = openpeepsApi.pinPostOnProfileAction();
|
|
97
|
-
|
|
98
89
|
const followProfile = openpeepsApi.followProfileAction({
|
|
99
90
|
id: post.profile.id,
|
|
100
91
|
});
|
|
@@ -115,7 +106,7 @@ export const PostMenu = ({ post, deleteCallback }: PostMenuProps) => {
|
|
|
115
106
|
}, []);
|
|
116
107
|
|
|
117
108
|
const handleDelete = async () => {
|
|
118
|
-
void deletePost().then((res
|
|
109
|
+
void deletePost().then((res) => {
|
|
119
110
|
if (res) {
|
|
120
111
|
Toast.show({
|
|
121
112
|
type: 'success',
|
|
@@ -132,350 +123,334 @@ export const PostMenu = ({ post, deleteCallback }: PostMenuProps) => {
|
|
|
132
123
|
};
|
|
133
124
|
|
|
134
125
|
const handleFollow = async () => {
|
|
135
|
-
const response = await followProfile({
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
});
|
|
146
|
-
await queryClient.invalidateQueries();
|
|
126
|
+
const response = await followProfile({ reblogs: true, notify: true });
|
|
127
|
+
if (response) {
|
|
128
|
+
setIsFollowing(true);
|
|
129
|
+
Toast.show({
|
|
130
|
+
type: 'success',
|
|
131
|
+
text1: t('profile.actions.followedSuccess'),
|
|
132
|
+
});
|
|
133
|
+
} else {
|
|
134
|
+
Toast.show({ type: 'error', text1: t('profile.follow.error') });
|
|
135
|
+
}
|
|
147
136
|
};
|
|
148
137
|
|
|
149
138
|
const handleUnfollow = async () => {
|
|
150
|
-
const response = await unfollowProfile();
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
139
|
+
const response = await unfollowProfile(undefined);
|
|
140
|
+
if (response) {
|
|
141
|
+
setIsFollowing(false);
|
|
142
|
+
Toast.show({
|
|
143
|
+
type: 'success',
|
|
144
|
+
text1: t('profile.actions.unfollowedSuccess'),
|
|
145
|
+
});
|
|
146
|
+
} else {
|
|
147
|
+
Toast.show({ type: 'error', text1: t('profile.follow.error') });
|
|
148
|
+
}
|
|
159
149
|
};
|
|
160
150
|
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
post.group &&
|
|
180
|
-
updateGroup({ ...post.group, pinnedPostId: '' })
|
|
181
|
-
.then(() =>
|
|
182
|
-
Toast.show({
|
|
183
|
-
type: 'success',
|
|
184
|
-
text1: t('posts.unpinInGroup.success'),
|
|
185
|
-
})
|
|
186
|
-
)
|
|
187
|
-
.catch(() =>
|
|
188
|
-
Toast.show({
|
|
189
|
-
type: 'error',
|
|
190
|
-
text1: t('posts.create.error'),
|
|
191
|
-
autoHide: false,
|
|
192
|
-
})
|
|
193
|
-
);
|
|
151
|
+
const handlePinOnProfile = async () => {
|
|
152
|
+
const response = await pinOnProfileMutation({
|
|
153
|
+
postId: pinnedOnProfile ? '' : post.id,
|
|
154
|
+
});
|
|
155
|
+
if (response) {
|
|
156
|
+
Toast.show({
|
|
157
|
+
type: 'success',
|
|
158
|
+
text1: t(
|
|
159
|
+
pinnedOnProfile
|
|
160
|
+
? 'posts.unpinOnProfile.success'
|
|
161
|
+
: 'posts.pinOnProfile.success'
|
|
162
|
+
),
|
|
163
|
+
});
|
|
164
|
+
} else {
|
|
165
|
+
Toast.show({ type: 'error', text1: t('posts.pinOnProfile.error') });
|
|
166
|
+
}
|
|
167
|
+
refetchCurrentProfile();
|
|
168
|
+
};
|
|
194
169
|
|
|
195
170
|
const handlePinGlobally = async () => {
|
|
196
171
|
const response = await pinGloballyMutation({
|
|
197
172
|
postId: pinnedGlobally ? '' : post.id,
|
|
198
173
|
});
|
|
199
|
-
if (response
|
|
174
|
+
if (response) {
|
|
200
175
|
Toast.show({
|
|
201
176
|
type: 'success',
|
|
202
177
|
text1: pinnedGlobally
|
|
203
178
|
? t('posts.unpinGlobally.success')
|
|
204
179
|
: t('posts.pinGlobally.success'),
|
|
205
180
|
});
|
|
181
|
+
} else {
|
|
182
|
+
Toast.show({ type: 'error', text1: t('posts.pinGlobally.error') });
|
|
206
183
|
}
|
|
207
184
|
};
|
|
208
185
|
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
186
|
+
const handlePinInGroup = async () => {
|
|
187
|
+
const response = await updateGroup({
|
|
188
|
+
...post.group!,
|
|
189
|
+
pinnedPostId: post.id,
|
|
190
|
+
});
|
|
191
|
+
if (response) {
|
|
215
192
|
Toast.show({
|
|
216
193
|
type: 'success',
|
|
217
|
-
text1:
|
|
218
|
-
? t('posts.unpinOnProfile.success')
|
|
219
|
-
: t('posts.pinOnProfile.success'),
|
|
194
|
+
text1: t('posts.pinInGroup.success'),
|
|
220
195
|
});
|
|
221
|
-
}
|
|
196
|
+
} else {
|
|
197
|
+
Toast.show({ type: 'error', text1: t('posts.pinInGroup.error') });
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const handleUnpinInGroup = async () => {
|
|
202
|
+
const response = await updateGroup({
|
|
203
|
+
...post.group!,
|
|
204
|
+
pinnedPostId: '',
|
|
205
|
+
});
|
|
206
|
+
if (response) {
|
|
222
207
|
Toast.show({
|
|
223
|
-
type: '
|
|
224
|
-
text1:
|
|
225
|
-
? t('posts.unpinOnProfile.error')
|
|
226
|
-
: t('posts.pinOnProfile.error'),
|
|
227
|
-
autoHide: false,
|
|
208
|
+
type: 'success',
|
|
209
|
+
text1: t('posts.unpinInGroup.success'),
|
|
228
210
|
});
|
|
211
|
+
} else {
|
|
212
|
+
Toast.show({ type: 'error', text1: t('posts.unpinInGroup.error') });
|
|
229
213
|
}
|
|
230
214
|
};
|
|
231
215
|
|
|
232
216
|
const handleBookmarkMenuPress = useCallback(async () => {
|
|
233
|
-
if (
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
bookmarkActionInFlight.current = true;
|
|
217
|
+
if (isBookmarkActionPending) return;
|
|
237
218
|
setIsBookmarkActionPending(true);
|
|
238
219
|
try {
|
|
239
220
|
if (isBookmarked) {
|
|
240
|
-
await unbookmarkPost();
|
|
241
|
-
Toast.show({
|
|
242
|
-
type: 'success',
|
|
243
|
-
text1: t('posts.unbookmark.success'),
|
|
244
|
-
});
|
|
221
|
+
await unbookmarkPost(undefined);
|
|
245
222
|
} else {
|
|
246
|
-
await bookmarkPost();
|
|
247
|
-
Toast.show({
|
|
248
|
-
type: 'success',
|
|
249
|
-
text1: t('posts.bookmark.success'),
|
|
250
|
-
});
|
|
223
|
+
await bookmarkPost(undefined);
|
|
251
224
|
}
|
|
252
225
|
await refetchBookmarkedIds();
|
|
226
|
+
Toast.show({
|
|
227
|
+
type: 'success',
|
|
228
|
+
text1: isBookmarked
|
|
229
|
+
? t('posts.unbookmark.success')
|
|
230
|
+
: t('posts.bookmark.success'),
|
|
231
|
+
});
|
|
232
|
+
} catch {
|
|
233
|
+
Toast.show({
|
|
234
|
+
type: 'error',
|
|
235
|
+
text1: t('posts.bookmark.error'),
|
|
236
|
+
});
|
|
253
237
|
} finally {
|
|
254
|
-
bookmarkActionInFlight.current = false;
|
|
255
238
|
setIsBookmarkActionPending(false);
|
|
256
|
-
dropdownMenuRef.current?.close();
|
|
257
239
|
}
|
|
258
|
-
}, [
|
|
240
|
+
}, [
|
|
241
|
+
isBookmarked,
|
|
242
|
+
bookmarkPost,
|
|
243
|
+
unbookmarkPost,
|
|
244
|
+
refetchBookmarkedIds,
|
|
245
|
+
isBookmarkActionPending,
|
|
246
|
+
t,
|
|
247
|
+
]);
|
|
259
248
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
.includes(post.profile.id);
|
|
249
|
+
const isCurrentProfileFollowing = currentProfile?.following
|
|
250
|
+
.map((p) => p.id)
|
|
251
|
+
.includes(post.profile.id);
|
|
264
252
|
|
|
253
|
+
useEffect(() => {
|
|
265
254
|
setIsFollowing(isCurrentProfileFollowing || false);
|
|
266
255
|
refetchBookmarkedIds();
|
|
267
256
|
}, [currentProfile, post, refetchBookmarkedIds]);
|
|
268
257
|
|
|
269
258
|
return (
|
|
270
259
|
<View key={post.id}>
|
|
271
|
-
<
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
260
|
+
<PopupMenu
|
|
261
|
+
title={t('posts.menu.title', { defaultValue: 'Post menu' })}
|
|
262
|
+
className="h-max rounded-lg p-2"
|
|
263
|
+
>
|
|
264
|
+
{currentProfile?.id !== post.profile.id ? (
|
|
265
|
+
isFollowing ? (
|
|
266
|
+
<PopupMenuButton
|
|
267
|
+
title={t('profile.actions.unfollow', {
|
|
268
|
+
defaultValue: 'Unfollow',
|
|
269
|
+
})}
|
|
270
|
+
text={t('profile.actions.unfollow', { defaultValue: 'Unfollow' })}
|
|
271
|
+
icon={UserXIcon}
|
|
272
|
+
action={handleUnfollow}
|
|
273
|
+
/>
|
|
274
|
+
) : (
|
|
275
|
+
<PopupMenuButton
|
|
276
|
+
title={t('profile.actions.follow', { defaultValue: 'Follow' })}
|
|
277
|
+
text={t('profile.actions.follow', { defaultValue: 'Follow' })}
|
|
278
|
+
icon={UsersPlusIcon}
|
|
279
|
+
action={handleFollow}
|
|
280
|
+
/>
|
|
281
|
+
)
|
|
282
|
+
) : null}
|
|
283
|
+
|
|
284
|
+
<PopupMenuButton
|
|
285
|
+
title={t('posts.menu.reposts', { defaultValue: 'Reposts' })}
|
|
286
|
+
text={t('posts.menu.reposts', { defaultValue: 'Reposts' })}
|
|
287
|
+
icon={Repeat2Icon}
|
|
288
|
+
action={() => setRepostsModalOpen(true)}
|
|
289
|
+
/>
|
|
290
|
+
<PopupMenuButton
|
|
291
|
+
title={t('posts.menu.reactions', { defaultValue: 'Reactions' })}
|
|
292
|
+
text={t('posts.menu.reactions', { defaultValue: 'Reactions' })}
|
|
293
|
+
icon={ThumbsUpIcon}
|
|
294
|
+
action={() => setReactionsModalOpen(true)}
|
|
295
|
+
/>
|
|
296
|
+
|
|
297
|
+
{isBookmarked ? (
|
|
298
|
+
<PopupMenuButton
|
|
299
|
+
title={t('posts.unbookmark.title', {
|
|
300
|
+
defaultValue: 'Remove bookmark',
|
|
301
|
+
})}
|
|
302
|
+
text={t('posts.unbookmark.title', {
|
|
303
|
+
defaultValue: 'Remove bookmark',
|
|
304
|
+
})}
|
|
305
|
+
icon={BookmarkMinusIcon}
|
|
306
|
+
action={handleBookmarkMenuPress}
|
|
307
|
+
closeOnPress={false}
|
|
308
|
+
disabled={isBookmarkActionPending}
|
|
309
|
+
/>
|
|
310
|
+
) : (
|
|
311
|
+
<PopupMenuButton
|
|
312
|
+
title={t('posts.bookmark.title', { defaultValue: 'Bookmark' })}
|
|
313
|
+
text={t('posts.bookmark.title', { defaultValue: 'Bookmark' })}
|
|
314
|
+
icon={BookmarkPlusIcon}
|
|
315
|
+
action={handleBookmarkMenuPress}
|
|
316
|
+
closeOnPress={false}
|
|
317
|
+
disabled={isBookmarkActionPending}
|
|
318
|
+
/>
|
|
319
|
+
)}
|
|
320
|
+
|
|
321
|
+
{currentProfile?.id === post.profile.id && !post.repost ? (
|
|
322
|
+
<>
|
|
323
|
+
<PopupSeparator />
|
|
324
|
+
<PopupMenuButton
|
|
325
|
+
title={
|
|
326
|
+
pinnedOnProfile
|
|
327
|
+
? t('posts.unpinOnProfile.title', {
|
|
328
|
+
defaultValue: 'Unpin from profile',
|
|
329
|
+
})
|
|
330
|
+
: t('posts.pinOnProfile.title', {
|
|
331
|
+
defaultValue: 'Pin to profile',
|
|
332
|
+
})
|
|
333
|
+
}
|
|
334
|
+
text={
|
|
335
|
+
pinnedOnProfile
|
|
336
|
+
? t('posts.unpinOnProfile.title', {
|
|
337
|
+
defaultValue: 'Unpin from profile',
|
|
338
|
+
})
|
|
339
|
+
: t('posts.pinOnProfile.title', {
|
|
340
|
+
defaultValue: 'Pin to profile',
|
|
341
|
+
})
|
|
342
|
+
}
|
|
343
|
+
icon={PinIcon}
|
|
344
|
+
action={handlePinOnProfile}
|
|
345
|
+
/>
|
|
346
|
+
<PopupMenuButton
|
|
347
|
+
title={t('common.actions.edit', { defaultValue: 'Edit' })}
|
|
348
|
+
text={t('common.actions.edit', { defaultValue: 'Edit' })}
|
|
349
|
+
icon={PencilIcon}
|
|
350
|
+
action={() => openEditPost(post)}
|
|
351
|
+
/>
|
|
352
|
+
</>
|
|
353
|
+
) : null}
|
|
301
354
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
355
|
+
{canPinGlobally ? (
|
|
356
|
+
<PopupMenuButton
|
|
357
|
+
title={
|
|
358
|
+
pinnedGlobally
|
|
359
|
+
? t('posts.unpinGlobally.title', {
|
|
360
|
+
defaultValue: 'Unpin globally',
|
|
361
|
+
})
|
|
362
|
+
: t('posts.pinGlobally.title', { defaultValue: 'Pin globally' })
|
|
363
|
+
}
|
|
364
|
+
text={
|
|
365
|
+
pinnedGlobally
|
|
366
|
+
? t('posts.unpinGlobally.title', {
|
|
367
|
+
defaultValue: 'Unpin globally',
|
|
368
|
+
})
|
|
369
|
+
: t('posts.pinGlobally.title', { defaultValue: 'Pin globally' })
|
|
370
|
+
}
|
|
371
|
+
icon={PinIcon}
|
|
372
|
+
action={handlePinGlobally}
|
|
373
|
+
/>
|
|
374
|
+
) : null}
|
|
314
375
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
className=" flex-row gap-x-2 items-center text-destructive"
|
|
394
|
-
>
|
|
395
|
-
<FlagIcon size={16} className="text-destructive" />
|
|
396
|
-
<ThemedText className="text-destructive">
|
|
397
|
-
{t('common.actions.reportPost')}
|
|
398
|
-
</ThemedText>
|
|
399
|
-
</DropdownMenuItem>
|
|
400
|
-
<DropdownMenuItem
|
|
401
|
-
onPress={handleReportProfileModalPress}
|
|
402
|
-
className=" flex-row gap-x-2 items-center text-destructive"
|
|
403
|
-
>
|
|
404
|
-
<FlagIcon size={16} className="text-destructive" />
|
|
405
|
-
<ThemedText className="text-destructive">
|
|
406
|
-
{t('common.actions.reportProfile', {
|
|
407
|
-
handle: post.profile.handle,
|
|
408
|
-
})}
|
|
409
|
-
</ThemedText>
|
|
410
|
-
</DropdownMenuItem>
|
|
411
|
-
</>
|
|
412
|
-
)}
|
|
413
|
-
{canPinGlobally && (
|
|
414
|
-
<DropdownMenuItem
|
|
415
|
-
onPress={handlePinGlobally}
|
|
416
|
-
className=" flex-row gap-x-2 items-center text-destructive"
|
|
417
|
-
>
|
|
418
|
-
<PinIcon size={16} className="text-destructive" />
|
|
419
|
-
<ThemedText className="text-destructive">
|
|
420
|
-
{pinnedGlobally
|
|
421
|
-
? t('posts.unpinGlobally.title')
|
|
422
|
-
: t('posts.pinGlobally.title')}
|
|
423
|
-
</ThemedText>
|
|
424
|
-
</DropdownMenuItem>
|
|
425
|
-
)}
|
|
426
|
-
{canPinToGroup && (
|
|
427
|
-
<>
|
|
428
|
-
{pinnedInGroup ? (
|
|
429
|
-
<DropdownMenuItem
|
|
430
|
-
onPress={handleUnpinInGroup}
|
|
431
|
-
className=" flex-row gap-x-2 items-center"
|
|
432
|
-
>
|
|
433
|
-
<PinIcon size={16} className="text-foreground" />
|
|
434
|
-
<ThemedText>{t('posts.unpinInGroup.title')}</ThemedText>
|
|
435
|
-
</DropdownMenuItem>
|
|
436
|
-
) : (
|
|
437
|
-
<DropdownMenuItem
|
|
438
|
-
onPress={handlePinInGroup}
|
|
439
|
-
className=" flex-row gap-x-2 items-center"
|
|
440
|
-
>
|
|
441
|
-
<PinIcon size={16} className="text-foreground" />
|
|
442
|
-
<ThemedText>{t('posts.pinInGroup.title')}</ThemedText>
|
|
443
|
-
</DropdownMenuItem>
|
|
444
|
-
)}
|
|
445
|
-
</>
|
|
446
|
-
)}
|
|
447
|
-
{isBookmarked ? (
|
|
448
|
-
<DropdownMenuItem
|
|
449
|
-
closeOnPress={false}
|
|
450
|
-
disabled={isBookmarkActionPending}
|
|
451
|
-
onPress={handleBookmarkMenuPress}
|
|
452
|
-
className=" flex-row gap-x-2 items-center"
|
|
453
|
-
>
|
|
454
|
-
{isBookmarkActionPending ? (
|
|
455
|
-
<ActivityIndicator size="small" />
|
|
456
|
-
) : (
|
|
457
|
-
<BookmarkMinusIcon size={16} className="text-foreground" />
|
|
458
|
-
)}
|
|
459
|
-
<ThemedText>{t('posts.unbookmark.title')}</ThemedText>
|
|
460
|
-
</DropdownMenuItem>
|
|
461
|
-
) : (
|
|
462
|
-
<DropdownMenuItem
|
|
463
|
-
closeOnPress={false}
|
|
464
|
-
disabled={isBookmarkActionPending}
|
|
465
|
-
onPress={handleBookmarkMenuPress}
|
|
466
|
-
className=" flex-row gap-x-2 items-center"
|
|
467
|
-
>
|
|
468
|
-
{isBookmarkActionPending ? (
|
|
469
|
-
<ActivityIndicator size="small" />
|
|
470
|
-
) : (
|
|
471
|
-
<BookmarkPlusIcon size={16} className="text-foreground" />
|
|
472
|
-
)}
|
|
473
|
-
<ThemedText>{t('posts.bookmark.title')}</ThemedText>
|
|
474
|
-
</DropdownMenuItem>
|
|
475
|
-
)}
|
|
476
|
-
</DropdownMenuGroup>
|
|
477
|
-
</DropdownMenuContent>
|
|
478
|
-
</DropdownMenu>
|
|
376
|
+
{canPinToGroup && post.group ? (
|
|
377
|
+
pinnedInGroup ? (
|
|
378
|
+
<PopupMenuButton
|
|
379
|
+
title={t('posts.unpinInGroup.title', {
|
|
380
|
+
defaultValue: 'Unpin in group',
|
|
381
|
+
})}
|
|
382
|
+
text={t('posts.unpinInGroup.title', {
|
|
383
|
+
defaultValue: 'Unpin in group',
|
|
384
|
+
})}
|
|
385
|
+
icon={PinIcon}
|
|
386
|
+
action={handleUnpinInGroup}
|
|
387
|
+
/>
|
|
388
|
+
) : (
|
|
389
|
+
<PopupMenuButton
|
|
390
|
+
title={t('posts.pinInGroup.title', {
|
|
391
|
+
defaultValue: 'Pin in group',
|
|
392
|
+
})}
|
|
393
|
+
text={t('posts.pinInGroup.title', {
|
|
394
|
+
defaultValue: 'Pin in group',
|
|
395
|
+
})}
|
|
396
|
+
icon={PinIcon}
|
|
397
|
+
action={handlePinInGroup}
|
|
398
|
+
/>
|
|
399
|
+
)
|
|
400
|
+
) : null}
|
|
401
|
+
|
|
402
|
+
{currentProfile?.id === post.profile.id ? (
|
|
403
|
+
<PopupMenuButton
|
|
404
|
+
title={t('common.actions.delete', { defaultValue: 'Delete' })}
|
|
405
|
+
text={t('common.actions.delete', { defaultValue: 'Delete' })}
|
|
406
|
+
icon={Trash2Icon}
|
|
407
|
+
danger
|
|
408
|
+
action={handleDeletePostModalPress}
|
|
409
|
+
/>
|
|
410
|
+
) : null}
|
|
411
|
+
|
|
412
|
+
{currentProfile?.id !== post.profile.id ? (
|
|
413
|
+
<>
|
|
414
|
+
<PopupSeparator />
|
|
415
|
+
<PopupMenuButton
|
|
416
|
+
title={t('common.actions.reportPost', {
|
|
417
|
+
defaultValue: 'Report post',
|
|
418
|
+
})}
|
|
419
|
+
text={t('common.actions.reportPost', {
|
|
420
|
+
defaultValue: 'Report post',
|
|
421
|
+
})}
|
|
422
|
+
icon={FlagIcon}
|
|
423
|
+
danger
|
|
424
|
+
action={handleReportPostModalPress}
|
|
425
|
+
/>
|
|
426
|
+
<PopupMenuButton
|
|
427
|
+
title={t('common.actions.reportProfile', {
|
|
428
|
+
defaultValue: 'Report @{{handle}}',
|
|
429
|
+
handle: post.profile.handle,
|
|
430
|
+
})}
|
|
431
|
+
text={t('common.actions.reportProfile', {
|
|
432
|
+
defaultValue: 'Report @{{handle}}',
|
|
433
|
+
handle: post.profile.handle,
|
|
434
|
+
})}
|
|
435
|
+
icon={FlagIcon}
|
|
436
|
+
danger
|
|
437
|
+
action={handleReportProfileModalPress}
|
|
438
|
+
/>
|
|
439
|
+
</>
|
|
440
|
+
) : null}
|
|
441
|
+
</PopupMenu>
|
|
442
|
+
|
|
443
|
+
<RepostModal
|
|
444
|
+
reposts={post.reposts ?? []}
|
|
445
|
+
repostCount={post.repostCount ?? 0}
|
|
446
|
+
open={repostsModalOpen}
|
|
447
|
+
onClose={() => setRepostsModalOpen(false)}
|
|
448
|
+
/>
|
|
449
|
+
<ReactionsModal
|
|
450
|
+
reactions={post.reactions ?? []}
|
|
451
|
+
open={reactionsModalOpen}
|
|
452
|
+
onClose={() => setReactionsModalOpen(false)}
|
|
453
|
+
/>
|
|
479
454
|
<DeletePostModal
|
|
480
455
|
ref={deleteMessageModalRef}
|
|
481
456
|
onDelete={handleDelete}
|