@openpeepshq/react 0.6.3 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/configuration/ConfigurationCategory.js +3 -2
- package/dist/components/configuration/ConfigurationList.js +1 -1
- package/dist/components/form/LocationInput.js +1 -1
- package/dist/components/groups/GroupHeader.js +2 -1
- package/dist/components/groups/GroupNotificationSettingsModal.d.ts +9 -0
- package/dist/components/groups/GroupNotificationSettingsModal.js +57 -0
- package/dist/components/groups/GroupShareMenu.js +30 -8
- package/dist/components/groups/index.d.ts +2 -0
- package/dist/components/groups/index.js +1 -0
- package/dist/components/jams/JamCapacityGate.js +1 -1
- package/dist/components/jams/JamConference.js +2 -0
- package/dist/components/jams/JamParticipantConference.js +2 -0
- package/dist/components/jams/JamRoom.js +2 -3
- package/dist/components/jams/LiveJamsSection.js +8 -2
- package/dist/components/jams/LivekitUnavailableNotice.d.ts +9 -0
- package/dist/components/jams/LivekitUnavailableNotice.js +19 -0
- package/dist/components/jams/dropLateAudio.d.ts +22 -0
- package/dist/components/jams/dropLateAudio.js +115 -0
- package/dist/components/jams/index.d.ts +1 -0
- package/dist/components/jams/index.js +1 -0
- package/dist/components/notifications/TypedNotification.js +46 -4
- package/dist/components/post/Markdown.d.ts +2 -2
- package/dist/components/post/Markdown.js +1 -1
- package/dist/components/post/attachmentPreview.js +1 -1
- package/dist/components/post/pieces/Attachments.js +23 -17
- package/dist/components/post/pieces/EventRsvpButton.js +37 -7
- package/dist/components/post/pieces/EventRsvpList.js +23 -3
- package/dist/components/post/pieces/EventRsvpScopeDialog.d.ts +1 -1
- package/dist/components/post/pieces/EventRsvpScopeDialog.js +34 -22
- package/dist/components/post/pieces/EventWaitlistJoinDialog.d.ts +10 -0
- package/dist/components/post/pieces/EventWaitlistJoinDialog.js +26 -0
- package/dist/components/post/pieces/ParticipantsCard.d.ts +1 -1
- package/dist/components/post/pieces/ParticipantsCard.js +1 -1
- package/dist/components/post/pieces/PostActions.d.ts +1 -1
- package/dist/components/post/pieces/PostActions.js +20 -12
- package/dist/components/post/pieces/ShareMenu.d.ts +6 -1
- package/dist/components/post/pieces/ShareMenu.js +40 -7
- package/dist/components/post/post-form/EventForm.js +10 -2
- package/dist/components/post/types/Article.js +1 -1
- package/dist/components/post/types/article/FullArticle.js +1 -1
- package/dist/components/post/types/event/CardEvent.js +2 -1
- package/dist/components/post/types/event/FullEvent.js +21 -11
- package/dist/components/post/types/event/ProfileEventRelationship.js +8 -0
- package/dist/components/preview-link/LocalPreviewLink.js +4 -2
- package/dist/components/preview-link/PreviewLink.js +1 -1
- package/dist/components/preview-link/helpers.d.ts +5 -0
- package/dist/components/preview-link/helpers.js +27 -1
- package/dist/components/preview-link/local/WelcomePreview.d.ts +1 -0
- package/dist/components/preview-link/local/WelcomePreview.js +6 -0
- package/dist/components/profile/Avatar.js +2 -2
- package/dist/components/profile/ProfileFromId.js +1 -1
- package/dist/components/server-data/context.d.ts +1 -0
- package/dist/contexts/openpeeps/hooks/accounts.d.ts +5 -5
- package/dist/contexts/openpeeps/hooks/accounts.js +1 -3
- package/dist/contexts/openpeeps/hooks/admin.d.ts +165 -66
- package/dist/contexts/openpeeps/hooks/admin.js +11 -3
- package/dist/contexts/openpeeps/hooks/auth.d.ts +2 -2
- package/dist/contexts/openpeeps/hooks/groups.d.ts +8 -8
- package/dist/contexts/openpeeps/hooks/jams.d.ts +73 -24
- package/dist/contexts/openpeeps/hooks/other.d.ts +7 -6
- package/dist/contexts/openpeeps/hooks/payments.d.ts +2 -2
- package/dist/contexts/openpeeps/hooks/posts.d.ts +368 -170
- package/dist/contexts/openpeeps/hooks/streaming.d.ts +1 -1
- package/dist/hooks/admin/useCanAccessAdminSection.d.ts +13 -0
- package/dist/hooks/admin/useCanAccessAdminSection.js +21 -0
- package/dist/hooks/events/useEventComposer.d.ts +94 -41
- package/dist/hooks/events/useEventForm.d.ts +1 -0
- package/dist/hooks/events/useEventRsvp.d.ts +11 -2
- package/dist/hooks/events/useEventRsvp.js +46 -5
- package/dist/hooks/events/useEventsCalendar.d.ts +174 -76
- package/dist/hooks/groups/useGroupNotificationLevel.d.ts +9 -0
- package/dist/hooks/groups/useGroupNotificationLevel.js +57 -0
- package/dist/hooks/groups/useNewGroup.js +22 -2
- package/dist/hooks/index.d.ts +6 -1
- package/dist/hooks/index.js +5 -1
- package/dist/hooks/jams/useCanDiagnoseLivekit.d.ts +2 -0
- package/dist/hooks/jams/useCanDiagnoseLivekit.js +3 -0
- package/dist/hooks/jams/useCreateNewJamForm.d.ts +3 -1
- package/dist/hooks/jams/useJamDetails.d.ts +87 -38
- package/dist/hooks/jams/useJamLobby.d.ts +1 -0
- package/dist/hooks/jams/useJamRoom.d.ts +175 -76
- package/dist/hooks/posts/useArticleComposer.d.ts +93 -41
- package/dist/hooks/posts/useFeedPostPresentation.d.ts +174 -76
- package/dist/hooks/posts/usePostDetailTitle.d.ts +87 -38
- package/dist/hooks/posts/useResourceComposer.d.ts +93 -41
- package/dist/hooks/posts/useResourceComposer.js +4 -2
- package/dist/hooks/posts/useShareMenu.d.ts +2 -0
- package/dist/hooks/posts/useShareMenu.js +7 -0
- package/dist/hooks/resources/useResourceLibrary.d.ts +176 -78
- package/dist/hooks/settings/useNotificationPreferences.d.ts +1 -1
- package/dist/hooks/useWelcomePreview.d.ts +13 -0
- package/dist/hooks/useWelcomePreview.js +39 -0
- package/dist/lib/groupFormErrors.d.ts +1 -0
- package/dist/lib/groupFormErrors.js +5 -2
- package/dist/lib/threadHelpers.js +1 -5
- package/dist/pages/admin/ConfigurationCommunity.js +1 -1
- package/dist/pages/admin/Diagnostics.js +1 -1
- package/dist/pages/admin/DiagnosticsLivekit.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsLivekit.js +50 -0
- package/dist/pages/admin/Invites.js +5 -3
- package/dist/pages/admin/Media.d.ts +1 -0
- package/dist/pages/admin/Media.js +135 -0
- package/dist/pages/admin/community/CommunityForbiddenUsernames.d.ts +1 -0
- package/dist/pages/admin/community/CommunityForbiddenUsernames.js +106 -0
- package/dist/pages/admin/community/CommunityRoles.js +1 -1
- package/dist/pages/admin/community/useCommunityConfig.d.ts +2 -0
- package/dist/pages/admin/components/EditInviteLinkModal.d.ts +5 -0
- package/dist/pages/admin/components/EditInviteLinkModal.js +131 -0
- package/dist/pages/admin/configurationSsoShared.d.ts +4 -0
- package/dist/pages/auth/Register.js +30 -8
- package/dist/pages/conversations/Show.js +11 -0
- package/dist/pages/groups/Show.js +22 -19
- package/dist/pages/index.d.ts +3 -0
- package/dist/pages/index.js +3 -0
- package/dist/pages/jams/Index.js +2 -4
- package/dist/pages/settings/PublicProfile.js +15 -3
- package/dist/pwa/sw.d.ts +0 -1
- package/dist/react-native.d.ts +2 -1
- package/dist/react-native.js +2 -1
- package/dist/stores/newPosts.d.ts +4 -2
- package/dist/stores/newPosts.js +6 -1
- package/package.json +11 -6
- package/src/components/configuration/ConfigurationCategory.tsx +23 -10
- package/src/components/configuration/ConfigurationList.tsx +6 -1
- package/src/components/form/LocationInput.tsx +7 -1
- package/src/components/groups/GroupHeader.tsx +2 -0
- package/src/components/groups/GroupNotificationSettingsModal.tsx +163 -0
- package/src/components/groups/GroupShareMenu.tsx +77 -12
- package/src/components/groups/index.ts +5 -0
- package/src/components/jams/JamCapacityGate.tsx +1 -1
- package/src/components/jams/JamConference.tsx +2 -0
- package/src/components/jams/JamParticipantConference.tsx +2 -0
- package/src/components/jams/JamRoom.tsx +2 -6
- package/src/components/jams/LiveJamsSection.tsx +16 -2
- package/src/components/jams/LivekitUnavailableNotice.tsx +40 -0
- package/src/components/jams/dropLateAudio.ts +153 -0
- package/src/components/jams/index.ts +1 -0
- package/src/components/notifications/TypedNotification.tsx +81 -9
- package/src/components/post/Markdown.tsx +8 -2
- package/src/components/post/attachmentPreview.ts +1 -3
- package/src/components/post/pieces/Attachments.tsx +93 -78
- package/src/components/post/pieces/EventRsvpButton.tsx +107 -7
- package/src/components/post/pieces/EventRsvpList.tsx +64 -0
- package/src/components/post/pieces/EventRsvpScopeDialog.tsx +39 -27
- package/src/components/post/pieces/EventWaitlistJoinDialog.tsx +77 -0
- package/src/components/post/pieces/ParticipantsCard.tsx +4 -1
- package/src/components/post/pieces/PostActions.tsx +73 -42
- package/src/components/post/pieces/ShareMenu.tsx +67 -9
- package/src/components/post/post-form/EventForm.tsx +26 -0
- package/src/components/post/post-form/VisibilitySelector.tsx +1 -2
- package/src/components/post/types/Article.tsx +1 -1
- package/src/components/post/types/article/FullArticle.tsx +2 -2
- package/src/components/post/types/event/CardEvent.tsx +26 -14
- package/src/components/post/types/event/FullEvent.tsx +47 -29
- package/src/components/post/types/event/ProfileEventRelationship.tsx +8 -0
- package/src/components/post/types/note/FullNote.tsx +1 -4
- package/src/components/post/types/poll/FullPoll.tsx +1 -4
- package/src/components/preview-link/LocalPreviewLink.tsx +4 -1
- package/src/components/preview-link/PreviewLink.tsx +2 -7
- package/src/components/preview-link/helpers.ts +32 -1
- package/src/components/preview-link/local/GroupPreview.tsx +1 -1
- package/src/components/preview-link/local/JamPreview.tsx +1 -1
- package/src/components/preview-link/local/WelcomePreview.tsx +36 -0
- package/src/components/profile/Avatar.tsx +6 -2
- package/src/components/profile/ProfileFromId.tsx +1 -5
- package/src/components/resources/ResourceCard.tsx +0 -1
- package/src/contexts/openpeeps/hooks/accounts.ts +1 -3
- package/src/contexts/openpeeps/hooks/admin.ts +11 -3
- package/src/contexts/openpeeps/hooks/other.ts +9 -12
- package/src/contexts/openpeeps/hooks/streaming.ts +3 -3
- package/src/css.d.ts +4 -0
- package/src/hooks/admin/useCanAccessAdminSection.ts +27 -0
- package/src/hooks/events/useEventRsvp.ts +51 -7
- package/src/hooks/groups/useGroupNotificationLevel.ts +57 -0
- package/src/hooks/groups/useNewGroup.ts +28 -3
- package/src/hooks/index.ts +9 -1
- package/src/hooks/jams/useCanDiagnoseLivekit.ts +5 -0
- package/src/hooks/posts/useResourceComposer.ts +8 -6
- package/src/hooks/posts/useShareMenu.ts +9 -0
- package/src/hooks/useWelcomePreview.ts +57 -0
- package/src/i18n/I18nProvider.tsx +1 -4
- package/src/lib/groupFormErrors.ts +9 -2
- package/src/lib/threadHelpers.ts +1 -5
- package/src/pages/admin/ConfigurationCommunity.tsx +5 -0
- package/src/pages/admin/Diagnostics.tsx +4 -0
- package/src/pages/admin/DiagnosticsLivekit.tsx +147 -0
- package/src/pages/admin/Invites.tsx +23 -1
- package/src/pages/admin/Media.tsx +290 -0
- package/src/pages/admin/community/CommunityForbiddenUsernames.tsx +223 -0
- package/src/pages/admin/community/CommunityRoles.tsx +2 -2
- package/src/pages/admin/components/EditInviteLinkModal.tsx +263 -0
- package/src/pages/auth/Register.tsx +33 -4
- package/src/pages/conversations/Show.tsx +11 -0
- package/src/pages/groups/Show.tsx +60 -53
- package/src/pages/index.ts +3 -0
- package/src/pages/jams/Index.tsx +2 -6
- package/src/pages/settings/PublicProfile.tsx +20 -2
- package/src/pwa/sw.ts +6 -3
- package/src/pwa/useNotificationBadgeSync.ts +3 -1
- package/src/react-native.ts +2 -1
- package/src/stores/newPosts.ts +6 -1
- package/src/streaming.ts +3 -3
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.js +0 -5
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
HANDLE_RESERVED_MESSAGE,
|
|
4
|
+
isForbiddenHandle,
|
|
5
|
+
type GroupData,
|
|
6
|
+
type PublicProfile,
|
|
7
|
+
} from '@openpeepshq/common/types';
|
|
3
8
|
import {
|
|
4
9
|
applySimpleGroupTemplate,
|
|
5
10
|
defaultSimpleGroupTemplate,
|
|
@@ -30,7 +35,10 @@ export const useNewGroup = () => {
|
|
|
30
35
|
const navigate = useNavigate();
|
|
31
36
|
const { openpeepsApi } = useOpenpeeps();
|
|
32
37
|
const createGroup = openpeepsApi.createGroupAction();
|
|
33
|
-
const
|
|
38
|
+
const serverInfo = useServerInfo();
|
|
39
|
+
const { publicContent } = serverInfo;
|
|
40
|
+
const additionalForbiddenHandles =
|
|
41
|
+
serverInfo.communityConfig?.settings?.additionalForbiddenHandles;
|
|
34
42
|
const [members, setMembers] = useState<PublicProfile[]>([]);
|
|
35
43
|
const [groupData, setGroupData] = useState<GroupData>(() => ({
|
|
36
44
|
displayName: '',
|
|
@@ -47,7 +55,9 @@ export const useNewGroup = () => {
|
|
|
47
55
|
|
|
48
56
|
const submit = async () => {
|
|
49
57
|
setError(null);
|
|
50
|
-
const nextFieldErrors = groupFormFieldErrors(groupData, t
|
|
58
|
+
const nextFieldErrors = groupFormFieldErrors(groupData, t, {
|
|
59
|
+
additionalForbiddenHandles,
|
|
60
|
+
});
|
|
51
61
|
if (hasGroupFormFieldErrors(nextFieldErrors)) {
|
|
52
62
|
setFieldErrors(nextFieldErrors);
|
|
53
63
|
return;
|
|
@@ -60,6 +70,13 @@ export const useNewGroup = () => {
|
|
|
60
70
|
handle: handleFromDisplayName(groupData.displayName!),
|
|
61
71
|
}
|
|
62
72
|
: groupData;
|
|
73
|
+
if (isForbiddenHandle(data.handle, additionalForbiddenHandles)) {
|
|
74
|
+
const msg = t('profile.form.handleReserved', {
|
|
75
|
+
defaultValue: 'That handle is reserved. Please choose another.',
|
|
76
|
+
});
|
|
77
|
+
setFieldErrors({ handle: msg });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
63
80
|
setSubmitting(true);
|
|
64
81
|
try {
|
|
65
82
|
const group = (await createGroup({ ...data, members })) as {
|
|
@@ -67,6 +84,14 @@ export const useNewGroup = () => {
|
|
|
67
84
|
};
|
|
68
85
|
navigate({ type: 'group', handle: group.handle });
|
|
69
86
|
} catch (err) {
|
|
87
|
+
if ((err as Error).message === HANDLE_RESERVED_MESSAGE) {
|
|
88
|
+
const msg = t('profile.form.handleReserved', {
|
|
89
|
+
defaultValue: 'That handle is reserved. Please choose another.',
|
|
90
|
+
});
|
|
91
|
+
setFieldErrors({ handle: msg });
|
|
92
|
+
setError(msg);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
70
95
|
if (isDuplicateHandleError(err)) {
|
|
71
96
|
const msg = duplicateHandleMessage(t);
|
|
72
97
|
setFieldErrors({ handle: msg });
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { useJoinGroup } from './groups/useJoinGroup';
|
|
2
|
+
export { useGroupNotificationLevel } from './groups/useGroupNotificationLevel';
|
|
2
3
|
export { useCreateConversation } from './conversations/useCreateConversation';
|
|
3
4
|
export type { UseCreateConversationArgs } from './conversations/useCreateConversation';
|
|
5
|
+
export { useCanDiagnoseLivekit } from './jams/useCanDiagnoseLivekit';
|
|
4
6
|
export { useLeaveCloseJam } from './jams/useLeaveCloseJam';
|
|
5
7
|
export type { UseLeaveCloseJamArgs } from './jams/useLeaveCloseJam';
|
|
6
8
|
export { useCreateNewJamForm } from './jams/useCreateNewJamForm';
|
|
@@ -93,7 +95,7 @@ export { useCommunityInfoPages } from './community/useCommunityInfoPages';
|
|
|
93
95
|
export { usePostThreads } from './posts/usePostThreads';
|
|
94
96
|
export { usePostDetailTitle } from './posts/usePostDetailTitle';
|
|
95
97
|
export { useEventMenu } from './events/useEventMenu';
|
|
96
|
-
export { useShareMenu } from './posts/useShareMenu';
|
|
98
|
+
export { postPublicPath, useShareMenu } from './posts/useShareMenu';
|
|
97
99
|
export type { EventIcsFile } from './posts/useShareMenu';
|
|
98
100
|
export { useNewEvent, useEditEvent } from './events/useEventComposer';
|
|
99
101
|
export { EVENT_WEEKDAYS, useEventForm } from './events/useEventForm';
|
|
@@ -106,3 +108,9 @@ export type {
|
|
|
106
108
|
EventFormat,
|
|
107
109
|
UseEventTypeSwitcherArgs,
|
|
108
110
|
} from './events/useEventTypeSwitcher';
|
|
111
|
+
export {
|
|
112
|
+
useAdminRoles,
|
|
113
|
+
useCanAccessAdminSection,
|
|
114
|
+
} from './admin/useCanAccessAdminSection';
|
|
115
|
+
export { useWelcomePreview } from './useWelcomePreview';
|
|
116
|
+
export type { WelcomePreviewContent } from './useWelcomePreview';
|
|
@@ -14,8 +14,8 @@ import { useT } from '../../i18n/context';
|
|
|
14
14
|
import { useServerInfo } from '../../components/server-data';
|
|
15
15
|
import { defaultNewResource, getNewPostStores } from '../../stores';
|
|
16
16
|
|
|
17
|
-
const asResource = (data: PostDataUnion): ResourcePost | null =>
|
|
18
|
-
data
|
|
17
|
+
const asResource = (data: PostDataUnion | undefined): ResourcePost | null =>
|
|
18
|
+
data?.type === 'resource' ? data : null;
|
|
19
19
|
|
|
20
20
|
const preparedResource = (resource: ResourcePost): ResourcePost => ({
|
|
21
21
|
...resource,
|
|
@@ -121,7 +121,11 @@ export const useEditResource = (resourceId: string) => {
|
|
|
121
121
|
const [error, setError] = useState<string | null>(null);
|
|
122
122
|
|
|
123
123
|
useEffect(() => {
|
|
124
|
-
if (
|
|
124
|
+
if (
|
|
125
|
+
postQuery.data &&
|
|
126
|
+
postQuery.data.type === 'resource' &&
|
|
127
|
+
postQuery.data.data
|
|
128
|
+
) {
|
|
125
129
|
setPostData({
|
|
126
130
|
visibility: postQuery.data.visibility,
|
|
127
131
|
type: 'resource',
|
|
@@ -132,9 +136,7 @@ export const useEditResource = (resourceId: string) => {
|
|
|
132
136
|
}
|
|
133
137
|
}, [postQuery.data]);
|
|
134
138
|
|
|
135
|
-
const resourceTitle = asResource(
|
|
136
|
-
postQuery.data?.data as PostDataUnion,
|
|
137
|
-
)?.title;
|
|
139
|
+
const resourceTitle = asResource(postQuery.data?.data)?.title;
|
|
138
140
|
|
|
139
141
|
const submit = useCallback(async () => {
|
|
140
142
|
if (!postData) return;
|
|
@@ -5,6 +5,15 @@ import { useCurrentProfile } from '../../components/layout/IdentityContext';
|
|
|
5
5
|
|
|
6
6
|
export type EventIcsFile = { filename: string; content: string };
|
|
7
7
|
|
|
8
|
+
/** Canonical public path for a post, including a recurring event occurrence. */
|
|
9
|
+
export const postPublicPath = (
|
|
10
|
+
post: Pick<PublicPost, 'id' | 'occurrenceRecurrenceId'>,
|
|
11
|
+
) => {
|
|
12
|
+
const occurrence = post.occurrenceRecurrenceId;
|
|
13
|
+
if (!occurrence) return `/posts/${post.id}`;
|
|
14
|
+
return `/posts/${post.id}?occurrence=${encodeURIComponent(occurrence)}`;
|
|
15
|
+
};
|
|
16
|
+
|
|
8
17
|
/** Share actions for a post; `postUrl` is the platform's canonical public link. */
|
|
9
18
|
export const useShareMenu = (post: PublicPost, postUrl: string) => {
|
|
10
19
|
const me = useCurrentProfile();
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { getTheme } from '@openpeepshq/common';
|
|
2
|
+
import { useCurrentProfileSettings } from '../components/layout/IdentityContext';
|
|
3
|
+
import {
|
|
4
|
+
firstMarkdownImage,
|
|
5
|
+
welcomePreviewExcerpt,
|
|
6
|
+
} from '../components/preview-link/helpers';
|
|
7
|
+
import { useServerInfo } from '../components/server-data/context';
|
|
8
|
+
import { useT } from '../i18n/context';
|
|
9
|
+
|
|
10
|
+
export type WelcomePreviewContent = {
|
|
11
|
+
/** Short label above the title. Omitted when it would repeat the title. */
|
|
12
|
+
eyebrow?: string;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
imageUrl?: string;
|
|
16
|
+
imageFit: 'cover' | 'contain';
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Shared welcome-link card. Native passes the device color scheme because
|
|
21
|
+
* `getTheme` cannot read it from `window` there.
|
|
22
|
+
*/
|
|
23
|
+
export const useWelcomePreview = (
|
|
24
|
+
systemScheme?: 'dark' | 'light',
|
|
25
|
+
): WelcomePreviewContent => {
|
|
26
|
+
const t = useT();
|
|
27
|
+
const serverInfo = useServerInfo();
|
|
28
|
+
const profileSettings = useCurrentProfileSettings();
|
|
29
|
+
const config = serverInfo.communityConfig;
|
|
30
|
+
const configured = config.content.welcomePage?.trim() ?? '';
|
|
31
|
+
const markdownImage = firstMarkdownImage(configured);
|
|
32
|
+
const logo = (
|
|
33
|
+
systemScheme
|
|
34
|
+
? getTheme(config, profileSettings, systemScheme)
|
|
35
|
+
: getTheme(config, profileSettings)
|
|
36
|
+
).logoSmall;
|
|
37
|
+
const label = t('welcome.previewLabel', { defaultValue: 'Welcome page' });
|
|
38
|
+
const name = config.info.name.trim();
|
|
39
|
+
const title = name
|
|
40
|
+
? t('welcome.heading', {
|
|
41
|
+
name,
|
|
42
|
+
defaultValue: 'Welcome to {{name}}',
|
|
43
|
+
})
|
|
44
|
+
: label;
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
eyebrow: title === label ? undefined : label,
|
|
48
|
+
title,
|
|
49
|
+
description: configured
|
|
50
|
+
? welcomePreviewExcerpt(configured)
|
|
51
|
+
: t('welcome.defaultIntro', {
|
|
52
|
+
defaultValue: 'Welcome to this community, hosted on AllPeep.',
|
|
53
|
+
}),
|
|
54
|
+
imageUrl: markdownImage || logo || undefined,
|
|
55
|
+
imageFit: markdownImage ? 'cover' : 'contain',
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -52,10 +52,7 @@ export function I18nProvider({
|
|
|
52
52
|
};
|
|
53
53
|
}, [i18n, lang]);
|
|
54
54
|
|
|
55
|
-
const value = useMemo(
|
|
56
|
-
() => ({ i18n, t: i18n.t.bind(i18n) }),
|
|
57
|
-
[i18n, lng],
|
|
58
|
-
);
|
|
55
|
+
const value = useMemo(() => ({ i18n, t: i18n.t.bind(i18n) }), [i18n, lng]);
|
|
59
56
|
|
|
60
57
|
if (!ready) return <>{fallback}</>;
|
|
61
58
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
accountNameSchema,
|
|
3
3
|
GROUP_DISPLAY_NAME_MAX_LENGTH,
|
|
4
|
+
HANDLE_RESERVED_MESSAGE,
|
|
5
|
+
isForbiddenHandle,
|
|
4
6
|
} from '@openpeepshq/common/types';
|
|
5
7
|
import type { TFunction } from 'i18next';
|
|
6
8
|
|
|
@@ -19,7 +21,7 @@ const displayNameMaxLengthMessage = (t: TFunction) =>
|
|
|
19
21
|
});
|
|
20
22
|
|
|
21
23
|
const handleErrorMessage = (issue: string | undefined, t: TFunction) =>
|
|
22
|
-
issue ===
|
|
24
|
+
issue === HANDLE_RESERVED_MESSAGE
|
|
23
25
|
? t('profile.form.handleReserved', {
|
|
24
26
|
defaultValue: 'That handle is reserved. Please choose another.',
|
|
25
27
|
})
|
|
@@ -31,7 +33,10 @@ const handleErrorMessage = (issue: string | undefined, t: TFunction) =>
|
|
|
31
33
|
export const groupFormFieldErrors = (
|
|
32
34
|
data: { displayName?: string; handle?: string },
|
|
33
35
|
t: TFunction,
|
|
34
|
-
options?: {
|
|
36
|
+
options?: {
|
|
37
|
+
skipHandle?: boolean;
|
|
38
|
+
additionalForbiddenHandles?: readonly string[];
|
|
39
|
+
},
|
|
35
40
|
): GroupFormFieldErrors => {
|
|
36
41
|
const errors: GroupFormFieldErrors = {};
|
|
37
42
|
const displayName = data.displayName ?? '';
|
|
@@ -49,6 +54,8 @@ export const groupFormFieldErrors = (
|
|
|
49
54
|
const result = accountNameSchema.safeParse(handle);
|
|
50
55
|
if (!result.success) {
|
|
51
56
|
errors.handle = handleErrorMessage(result.error.issues[0]?.message, t);
|
|
57
|
+
} else if (isForbiddenHandle(handle, options?.additionalForbiddenHandles)) {
|
|
58
|
+
errors.handle = handleErrorMessage(HANDLE_RESERVED_MESSAGE, t);
|
|
52
59
|
}
|
|
53
60
|
} else if (!displayName && !errors.displayName) {
|
|
54
61
|
errors.displayName = t('handle.validation.error', {
|
package/src/lib/threadHelpers.ts
CHANGED
|
@@ -22,9 +22,5 @@ export const collectPath = (
|
|
|
22
22
|
currentPath: PublicPost[] = [],
|
|
23
23
|
): PublicPost[] => {
|
|
24
24
|
if (!thread) return currentPath;
|
|
25
|
-
return [
|
|
26
|
-
...currentPath,
|
|
27
|
-
thread,
|
|
28
|
-
...collectPath(thread.children[0]),
|
|
29
|
-
];
|
|
25
|
+
return [...currentPath, thread, ...collectPath(thread.children[0])];
|
|
30
26
|
};
|
|
@@ -42,6 +42,11 @@ export function AdminConfigurationCommunity() {
|
|
|
42
42
|
translationPrefix="configuration.community.profileFields"
|
|
43
43
|
action="/admin/configuration/community/profile-fields"
|
|
44
44
|
/>
|
|
45
|
+
<ConfigMenuButton
|
|
46
|
+
translationPrefix="configuration.community.forbiddenUsernames"
|
|
47
|
+
action="/admin/configuration/community/forbidden-usernames"
|
|
48
|
+
testId="admin-community-forbidden-usernames"
|
|
49
|
+
/>
|
|
45
50
|
<ConfigMenuButton
|
|
46
51
|
translationPrefix="configuration.community.roles"
|
|
47
52
|
action="/admin/configuration/community/roles"
|
|
@@ -12,6 +12,10 @@ export function AdminDiagnostics() {
|
|
|
12
12
|
translationPrefix="diagnostics.email"
|
|
13
13
|
action="/admin/diagnostics/email"
|
|
14
14
|
/>
|
|
15
|
+
<ConfigMenuButton
|
|
16
|
+
translationPrefix="diagnostics.livekit"
|
|
17
|
+
action="/admin/diagnostics/livekit"
|
|
18
|
+
/>
|
|
15
19
|
<ConfigMenuButton
|
|
16
20
|
translationPrefix="diagnostics.logs"
|
|
17
21
|
action="/admin/diagnostics/logs"
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index';
|
|
2
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
3
|
+
import type { LivekitDiagnosis } from '@openpeepshq/common/types';
|
|
4
|
+
|
|
5
|
+
const checkLabelKey = {
|
|
6
|
+
url: 'diagnostics.livekit.url',
|
|
7
|
+
apiKey: 'diagnostics.livekit.apiKey',
|
|
8
|
+
apiSecret: 'diagnostics.livekit.apiSecret',
|
|
9
|
+
reachable: 'diagnostics.livekit.reachable',
|
|
10
|
+
} as const;
|
|
11
|
+
|
|
12
|
+
export const AdminDiagnosticsLivekit = () => {
|
|
13
|
+
const t = useT();
|
|
14
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
15
|
+
const diagnosisQuery = openpeepsApi.admin.useLivekitDiagnosis();
|
|
16
|
+
|
|
17
|
+
useSetPageHeader(t('diagnostics.livekit.title', { defaultValue: 'LiveKit' }));
|
|
18
|
+
|
|
19
|
+
const diagnosis = diagnosisQuery.data;
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className="space-y-4 p-4">
|
|
23
|
+
<p className="text-muted-foreground text-sm">
|
|
24
|
+
{t('diagnostics.livekit.description', {
|
|
25
|
+
defaultValue:
|
|
26
|
+
'Check whether jams can reach the LiveKit server. Missing or invalid credentials disable live jams.',
|
|
27
|
+
})}
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
<Button
|
|
31
|
+
variant="outline"
|
|
32
|
+
title={t('diagnostics.livekit.refresh', { defaultValue: 'Refresh' })}
|
|
33
|
+
action={() => void diagnosisQuery.refetch()}
|
|
34
|
+
>
|
|
35
|
+
{t('diagnostics.livekit.refresh', { defaultValue: 'Refresh' })}
|
|
36
|
+
</Button>
|
|
37
|
+
|
|
38
|
+
{diagnosisQuery.isPending ? (
|
|
39
|
+
<p className="text-muted-foreground text-sm">
|
|
40
|
+
{t('common.form.loading', { defaultValue: 'Loading…' })}
|
|
41
|
+
</p>
|
|
42
|
+
) : null}
|
|
43
|
+
|
|
44
|
+
{diagnosisQuery.isError ? (
|
|
45
|
+
<p className="text-error text-sm">
|
|
46
|
+
{t('diagnostics.livekit.loadError', {
|
|
47
|
+
defaultValue: 'Could not load the LiveKit diagnosis.',
|
|
48
|
+
})}
|
|
49
|
+
</p>
|
|
50
|
+
) : null}
|
|
51
|
+
|
|
52
|
+
{diagnosis ? <DiagnosisReport diagnosis={diagnosis} /> : null}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const DiagnosisReport = ({ diagnosis }: { diagnosis: LivekitDiagnosis }) => {
|
|
58
|
+
const t = useT();
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className="space-y-4">
|
|
62
|
+
<p
|
|
63
|
+
className={`font-medium ${diagnosis.connected ? 'text-success' : 'text-error'}`}
|
|
64
|
+
role="status"
|
|
65
|
+
>
|
|
66
|
+
{diagnosis.connected
|
|
67
|
+
? t('diagnostics.livekit.connected', { defaultValue: 'Connected' })
|
|
68
|
+
: t('diagnostics.livekit.notConnected', {
|
|
69
|
+
defaultValue: 'Not connected',
|
|
70
|
+
})}
|
|
71
|
+
</p>
|
|
72
|
+
|
|
73
|
+
<ul className="border-border divide-border divide-y rounded-md border">
|
|
74
|
+
{diagnosis.checks.map((check) => {
|
|
75
|
+
const status =
|
|
76
|
+
check.id === 'reachable'
|
|
77
|
+
? check.ok
|
|
78
|
+
? t('diagnostics.livekit.ok', { defaultValue: 'OK' })
|
|
79
|
+
: t('diagnostics.livekit.failed', { defaultValue: 'Failed' })
|
|
80
|
+
: check.ok
|
|
81
|
+
? t('diagnostics.livekit.set', { defaultValue: 'Set' })
|
|
82
|
+
: t('diagnostics.livekit.missing', {
|
|
83
|
+
defaultValue: 'Missing',
|
|
84
|
+
});
|
|
85
|
+
return (
|
|
86
|
+
<li
|
|
87
|
+
key={check.id}
|
|
88
|
+
className="flex items-start justify-between gap-4 p-3 text-sm"
|
|
89
|
+
>
|
|
90
|
+
<div>
|
|
91
|
+
<p className="font-medium">
|
|
92
|
+
{t(checkLabelKey[check.id], {
|
|
93
|
+
defaultValue: check.id,
|
|
94
|
+
})}
|
|
95
|
+
</p>
|
|
96
|
+
{check.id === 'url' && diagnosis.url ? (
|
|
97
|
+
<p className="text-muted-foreground font-mono text-xs">
|
|
98
|
+
{diagnosis.url}
|
|
99
|
+
</p>
|
|
100
|
+
) : null}
|
|
101
|
+
</div>
|
|
102
|
+
<span
|
|
103
|
+
className={`rounded px-2 py-0.5 text-xs font-medium ${check.ok ? 'bg-success/20 text-success' : 'bg-error/20 text-error'}`}
|
|
104
|
+
>
|
|
105
|
+
{status}
|
|
106
|
+
</span>
|
|
107
|
+
</li>
|
|
108
|
+
);
|
|
109
|
+
})}
|
|
110
|
+
</ul>
|
|
111
|
+
|
|
112
|
+
<p className="text-sm">
|
|
113
|
+
{t('diagnostics.livekit.recording', { defaultValue: 'Recording' })}
|
|
114
|
+
{': '}
|
|
115
|
+
<strong>
|
|
116
|
+
{diagnosis.recordingEnabled
|
|
117
|
+
? t('diagnostics.livekit.recordingOn', {
|
|
118
|
+
defaultValue: 'Enabled',
|
|
119
|
+
})
|
|
120
|
+
: t('diagnostics.livekit.recordingOff', {
|
|
121
|
+
defaultValue: 'Disabled',
|
|
122
|
+
})}
|
|
123
|
+
</strong>
|
|
124
|
+
</p>
|
|
125
|
+
|
|
126
|
+
{diagnosis.error ? (
|
|
127
|
+
<div>
|
|
128
|
+
<p className="font-medium">
|
|
129
|
+
{t('diagnostics.livekit.error', { defaultValue: 'Last error' })}
|
|
130
|
+
</p>
|
|
131
|
+
<pre className="bg-surface mt-2 overflow-x-auto whitespace-pre-wrap break-words rounded-md p-3 font-mono text-xs">
|
|
132
|
+
{diagnosis.error}
|
|
133
|
+
</pre>
|
|
134
|
+
</div>
|
|
135
|
+
) : null}
|
|
136
|
+
|
|
137
|
+
{!diagnosis.connected ? (
|
|
138
|
+
<p className="text-muted-foreground text-sm">
|
|
139
|
+
{t('diagnostics.livekit.envHint', {
|
|
140
|
+
defaultValue:
|
|
141
|
+
'Set JAMS_LIVEKIT_URL, JAMS_LIVEKIT_API_KEY, and JAMS_LIVEKIT_API_SECRET on the server, then refresh.',
|
|
142
|
+
})}
|
|
143
|
+
</p>
|
|
144
|
+
) : null}
|
|
145
|
+
</div>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { useMemo, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CheckCheck,
|
|
4
|
+
Copy,
|
|
5
|
+
MoreVertical,
|
|
6
|
+
Pencil,
|
|
7
|
+
QrCode,
|
|
8
|
+
Users,
|
|
9
|
+
X,
|
|
10
|
+
} from 'lucide-react';
|
|
3
11
|
import { inviteLinkMatchesQuery } from '@openpeepshq/common/lib';
|
|
4
12
|
import type { InviteLinkWithMeta } from '@openpeepshq/common/types';
|
|
5
13
|
import {
|
|
@@ -20,6 +28,7 @@ import {
|
|
|
20
28
|
PopupMenuButton,
|
|
21
29
|
} from '@openpeepshq/react-ui';
|
|
22
30
|
import { AdminInviteActions } from './components/AdminInviteActions';
|
|
31
|
+
import { EditInviteLinkModal } from './components/EditInviteLinkModal';
|
|
23
32
|
import {
|
|
24
33
|
communityQrLogoSrc,
|
|
25
34
|
downloadInviteQr,
|
|
@@ -153,6 +162,7 @@ function InvitesTablePopup({ invite }: { invite: InviteLinkWithMeta }) {
|
|
|
153
162
|
const activate = openpeepsApi.admin.activateInviteAction();
|
|
154
163
|
const deactivate = openpeepsApi.admin.deactivateInviteAction();
|
|
155
164
|
const [showInvited, setShowInvited] = useState(false);
|
|
165
|
+
const [showEdit, setShowEdit] = useState(false);
|
|
156
166
|
|
|
157
167
|
const active = invite.active && new Date(invite.expiresAt) > new Date();
|
|
158
168
|
const expired = new Date(invite.expiresAt) <= new Date();
|
|
@@ -170,6 +180,12 @@ function InvitesTablePopup({ invite }: { invite: InviteLinkWithMeta }) {
|
|
|
170
180
|
})}
|
|
171
181
|
action={() => setShowInvited(true)}
|
|
172
182
|
/>
|
|
183
|
+
<PopupMenuButton
|
|
184
|
+
icon={Pencil}
|
|
185
|
+
title={t('admin.invites.edit', { defaultValue: 'Edit' })}
|
|
186
|
+
text={t('admin.invites.edit', { defaultValue: 'Edit' })}
|
|
187
|
+
action={() => setShowEdit(true)}
|
|
188
|
+
/>
|
|
173
189
|
{active ? (
|
|
174
190
|
<>
|
|
175
191
|
<PopupMenuButton
|
|
@@ -219,6 +235,12 @@ function InvitesTablePopup({ invite }: { invite: InviteLinkWithMeta }) {
|
|
|
219
235
|
onClose={() => setShowInvited(false)}
|
|
220
236
|
/>
|
|
221
237
|
) : null}
|
|
238
|
+
{showEdit ? (
|
|
239
|
+
<EditInviteLinkModal
|
|
240
|
+
invite={invite}
|
|
241
|
+
onClose={() => setShowEdit(false)}
|
|
242
|
+
/>
|
|
243
|
+
) : null}
|
|
222
244
|
</>
|
|
223
245
|
);
|
|
224
246
|
}
|