@openpeepshq/react 0.10.0 → 0.11.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.
Files changed (277) hide show
  1. package/dist/components/RelationCapabilitiesEditor.js +3 -3
  2. package/dist/components/RoleCapabilityMatrix.js +2 -2
  3. package/dist/components/accounts/SignUpLoginModal.js +1 -1
  4. package/dist/components/configuration/ConfigurationList.js +2 -2
  5. package/dist/components/conversations/ConversationMessageBubble.js +8 -1
  6. package/dist/components/conversations/CreateNewConversation.js +34 -17
  7. package/dist/components/form/ImageEditModal.js +2 -2
  8. package/dist/components/groups/ChangeGroupRolesModal.js +1 -1
  9. package/dist/components/groups/ConfirmGroupExitModal.js +1 -1
  10. package/dist/components/groups/ConfirmMemberRemovalModal.js +1 -1
  11. package/dist/components/groups/DeleteGroupModal.js +1 -1
  12. package/dist/components/groups/GroupForm.js +2 -2
  13. package/dist/components/groups/GroupNotificationSettingsModal.js +2 -2
  14. package/dist/components/jams/JamCallParticipant.js +4 -3
  15. package/dist/components/jams/JamGuestForm.js +1 -1
  16. package/dist/components/jams/jamEventActions.d.ts +10 -0
  17. package/dist/components/jams/jamEventActions.js +13 -0
  18. package/dist/components/navigation/ContentHeader.js +1 -1
  19. package/dist/components/navigation/FooterMobile.js +1 -1
  20. package/dist/components/navigation/SideBar.js +1 -1
  21. package/dist/components/post/FullPostLayout.js +1 -1
  22. package/dist/components/post/index.d.ts +1 -0
  23. package/dist/components/post/index.js +1 -0
  24. package/dist/components/post/pieces/EventRsvpList.js +1 -1
  25. package/dist/components/post/pieces/EventRsvpScopeDialog.js +2 -2
  26. package/dist/components/post/pieces/EventWaitlistJoinDialog.js +1 -1
  27. package/dist/components/post/pieces/GalleryModal.js +1 -1
  28. package/dist/components/post/pieces/modals/DeletePostModal.js +2 -2
  29. package/dist/components/post/post-form/ComposeAttachments.d.ts +2 -0
  30. package/dist/components/post/post-form/ComposeAttachments.js +8 -0
  31. package/dist/components/post/post-form/DescriptionEditModal.js +1 -1
  32. package/dist/components/post/post-form/EditPostModal.js +2 -2
  33. package/dist/components/post/post-form/EventForm.js +4 -26
  34. package/dist/components/post/post-form/PostAudienceSelector.js +2 -2
  35. package/dist/components/post/post-form/ReplyModal.js +1 -1
  36. package/dist/components/post/types/event/FullEvent.js +3 -3
  37. package/dist/components/post/types/resource/FullResource.js +2 -1
  38. package/dist/components/preview-link/RemotePreviewLink.js +32 -4
  39. package/dist/components/preview-link/RemotePreviewLink.test.d.ts +1 -0
  40. package/dist/components/preview-link/RemotePreviewLink.test.js +118 -0
  41. package/dist/components/profile/ProfileActivitySummary.js +4 -4
  42. package/dist/components/profile/ProfileBadge.js +1 -1
  43. package/dist/components/profile/ProfilePageAction.js +1 -1
  44. package/dist/components/profile/ProfilePostsAndReplies.js +1 -1
  45. package/dist/components/profile/ProfileSelector.js +1 -1
  46. package/dist/components/profile/ReportProfileOrPostModal.js +4 -2
  47. package/dist/components/resources/CategoryPathPicker.js +1 -1
  48. package/dist/components/resources/ResourceCard.js +5 -3
  49. package/dist/components/resources/ResourceLibrary.js +61 -8
  50. package/dist/components/resources/ResourceLibrary.test.d.ts +1 -0
  51. package/dist/components/resources/ResourceLibrary.test.js +122 -0
  52. package/dist/components/server-data/context.d.ts +24 -16
  53. package/dist/contexts/openpeeps/hooks/admin.d.ts +2 -2
  54. package/dist/contexts/openpeeps/hooks/auth.d.ts +1 -1
  55. package/dist/contexts/router/index.d.ts +8 -0
  56. package/dist/contexts/router/index.js +27 -2
  57. package/dist/hooks/conversations/dmMessage.d.ts +15 -0
  58. package/dist/hooks/conversations/dmMessage.js +12 -0
  59. package/dist/hooks/conversations/useCreateConversation.d.ts +40 -0
  60. package/dist/hooks/conversations/useCreateConversation.js +6 -0
  61. package/dist/hooks/events/useEventForm.d.ts +3 -0
  62. package/dist/hooks/events/useEventForm.js +31 -2
  63. package/dist/hooks/events/useEventForm.test.d.ts +1 -0
  64. package/dist/hooks/events/useEventForm.test.js +107 -0
  65. package/dist/hooks/index.d.ts +3 -1
  66. package/dist/hooks/index.js +3 -1
  67. package/dist/hooks/posts/useFeedPostActions.js +4 -15
  68. package/dist/hooks/posts/usePostReactionToggle.d.ts +14 -0
  69. package/dist/hooks/posts/usePostReactionToggle.js +46 -0
  70. package/dist/hooks/resources/useResourceLibrary.d.ts +8 -1
  71. package/dist/hooks/resources/useResourceLibrary.js +5 -5
  72. package/dist/hooks/settings/useAccessTokens.d.ts +3 -3
  73. package/dist/hooks/settings/useAccessTokens.js +1 -0
  74. package/dist/hooks/settings/useNotificationPreferences.d.ts +1 -0
  75. package/dist/hooks/settings/useNotificationPreferences.js +7 -2
  76. package/dist/lib/downloadUrl.d.ts +6 -0
  77. package/dist/lib/downloadUrl.js +6 -0
  78. package/dist/navigation/menuItems.js +4 -4
  79. package/dist/pages/Explore.js +1 -1
  80. package/dist/pages/admin/ApiKeys.js +17 -9
  81. package/dist/pages/admin/ConfigEditor.js +1 -1
  82. package/dist/pages/admin/ConfigurationCommunityFeed.js +2 -2
  83. package/dist/pages/admin/ConfigurationCommunityLanguage.js +2 -2
  84. package/dist/pages/admin/ConfigurationCommunityTimezone.js +2 -2
  85. package/dist/pages/admin/ConfigurationEmail.js +4 -4
  86. package/dist/pages/admin/ConfigurationI18n.js +1 -1
  87. package/dist/pages/admin/ConfigurationSso.js +2 -2
  88. package/dist/pages/admin/ConfigurationSsoNew.js +1 -1
  89. package/dist/pages/admin/Dashboard.js +1 -1
  90. package/dist/pages/admin/Db.js +4 -4
  91. package/dist/pages/admin/DiagnosticsEmail.js +3 -3
  92. package/dist/pages/admin/DiagnosticsJob.js +2 -2
  93. package/dist/pages/admin/DiagnosticsLivekit.js +1 -1
  94. package/dist/pages/admin/DiagnosticsLogs.js +2 -2
  95. package/dist/pages/admin/DiagnosticsPerformance.js +1 -1
  96. package/dist/pages/admin/GroupMembers.js +5 -5
  97. package/dist/pages/admin/Groups.js +2 -2
  98. package/dist/pages/admin/Invites.js +3 -3
  99. package/dist/pages/admin/Media.js +2 -2
  100. package/dist/pages/admin/MemberDetail.js +7 -7
  101. package/dist/pages/admin/Members.js +2 -2
  102. package/dist/pages/admin/analytics/AnalyticsLayout.js +3 -1
  103. package/dist/pages/admin/analytics/Content.js +1 -1
  104. package/dist/pages/admin/analytics/Engagement.js +1 -1
  105. package/dist/pages/admin/analytics/Groups.js +1 -1
  106. package/dist/pages/admin/analytics/ReportSettings.js +1 -1
  107. package/dist/pages/admin/community/CommunityAccess.js +1 -1
  108. package/dist/pages/admin/community/CommunityFavicons.js +1 -1
  109. package/dist/pages/admin/community/CommunityForbiddenUsernames.js +2 -2
  110. package/dist/pages/admin/community/CommunityInfo.js +1 -1
  111. package/dist/pages/admin/community/CommunityLinks.js +1 -1
  112. package/dist/pages/admin/community/CommunityMarkdownPage.js +1 -1
  113. package/dist/pages/admin/community/CommunityProfileFields.js +2 -2
  114. package/dist/pages/admin/community/CommunityRoles.js +7 -7
  115. package/dist/pages/admin/community/CommunityTheme.js +3 -2
  116. package/dist/pages/admin/community/ThemeColorPreview.d.ts +8 -0
  117. package/dist/pages/admin/community/ThemeColorPreview.js +46 -0
  118. package/dist/pages/admin/community/ThemeColorPreview.test.d.ts +1 -0
  119. package/dist/pages/admin/community/ThemeColorPreview.test.js +49 -0
  120. package/dist/pages/admin/components/AdminGroupCard.js +1 -1
  121. package/dist/pages/admin/components/EditInviteLinkModal.js +1 -1
  122. package/dist/pages/admin/components/InviteWithEmailModal.js +2 -2
  123. package/dist/pages/admin/components/InviteWithLinkModal.js +3 -3
  124. package/dist/pages/admin/components/ProfileRowActions.js +4 -4
  125. package/dist/pages/admin/components/RestoreBackupModal.js +2 -2
  126. package/dist/pages/admin/components/RestoreTestBackupModal.js +1 -1
  127. package/dist/pages/auth/Login.js +1 -1
  128. package/dist/pages/auth/Register.js +3 -3
  129. package/dist/pages/auth/RequestResetPassword.js +2 -2
  130. package/dist/pages/conversations/Info.js +1 -1
  131. package/dist/pages/conversations/Show.js +45 -15
  132. package/dist/pages/events/Index.js +1 -1
  133. package/dist/pages/feeds/Bookmarks.js +1 -1
  134. package/dist/pages/groups/EditInfo.js +1 -1
  135. package/dist/pages/groups/EditRoles.js +1 -1
  136. package/dist/pages/groups/Index.js +1 -1
  137. package/dist/pages/groups/Members.js +2 -2
  138. package/dist/pages/groups/New.js +1 -1
  139. package/dist/pages/groups/Show.js +2 -2
  140. package/dist/pages/settings/AccessTokens.js +4 -4
  141. package/dist/pages/settings/Account.js +1 -1
  142. package/dist/pages/settings/Feed.js +1 -1
  143. package/dist/pages/settings/Language.js +1 -1
  144. package/dist/pages/settings/NotificationPreferences.js +7 -3
  145. package/dist/pages/settings/NotificationPreferences.test.d.ts +1 -0
  146. package/dist/pages/settings/NotificationPreferences.test.js +119 -0
  147. package/dist/pages/settings/PublicProfile.js +3 -3
  148. package/dist/pages/settings/PushEnabledDevices.js +1 -1
  149. package/dist/pages/settings/Theme.js +1 -1
  150. package/dist/pages/settings/Timezone.js +1 -1
  151. package/dist/react-native.d.ts +1 -1
  152. package/dist/react-native.js +1 -1
  153. package/package.json +9 -9
  154. package/src/components/RelationCapabilitiesEditor.tsx +3 -3
  155. package/src/components/RoleCapabilityMatrix.tsx +2 -2
  156. package/src/components/accounts/SignUpLoginModal.tsx +1 -1
  157. package/src/components/configuration/ConfigurationList.tsx +2 -2
  158. package/src/components/conversations/ConversationMessageBubble.tsx +24 -0
  159. package/src/components/conversations/CreateNewConversation.tsx +114 -78
  160. package/src/components/form/ImageEditModal.tsx +2 -2
  161. package/src/components/groups/ChangeGroupRolesModal.tsx +1 -1
  162. package/src/components/groups/ConfirmGroupExitModal.tsx +1 -1
  163. package/src/components/groups/ConfirmMemberRemovalModal.tsx +2 -2
  164. package/src/components/groups/DeleteGroupModal.tsx +2 -2
  165. package/src/components/groups/GroupForm.tsx +2 -2
  166. package/src/components/groups/GroupNotificationSettingsModal.tsx +2 -2
  167. package/src/components/jams/JamCallParticipant.tsx +4 -3
  168. package/src/components/jams/JamGuestForm.tsx +1 -1
  169. package/src/components/jams/jamEventActions.ts +21 -0
  170. package/src/components/navigation/ContentHeader.tsx +3 -3
  171. package/src/components/navigation/FooterMobile.tsx +1 -1
  172. package/src/components/navigation/SideBar.tsx +3 -3
  173. package/src/components/post/FullPostLayout.tsx +1 -1
  174. package/src/components/post/index.ts +1 -0
  175. package/src/components/post/pieces/EventRsvpList.tsx +1 -1
  176. package/src/components/post/pieces/EventRsvpScopeDialog.tsx +2 -2
  177. package/src/components/post/pieces/EventWaitlistJoinDialog.tsx +1 -1
  178. package/src/components/post/pieces/GalleryModal.tsx +1 -1
  179. package/src/components/post/pieces/modals/DeletePostModal.tsx +2 -2
  180. package/src/components/post/post-form/ComposeAttachments.tsx +10 -0
  181. package/src/components/post/post-form/DescriptionEditModal.tsx +1 -1
  182. package/src/components/post/post-form/EditPostModal.tsx +2 -2
  183. package/src/components/post/post-form/EventForm.tsx +10 -28
  184. package/src/components/post/post-form/PostAudienceSelector.tsx +2 -2
  185. package/src/components/post/post-form/ReplyModal.tsx +1 -1
  186. package/src/components/post/types/event/FullEvent.tsx +3 -3
  187. package/src/components/post/types/resource/FullResource.tsx +2 -1
  188. package/src/components/preview-link/RemotePreviewLink.tsx +92 -25
  189. package/src/components/profile/ProfileActivitySummary.tsx +4 -4
  190. package/src/components/profile/ProfileBadge.tsx +1 -1
  191. package/src/components/profile/ProfilePageAction.tsx +1 -1
  192. package/src/components/profile/ProfilePostsAndReplies.tsx +2 -2
  193. package/src/components/profile/ProfileSelector.tsx +1 -1
  194. package/src/components/profile/ReportProfileOrPostModal.tsx +4 -2
  195. package/src/components/resources/CategoryPathPicker.tsx +1 -1
  196. package/src/components/resources/ResourceCard.tsx +5 -3
  197. package/src/components/resources/ResourceLibrary.tsx +79 -4
  198. package/src/contexts/router/index.tsx +40 -1
  199. package/src/hooks/conversations/dmMessage.ts +26 -0
  200. package/src/hooks/conversations/useCreateConversation.ts +7 -0
  201. package/src/hooks/events/useEventForm.ts +32 -1
  202. package/src/hooks/index.ts +10 -1
  203. package/src/hooks/posts/useFeedPostActions.ts +4 -18
  204. package/src/hooks/posts/usePostReactionToggle.ts +60 -0
  205. package/src/hooks/resources/useResourceLibrary.ts +20 -5
  206. package/src/hooks/settings/useAccessTokens.ts +1 -0
  207. package/src/hooks/settings/useNotificationPreferences.ts +12 -1
  208. package/src/lib/downloadUrl.ts +7 -0
  209. package/src/navigation/menuItems.ts +4 -4
  210. package/src/pages/Explore.tsx +4 -4
  211. package/src/pages/admin/ApiKeys.tsx +24 -13
  212. package/src/pages/admin/ConfigEditor.tsx +1 -1
  213. package/src/pages/admin/ConfigurationCommunityFeed.tsx +2 -2
  214. package/src/pages/admin/ConfigurationCommunityLanguage.tsx +2 -2
  215. package/src/pages/admin/ConfigurationCommunityTimezone.tsx +2 -2
  216. package/src/pages/admin/ConfigurationEmail.tsx +4 -4
  217. package/src/pages/admin/ConfigurationI18n.tsx +1 -1
  218. package/src/pages/admin/ConfigurationSso.tsx +3 -2
  219. package/src/pages/admin/ConfigurationSsoNew.tsx +1 -1
  220. package/src/pages/admin/Dashboard.tsx +1 -1
  221. package/src/pages/admin/Db.tsx +6 -6
  222. package/src/pages/admin/DiagnosticsEmail.tsx +5 -5
  223. package/src/pages/admin/DiagnosticsJob.tsx +2 -2
  224. package/src/pages/admin/DiagnosticsLivekit.tsx +3 -3
  225. package/src/pages/admin/DiagnosticsLogs.tsx +4 -4
  226. package/src/pages/admin/DiagnosticsPerformance.tsx +1 -1
  227. package/src/pages/admin/GroupMembers.tsx +6 -6
  228. package/src/pages/admin/Groups.tsx +2 -2
  229. package/src/pages/admin/Invites.tsx +4 -4
  230. package/src/pages/admin/Media.tsx +2 -2
  231. package/src/pages/admin/MemberDetail.tsx +7 -7
  232. package/src/pages/admin/Members.tsx +2 -2
  233. package/src/pages/admin/analytics/AnalyticsLayout.tsx +5 -1
  234. package/src/pages/admin/analytics/Content.tsx +1 -1
  235. package/src/pages/admin/analytics/Engagement.tsx +1 -1
  236. package/src/pages/admin/analytics/Groups.tsx +1 -1
  237. package/src/pages/admin/analytics/ReportSettings.tsx +1 -1
  238. package/src/pages/admin/community/CommunityAccess.tsx +1 -1
  239. package/src/pages/admin/community/CommunityFavicons.tsx +1 -1
  240. package/src/pages/admin/community/CommunityForbiddenUsernames.tsx +2 -2
  241. package/src/pages/admin/community/CommunityInfo.tsx +1 -1
  242. package/src/pages/admin/community/CommunityLinks.tsx +1 -1
  243. package/src/pages/admin/community/CommunityMarkdownPage.tsx +1 -1
  244. package/src/pages/admin/community/CommunityProfileFields.tsx +5 -5
  245. package/src/pages/admin/community/CommunityRoles.tsx +9 -9
  246. package/src/pages/admin/community/CommunityTheme.tsx +26 -23
  247. package/src/pages/admin/community/ThemeColorPreview.tsx +141 -0
  248. package/src/pages/admin/components/AdminGroupCard.tsx +2 -2
  249. package/src/pages/admin/components/EditInviteLinkModal.tsx +2 -2
  250. package/src/pages/admin/components/InviteWithEmailModal.tsx +2 -2
  251. package/src/pages/admin/components/InviteWithLinkModal.tsx +3 -3
  252. package/src/pages/admin/components/ProfileRowActions.tsx +6 -6
  253. package/src/pages/admin/components/RestoreBackupModal.tsx +2 -2
  254. package/src/pages/admin/components/RestoreTestBackupModal.tsx +1 -1
  255. package/src/pages/auth/Login.tsx +1 -1
  256. package/src/pages/auth/Register.tsx +3 -3
  257. package/src/pages/auth/RequestResetPassword.tsx +2 -2
  258. package/src/pages/conversations/Info.tsx +1 -1
  259. package/src/pages/conversations/Show.tsx +94 -33
  260. package/src/pages/events/Index.tsx +1 -1
  261. package/src/pages/feeds/Bookmarks.tsx +3 -1
  262. package/src/pages/groups/EditInfo.tsx +1 -1
  263. package/src/pages/groups/EditRoles.tsx +1 -1
  264. package/src/pages/groups/Index.tsx +1 -1
  265. package/src/pages/groups/Members.tsx +2 -2
  266. package/src/pages/groups/New.tsx +1 -1
  267. package/src/pages/groups/Show.tsx +4 -4
  268. package/src/pages/settings/AccessTokens.tsx +4 -4
  269. package/src/pages/settings/Account.tsx +1 -1
  270. package/src/pages/settings/Feed.tsx +1 -1
  271. package/src/pages/settings/Language.tsx +1 -1
  272. package/src/pages/settings/NotificationPreferences.tsx +38 -12
  273. package/src/pages/settings/PublicProfile.tsx +3 -3
  274. package/src/pages/settings/PushEnabledDevices.tsx +3 -6
  275. package/src/pages/settings/Theme.tsx +1 -1
  276. package/src/pages/settings/Timezone.tsx +1 -1
  277. package/src/react-native.ts +1 -0
