@openpeepshq/rn-components 0.12.4 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/rn-components",
3
- "version": "0.12.4",
3
+ "version": "0.13.0",
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",
@@ -142,8 +142,8 @@
142
142
  "timezones-list": "^3.1.0",
143
143
  "validator": "^13.15.23",
144
144
  "zustand": "^5.0.3",
145
- "@openpeepshq/common": "^0.6.2",
146
- "@openpeepshq/react": "^0.11.1"
145
+ "@openpeepshq/common": "^0.7.0",
146
+ "@openpeepshq/react": "^0.13.0"
147
147
  },
148
148
  "devDependencies": {
149
149
  "@babel/core": "^7.26.7",
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Unit tests for the ImagePickerSheet error paths (#1789).
3
+ *
4
+ * The sheet is the single gate for image picks: every library/camera pick
5
+ * must go through the cropper, a crop failure must upload nothing and show
6
+ * the form.imageInput.cropError toast (the sheet closes so the retry
7
+ * surface is clean), and a cancel must be silent.
8
+ */
9
+
10
+ const React = require('react');
11
+ const ReactTestRenderer = require('react-test-renderer');
12
+
13
+ let mockTranslations: Record<string, string> = {};
14
+
15
+ const toastShow = jest.fn();
16
+ jest.mock('react-native-toast-message', () => ({
17
+ __esModule: true,
18
+ default: { show: (options: unknown) => toastShow(options) },
19
+ }));
20
+
21
+ jest.mock('react-native', () => ({
22
+ View: (props: { children?: unknown }) =>
23
+ React.createElement('View', null, props.children),
24
+ Text: (props: { children?: unknown }) =>
25
+ React.createElement('Text', null, props.children),
26
+ ActivityIndicator: () => React.createElement('ActivityIndicator'),
27
+ Platform: { OS: 'android' },
28
+ }));
29
+
30
+ jest.mock('react-i18next', () => ({
31
+ useTranslation: () => ({
32
+ t: (key: string) => mockTranslations[key] ?? key,
33
+ }),
34
+ }));
35
+
36
+ jest.mock('@openpeepshq/react', () => ({
37
+ useOpenpeeps: () => ({
38
+ openpeepsApi: {
39
+ createMediaAttachmentAction: () => jest.fn(),
40
+ },
41
+ }),
42
+ }));
43
+
44
+ jest.mock('../../../../theme/OpenPeepsThemeProvider', () => ({
45
+ useOpenPeepsTheme: () => ({
46
+ colors: { background: '#fff', foreground: '#000' },
47
+ isDark: false,
48
+ }),
49
+ }));
50
+
51
+ jest.mock('react-native-image-crop-picker', () => ({
52
+ __esModule: true,
53
+ default: {
54
+ openCropper: jest.fn(),
55
+ openCamera: jest.fn(),
56
+ openPicker: jest.fn(),
57
+ },
58
+ }));
59
+
60
+ jest.mock('react-native-image-picker', () => ({
61
+ launchCamera: jest.fn(),
62
+ launchImageLibrary: jest.fn(),
63
+ }));
64
+
65
+ jest.mock('../../../../lib/uploadMedia', () => ({
66
+ uploadMedia: jest.fn(),
67
+ }));
68
+
69
+ jest.mock('../../../../lib/bottom-sheet-ref', () => ({
70
+ bottomSheetClose: jest.fn(),
71
+ }));
72
+
73
+ jest.mock('../../../../lib/mediaUriHelpers', () => ({
74
+ dismissSheetForNativeModal: jest.fn(async () => {}),
75
+ isPickerCancelled: (error: unknown): boolean =>
76
+ (error as { code?: string })?.code === 'E_PICKER_CANCELLED',
77
+ toCropperPath: jest.fn(async (uri: string) => uri),
78
+ }));
79
+
80
+ jest.mock('../common', () => ({
81
+ BaseSheet: (props: { children?: unknown }) =>
82
+ React.createElement('BaseSheet', null, props.children),
83
+ }));
84
+
85
+ jest.mock('../../../ui/button', () => ({
86
+ Button: (props: {
87
+ children?: unknown;
88
+ onPress?: () => void;
89
+ disabled?: boolean;
90
+ }) =>
91
+ React.createElement(
92
+ 'Button',
93
+ { onPress: props.onPress, disabled: props.disabled },
94
+ props.children
95
+ ),
96
+ }));
97
+
98
+ jest.mock('../../../icons/index', () => ({
99
+ CameraIcon: () => React.createElement('CameraIcon'),
100
+ ImageIcon: () => React.createElement('ImageIcon'),
101
+ }));
102
+
103
+ import { ImagePickerSheet } from './image-picker-sheet';
104
+
105
+ const openCropper = require('react-native-image-crop-picker').default
106
+ .openCropper;
107
+ const launchImageLibrary =
108
+ require('react-native-image-picker').launchImageLibrary;
109
+ const uploadMedia = require('../../../../lib/uploadMedia').uploadMedia;
110
+ const bottomSheetClose =
111
+ require('../../../../lib/bottom-sheet-ref').bottomSheetClose;
112
+
113
+ const renderSheet = (onSelect: (attachments: unknown[]) => void) => {
114
+ let tree!: ReturnType<typeof ReactTestRenderer.create>;
115
+ ReactTestRenderer.act(() => {
116
+ tree = ReactTestRenderer.create(
117
+ React.createElement(ImagePickerSheet, {
118
+ ref: { current: null },
119
+ onSelect,
120
+ })
121
+ );
122
+ });
123
+ return tree;
124
+ };
125
+
126
+ // The Library button is the second outline Button in the sheet. Drain the
127
+ // pick promise chain inside act so the sheet's state updates stay wrapped.
128
+ const pressLibrary = async (
129
+ tree: ReturnType<typeof ReactTestRenderer.create>
130
+ ) => {
131
+ const buttons = tree.root.findAll(
132
+ (node) =>
133
+ typeof node.type === 'string' &&
134
+ node.type === 'Button' &&
135
+ !node.props.disabled
136
+ );
137
+ await ReactTestRenderer.act(async () => {
138
+ buttons[buttons.length - 1].props.onPress();
139
+ for (let i = 0; i < 15; i++) {
140
+ await Promise.resolve();
141
+ }
142
+ });
143
+ };
144
+
145
+ describe('ImagePickerSheet error paths', () => {
146
+ beforeEach(() => {
147
+ mockTranslations = { 'form.imageInput.cropError': 'Crop failed' };
148
+ toastShow.mockClear();
149
+ uploadMedia.mockClear();
150
+ bottomSheetClose.mockClear();
151
+ openCropper.mockReset();
152
+ launchImageLibrary.mockReset();
153
+ });
154
+
155
+ it('uploads nothing, toasts, and closes the sheet on a crop failure', async () => {
156
+ launchImageLibrary.mockResolvedValue({
157
+ didCancel: false,
158
+ assets: [{ uri: 'file:///tmp/pick.jpg' }],
159
+ });
160
+ openCropper.mockRejectedValue(new Error('cropper blew up'));
161
+
162
+ const tree = renderSheet(jest.fn());
163
+ await pressLibrary(tree);
164
+
165
+ expect(uploadMedia).not.toHaveBeenCalled();
166
+ expect(toastShow).toHaveBeenCalledWith(
167
+ expect.objectContaining({ text1: 'Crop failed' })
168
+ );
169
+ expect(bottomSheetClose).toHaveBeenCalled();
170
+ });
171
+
172
+ it('stays silent on a cancelled pick', async () => {
173
+ launchImageLibrary.mockResolvedValue({ didCancel: true, assets: [] });
174
+
175
+ const tree = renderSheet(jest.fn());
176
+ await pressLibrary(tree);
177
+
178
+ expect(toastShow).not.toHaveBeenCalled();
179
+ expect(openCropper).not.toHaveBeenCalled();
180
+ expect(uploadMedia).not.toHaveBeenCalled();
181
+ });
182
+
183
+ it('resolves exactly one asset and uploads exactly one attachment', async () => {
184
+ launchImageLibrary.mockResolvedValue({
185
+ didCancel: false,
186
+ assets: [{ uri: 'file:///tmp/pick.jpg' }],
187
+ });
188
+ openCropper.mockResolvedValue({ path: '/tmp/cropped.jpg' });
189
+ uploadMedia.mockResolvedValue({ id: 'att-1', type: 'image' });
190
+ const onSelect = jest.fn();
191
+
192
+ const tree = renderSheet(onSelect);
193
+ await pressLibrary(tree);
194
+
195
+ expect(uploadMedia).toHaveBeenCalledTimes(1);
196
+ expect(onSelect).toHaveBeenCalledWith([{ id: 'att-1', type: 'image' }]);
197
+ expect(launchImageLibrary).toHaveBeenCalledWith(
198
+ expect.objectContaining({ selectionLimit: 1 })
199
+ );
200
+ });
201
+ });
@@ -38,6 +38,14 @@ export const ImagePickerSheet = forwardRef<
38
38
  const createAttachment = openpeepsApi.createMediaAttachmentAction();
39
39
  const { colors, isDark } = useOpenPeepsTheme();
40
40
 
41
+ const onCropError = (error: unknown) => {
42
+ // Never bypass the cropper with an uncropped fallback upload.
43
+ console.error('Image crop failed:', error);
44
+ Toast.show({ type: 'error', text1: t('form.imageInput.cropError') });
45
+ // Retry surface: leave nothing interactive on top of the form (#1789).
46
+ bottomSheetClose(ref);
47
+ };
48
+
41
49
  const cropImage = async (uri: string) => {
42
50
  const path = await toCropperPath(uri);
43
51
  return ImagePicker.openCropper(
@@ -99,35 +107,35 @@ export const ImagePickerSheet = forwardRef<
99
107
  } catch (error) {
100
108
  if (!isPickerCancelled(error)) {
101
109
  console.error('iOS library pick failed:', error);
110
+ onCropError(error);
102
111
  }
103
112
  }
104
113
  return;
105
114
  }
106
115
 
116
+ // Single pick (parity with web, #1789) so the cropper can be shown for
117
+ // every image, including gallery resources.
107
118
  const result = await launchImageLibrary({
108
119
  mediaType: 'photo',
109
- selectionLimit: 0,
120
+ selectionLimit: 1,
110
121
  quality: 1,
111
122
  });
112
123
  if (result.didCancel || !result.assets?.length) {
113
124
  return;
114
125
  }
115
- const uris = result.assets
116
- .map((asset) => asset.uri)
117
- .filter((uri): uri is string => Boolean(uri));
118
- if (uris.length === 1) {
119
- try {
120
- const cropped = await cropImage(uris[0]);
121
- await finalize([cropped.path]);
122
- } catch (error) {
123
- if (isPickerCancelled(error)) {
124
- return;
125
- }
126
- await finalize(uris);
127
- }
126
+ const uri = result.assets[0]?.uri;
127
+ if (!uri) {
128
128
  return;
129
129
  }
130
- await finalize(uris);
130
+ try {
131
+ const cropped = await cropImage(uri);
132
+ await finalize([cropped.path]);
133
+ } catch (error) {
134
+ if (isPickerCancelled(error)) {
135
+ return;
136
+ }
137
+ onCropError(error);
138
+ }
131
139
  };
132
140
 
133
141
  const handleCamera = async () => {
@@ -145,7 +153,9 @@ export const ImagePickerSheet = forwardRef<
145
153
  }
146
154
  const result = await launchCamera({ mediaType: 'photo', quality: 1 });
147
155
  if (result.errorCode) {
148
- Toast.show({ type: 'error', text1: t('form.imageInput.camera.error') });
156
+ // No dedicated camera key exists; reuse the cropError copy so the
157
+ // toast resolves instead of rendering a missing key (i18n scan, #1789).
158
+ Toast.show({ type: 'error', text1: t('form.imageInput.cropError') });
149
159
  return;
150
160
  }
151
161
  const uri = result.assets?.[0]?.uri;
@@ -159,7 +169,7 @@ export const ImagePickerSheet = forwardRef<
159
169
  if (isPickerCancelled(error)) {
160
170
  return;
161
171
  }
162
- await finalize([uri]);
172
+ onCropError(error);
163
173
  }
164
174
  } catch (error) {
165
175
  if (!isPickerCancelled(error)) {
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Regression tests for the GroupMembersList row geometry (issue #1666).
3
+ *
4
+ * The member row must mirror the web list's geometry: a 48 dp avatar slot
5
+ * (`size-12`, matching web's `Avatar size={3}`) and the standard `p-4` row
6
+ * padding. A previous pass shrank the avatar to `size-10` and cut the row
7
+ * padding to `py-2 pl-4 pr-1`, which moved the avatar away from web parity
8
+ * and shrank the dropdown-menu trigger's hit target.
9
+ */
10
+
11
+ const React = require('react');
12
+ const ReactTestRenderer = require('react-test-renderer');
13
+
14
+ jest.mock('react-native', () => ({
15
+ View: (props: { children?: unknown }) =>
16
+ React.createElement('View', props, props.children),
17
+ Pressable: (props: { children?: unknown }) =>
18
+ React.createElement('Pressable', props, props.children),
19
+ ActivityIndicator: () => null,
20
+ TextInput: () => null,
21
+ }));
22
+
23
+ jest.mock('react-i18next', () => ({
24
+ useTranslation: () => ({ t: (key: string) => key }),
25
+ }));
26
+
27
+ jest.mock('@react-navigation/native', () => ({
28
+ useNavigation: () => ({ navigate: jest.fn() }),
29
+ }));
30
+
31
+ jest.mock('@openpeepshq/common/lib', () => ({
32
+ // Mirrored from platform/common/src/lib — the built package ships ESM
33
+ // which Jest's node transform doesn't cover.
34
+ canChangeMemberRole: () => false,
35
+ canRemoveMember: () => false,
36
+ matchesQuery: () => true,
37
+ sortGroupMembers: (members: unknown) => members,
38
+ truncateText: (text: string) => text,
39
+ }));
40
+
41
+ jest.mock('@openpeepshq/react', () => ({
42
+ useCurrentProfile: () => null,
43
+ useOpenpeeps: () => ({
44
+ openpeepsApi: {
45
+ useGroupMembers: () => ({ data: MEMBERS, isLoading: false }),
46
+ },
47
+ }),
48
+ }));
49
+
50
+ jest.mock('../conversations/CreateNewConversationContext', () => ({
51
+ useCreateNewConversation: () => ({ openCreateConversation: jest.fn() }),
52
+ }));
53
+
54
+ jest.mock('../icons/index', () => ({
55
+ MessageSquareTextIcon: () => React.createElement('Icon'),
56
+ MoreHorizontalIcon: () => React.createElement('Icon'),
57
+ UserCogIcon: () => React.createElement('Icon'),
58
+ UserMinusIcon: () => React.createElement('Icon'),
59
+ }));
60
+
61
+ jest.mock('../profile/Avatar', () => ({
62
+ ProfileAvatar: (props: Record<string, unknown>) =>
63
+ React.createElement('ProfileAvatar', props),
64
+ }));
65
+
66
+ jest.mock('../ui/dropdown-menu', () => ({
67
+ DropdownMenu: (props: { children?: unknown }) =>
68
+ React.createElement('DropdownMenu', null, props.children),
69
+ DropdownMenuContent: (props: { children?: unknown }) =>
70
+ React.createElement('DropdownMenuContent', null, props.children),
71
+ DropdownMenuGroup: (props: { children?: unknown }) =>
72
+ React.createElement('DropdownMenuGroup', null, props.children),
73
+ DropdownMenuItem: (props: { children?: unknown }) =>
74
+ React.createElement('DropdownMenuItem', null, props.children),
75
+ DropdownMenuTrigger: (props: { children?: unknown }) =>
76
+ React.createElement('DropdownMenuTrigger', null, props.children),
77
+ }));
78
+
79
+ jest.mock('../ui/input', () => ({ Input: () => null }));
80
+
81
+ jest.mock('../ui/themed-text', () => ({
82
+ ThemedText: (props: Record<string, unknown>) =>
83
+ React.createElement('ThemedText', props, props.children),
84
+ }));
85
+
86
+ jest.mock('../../theme/useThemeOpacity', () => ({
87
+ useThemeOpacity: () => ({
88
+ themeOpacity: 1,
89
+ setThemeOpacity: jest.fn(),
90
+ }),
91
+ }));
92
+
93
+ jest.mock('./ChangeGroupRolesModal', () => ({
94
+ ChangeGroupRolesModal: () => null,
95
+ }));
96
+
97
+ jest.mock('./ConfirmMemberRemovalModal', () => ({
98
+ ConfirmMemberRemovalModal: () => null,
99
+ }));
100
+
101
+ import type { GroupMembersListProps } from './GroupMembersList';
102
+ import { GroupMembersList } from './GroupMembersList';
103
+
104
+ const MEMBERS = [
105
+ {
106
+ profile: {
107
+ id: 'p1',
108
+ handle: 'ada.example',
109
+ displayName: 'Ada Lovelace',
110
+ },
111
+ roles: [],
112
+ },
113
+ ];
114
+
115
+ const group = {
116
+ id: 'g1',
117
+ name: 'Test Group',
118
+ } as unknown as GroupMembersListProps['group'];
119
+
120
+ const renderList = () => {
121
+ let tree: ReturnType<typeof ReactTestRenderer.create>;
122
+ ReactTestRenderer.act(() => {
123
+ tree = ReactTestRenderer.create(
124
+ React.createElement(GroupMembersList, { group })
125
+ );
126
+ });
127
+ return tree;
128
+ };
129
+
130
+ describe('GroupMembersList row geometry (issue #1666)', () => {
131
+ it('renders the member avatar at web parity (size-12 = 48 dp, web Avatar size={3})', () => {
132
+ const tree = renderList();
133
+ const avatar = tree.root
134
+ .findAllByType('ProfileAvatar')
135
+ .find(
136
+ (node: { props: { className?: string } }) =>
137
+ typeof node.props.className === 'string'
138
+ );
139
+ expect(avatar).toBeDefined();
140
+ expect(avatar.props.className).toContain('size-12');
141
+ });
142
+
143
+ it('keeps the standard p-4 row padding so the menu trigger keeps its hit target', () => {
144
+ const tree = renderList();
145
+ const rows = tree.root
146
+ .findAllByType('View')
147
+ .filter(
148
+ (node: { props: { className?: string } }) =>
149
+ typeof node.props.className === 'string' &&
150
+ node.props.className.includes('border-b')
151
+ );
152
+ expect(rows.length).toBe(1);
153
+ expect(rows[0].props.className).toContain('p-4');
154
+ expect(rows[0].props.className).not.toContain('pr-1');
155
+ });
156
+ });
@@ -57,6 +57,7 @@ import {
57
57
  VolumeOff,
58
58
  Share,
59
59
  Hand,
60
+ History,
60
61
  Copy,
61
62
  Clock,
62
63
  Pencil,
@@ -206,6 +207,7 @@ export const VolumeOffIcon = iconWithClassName(VolumeOff);
206
207
  export const InfoIcon = iconWithClassName(Info);
207
208
  export const ShareIcon = iconWithClassName(Share);
208
209
  export const HandIcon = iconWithClassName(Hand);
210
+ export const HistoryIcon = iconWithClassName(History);
209
211
  export const CopyIcon = iconWithClassName(Copy);
210
212
  export const ClockIcon = iconWithClassName(Clock);
211
213
  export const PencilIcon = iconWithClassName(Pencil);
@@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next';
6
6
  import type { ExpandedOccurrence } from '@openpeepshq/common/lib';
7
7
  import {
8
8
  countYesRsvps,
9
+ eventTimeZoneOptions,
9
10
  isCapacityEvent,
10
11
  sameRecurrenceId,
11
12
  } from '@openpeepshq/common/lib';
@@ -20,9 +21,11 @@ export interface EventOccurrenceListProps {
20
21
  occurrences: ExpandedOccurrence[];
21
22
  currentOccurrenceId?: string;
22
23
  recurrenceLabel: string;
24
+ /** IANA zone the occurrence timestamps render in. */
25
+ timeZone?: string;
23
26
  }
24
27
 
25
- const formatOccurrenceStart = (start: string) =>
28
+ const formatOccurrenceStart = (start: string, timeZone?: string) =>
26
29
  new Date(start).toLocaleString(undefined, {
27
30
  weekday: 'short',
28
31
  month: 'short',
@@ -30,6 +33,7 @@ const formatOccurrenceStart = (start: string) =>
30
33
  year: 'numeric',
31
34
  hour: '2-digit',
32
35
  minute: '2-digit',
36
+ ...eventTimeZoneOptions(timeZone),
33
37
  });
34
38
 
35
39
  export const EventOccurrenceList: React.FC<EventOccurrenceListProps> = ({
@@ -38,6 +42,7 @@ export const EventOccurrenceList: React.FC<EventOccurrenceListProps> = ({
38
42
  occurrences,
39
43
  currentOccurrenceId,
40
44
  recurrenceLabel,
45
+ timeZone,
41
46
  }) => {
42
47
  const { t } = useTranslation();
43
48
  const event = post.data?.type === 'event' ? post.data : undefined;
@@ -100,7 +105,7 @@ export const EventOccurrenceList: React.FC<EventOccurrenceListProps> = ({
100
105
  occurrence.recurrenceId,
101
106
  currentOccurrenceId
102
107
  );
103
- const label = formatOccurrenceStart(occurrence.start);
108
+ const label = formatOccurrenceStart(occurrence.start, timeZone);
104
109
  const capacity =
105
110
  showCapacity && event?.maxAttendees !== undefined
106
111
  ? ` ${t('events.occurrence.capacity', {
@@ -11,11 +11,15 @@ import {
11
11
  BookmarkMinusIcon,
12
12
  Repeat2Icon,
13
13
  ThumbsUpIcon,
14
+ HistoryIcon,
14
15
  } from '../../icons/index';
15
16
  import { PopupMenu, PopupMenuButton, PopupSeparator } from '../../ui';
16
17
  import { useOpenpeeps } from '@openpeepshq/react';
17
18
  import { checkGroupCapabilities } from '@openpeepshq/common';
18
- import { checkRoleCapabilities } from '@openpeepshq/common/lib';
19
+ import {
20
+ checkRoleCapabilities,
21
+ postHasEditHistory,
22
+ } from '@openpeepshq/common/lib';
19
23
  import type { PublicPost } from '@openpeepshq/common/types';
20
24
  import { useNavigation } from '@react-navigation/native';
21
25
  import { NativeStackNavigationProp } from '@react-navigation/native-stack';
@@ -26,6 +30,7 @@ import { BottomSheetModal } from '@gorhom/bottom-sheet';
26
30
  import { DeletePostModal } from './modals/DeletePostModal';
27
31
  import { ReportProfileOrPostModal } from '../../profile/ReportProfileOrPostModal';
28
32
  import { RepostModal } from './modals/RepostModal';
33
+ import { PostEditHistoryModal } from './modals/PostEditHistoryModal';
29
34
  import { ReactionsModal } from './modals/ReactionsModal';
30
35
  import Toast from 'react-native-toast-message';
31
36
 
@@ -51,6 +56,12 @@ export const PostMenu = ({ post, deleteCallback }: PostMenuProps) => {
51
56
  const [isFollowing, setIsFollowing] = React.useState(false);
52
57
  const [repostsModalOpen, setRepostsModalOpen] = React.useState(false);
53
58
  const [reactionsModalOpen, setReactionsModalOpen] = React.useState(false);
59
+ const [historyModalOpen, setHistoryModalOpen] = React.useState(false);
60
+
61
+ // Hidden (blocked-author tombstone) posts have their entry snapshots
62
+ // stripped server-side; never offer history for them or deleted posts.
63
+ const showEditHistory =
64
+ !post.hidden && !post.deletedAt && postHasEditHistory(post.entries);
54
65
 
55
66
  const { data: serverInfo } = openpeepsApi.useServerInfo();
56
67
  const canPinToGroup =
@@ -293,6 +304,16 @@ export const PostMenu = ({ post, deleteCallback }: PostMenuProps) => {
293
304
  icon={ThumbsUpIcon}
294
305
  action={() => setReactionsModalOpen(true)}
295
306
  />
307
+ {showEditHistory ? (
308
+ <PopupMenuButton
309
+ title={t('posts.editHistory.menu', {
310
+ defaultValue: 'Edit history',
311
+ })}
312
+ text={t('posts.editHistory.menu', { defaultValue: 'Edit history' })}
313
+ icon={HistoryIcon}
314
+ action={() => setHistoryModalOpen(true)}
315
+ />
316
+ ) : null}
296
317
 
297
318
  {isBookmarked ? (
298
319
  <PopupMenuButton
@@ -457,6 +478,13 @@ export const PostMenu = ({ post, deleteCallback }: PostMenuProps) => {
457
478
  open={reactionsModalOpen}
458
479
  onClose={() => setReactionsModalOpen(false)}
459
480
  />
481
+ {showEditHistory ? (
482
+ <PostEditHistoryModal
483
+ post={post}
484
+ open={historyModalOpen}
485
+ onClose={() => setHistoryModalOpen(false)}
486
+ />
487
+ ) : null}
460
488
  <DeletePostModal
461
489
  ref={deleteMessageModalRef}
462
490
  onDelete={handleDelete}