@openpeepshq/react 0.9.23 → 0.11.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/dist/components/RelationCapabilitiesEditor.js +3 -3
- package/dist/components/RoleCapabilityMatrix.js +2 -2
- package/dist/components/accounts/SignUpLoginModal.js +1 -1
- package/dist/components/configuration/ConfigurationList.js +2 -2
- package/dist/components/conversations/ConversationMessageBubble.js +8 -1
- package/dist/components/conversations/CreateNewConversation.js +34 -17
- package/dist/components/form/ImageEditModal.js +2 -2
- package/dist/components/groups/ChangeGroupRolesModal.js +1 -1
- package/dist/components/groups/ConfirmGroupExitModal.js +1 -1
- package/dist/components/groups/ConfirmMemberRemovalModal.js +1 -1
- package/dist/components/groups/DeleteGroupModal.js +1 -1
- package/dist/components/groups/GroupForm.js +2 -2
- package/dist/components/groups/GroupNotificationSettingsModal.js +2 -2
- package/dist/components/jams/JamCallParticipant.js +4 -3
- package/dist/components/jams/JamGuestForm.js +1 -1
- package/dist/components/jams/jamEventActions.d.ts +10 -0
- package/dist/components/jams/jamEventActions.js +13 -0
- package/dist/components/navigation/ContentHeader.js +1 -1
- package/dist/components/navigation/FooterMobile.js +1 -1
- package/dist/components/navigation/SideBar.js +3 -3
- package/dist/components/post/FullPostLayout.js +1 -1
- package/dist/components/post/index.d.ts +1 -0
- package/dist/components/post/index.js +1 -0
- package/dist/components/post/pieces/EventRsvpList.js +1 -1
- package/dist/components/post/pieces/EventRsvpScopeDialog.js +2 -2
- package/dist/components/post/pieces/EventWaitlistJoinDialog.js +1 -1
- package/dist/components/post/pieces/GalleryModal.js +1 -1
- package/dist/components/post/pieces/modals/DeletePostModal.js +2 -2
- package/dist/components/post/post-form/ComposeAttachments.d.ts +2 -0
- package/dist/components/post/post-form/ComposeAttachments.js +8 -0
- package/dist/components/post/post-form/DescriptionEditModal.js +1 -1
- package/dist/components/post/post-form/EditPostModal.js +2 -2
- package/dist/components/post/post-form/EventForm.js +4 -26
- package/dist/components/post/post-form/PostAudienceSelector.js +2 -2
- package/dist/components/post/post-form/ReplyModal.js +1 -1
- package/dist/components/post/types/event/FullEvent.js +3 -3
- package/dist/components/post/types/resource/FullResource.js +2 -1
- package/dist/components/preview-link/RemotePreviewLink.js +32 -4
- package/dist/components/preview-link/RemotePreviewLink.test.d.ts +1 -0
- package/dist/components/preview-link/RemotePreviewLink.test.js +118 -0
- package/dist/components/profile/ProfileActivitySummary.js +4 -4
- package/dist/components/profile/ProfileBadge.js +1 -1
- package/dist/components/profile/ProfilePageAction.js +1 -1
- package/dist/components/profile/ProfilePostsAndReplies.js +1 -1
- package/dist/components/profile/ProfileSelector.js +1 -1
- package/dist/components/profile/ReportProfileOrPostModal.js +4 -2
- package/dist/components/resources/CategoryPathPicker.js +1 -1
- package/dist/components/resources/ResourceCard.js +5 -3
- package/dist/components/resources/ResourceLibrary.js +61 -8
- package/dist/components/resources/ResourceLibrary.test.d.ts +1 -0
- package/dist/components/resources/ResourceLibrary.test.js +122 -0
- package/dist/components/server-data/context.d.ts +25 -16
- package/dist/contexts/openpeeps/hooks/admin.d.ts +2 -2
- package/dist/contexts/openpeeps/hooks/auth.d.ts +1 -1
- package/dist/contexts/openpeeps/hooks/other.d.ts +1 -0
- package/dist/contexts/router/index.d.ts +8 -0
- package/dist/contexts/router/index.js +27 -2
- package/dist/hooks/conversations/dmMessage.d.ts +15 -0
- package/dist/hooks/conversations/dmMessage.js +12 -0
- package/dist/hooks/conversations/useCreateConversation.d.ts +40 -0
- package/dist/hooks/conversations/useCreateConversation.js +6 -0
- package/dist/hooks/events/useEventForm.d.ts +3 -0
- package/dist/hooks/events/useEventForm.js +31 -2
- package/dist/hooks/events/useEventForm.test.d.ts +1 -0
- package/dist/hooks/events/useEventForm.test.js +107 -0
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/index.js +3 -1
- package/dist/hooks/posts/useFeedPostActions.js +4 -15
- package/dist/hooks/posts/usePostReactionToggle.d.ts +14 -0
- package/dist/hooks/posts/usePostReactionToggle.js +46 -0
- package/dist/hooks/resources/useResourceLibrary.d.ts +8 -1
- package/dist/hooks/resources/useResourceLibrary.js +5 -5
- package/dist/hooks/settings/useAccessTokens.d.ts +3 -3
- package/dist/hooks/settings/useAccessTokens.js +1 -0
- package/dist/lib/downloadUrl.d.ts +6 -0
- package/dist/lib/downloadUrl.js +6 -0
- package/dist/navigation/menuItems.js +4 -4
- package/dist/pages/Explore.js +1 -1
- package/dist/pages/admin/ApiKeys.js +3 -3
- package/dist/pages/admin/ConfigEditor.js +1 -1
- package/dist/pages/admin/ConfigurationCommunityFeed.js +2 -2
- package/dist/pages/admin/ConfigurationCommunityLanguage.js +2 -2
- package/dist/pages/admin/ConfigurationCommunityTimezone.js +2 -2
- package/dist/pages/admin/ConfigurationEmail.js +2 -2
- package/dist/pages/admin/ConfigurationI18n.js +1 -1
- package/dist/pages/admin/ConfigurationSso.js +1 -1
- package/dist/pages/admin/ConfigurationSsoNew.js +1 -1
- package/dist/pages/admin/Dashboard.js +1 -1
- package/dist/pages/admin/Db.js +4 -4
- package/dist/pages/admin/DiagnosticsEmail.js +3 -3
- package/dist/pages/admin/DiagnosticsJob.js +2 -2
- package/dist/pages/admin/DiagnosticsLivekit.js +1 -1
- package/dist/pages/admin/DiagnosticsLogs.js +2 -2
- package/dist/pages/admin/DiagnosticsPerformance.js +1 -1
- package/dist/pages/admin/GroupMembers.js +5 -5
- package/dist/pages/admin/Groups.js +2 -2
- package/dist/pages/admin/Invites.js +3 -3
- package/dist/pages/admin/Media.js +2 -2
- package/dist/pages/admin/MemberDetail.js +7 -7
- package/dist/pages/admin/Members.js +2 -2
- package/dist/pages/admin/analytics/AnalyticsLayout.js +3 -1
- package/dist/pages/admin/analytics/Content.js +1 -1
- package/dist/pages/admin/analytics/Engagement.js +1 -1
- package/dist/pages/admin/analytics/Groups.js +1 -1
- package/dist/pages/admin/analytics/ReportSettings.js +1 -1
- package/dist/pages/admin/community/CommunityAccess.js +1 -1
- package/dist/pages/admin/community/CommunityFavicons.js +1 -1
- package/dist/pages/admin/community/CommunityForbiddenUsernames.js +2 -2
- package/dist/pages/admin/community/CommunityInfo.js +1 -1
- package/dist/pages/admin/community/CommunityLinks.js +7 -3
- package/dist/pages/admin/community/CommunityMarkdownPage.js +1 -1
- package/dist/pages/admin/community/CommunityProfileFields.js +2 -2
- package/dist/pages/admin/community/CommunityRoles.js +7 -7
- package/dist/pages/admin/community/CommunityTheme.js +3 -2
- package/dist/pages/admin/community/ThemeColorPreview.d.ts +8 -0
- package/dist/pages/admin/community/ThemeColorPreview.js +46 -0
- package/dist/pages/admin/community/ThemeColorPreview.test.d.ts +1 -0
- package/dist/pages/admin/community/ThemeColorPreview.test.js +49 -0
- package/dist/pages/admin/community/useCommunityConfig.d.ts +2 -0
- package/dist/pages/admin/components/AdminGroupCard.js +1 -1
- package/dist/pages/admin/components/EditInviteLinkModal.js +1 -1
- package/dist/pages/admin/components/InviteWithEmailModal.js +2 -2
- package/dist/pages/admin/components/InviteWithLinkModal.js +3 -3
- package/dist/pages/admin/components/ProfileRowActions.js +4 -4
- package/dist/pages/admin/components/RestoreBackupModal.js +2 -2
- package/dist/pages/admin/components/RestoreTestBackupModal.js +1 -1
- package/dist/pages/auth/Login.js +1 -1
- package/dist/pages/auth/Register.js +3 -3
- package/dist/pages/auth/RequestResetPassword.js +1 -1
- package/dist/pages/conversations/Info.js +1 -1
- package/dist/pages/conversations/Show.js +45 -15
- package/dist/pages/events/Index.js +1 -1
- package/dist/pages/feeds/Bookmarks.js +1 -1
- package/dist/pages/groups/EditInfo.js +1 -1
- package/dist/pages/groups/EditRoles.js +1 -1
- package/dist/pages/groups/Index.js +1 -1
- package/dist/pages/groups/Members.js +2 -2
- package/dist/pages/groups/New.js +1 -1
- package/dist/pages/groups/Show.js +2 -2
- package/dist/pages/settings/AccessTokens.js +4 -4
- package/dist/pages/settings/Account.js +1 -1
- package/dist/pages/settings/Feed.js +1 -1
- package/dist/pages/settings/Language.js +1 -1
- package/dist/pages/settings/PublicProfile.js +3 -3
- package/dist/pages/settings/PushEnabledDevices.js +1 -1
- package/dist/pages/settings/Theme.js +1 -1
- package/dist/pages/settings/Timezone.js +1 -1
- package/dist/react-native.d.ts +1 -1
- package/dist/react-native.js +1 -1
- package/package.json +9 -9
- package/src/components/RelationCapabilitiesEditor.tsx +3 -3
- package/src/components/RoleCapabilityMatrix.tsx +2 -2
- package/src/components/accounts/SignUpLoginModal.tsx +1 -1
- package/src/components/configuration/ConfigurationList.tsx +2 -2
- package/src/components/conversations/ConversationMessageBubble.tsx +24 -0
- package/src/components/conversations/CreateNewConversation.tsx +114 -78
- package/src/components/form/ImageEditModal.tsx +2 -2
- package/src/components/groups/ChangeGroupRolesModal.tsx +1 -1
- package/src/components/groups/ConfirmGroupExitModal.tsx +1 -1
- package/src/components/groups/ConfirmMemberRemovalModal.tsx +2 -2
- package/src/components/groups/DeleteGroupModal.tsx +2 -2
- package/src/components/groups/GroupForm.tsx +2 -2
- package/src/components/groups/GroupNotificationSettingsModal.tsx +2 -2
- package/src/components/jams/JamCallParticipant.tsx +4 -3
- package/src/components/jams/JamGuestForm.tsx +1 -1
- package/src/components/jams/jamEventActions.ts +21 -0
- package/src/components/navigation/ContentHeader.tsx +3 -3
- package/src/components/navigation/FooterMobile.tsx +1 -1
- package/src/components/navigation/SideBar.tsx +19 -5
- package/src/components/post/FullPostLayout.tsx +1 -1
- package/src/components/post/index.ts +1 -0
- package/src/components/post/pieces/EventRsvpList.tsx +1 -1
- package/src/components/post/pieces/EventRsvpScopeDialog.tsx +2 -2
- package/src/components/post/pieces/EventWaitlistJoinDialog.tsx +1 -1
- package/src/components/post/pieces/GalleryModal.tsx +1 -1
- package/src/components/post/pieces/modals/DeletePostModal.tsx +2 -2
- package/src/components/post/post-form/ComposeAttachments.tsx +10 -0
- package/src/components/post/post-form/DescriptionEditModal.tsx +1 -1
- package/src/components/post/post-form/EditPostModal.tsx +2 -2
- package/src/components/post/post-form/EventForm.tsx +8 -26
- package/src/components/post/post-form/PostAudienceSelector.tsx +2 -2
- package/src/components/post/post-form/ReplyModal.tsx +1 -1
- package/src/components/post/types/event/FullEvent.tsx +3 -3
- package/src/components/post/types/resource/FullResource.tsx +2 -1
- package/src/components/preview-link/RemotePreviewLink.tsx +92 -25
- package/src/components/profile/ProfileActivitySummary.tsx +4 -4
- package/src/components/profile/ProfileBadge.tsx +1 -1
- package/src/components/profile/ProfilePageAction.tsx +1 -1
- package/src/components/profile/ProfilePostsAndReplies.tsx +2 -2
- package/src/components/profile/ProfileSelector.tsx +1 -1
- package/src/components/profile/ReportProfileOrPostModal.tsx +4 -2
- package/src/components/resources/CategoryPathPicker.tsx +1 -1
- package/src/components/resources/ResourceCard.tsx +5 -3
- package/src/components/resources/ResourceLibrary.tsx +79 -4
- package/src/contexts/router/index.tsx +40 -1
- package/src/hooks/conversations/dmMessage.ts +26 -0
- package/src/hooks/conversations/useCreateConversation.ts +7 -0
- package/src/hooks/events/useEventForm.ts +32 -1
- package/src/hooks/index.ts +10 -1
- package/src/hooks/posts/useFeedPostActions.ts +4 -18
- package/src/hooks/posts/usePostReactionToggle.ts +60 -0
- package/src/hooks/resources/useResourceLibrary.ts +20 -5
- package/src/hooks/settings/useAccessTokens.ts +1 -0
- package/src/lib/downloadUrl.ts +7 -0
- package/src/navigation/menuItems.ts +4 -4
- package/src/pages/Explore.tsx +4 -4
- package/src/pages/admin/ApiKeys.tsx +4 -4
- package/src/pages/admin/ConfigEditor.tsx +1 -1
- package/src/pages/admin/ConfigurationCommunityFeed.tsx +2 -2
- package/src/pages/admin/ConfigurationCommunityLanguage.tsx +2 -2
- package/src/pages/admin/ConfigurationCommunityTimezone.tsx +2 -2
- package/src/pages/admin/ConfigurationEmail.tsx +2 -2
- package/src/pages/admin/ConfigurationI18n.tsx +1 -1
- package/src/pages/admin/ConfigurationSso.tsx +1 -1
- package/src/pages/admin/ConfigurationSsoNew.tsx +1 -1
- package/src/pages/admin/Dashboard.tsx +1 -1
- package/src/pages/admin/Db.tsx +6 -6
- package/src/pages/admin/DiagnosticsEmail.tsx +5 -5
- package/src/pages/admin/DiagnosticsJob.tsx +2 -2
- package/src/pages/admin/DiagnosticsLivekit.tsx +3 -3
- package/src/pages/admin/DiagnosticsLogs.tsx +4 -4
- package/src/pages/admin/DiagnosticsPerformance.tsx +1 -1
- package/src/pages/admin/GroupMembers.tsx +6 -6
- package/src/pages/admin/Groups.tsx +2 -2
- package/src/pages/admin/Invites.tsx +4 -4
- package/src/pages/admin/Media.tsx +2 -2
- package/src/pages/admin/MemberDetail.tsx +7 -7
- package/src/pages/admin/Members.tsx +2 -2
- package/src/pages/admin/analytics/AnalyticsLayout.tsx +5 -1
- package/src/pages/admin/analytics/Content.tsx +1 -1
- package/src/pages/admin/analytics/Engagement.tsx +1 -1
- package/src/pages/admin/analytics/Groups.tsx +1 -1
- package/src/pages/admin/analytics/ReportSettings.tsx +1 -1
- package/src/pages/admin/community/CommunityAccess.tsx +1 -1
- package/src/pages/admin/community/CommunityFavicons.tsx +1 -1
- package/src/pages/admin/community/CommunityForbiddenUsernames.tsx +2 -2
- package/src/pages/admin/community/CommunityInfo.tsx +1 -1
- package/src/pages/admin/community/CommunityLinks.tsx +30 -1
- package/src/pages/admin/community/CommunityMarkdownPage.tsx +1 -1
- package/src/pages/admin/community/CommunityProfileFields.tsx +5 -5
- package/src/pages/admin/community/CommunityRoles.tsx +9 -9
- package/src/pages/admin/community/CommunityTheme.tsx +26 -23
- package/src/pages/admin/community/ThemeColorPreview.tsx +141 -0
- package/src/pages/admin/components/AdminGroupCard.tsx +2 -2
- package/src/pages/admin/components/EditInviteLinkModal.tsx +2 -2
- package/src/pages/admin/components/InviteWithEmailModal.tsx +2 -2
- package/src/pages/admin/components/InviteWithLinkModal.tsx +3 -3
- package/src/pages/admin/components/ProfileRowActions.tsx +6 -6
- package/src/pages/admin/components/RestoreBackupModal.tsx +2 -2
- package/src/pages/admin/components/RestoreTestBackupModal.tsx +1 -1
- package/src/pages/auth/Login.tsx +1 -1
- package/src/pages/auth/Register.tsx +3 -3
- package/src/pages/auth/RequestResetPassword.tsx +1 -1
- package/src/pages/conversations/Info.tsx +1 -1
- package/src/pages/conversations/Show.tsx +94 -33
- package/src/pages/events/Index.tsx +1 -1
- package/src/pages/feeds/Bookmarks.tsx +3 -1
- package/src/pages/groups/EditInfo.tsx +1 -1
- package/src/pages/groups/EditRoles.tsx +1 -1
- package/src/pages/groups/Index.tsx +1 -1
- package/src/pages/groups/Members.tsx +2 -2
- package/src/pages/groups/New.tsx +1 -1
- package/src/pages/groups/Show.tsx +4 -4
- package/src/pages/settings/AccessTokens.tsx +4 -4
- package/src/pages/settings/Account.tsx +1 -1
- package/src/pages/settings/Feed.tsx +1 -1
- package/src/pages/settings/Language.tsx +1 -1
- package/src/pages/settings/PublicProfile.tsx +3 -3
- package/src/pages/settings/PushEnabledDevices.tsx +3 -6
- package/src/pages/settings/Theme.tsx +1 -1
- package/src/pages/settings/Timezone.tsx +1 -1
- package/src/react-native.ts +1 -0
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { useParams, useSearchParams } from 'react-router-dom';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type {
|
|
4
|
+
MediaAttachmentData,
|
|
5
|
+
Note,
|
|
6
|
+
PostCreationData,
|
|
7
|
+
PublicPost,
|
|
8
|
+
} from '@openpeepshq/common/types';
|
|
9
|
+
import { Image, Info, Search } from 'lucide-react';
|
|
5
10
|
import {
|
|
6
11
|
useT,
|
|
7
12
|
useOpenpeeps,
|
|
@@ -19,10 +24,15 @@ import {
|
|
|
19
24
|
OpenpeepsMarkdownInput,
|
|
20
25
|
ProfileCard,
|
|
21
26
|
useAuthData,
|
|
27
|
+
useComposeAttachments,
|
|
22
28
|
useCurrentProfile,
|
|
23
29
|
useToast,
|
|
24
30
|
} from '../../components';
|
|
25
31
|
import { apiErrorMessage } from '../../lib/apiErrorMessage';
|
|
32
|
+
import {
|
|
33
|
+
canSendDmMessage,
|
|
34
|
+
DM_MAX_ATTACHMENTS,
|
|
35
|
+
} from '../../hooks/conversations/dmMessage';
|
|
26
36
|
import { Button, LoadingSpinner } from '@openpeepshq/react-ui';
|
|
27
37
|
|
|
28
38
|
const MAX_LENGTH = 500;
|
|
@@ -31,6 +41,82 @@ const isMessageId = (value: string | null): value is string =>
|
|
|
31
41
|
!!value &&
|
|
32
42
|
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
33
43
|
|
|
44
|
+
const ConversationComposer = ({
|
|
45
|
+
sending,
|
|
46
|
+
onSend,
|
|
47
|
+
}: {
|
|
48
|
+
sending: boolean;
|
|
49
|
+
onSend: (data: Note) => Promise<boolean>;
|
|
50
|
+
}) => {
|
|
51
|
+
const t = useT();
|
|
52
|
+
const [text, setText] = useState('');
|
|
53
|
+
const [attachments, setAttachments] = useState<MediaAttachmentData[]>([]);
|
|
54
|
+
const compose = useComposeAttachments({
|
|
55
|
+
attachments,
|
|
56
|
+
onChange: setAttachments,
|
|
57
|
+
});
|
|
58
|
+
const canSend = canSendDmMessage({
|
|
59
|
+
sending,
|
|
60
|
+
uploadsPending: compose.pending,
|
|
61
|
+
text,
|
|
62
|
+
attachments,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const send = async () => {
|
|
66
|
+
if (!canSend) return;
|
|
67
|
+
const sent = await onSend({
|
|
68
|
+
type: 'note',
|
|
69
|
+
content: text.trim(),
|
|
70
|
+
attachments: attachments.length ? attachments : undefined,
|
|
71
|
+
});
|
|
72
|
+
if (!sent) return;
|
|
73
|
+
setText('');
|
|
74
|
+
compose.clear();
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const addImageLabel = t('posts.form.addImage', {
|
|
78
|
+
defaultValue: 'Add Media',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<footer className="space-y-2 border-t p-3">
|
|
83
|
+
{compose.previews}
|
|
84
|
+
<OpenpeepsMarkdownInput
|
|
85
|
+
rows={3}
|
|
86
|
+
value={text}
|
|
87
|
+
onChange={setText}
|
|
88
|
+
maxLength={MAX_LENGTH}
|
|
89
|
+
placeholder={t('conversations.placeholder', {
|
|
90
|
+
defaultValue: 'Write a message…',
|
|
91
|
+
})}
|
|
92
|
+
/>
|
|
93
|
+
<div className="flex items-center justify-between">
|
|
94
|
+
<Button
|
|
95
|
+
compact
|
|
96
|
+
variant="ghost"
|
|
97
|
+
title={addImageLabel}
|
|
98
|
+
action={compose.openImagePicker}
|
|
99
|
+
disabled={attachments.length >= DM_MAX_ATTACHMENTS}
|
|
100
|
+
data-testid="conversation-add-image"
|
|
101
|
+
>
|
|
102
|
+
<Image className="size-5" />
|
|
103
|
+
</Button>
|
|
104
|
+
<Button
|
|
105
|
+
title={t('common.send', { defaultValue: 'Send' })}
|
|
106
|
+
variant="default"
|
|
107
|
+
action={send}
|
|
108
|
+
disabled={!canSend}
|
|
109
|
+
>
|
|
110
|
+
{sending
|
|
111
|
+
? t('common.sending', { defaultValue: 'Sending…' })
|
|
112
|
+
: t('common.send', { defaultValue: 'Send' })}
|
|
113
|
+
</Button>
|
|
114
|
+
</div>
|
|
115
|
+
{compose.inputs}
|
|
116
|
+
</footer>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
34
120
|
export function ConversationShow() {
|
|
35
121
|
const t = useT();
|
|
36
122
|
const { id = '' } = useParams<{ id: string }>();
|
|
@@ -102,7 +188,7 @@ export function ConversationShow() {
|
|
|
102
188
|
const navigate = useNavigate();
|
|
103
189
|
|
|
104
190
|
const searchLabel = searchOpen
|
|
105
|
-
? t('common.close', { defaultValue: 'Close' })
|
|
191
|
+
? t('common.actions.close', { defaultValue: 'Close' })
|
|
106
192
|
: t('conversations.search.toggle', {
|
|
107
193
|
defaultValue: 'Search this conversation',
|
|
108
194
|
});
|
|
@@ -143,26 +229,24 @@ export function ConversationShow() {
|
|
|
143
229
|
|
|
144
230
|
useSetPageHeader(headerTitle, headerActions);
|
|
145
231
|
|
|
146
|
-
const [text, setText] = useState('');
|
|
147
232
|
const [sending, setSending] = useState(false);
|
|
148
233
|
|
|
149
|
-
const
|
|
150
|
-
if (!text.trim() || text.length > MAX_LENGTH) return;
|
|
234
|
+
const sendMessage = async (data: Note) => {
|
|
151
235
|
setSending(true);
|
|
152
236
|
try {
|
|
153
237
|
const payload: PostCreationData = {
|
|
154
238
|
visibility: 'direct',
|
|
155
239
|
audience: lastMessage?.audience ?? participants,
|
|
156
240
|
type: 'note',
|
|
157
|
-
data
|
|
241
|
+
data,
|
|
158
242
|
};
|
|
159
243
|
await createMessage(payload);
|
|
160
|
-
setText('');
|
|
161
244
|
await conversationQuery.refetch();
|
|
162
245
|
await queryClient.invalidateQueries({
|
|
163
246
|
queryKey: client.conversations.list.queryKey({}),
|
|
164
247
|
refetchType: 'all',
|
|
165
248
|
});
|
|
249
|
+
return true;
|
|
166
250
|
} catch (err) {
|
|
167
251
|
toast.error(
|
|
168
252
|
apiErrorMessage(
|
|
@@ -173,6 +257,7 @@ export function ConversationShow() {
|
|
|
173
257
|
}),
|
|
174
258
|
),
|
|
175
259
|
);
|
|
260
|
+
return false;
|
|
176
261
|
} finally {
|
|
177
262
|
setSending(false);
|
|
178
263
|
}
|
|
@@ -236,8 +321,6 @@ export function ConversationShow() {
|
|
|
236
321
|
);
|
|
237
322
|
}
|
|
238
323
|
|
|
239
|
-
const overLimit = text.length > MAX_LENGTH;
|
|
240
|
-
|
|
241
324
|
return (
|
|
242
325
|
<div className="flex h-[calc(100vh-8rem)] flex-col">
|
|
243
326
|
<header className="border-b">
|
|
@@ -304,29 +387,7 @@ export function ConversationShow() {
|
|
|
304
387
|
</div>
|
|
305
388
|
|
|
306
389
|
{canCreate && (
|
|
307
|
-
<
|
|
308
|
-
<OpenpeepsMarkdownInput
|
|
309
|
-
rows={3}
|
|
310
|
-
value={text}
|
|
311
|
-
onChange={setText}
|
|
312
|
-
maxLength={MAX_LENGTH}
|
|
313
|
-
placeholder={t('conversations.placeholder', {
|
|
314
|
-
defaultValue: 'Write a message…',
|
|
315
|
-
})}
|
|
316
|
-
/>
|
|
317
|
-
<div className="flex justify-end">
|
|
318
|
-
<Button
|
|
319
|
-
title="Send"
|
|
320
|
-
variant="default"
|
|
321
|
-
action={send}
|
|
322
|
-
disabled={sending || !text.trim() || overLimit}
|
|
323
|
-
>
|
|
324
|
-
{sending
|
|
325
|
-
? t('common.sending', { defaultValue: 'Sending…' })
|
|
326
|
-
: t('common.send', { defaultValue: 'Send' })}
|
|
327
|
-
</Button>
|
|
328
|
-
</div>
|
|
329
|
-
</footer>
|
|
390
|
+
<ConversationComposer key={id} sending={sending} onSend={sendMessage} />
|
|
330
391
|
)}
|
|
331
392
|
</div>
|
|
332
393
|
);
|
|
@@ -11,7 +11,9 @@ export function FeedsBookmarks() {
|
|
|
11
11
|
useFeedListParams({ format: 'linear' }),
|
|
12
12
|
);
|
|
13
13
|
|
|
14
|
-
useSetPageHeader(
|
|
14
|
+
useSetPageHeader(
|
|
15
|
+
t('common.entities.bookmarks', { defaultValue: 'Bookmarks' }),
|
|
16
|
+
);
|
|
15
17
|
|
|
16
18
|
return <Feed query={query} formatSwitch={false} />;
|
|
17
19
|
}
|
|
@@ -57,7 +57,7 @@ export function GroupsIndex() {
|
|
|
57
57
|
);
|
|
58
58
|
useSetPlusButtonActions(plusButton);
|
|
59
59
|
|
|
60
|
-
useSetPageHeader(t('
|
|
60
|
+
useSetPageHeader(t('common.entities.groups', { defaultValue: 'Groups' }));
|
|
61
61
|
|
|
62
62
|
const filtered = useMemo(
|
|
63
63
|
() => tabGroups.filter((g) => !search || matchesQuery(g, search)),
|
|
@@ -16,8 +16,8 @@ export function GroupMembers() {
|
|
|
16
16
|
const group = groupQuery.data;
|
|
17
17
|
|
|
18
18
|
const headerTitle = group
|
|
19
|
-
? `${groupName(group)} - ${t('
|
|
20
|
-
: t('
|
|
19
|
+
? `${groupName(group)} - ${t('common.entities.members', { defaultValue: 'Members' })}`
|
|
20
|
+
: t('common.entities.members', { defaultValue: 'Members' });
|
|
21
21
|
const headerActions = useMemo(
|
|
22
22
|
() => (group ? <AddGroupMembersButton group={group} /> : undefined),
|
|
23
23
|
[group],
|
package/src/pages/groups/New.tsx
CHANGED
|
@@ -42,7 +42,7 @@ export function NewGroup() {
|
|
|
42
42
|
|
|
43
43
|
<div className="space-y-2 px-1">
|
|
44
44
|
<Label htmlFor="group-members">
|
|
45
|
-
{t('
|
|
45
|
+
{t('common.entities.members', { defaultValue: 'Members' })}
|
|
46
46
|
</Label>
|
|
47
47
|
<ProfilesInput
|
|
48
48
|
value={members}
|
|
@@ -106,14 +106,14 @@ export function GroupShow() {
|
|
|
106
106
|
data-testid="tab-group"
|
|
107
107
|
>
|
|
108
108
|
<TabLink active={tab === 'posts'} hash="">
|
|
109
|
-
{t('
|
|
109
|
+
{t('common.entities.posts', { defaultValue: 'Posts' })}
|
|
110
110
|
</TabLink>
|
|
111
111
|
<TabLink
|
|
112
112
|
active={tab === 'events'}
|
|
113
113
|
hash="#events"
|
|
114
114
|
testId="groups-tab-events"
|
|
115
115
|
>
|
|
116
|
-
{t('
|
|
116
|
+
{t('common.entities.events', { defaultValue: 'Events' })}
|
|
117
117
|
</TabLink>
|
|
118
118
|
<TabLink
|
|
119
119
|
active={tab === 'resources'}
|
|
@@ -127,7 +127,7 @@ export function GroupShow() {
|
|
|
127
127
|
hash="#description"
|
|
128
128
|
testId="groups-tab-description"
|
|
129
129
|
>
|
|
130
|
-
{t('
|
|
130
|
+
{t('common.labels.description', { defaultValue: 'Description' })}
|
|
131
131
|
</TabLink>
|
|
132
132
|
</nav>
|
|
133
133
|
|
|
@@ -197,7 +197,7 @@ export function GroupShow() {
|
|
|
197
197
|
<p>{new Date(group.createdAt).toLocaleDateString()}</p>
|
|
198
198
|
</div>
|
|
199
199
|
<div>
|
|
200
|
-
<h4 className="font-semibold">{t('
|
|
200
|
+
<h4 className="font-semibold">{t('common.labels.visibility')}</h4>
|
|
201
201
|
<p>{t(`groups.visibility.${visibilityValue}.description`)}</p>
|
|
202
202
|
</div>
|
|
203
203
|
<div>
|
|
@@ -53,7 +53,7 @@ export function AccessTokensSettings() {
|
|
|
53
53
|
</p>
|
|
54
54
|
<div className="space-y-2">
|
|
55
55
|
<Label htmlFor="token-name">
|
|
56
|
-
{t('
|
|
56
|
+
{t('common.labels.name', { defaultValue: 'Name' })}
|
|
57
57
|
</Label>
|
|
58
58
|
<Input
|
|
59
59
|
id="token-name"
|
|
@@ -66,7 +66,7 @@ export function AccessTokensSettings() {
|
|
|
66
66
|
</div>
|
|
67
67
|
<div className="space-y-2">
|
|
68
68
|
<Label htmlFor="token-description">
|
|
69
|
-
{t('
|
|
69
|
+
{t('common.labels.description', {
|
|
70
70
|
defaultValue: 'Description',
|
|
71
71
|
})}
|
|
72
72
|
</Label>
|
|
@@ -144,7 +144,7 @@ export function AccessTokensSettings() {
|
|
|
144
144
|
disabled={(form.scopes?.length ?? 0) === 1}
|
|
145
145
|
action={() => removeScope(index)}
|
|
146
146
|
>
|
|
147
|
-
{t('common.remove', { defaultValue: 'Remove' })}
|
|
147
|
+
{t('common.actions.remove', { defaultValue: 'Remove' })}
|
|
148
148
|
</Button>
|
|
149
149
|
</div>
|
|
150
150
|
))}
|
|
@@ -223,7 +223,7 @@ export function AccessTokensSettings() {
|
|
|
223
223
|
:{' '}
|
|
224
224
|
{token.expiresAt
|
|
225
225
|
? new Date(token.expiresAt).toLocaleString()
|
|
226
|
-
: t('
|
|
226
|
+
: t('common.states.never', {
|
|
227
227
|
defaultValue: 'Never',
|
|
228
228
|
})}
|
|
229
229
|
</p>
|
|
@@ -146,7 +146,7 @@ export function AccountSettings() {
|
|
|
146
146
|
|
|
147
147
|
<div className="space-y-2">
|
|
148
148
|
<Label htmlFor="email">
|
|
149
|
-
{t('
|
|
149
|
+
{t('common.labels.email', { defaultValue: 'Email' })}
|
|
150
150
|
</Label>
|
|
151
151
|
<Input
|
|
152
152
|
id="email"
|
|
@@ -71,7 +71,7 @@ export function FeedSettings() {
|
|
|
71
71
|
<Button variant="default" action={onSave} disabled={submitting}>
|
|
72
72
|
{submitting
|
|
73
73
|
? t('common.saving', { defaultValue: 'Saving…' })
|
|
74
|
-
: t('common.save', { defaultValue: 'Save' })}
|
|
74
|
+
: t('common.actions.save', { defaultValue: 'Save' })}
|
|
75
75
|
</Button>
|
|
76
76
|
</div>
|
|
77
77
|
);
|
|
@@ -63,7 +63,7 @@ export function LanguageSettings() {
|
|
|
63
63
|
</Toast>
|
|
64
64
|
) : null}
|
|
65
65
|
<Button variant="default" action={save} disabled={saving}>
|
|
66
|
-
{t('common.
|
|
66
|
+
{t('common.actions.save', { defaultValue: 'Save' })}
|
|
67
67
|
</Button>
|
|
68
68
|
</div>
|
|
69
69
|
);
|
|
@@ -201,7 +201,7 @@ export function PublicProfileSettings() {
|
|
|
201
201
|
|
|
202
202
|
<div className="space-y-2">
|
|
203
203
|
<Label htmlFor="handle">
|
|
204
|
-
{t('
|
|
204
|
+
{t('common.labels.handle', { defaultValue: 'Handle' })}
|
|
205
205
|
</Label>
|
|
206
206
|
<Input
|
|
207
207
|
id="handle"
|
|
@@ -268,7 +268,7 @@ export function PublicProfileSettings() {
|
|
|
268
268
|
))}
|
|
269
269
|
|
|
270
270
|
<Button
|
|
271
|
-
title={t('common.save', { defaultValue: 'Save' })}
|
|
271
|
+
title={t('common.actions.save', { defaultValue: 'Save' })}
|
|
272
272
|
variant="default"
|
|
273
273
|
action={submit}
|
|
274
274
|
disabled={submitting}
|
|
@@ -276,7 +276,7 @@ export function PublicProfileSettings() {
|
|
|
276
276
|
>
|
|
277
277
|
{submitting
|
|
278
278
|
? t('common.saving', { defaultValue: 'Saving…' })
|
|
279
|
-
: t('common.save', { defaultValue: 'Save' })}
|
|
279
|
+
: t('common.actions.save', { defaultValue: 'Save' })}
|
|
280
280
|
</Button>
|
|
281
281
|
</div>
|
|
282
282
|
);
|
|
@@ -102,12 +102,9 @@ export function PushEnabledDevices() {
|
|
|
102
102
|
)}
|
|
103
103
|
</Button>
|
|
104
104
|
<Button variant="ghost" action={() => setConfirmId(null)}>
|
|
105
|
-
{t(
|
|
106
|
-
'
|
|
107
|
-
|
|
108
|
-
defaultValue: 'Cancel',
|
|
109
|
-
},
|
|
110
|
-
)}
|
|
105
|
+
{t('common.actions.cancel', {
|
|
106
|
+
defaultValue: 'Cancel',
|
|
107
|
+
})}
|
|
111
108
|
</Button>
|
|
112
109
|
</div>
|
|
113
110
|
) : (
|
|
@@ -53,7 +53,7 @@ export function TimezoneSettings() {
|
|
|
53
53
|
</Toast>
|
|
54
54
|
) : null}
|
|
55
55
|
<Button variant="default" action={save} disabled={saving}>
|
|
56
|
-
{t('common.
|
|
56
|
+
{t('common.actions.save', { defaultValue: 'Save' })}
|
|
57
57
|
</Button>
|
|
58
58
|
</div>
|
|
59
59
|
);
|