@@ -0,0 +1,119 @@
1
+ /** @vitest-environment jsdom */
2
+ import { act, createElement } from 'react';
3
+ import { createRoot } from 'react-dom/client';
4
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
5
+ const { hookState } = vi.hoisted(() => ({
6
+ hookState: {
7
+ dirty: false,
8
+ saving: false,
9
+ save: () => { },
10
+ },
11
+ }));
12
+ vi.mock('../../index', () => ({
13
+ useT: () => (key, opts) => {
14
+ const translations = {
15
+ 'common.submit': 'Submit',
16
+ 'common.submitting': 'Submitting…',
17
+ 'settings.notifications.unsavedChanges': 'You have unsaved changes.',
18
+ 'settings.notifications.description': 'Choose how you want to be notified about activity.',
19
+ 'settings.notifications.pushSettings': 'Push settings',
20
+ 'settings.notifications.serverPushDisabled': 'Push notifications are not configured on this server.',
21
+ };
22
+ return (translations[key] ?? key).replace(/\{\{(\w+)\}\}/g, (_match, name) => opts?.[name] ?? '');
23
+ },
24
+ useOpenpeeps: () => ({
25
+ client: {},
26
+ openpeepsApi: { testPushSubscriptionAction: () => vi.fn(async () => { }) },
27
+ }),
28
+ useSetPageHeader: () => undefined,
29
+ usePushSubscription: () => ({
30
+ isSubscribed: false,
31
+ isLoading: false,
32
+ hasServiceWorker: false,
33
+ isSupported: false,
34
+ subscribe: vi.fn(async () => null),
35
+ unsubscribe: vi.fn(async () => { }),
36
+ }),
37
+ getPushSubscription: vi.fn(),
38
+ isBraveBrowser: () => false,
39
+ subscribePushNotifications: vi.fn(async () => { }),
40
+ }));
41
+ vi.mock('../../components', () => ({
42
+ useServerInfo: () => ({ vapid: { publicKey: undefined } }),
43
+ }));
44
+ vi.mock('../../hooks', () => ({
45
+ useNotificationPreferences: () => ({
46
+ me: { id: 'me' },
47
+ types: [],
48
+ settings: { notifications: {} },
49
+ dirty: hookState.dirty,
50
+ saving: hookState.saving,
51
+ save: () => hookState.save(),
52
+ status: null,
53
+ setTypeSettings: () => { },
54
+ clearStatus: () => { },
55
+ }),
56
+ }));
57
+ vi.mock('@openpeepshq/react-ui', () => ({
58
+ Button: (props) => createElement('button', {
59
+ 'data-testid': props['data-testid'],
60
+ disabled: props.disabled,
61
+ onClick: typeof props.action === 'function'
62
+ ? () => {
63
+ props.action();
64
+ }
65
+ : undefined,
66
+ }, props.children),
67
+ Toast: (props) => createElement('div', null, props.children),
68
+ }));
69
+ import { NotificationPreferences } from './NotificationPreferences.js';
70
+ describe('NotificationPreferences', () => {
71
+ let root;
72
+ let container;
73
+ beforeEach(() => {
74
+ globalThis.IS_REACT_ACT_ENVIRONMENT = true;
75
+ hookState.dirty = false;
76
+ hookState.saving = false;
77
+ hookState.save = vi.fn();
78
+ container = document.createElement('div');
79
+ document.body.appendChild(container);
80
+ root = createRoot(container);
81
+ });
82
+ afterEach(() => {
83
+ act(() => {
84
+ root?.unmount();
85
+ });
86
+ container?.remove();
87
+ root = undefined;
88
+ container = undefined;
89
+ });
90
+ const render = (element) => {
91
+ act(() => {
92
+ root?.render(element);
93
+ });
94
+ };
95
+ it('shows only the inline save button while there are no unsaved changes', () => {
96
+ render(createElement(NotificationPreferences));
97
+ expect(container?.querySelector('[data-testid=settings-unsaved-bar]')).toBeNull();
98
+ expect(container?.querySelectorAll('[data-testid=settings-save-button]')).toHaveLength(1);
99
+ });
100
+ it('shows the sticky unsaved bar with the single save button when dirty', () => {
101
+ hookState.dirty = true;
102
+ render(createElement(NotificationPreferences));
103
+ const bar = container?.querySelector('[data-testid=settings-unsaved-bar]');
104
+ expect(bar).not.toBeNull();
105
+ expect(bar?.textContent).toContain('You have unsaved changes.');
106
+ const buttons = container?.querySelectorAll('[data-testid=settings-save-button]');
107
+ expect(buttons).toHaveLength(1);
108
+ expect(bar?.querySelector('[data-testid=settings-save-button]')).not.toBeNull();
109
+ });
110
+ it('saves via the bar button when dirty', () => {
111
+ hookState.dirty = true;
112
+ render(createElement(NotificationPreferences));
113
+ const button = container?.querySelector('[data-testid=settings-unsaved-bar] [data-testid=settings-save-button]');
114
+ act(() => {
115
+ button.click();
116
+ });
117
+ expect(hookState.save).toHaveBeenCalledTimes(1);
118
+ });
119
+ });
@@ -138,7 +138,7 @@ export function PublicProfileSettings() {
138
138
  return { ...d, fields };
139
139
  });
140
140
  };
141
- return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsx(HeaderAvatarInput, { header: draft.header ?? undefined, avatar: draft.avatar ?? undefined, onHeaderChange: (header) => setDraft((d) => ({ ...d, header })), onAvatarChange: (avatar) => setDraft((d) => ({ ...d, avatar })) }), _jsxs("div", { className: "space-y-2 pt-4", children: [_jsx(Label, { htmlFor: "displayName", children: t('profile.form.displayName', { defaultValue: 'Display name' }) }), _jsx(Input, { id: "displayName", value: draft.displayName ?? '', onChange: (e) => setDraft((d) => ({ ...d, displayName: e.target.value })), "data-testid": "settings-display-name-input" })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "handle", children: t('profile.form.handle', { defaultValue: 'Handle' }) }), _jsx(Input, { id: "handle", value: draft.handle ?? '', maxLength: 16, "aria-invalid": Boolean(handleError), "aria-describedby": "handle-hint", onChange: (e) => {
141
+ return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsx(HeaderAvatarInput, { header: draft.header ?? undefined, avatar: draft.avatar ?? undefined, onHeaderChange: (header) => setDraft((d) => ({ ...d, header })), onAvatarChange: (avatar) => setDraft((d) => ({ ...d, avatar })) }), _jsxs("div", { className: "space-y-2 pt-4", children: [_jsx(Label, { htmlFor: "displayName", children: t('profile.form.displayName', { defaultValue: 'Display name' }) }), _jsx(Input, { id: "displayName", value: draft.displayName ?? '', onChange: (e) => setDraft((d) => ({ ...d, displayName: e.target.value })), "data-testid": "settings-display-name-input" })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "handle", children: t('common.labels.handle', { defaultValue: 'Handle' }) }), _jsx(Input, { id: "handle", value: draft.handle ?? '', maxLength: 16, "aria-invalid": Boolean(handleError), "aria-describedby": "handle-hint", onChange: (e) => {
142
142
  const handle = e.target.value.replace(/^@/, '');
143
143
  setDraft((d) => ({ ...d, handle }));
144
144
  if (handleError)
@@ -150,7 +150,7 @@ export function PublicProfileSettings() {
150
150
  : 'text-muted-foreground text-sm', "data-testid": "settings-handle-hint", children: handleError ??
151
151
  t('profile.form.handleHint', {
152
152
  defaultValue: '1–16 characters. Letters, numbers, underscores, and hyphens only — no spaces or punctuation.',
153
- }) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "bio", children: t('profile.form.bio', { defaultValue: 'Bio' }) }), _jsx(Textarea, { id: "bio", rows: 4, value: draft.bio ?? '', onChange: (e) => setDraft((d) => ({ ...d, bio: e.target.value })), "data-testid": "settings-bio-input" })] }), _jsx(LocationInput, { title: t('profile.form.location', { defaultValue: 'Location' }), value: draft.location, onChange: (location) => setDraft((d) => ({ ...d, location })) }), additionalFieldDefs.map((field, index) => (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: `field-${index}`, children: field.label }), _jsx(Input, { id: `field-${index}`, value: draft.fields?.[index]?.value ?? '', placeholder: field.label, onChange: (e) => patchField(index, e.target.value) })] }, field.label))), _jsx(Button, { title: t('common.save', { defaultValue: 'Save' }), variant: "default", action: submit, disabled: submitting, "data-testid": "settings-save-button", children: submitting
153
+ }) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "bio", children: t('profile.form.bio', { defaultValue: 'Bio' }) }), _jsx(Textarea, { id: "bio", rows: 4, value: draft.bio ?? '', onChange: (e) => setDraft((d) => ({ ...d, bio: e.target.value })), "data-testid": "settings-bio-input" })] }), _jsx(LocationInput, { title: t('profile.form.location', { defaultValue: 'Location' }), value: draft.location, onChange: (location) => setDraft((d) => ({ ...d, location })) }), additionalFieldDefs.map((field, index) => (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: `field-${index}`, children: field.label }), _jsx(Input, { id: `field-${index}`, value: draft.fields?.[index]?.value ?? '', placeholder: field.label, onChange: (e) => patchField(index, e.target.value) })] }, field.label))), _jsx(Button, { title: t('common.actions.save', { defaultValue: 'Save' }), variant: "default", action: submit, disabled: submitting, "data-testid": "settings-save-button", children: submitting
154
154
  ? t('common.saving', { defaultValue: 'Saving…' })
155
- : t('common.save', { defaultValue: 'Save' }) })] }));
155
+ : t('common.actions.save', { defaultValue: 'Save' }) })] }));
156
156
  }
@@ -25,7 +25,7 @@ export function PushEnabledDevices() {
25
25
  defaultValue: 'This device',
26
26
  }) })) : null] }), _jsx("p", { className: "text-muted-foreground text-xs", children: subscription.type })] })] }), confirming ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { variant: "destructive", disabled: deletingId === subscription.id, action: () => remove(subscription), children: t('settings.notifications.pushEnabledDevices.delete.confirm', {
27
27
  defaultValue: 'Delete',
28
- }) }), _jsx(Button, { variant: "ghost", action: () => setConfirmId(null), children: t('settings.notifications.pushEnabledDevices.delete.cancel', {
28
+ }) }), _jsx(Button, { variant: "ghost", action: () => setConfirmId(null), children: t('common.actions.cancel', {
29
29
  defaultValue: 'Cancel',
30
30
  }) })] })) : (_jsx("button", { type: "button", className: "text-muted-foreground hover:text-error p-2 transition-colors", title: t('common.actions.delete', {
31
31
  defaultValue: 'Delete',
@@ -17,5 +17,5 @@ export function ThemeSettings() {
17
17
  defaultValue: 'Choose how the application looks for you.',
18
18
  }) }), _jsx("div", { className: "mt-2 flex flex-wrap items-center gap-x-4 gap-y-2", children: THEME_OPTIONS.map((option) => (_jsxs("label", { className: "inline-flex items-center gap-2", children: [_jsx("input", { type: "radio", className: "h-4 w-4", name: "theme", value: option, checked: theme === option, onChange: () => setTheme(option) }), _jsx("span", { children: t(`settings.theme.${option}.mode`, { defaultValue: option }) })] }, option))) })] }), _jsx(Button, { title: "Save", variant: "default", action: submit, disabled: submitting, children: submitting
19
19
  ? t('common.saving', { defaultValue: 'Saving…' })
20
- : t('common.save', { defaultValue: 'Save' }) })] }));
20
+ : t('common.actions.save', { defaultValue: 'Save' }) })] }));
21
21
  }
@@ -15,5 +15,5 @@ export function TimezoneSettings() {
15
15
  ? `${tz} ${t('settings.timezone.communityDefault', {
16
16
  defaultValue: '(community default)',
17
17
  })}`
18
- : tz }) })] }), status ? (_jsx(Toast, { variant: status.type, onDismiss: clearStatus, children: status.message })) : null, _jsx(Button, { variant: "default", action: save, disabled: saving, children: t('common.form.save', { defaultValue: 'Save' }) })] }));
18
+ : tz }) })] }), status ? (_jsx(Toast, { variant: status.type, onDismiss: clearStatus, children: status.message })) : null, _jsx(Button, { variant: "default", action: save, disabled: saving, children: t('common.actions.save', { defaultValue: 'Save' }) })] }));
19
19
  }
@@ -49,7 +49,7 @@ export { JamProvider, useJamContext, useJamObserver, } from './components/jams/J
49
49
  export type { JamContextValue, JamProviderProps, } from './components/jams/JamContext';
50
50
  export { JamEventsProvider, useJamEventsContext, useMaybeJamEventsContext, } from './components/jams/JamEventsContext';
51
51
  export type { JamEventsContextValue } from './components/jams/JamEventsContext';
52
- export { mentionProfilesFromParticipants, parseJamEventPayload, parseParticipantMetadata, sendAttendance, sendJamEvent, sendReaction, toggleHand, } from './components/jams/jamEventActions';
52
+ export { mentionProfilesFromParticipants, parseJamEventPayload, parseParticipantMetadata, participantTileProfile, sendAttendance, sendJamEvent, sendReaction, toggleHand, } from './components/jams/jamEventActions';
53
53
  export type { JamParticipantMetadata } from './components/jams/jamEventActions';
54
54
  export { useRaisedHands } from './components/jams/useJamHands';
55
55
  export { useDropLateAudio } from './components/jams/dropLateAudio';
@@ -38,7 +38,7 @@ export { extractUrlsFromText, isValidUrl, } from './components/preview-link/help
38
38
  // Jam logic that only depends on livekit-client (no @livekit/components-react).
39
39
  export { JamProvider, useJamContext, useJamObserver, } from './components/jams/JamContext.js';
40
40
  export { JamEventsProvider, useJamEventsContext, useMaybeJamEventsContext, } from './components/jams/JamEventsContext.js';
41
- export { mentionProfilesFromParticipants, parseJamEventPayload, parseParticipantMetadata, sendAttendance, sendJamEvent, sendReaction, toggleHand, } from './components/jams/jamEventActions.js';
41
+ export { mentionProfilesFromParticipants, parseJamEventPayload, parseParticipantMetadata, participantTileProfile, sendAttendance, sendJamEvent, sendReaction, toggleHand, } from './components/jams/jamEventActions.js';
42
42
  export { useRaisedHands } from './components/jams/useJamHands.js';
43
43
  export { useDropLateAudio } from './components/jams/dropLateAudio.js';
44
44
  export { calculateRecordingState, calculateRtmpStreamState, formatRecordingElapsed, useJamRecordingElapsed, useJamRecordingState, useJamRtmpStreamState, } from './components/jams/jamRecordingState.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/react",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,11 +34,11 @@
34
34
  "@livekit/components-styles": "^1.1.6",
35
35
  "@tanstack/react-query": "5.90.16",
36
36
  "@videojs/react": "^10.0.0-beta.24",
37
- "dompurify": "^3.4.17",
37
+ "dompurify": "3.4.17",
38
38
  "emoji-picker-element": "^1.29.1",
39
39
  "heic2any": "^0.0.4",
40
40
  "i18next": "^24.2.3",
41
- "i18next-http-backend": "^3.0.2",
41
+ "i18next-http-backend": "^4.0.10",
42
42
  "js-base64": "^3.7.7",
43
43
  "livekit-client": "2.19.2",
44
44
  "lucide-react": "^0.469.0",
@@ -52,9 +52,9 @@
52
52
  "simple-icons": "^16.31.0",
53
53
  "uuidv7": "^1.0.2",
54
54
  "@openpeepshq/client": "^0.3.0",
55
+ "@openpeepshq/react-ui": "^0.5.1",
55
56
  "@openpeepshq/greenscreen": "^0.2.1",
56
- "@openpeepshq/react-ui": "^0.4.1",
57
- "@openpeepshq/common": "^0.6.0"
57
+ "@openpeepshq/common": "^0.6.2"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "react": "^18.3.0 || ^19.0.0",
@@ -68,14 +68,14 @@
68
68
  "@types/react-dom": "19.2.3",
69
69
  "@typescript-eslint/eslint-plugin": "^8.72.0",
70
70
  "@typescript-eslint/parser": "^8.72.0",
71
- "concurrently": "^9.1.2",
72
- "eslint": "^10.1.0",
71
+ "eslint": "^10.14.0",
72
+ "concurrently": "^9.2.5",
73
73
  "eslint-plugin-react-hooks": "^5.2.0",
74
74
  "jsdom": "^25.0.1",
75
- "react-router-dom": "^7.0.0",
75
+ "react-router-dom": "^7.18.5",
76
76
  "tsc-alias": "^1.8.10",
77
77
  "typescript": "^6.0.2",
78
- "vitest": "^2.1.8",
78
+ "vitest": "^4.1.12",
79
79
  "eslint-config-prettier": "^9.1.0",
80
80
  "@eslint/js": "^9.17.0",
81
81
  "@openpeepshq/fetch-client": "^0.2.1"
@@ -161,7 +161,7 @@ export function RelationCapabilitiesEditor() {
161
161
  if (configQuery.isLoading || !draft) {
162
162
  return (
163
163
  <div className="text-muted-foreground flex h-32 items-center justify-center text-sm">
164
- {t('common.form.loading', { defaultValue: 'Loading…' })}
164
+ {t('common.states.loading', { defaultValue: 'Loading…' })}
165
165
  </div>
166
166
  );
167
167
  }
@@ -198,11 +198,11 @@ export function RelationCapabilitiesEditor() {
198
198
  action={handleSave}
199
199
  disabled={saving || !canUpdateConfig || !diffPatch}
200
200
  loadingContent={t('common.saving', { defaultValue: 'Saving…' })}
201
- title={t('common.save', { defaultValue: 'Save' })}
201
+ title={t('common.actions.save', { defaultValue: 'Save' })}
202
202
  >
203
203
  {saving
204
204
  ? t('common.saving', { defaultValue: 'Saving…' })
205
- : t('common.save', { defaultValue: 'Save' })}
205
+ : t('common.actions.save', { defaultValue: 'Save' })}
206
206
  </Button>
207
207
  {canUpdateConfig && diffPatch ? (
208
208
  <Button
@@ -183,11 +183,11 @@ export function RoleCapabilityMatrix({ roles }: RoleCapabilityMatrixProps) {
183
183
  action={handleSave}
184
184
  disabled={saving || !canUpdateRoles || changedRoleIds.length === 0}
185
185
  loadingContent={t('common.saving', { defaultValue: 'Saving…' })}
186
- title={t('common.save', { defaultValue: 'Save' })}
186
+ title={t('common.actions.save', { defaultValue: 'Save' })}
187
187
  >
188
188
  {saving
189
189
  ? t('common.saving', { defaultValue: 'Saving…' })
190
- : t('common.save', { defaultValue: 'Save' })}
190
+ : t('common.actions.save', { defaultValue: 'Save' })}
191
191
  </Button>
192
192
  {canUpdateRoles && deviatesFromDefaults ? (
193
193
  <Button
@@ -36,7 +36,7 @@ export function SignUpLoginModal({ onClose }: SignUpLoginModalProps) {
36
36
  </DialogDescription>
37
37
  </DialogHeader>
38
38
  <DialogActions
39
- cancelLabel={t('common.cancel', { defaultValue: 'Cancel' })}
39
+ cancelLabel={t('common.actions.cancel', { defaultValue: 'Cancel' })}
40
40
  onCancel={onClose}
41
41
  actionLabel={t('accounts.login.loginButton', {
42
42
  defaultValue: 'Log In',
@@ -89,7 +89,7 @@ export function ConfigurationList({
89
89
  )}
90
90
  <button
91
91
  type="button"
92
- title={t('common.listEditor.removeTitle', {
92
+ title={t('common.actions.remove', {
93
93
  defaultValue: 'Remove',
94
94
  })}
95
95
  onClick={() => setAndNotify(value.toSpliced(index, 1))}
@@ -100,7 +100,7 @@ export function ConfigurationList({
100
100
  ))}
101
101
  <button
102
102
  type="button"
103
- title={t('common.listEditor.addTitle', { defaultValue: 'Add' })}
103
+ title={t('common.actions.add', { defaultValue: 'Add' })}
104
104
  onClick={() => setAndNotify([...value, structuredClone(defaults)])}
105
105
  >
106
106
  <Plus className="h-4 w-4" />
@@ -1,4 +1,8 @@
1
+ import { ThumbsUp } from 'lucide-react';
1
2
  import type { PublicPost } from '@openpeepshq/common/types';
3
+ import { Button } from '@openpeepshq/react-ui';
4
+ import { useT } from '../../i18n';
5
+ import { usePostReactionToggle } from '../../hooks/posts/usePostReactionToggle';
2
6
  import { useCurrentProfile } from '../layout/IdentityContext';
3
7
  import { FeedPostContent } from '../post/FeedPostContent';
4
8
  import { UnreadPostIndicator } from '../post/pieces/UnreadPostIndicator';
@@ -11,7 +15,10 @@ export function ConversationMessageBubble({
11
15
  unread?: boolean;
12
16
  }) {
13
17
  const me = useCurrentProfile();
18
+ const t = useT();
14
19
  const mine = message.profile.id === me?.id;
20
+ const { iReacted, canReact, toggleReaction } = usePostReactionToggle(message);
21
+ const reactionCount = message.reactions?.length ?? 0;
15
22
 
16
23
  return (
17
24
  <div
@@ -23,6 +30,23 @@ export function ConversationMessageBubble({
23
30
  }`}
24
31
  >
25
32
  <FeedPostContent post={message} />
33
+ {me && canReact ? (
34
+ <div className={mine ? 'mt-2 flex justify-end' : 'mt-2 flex'}>
35
+ <Button
36
+ variant="unstyled"
37
+ className={`items-center gap-1 rounded-button p-1 text-xs ${
38
+ iReacted ? 'text-primary' : 'text-muted-foreground'
39
+ }`}
40
+ title={t('posts.actions.react', { defaultValue: 'React' })}
41
+ aria-label={t('posts.actions.react')}
42
+ action={toggleReaction}
43
+ spinnerOnlyOnLoading
44
+ >
45
+ <ThumbsUp className="h-4 w-4" />
46
+ {reactionCount > 0 ? reactionCount : null}
47
+ </Button>
48
+ </div>
49
+ ) : null}
26
50
  </div>
27
51
  {!mine ? (
28
52
  <UnreadPostIndicator
@@ -1,3 +1,4 @@
1
+ import { Image } from 'lucide-react';
1
2
  import type { PublicProfile } from '@openpeepshq/common/types';
2
3
  import { blockedPairIds } from '@openpeepshq/common/lib';
3
4
  import {
@@ -11,7 +12,11 @@ import {
11
12
  } from '@openpeepshq/react-ui';
12
13
  import { useT } from '../../i18n';
13
14
  import { useCreateConversation } from '../../hooks/conversations/useCreateConversation';
14
- import { OpenpeepsMarkdownInput } from '../post';
15
+ import {
16
+ canSendDmMessage,
17
+ DM_MAX_ATTACHMENTS,
18
+ } from '../../hooks/conversations/dmMessage';
19
+ import { OpenpeepsMarkdownInput, useComposeAttachments } from '../post';
15
20
  import { ProfilesInput } from '../profile';
16
21
 
17
22
  const MAX_MESSAGE_LENGTH = 500;
@@ -38,6 +43,8 @@ export const CreateNewConversation = ({
38
43
  setSelectedProfiles,
39
44
  message,
40
45
  setMessage,
46
+ attachments,
47
+ setAttachments,
41
48
  submitting,
42
49
  error,
43
50
  send,
@@ -47,91 +54,120 @@ export const CreateNewConversation = ({
47
54
  skipProfileSelection,
48
55
  onClose,
49
56
  });
57
+ const compose = useComposeAttachments({
58
+ attachments,
59
+ onChange: setAttachments,
60
+ });
61
+ const canSend = canSendDmMessage({
62
+ sending: submitting,
63
+ uploadsPending: compose.pending,
64
+ text: message,
65
+ attachments,
66
+ });
67
+ const addImageLabel = t('posts.form.addImage', {
68
+ defaultValue: 'Add Media',
69
+ });
50
70
 
51
71
  return (
52
- <Dialog open onOpenChange={(open) => !open && onClose()}>
53
- <DialogContent className="flex max-h-[85vh] max-w-lg flex-col overflow-hidden">
54
- {step === 1 ? (
55
- <>
56
- <DialogHeader>
57
- <DialogTitle>
58
- {t('conversations.createNew.title', {
59
- defaultValue: 'New message',
60
- })}
61
- </DialogTitle>
62
- </DialogHeader>
72
+ <>
73
+ <Dialog open onOpenChange={(open) => !open && onClose()}>
74
+ <DialogContent className="flex max-h-[85vh] max-w-lg flex-col overflow-hidden">
75
+ {step === 1 ? (
76
+ <>
77
+ <DialogHeader>
78
+ <DialogTitle>
79
+ {t('conversations.createNew.title', {
80
+ defaultValue: 'New message',
81
+ })}
82
+ </DialogTitle>
83
+ </DialogHeader>
63
84
 
64
- <div className="min-h-0 flex-1 space-y-2 overflow-y-auto">
65
- <ProfilesInput
66
- value={selectedProfiles}
67
- onChange={setSelectedProfiles}
68
- banlist={me ? [me.id, ...blockedPairIds(me)] : []}
69
- placeholder={t('conversations.createNew.searchPlaceholder', {
70
- defaultValue: 'Search members…',
71
- })}
72
- title={t('conversations.createNew.title', {
73
- defaultValue: 'New message',
74
- })}
75
- />
76
- </div>
77
-
78
- <DialogActions
79
- cancelLabel={t('common.cancel', { defaultValue: 'Cancel' })}
80
- onCancel={onClose}
81
- actionLabel={t('common.next', { defaultValue: 'Next' })}
82
- onAction={() => setStep(2)}
83
- disabled={selectedProfiles.length === 0}
84
- />
85
- </>
86
- ) : (
87
- <>
88
- <DialogHeader>
89
- <DialogTitle>
90
- {t('conversations.createNew.sendMessage', {
91
- defaultValue: 'Send message',
92
- })}
93
- </DialogTitle>
94
- </DialogHeader>
85
+ <div className="min-h-0 flex-1 space-y-2 overflow-y-auto">
86
+ <ProfilesInput
87
+ value={selectedProfiles}
88
+ onChange={setSelectedProfiles}
89
+ banlist={me ? [me.id, ...blockedPairIds(me)] : []}
90
+ placeholder={t('conversations.createNew.searchPlaceholder', {
91
+ defaultValue: 'Search members…',
92
+ })}
93
+ title={t('conversations.createNew.title', {
94
+ defaultValue: 'New message',
95
+ })}
96
+ />
97
+ </div>
95
98
 
96
- <div className="min-h-0 flex-1 overflow-y-auto">
97
- <OpenpeepsMarkdownInput
98
- rows={5}
99
- value={message}
100
- onChange={setMessage}
101
- maxLength={MAX_MESSAGE_LENGTH}
102
- placeholder={t('conversations.createNew.messagePlaceholder', {
103
- defaultValue: 'Write a message…',
99
+ <DialogActions
100
+ cancelLabel={t('common.actions.cancel', {
101
+ defaultValue: 'Cancel',
104
102
  })}
103
+ onCancel={onClose}
104
+ actionLabel={t('common.next', { defaultValue: 'Next' })}
105
+ onAction={() => setStep(2)}
106
+ disabled={selectedProfiles.length === 0}
105
107
  />
106
- </div>
108
+ </>
109
+ ) : (
110
+ <>
111
+ <DialogHeader>
112
+ <DialogTitle>
113
+ {t('conversations.createNew.sendMessage', {
114
+ defaultValue: 'Send message',
115
+ })}
116
+ </DialogTitle>
117
+ </DialogHeader>
107
118
 
108
- {error ? <p className="text-error text-sm">{error}</p> : null}
109
-
110
- <DialogFooter className="flex-wrap gap-2">
111
- {!skipProfileSelection ? (
112
- <Button variant="outline" action={() => setStep(1)}>
113
- {t('common.back', { defaultValue: 'Back' })}
119
+ <div className="min-h-0 flex-1 space-y-2 overflow-y-auto">
120
+ {compose.previews}
121
+ <OpenpeepsMarkdownInput
122
+ rows={5}
123
+ value={message}
124
+ onChange={setMessage}
125
+ maxLength={MAX_MESSAGE_LENGTH}
126
+ placeholder={t('conversations.createNew.messagePlaceholder', {
127
+ defaultValue: 'Write a message…',
128
+ })}
129
+ />
130
+ <Button
131
+ compact
132
+ variant="ghost"
133
+ title={addImageLabel}
134
+ action={compose.openImagePicker}
135
+ disabled={attachments.length >= DM_MAX_ATTACHMENTS}
136
+ data-testid="conversation-add-image"
137
+ >
138
+ <Image className="size-5" />
114
139
  </Button>
115
- ) : (
116
- <Button variant="outline" action={onClose}>
117
- {t('common.cancel', { defaultValue: 'Cancel' })}
140
+ </div>
141
+
142
+ {error ? <p className="text-error text-sm">{error}</p> : null}
143
+
144
+ <DialogFooter className="flex-wrap gap-2">
145
+ {!skipProfileSelection ? (
146
+ <Button variant="outline" action={() => setStep(1)}>
147
+ {t('common.actions.back', { defaultValue: 'Back' })}
148
+ </Button>
149
+ ) : (
150
+ <Button variant="outline" action={onClose}>
151
+ {t('common.actions.cancel', { defaultValue: 'Cancel' })}
152
+ </Button>
153
+ )}
154
+ <Button
155
+ variant="default"
156
+ disabled={!canSend || selectedProfiles.length === 0}
157
+ action={send}
158
+ >
159
+ {submitting
160
+ ? t('common.actions.sending', { defaultValue: 'Sending…' })
161
+ : t('common.actions.send', {
162
+ defaultValue: 'Send',
163
+ })}
118
164
  </Button>
119
- )}
120
- <Button
121
- variant="default"
122
- disabled={submitting || selectedProfiles.length === 0}
123
- action={send}
124
- >
125
- {submitting
126
- ? t('common.sending', { defaultValue: 'Sending…' })
127
- : t('conversations.createNew.send', {
128
- defaultValue: 'Send',
129
- })}
130
- </Button>
131
- </DialogFooter>
132
- </>
133
- )}
134
- </DialogContent>
135
- </Dialog>
165
+ </DialogFooter>
166
+ </>
167
+ )}
168
+ </DialogContent>
169
+ </Dialog>
170
+ {compose.inputs}
171
+ </>
136
172
  );
137
173
  };
@@ -216,12 +216,12 @@ export function ImageEditModal({
216
216
  </div>
217
217
 
218
218
  <DialogActions
219
- cancelLabel={t('common.cancel', { defaultValue: 'Cancel' })}
219
+ cancelLabel={t('common.actions.cancel', { defaultValue: 'Cancel' })}
220
220
  onCancel={onClose}
221
221
  actionLabel={
222
222
  submitting
223
223
  ? t('common.uploading', { defaultValue: 'Uploading…' })
224
- : t('common.add', { defaultValue: 'Add' })
224
+ : t('common.actions.add', { defaultValue: 'Add' })
225
225
  }
226
226
  onAction={confirm}
227
227
  disabled={submitting}
@@ -110,7 +110,7 @@ export function ChangeGroupRolesModal({
110
110
  </p>
111
111
  ) : null}
112
112
  <DialogActions
113
- cancelLabel={t('common.cancel', { defaultValue: 'Cancel' })}
113
+ cancelLabel={t('common.actions.cancel', { defaultValue: 'Cancel' })}
114
114
  onCancel={onClose}
115
115
  actionLabel={t('groups.changeRoles.confirm', {
116
116
  defaultValue: 'Save roles',
@@ -63,7 +63,7 @@ export function ConfirmGroupExitModal({
63
63
  </p>
64
64
  ) : null}
65
65
  <DialogActions
66
- cancelLabel={t('common.cancel', { defaultValue: 'Cancel' })}
66
+ cancelLabel={t('common.actions.cancel', { defaultValue: 'Cancel' })}
67
67
  onCancel={onClose}
68
68
  actionLabel={t('groups.modals.confirmExit.leave', {
69
69
  defaultValue: 'Leave',
@@ -63,9 +63,9 @@ export function ConfirmMemberRemovalModal({
63
63
  </p>
64
64
  ) : null}
65
65
  <DialogActions
66
- cancelLabel={t('common.cancel', { defaultValue: 'Cancel' })}
66
+ cancelLabel={t('common.actions.cancel', { defaultValue: 'Cancel' })}
67
67
  onCancel={onClose}
68
- actionLabel={t('groups.removeMember.confirm', {
68
+ actionLabel={t('common.actions.remove', {
69
69
  defaultValue: 'Remove',
70
70
  })}
71
71
  onAction={submit}