@openpeepshq/react 0.7.0 → 0.8.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/configuration/ConfigurationCategory.js +3 -2
- package/dist/components/configuration/ConfigurationList.js +1 -1
- package/dist/components/form/LocationInput.js +1 -1
- 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/markdown/compileMarkdown.js +1 -0
- package/dist/components/navigation/FooterMobile.js +4 -3
- package/dist/components/navigation/HeaderMobile.js +5 -2
- package/dist/components/navigation/MobileMenuItem.d.ts +3 -1
- package/dist/components/navigation/MobileMenuItem.js +7 -2
- package/dist/components/navigation/NavWithTooltip.d.ts +9 -0
- package/dist/components/navigation/NavWithTooltip.js +4 -0
- package/dist/components/navigation/index.d.ts +2 -0
- package/dist/components/navigation/index.js +1 -0
- package/dist/components/navigation/sideBarNavLinkClass.d.ts +6 -4
- package/dist/components/navigation/sideBarNavLinkClass.js +6 -2
- package/dist/components/notifications/TypedNotification.js +46 -4
- package/dist/components/post/CompactReplyParent.js +5 -6
- package/dist/components/post/Markdown.d.ts +2 -2
- package/dist/components/post/Markdown.js +1 -1
- package/dist/components/post/TruncatedMarkdown.d.ts +27 -0
- package/dist/components/post/TruncatedMarkdown.js +37 -0
- package/dist/components/post/attachmentPreview.js +1 -1
- package/dist/components/post/helpers.d.ts +2 -2
- package/dist/components/post/helpers.js +3 -16
- package/dist/components/post/index.d.ts +2 -0
- package/dist/components/post/index.js +1 -0
- package/dist/components/post/pieces/Attachments.js +23 -17
- package/dist/components/post/pieces/EventLocation.js +14 -0
- package/dist/components/post/pieces/EventRsvpButton.js +39 -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/PollContent.js +8 -2
- 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/ArticleForm.js +1 -1
- package/dist/components/post/post-form/EventForm.js +33 -5
- package/dist/components/post/post-form/ResourceForm.d.ts +3 -1
- package/dist/components/post/post-form/ResourceForm.js +48 -7
- package/dist/components/post/post-form/VisibilitySelector.js +9 -3
- package/dist/components/post/types/Article.js +2 -3
- package/dist/components/post/types/Event.js +10 -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 +22 -13
- package/dist/components/post/types/event/ProfileEventRelationship.js +8 -0
- package/dist/components/post/types/resource/FullResource.js +3 -3
- 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 +8 -0
- package/dist/components/profile/Avatar.js +2 -2
- package/dist/components/profile/ProfileFromId.js +1 -1
- package/dist/components/resources/ResourceCard.d.ts +5 -1
- package/dist/components/resources/ResourceCard.js +29 -5
- package/dist/components/resources/ResourceCard.test.d.ts +1 -0
- package/dist/components/resources/ResourceCard.test.js +75 -0
- package/dist/components/resources/ResourceLibrary.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 +12 -2
- package/dist/hooks/events/useEventRsvp.js +59 -10
- package/dist/hooks/events/useEventsCalendar.d.ts +174 -76
- package/dist/hooks/groups/useNewGroup.js +22 -2
- package/dist/hooks/index.d.ts +5 -1
- package/dist/hooks/index.js +4 -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 +95 -41
- package/dist/hooks/posts/useResourceComposer.js +135 -27
- package/dist/hooks/posts/useShareMenu.d.ts +2 -0
- package/dist/hooks/posts/useShareMenu.js +7 -0
- package/dist/hooks/resources/useResourceLibrary.d.ts +177 -79
- package/dist/hooks/resources/useResourceLibrary.js +6 -2
- package/dist/hooks/settings/useNotificationPreferences.d.ts +1 -1
- package/dist/hooks/useWelcomePreview.d.ts +16 -0
- package/dist/hooks/useWelcomePreview.js +40 -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/navigation/menuItems.js +15 -0
- package/dist/navigation/targets.d.ts +2 -0
- 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/CommunityMarkdownPage.js +2 -1
- 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/auth/Register.js +33 -9
- package/dist/pages/conversations/Show.js +11 -0
- 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/resources/Edit.js +3 -3
- package/dist/pages/resources/New.js +2 -2
- package/dist/pages/settings/Account.js +30 -2
- package/dist/pages/settings/PublicProfile.js +15 -3
- package/dist/pwa/sw.d.ts +0 -1
- package/dist/react-native.d.ts +1 -0
- package/dist/react-native.js +1 -0
- package/dist/stores/newPosts.d.ts +4 -2
- package/dist/stores/newPosts.js +6 -1
- package/package.json +12 -7
- 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/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/markdown/compileMarkdown.ts +1 -0
- package/src/components/navigation/FooterMobile.tsx +41 -33
- package/src/components/navigation/HeaderMobile.tsx +55 -41
- package/src/components/navigation/MobileMenuItem.tsx +15 -2
- package/src/components/navigation/NavWithTooltip.tsx +26 -0
- package/src/components/navigation/index.ts +2 -0
- package/src/components/navigation/sideBarNavLinkClass.ts +9 -6
- package/src/components/notifications/TypedNotification.tsx +81 -9
- package/src/components/post/CompactReplyParent.tsx +17 -10
- package/src/components/post/Markdown.tsx +8 -2
- package/src/components/post/TruncatedMarkdown.tsx +91 -0
- package/src/components/post/attachmentPreview.ts +1 -3
- package/src/components/post/helpers.ts +4 -18
- package/src/components/post/index.ts +2 -0
- package/src/components/post/pieces/Attachments.tsx +93 -78
- package/src/components/post/pieces/EventLocation.tsx +27 -0
- package/src/components/post/pieces/EventRsvpButton.tsx +110 -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/PollContent.tsx +8 -2
- package/src/components/post/pieces/PostActions.tsx +73 -42
- package/src/components/post/pieces/ShareMenu.tsx +67 -9
- package/src/components/post/post-form/ArticleForm.tsx +1 -1
- package/src/components/post/post-form/EventForm.tsx +69 -15
- package/src/components/post/post-form/ResourceForm.tsx +132 -4
- package/src/components/post/post-form/VisibilitySelector.tsx +12 -5
- package/src/components/post/types/Article.tsx +6 -6
- package/src/components/post/types/Event.tsx +68 -7
- 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 +48 -35
- 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/post/types/resource/FullResource.tsx +9 -1
- 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 +45 -0
- package/src/components/profile/Avatar.tsx +6 -2
- package/src/components/profile/ProfileFromId.tsx +1 -5
- package/src/components/resources/ResourceCard.tsx +68 -11
- package/src/components/resources/ResourceLibrary.tsx +2 -2
- 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 +69 -13
- package/src/hooks/groups/useNewGroup.ts +28 -3
- package/src/hooks/index.ts +8 -1
- package/src/hooks/jams/useCanDiagnoseLivekit.ts +5 -0
- package/src/hooks/posts/useResourceComposer.ts +165 -39
- package/src/hooks/posts/useShareMenu.ts +9 -0
- package/src/hooks/resources/useResourceLibrary.ts +6 -2
- package/src/hooks/useWelcomePreview.ts +61 -0
- package/src/i18n/I18nProvider.tsx +1 -4
- package/src/lib/groupFormErrors.ts +9 -2
- package/src/lib/threadHelpers.ts +1 -5
- package/src/navigation/menuItems.ts +16 -0
- package/src/navigation/targets.ts +2 -0
- 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/CommunityMarkdownPage.tsx +5 -1
- package/src/pages/admin/community/CommunityRoles.tsx +2 -2
- package/src/pages/admin/components/EditInviteLinkModal.tsx +263 -0
- package/src/pages/auth/Register.tsx +45 -4
- package/src/pages/conversations/Show.tsx +11 -0
- package/src/pages/index.ts +3 -0
- package/src/pages/jams/Index.tsx +2 -6
- package/src/pages/resources/Edit.tsx +3 -2
- package/src/pages/resources/New.tsx +6 -1
- package/src/pages/settings/Account.tsx +51 -1
- 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 +1 -0
- 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
|
@@ -8,12 +8,16 @@ import {
|
|
|
8
8
|
import { useOpenpeeps } from '../../contexts/openpeeps';
|
|
9
9
|
import { useFeedListParams } from '../useResolvedFeedFormat';
|
|
10
10
|
|
|
11
|
-
export const useResourceLibrary = (groupId?: string) => {
|
|
11
|
+
export const useResourceLibrary = (groupId?: string, ungrouped?: boolean) => {
|
|
12
12
|
const { openpeepsApi } = useOpenpeeps();
|
|
13
13
|
const params = useFeedListParams({ format: 'linear' });
|
|
14
14
|
const query = openpeepsApi.usePostsByType('resource', {
|
|
15
15
|
...params,
|
|
16
|
-
...(groupId
|
|
16
|
+
...(groupId
|
|
17
|
+
? { groupId }
|
|
18
|
+
: ungrouped
|
|
19
|
+
? { ungrouped: 'true' as const }
|
|
20
|
+
: {}),
|
|
17
21
|
});
|
|
18
22
|
const bookmarkedIds = openpeepsApi.useCurrentProfileBookmarkedIds();
|
|
19
23
|
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
/** Plain-text excerpt (image-stripped) for non-markdown consumers / fallback. */
|
|
15
|
+
description: string;
|
|
16
|
+
/** Raw welcome markdown (image-bearing) for markdown rendering + overlays. */
|
|
17
|
+
markdown: string;
|
|
18
|
+
imageUrl?: string;
|
|
19
|
+
imageFit: 'cover' | 'contain';
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Shared welcome-link card. Native passes the device color scheme because
|
|
24
|
+
* `getTheme` cannot read it from `window` there.
|
|
25
|
+
*/
|
|
26
|
+
export const useWelcomePreview = (
|
|
27
|
+
systemScheme?: 'dark' | 'light',
|
|
28
|
+
): WelcomePreviewContent => {
|
|
29
|
+
const t = useT();
|
|
30
|
+
const serverInfo = useServerInfo();
|
|
31
|
+
const profileSettings = useCurrentProfileSettings();
|
|
32
|
+
const config = serverInfo.communityConfig;
|
|
33
|
+
const configured = config.content.welcomePage?.trim() ?? '';
|
|
34
|
+
const markdownImage = firstMarkdownImage(configured);
|
|
35
|
+
const logo = (
|
|
36
|
+
systemScheme
|
|
37
|
+
? getTheme(config, profileSettings, systemScheme)
|
|
38
|
+
: getTheme(config, profileSettings)
|
|
39
|
+
).logoSmall;
|
|
40
|
+
const label = t('welcome.previewLabel', { defaultValue: 'Welcome page' });
|
|
41
|
+
const name = config.info.name.trim();
|
|
42
|
+
const title = name
|
|
43
|
+
? t('welcome.heading', {
|
|
44
|
+
name,
|
|
45
|
+
defaultValue: 'Welcome to {{name}}',
|
|
46
|
+
})
|
|
47
|
+
: label;
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
eyebrow: title === label ? undefined : label,
|
|
51
|
+
title,
|
|
52
|
+
description: configured
|
|
53
|
+
? welcomePreviewExcerpt(configured)
|
|
54
|
+
: t('welcome.defaultIntro', {
|
|
55
|
+
defaultValue: 'Welcome to this community, hosted on AllPeep.',
|
|
56
|
+
}),
|
|
57
|
+
markdown: configured,
|
|
58
|
+
imageUrl: markdownImage || logo || undefined,
|
|
59
|
+
imageFit: markdownImage ? 'cover' : 'contain',
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -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
|
};
|
|
@@ -5,6 +5,8 @@ export type MainMenuCapabilities = {
|
|
|
5
5
|
showAdmin: boolean;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
const navTooltip = (id: string) => `navigation.tooltips.${id}` as const;
|
|
9
|
+
|
|
8
10
|
/** Default main-menu targets for hosts to render with their own icons/labels. */
|
|
9
11
|
export const buildMainNavItems = (caps: MainMenuCapabilities): NavItemDef[] => {
|
|
10
12
|
const items: NavItemDef[] = [
|
|
@@ -12,24 +14,28 @@ export const buildMainNavItems = (caps: MainMenuCapabilities): NavItemDef[] => {
|
|
|
12
14
|
id: 'community',
|
|
13
15
|
target: { type: 'feed', feed: 'local' },
|
|
14
16
|
labelKey: 'navigation.community',
|
|
17
|
+
tooltipKey: navTooltip('community'),
|
|
15
18
|
icon: 'Home',
|
|
16
19
|
},
|
|
17
20
|
{
|
|
18
21
|
id: 'welcome',
|
|
19
22
|
target: { type: 'welcome' },
|
|
20
23
|
labelKey: 'navigation.goToWelcomePage',
|
|
24
|
+
tooltipKey: navTooltip('welcome'),
|
|
21
25
|
icon: 'BookCheck',
|
|
22
26
|
},
|
|
23
27
|
{
|
|
24
28
|
id: 'explore',
|
|
25
29
|
target: { type: 'explore' },
|
|
26
30
|
labelKey: 'navigation.explore',
|
|
31
|
+
tooltipKey: navTooltip('explore'),
|
|
27
32
|
icon: 'Search',
|
|
28
33
|
},
|
|
29
34
|
{
|
|
30
35
|
id: 'myFeed',
|
|
31
36
|
target: { type: 'feed', feed: 'my' },
|
|
32
37
|
labelKey: 'navigation.myFeed',
|
|
38
|
+
tooltipKey: navTooltip('myFeed'),
|
|
33
39
|
icon: 'Newspaper',
|
|
34
40
|
},
|
|
35
41
|
];
|
|
@@ -38,6 +44,7 @@ export const buildMainNavItems = (caps: MainMenuCapabilities): NavItemDef[] => {
|
|
|
38
44
|
id: 'jams',
|
|
39
45
|
target: { type: 'jams' },
|
|
40
46
|
labelKey: 'navigation.jams',
|
|
47
|
+
tooltipKey: navTooltip('jams'),
|
|
41
48
|
icon: 'PhoneCall',
|
|
42
49
|
});
|
|
43
50
|
}
|
|
@@ -46,48 +53,56 @@ export const buildMainNavItems = (caps: MainMenuCapabilities): NavItemDef[] => {
|
|
|
46
53
|
id: 'groups',
|
|
47
54
|
target: { type: 'groups' },
|
|
48
55
|
labelKey: 'navigation.groups',
|
|
56
|
+
tooltipKey: navTooltip('groups'),
|
|
49
57
|
icon: 'Users',
|
|
50
58
|
},
|
|
51
59
|
{
|
|
52
60
|
id: 'events',
|
|
53
61
|
target: { type: 'events' },
|
|
54
62
|
labelKey: 'navigation.events',
|
|
63
|
+
tooltipKey: navTooltip('events'),
|
|
55
64
|
icon: 'CalendarDays',
|
|
56
65
|
},
|
|
57
66
|
{
|
|
58
67
|
id: 'articles',
|
|
59
68
|
target: { type: 'articles' },
|
|
60
69
|
labelKey: 'navigation.articles',
|
|
70
|
+
tooltipKey: navTooltip('articles'),
|
|
61
71
|
icon: 'ScrollText',
|
|
62
72
|
},
|
|
63
73
|
{
|
|
64
74
|
id: 'resources',
|
|
65
75
|
target: { type: 'resources' },
|
|
66
76
|
labelKey: 'navigation.resources',
|
|
77
|
+
tooltipKey: navTooltip('resources'),
|
|
67
78
|
icon: 'Library',
|
|
68
79
|
},
|
|
69
80
|
{
|
|
70
81
|
id: 'messages',
|
|
71
82
|
target: { type: 'conversation' },
|
|
72
83
|
labelKey: 'navigation.messages',
|
|
84
|
+
tooltipKey: navTooltip('messages'),
|
|
73
85
|
icon: 'MessageSquareText',
|
|
74
86
|
},
|
|
75
87
|
{
|
|
76
88
|
id: 'members',
|
|
77
89
|
target: { type: 'members' },
|
|
78
90
|
labelKey: 'navigation.members',
|
|
91
|
+
tooltipKey: navTooltip('members'),
|
|
79
92
|
icon: 'BookUser',
|
|
80
93
|
},
|
|
81
94
|
{
|
|
82
95
|
id: 'bookmarks',
|
|
83
96
|
target: { type: 'feed', feed: 'bookmarks' },
|
|
84
97
|
labelKey: 'navigation.bookmarks',
|
|
98
|
+
tooltipKey: navTooltip('bookmarks'),
|
|
85
99
|
icon: 'Bookmark',
|
|
86
100
|
},
|
|
87
101
|
{
|
|
88
102
|
id: 'settings',
|
|
89
103
|
target: { type: 'settings' },
|
|
90
104
|
labelKey: 'navigation.settings',
|
|
105
|
+
tooltipKey: navTooltip('settings'),
|
|
91
106
|
icon: 'Settings',
|
|
92
107
|
},
|
|
93
108
|
);
|
|
@@ -96,6 +111,7 @@ export const buildMainNavItems = (caps: MainMenuCapabilities): NavItemDef[] => {
|
|
|
96
111
|
id: 'admin',
|
|
97
112
|
target: { type: 'admin' },
|
|
98
113
|
labelKey: 'navigation.administration',
|
|
114
|
+
tooltipKey: navTooltip('administration'),
|
|
99
115
|
icon: 'Bolt',
|
|
100
116
|
});
|
|
101
117
|
}
|
|
@@ -49,6 +49,8 @@ export type NavItemDef = {
|
|
|
49
49
|
id: string;
|
|
50
50
|
target: NavTarget;
|
|
51
51
|
labelKey: string;
|
|
52
|
+
/** i18n key describing what happens when the item is activated. */
|
|
53
|
+
tooltipKey?: string;
|
|
52
54
|
/** Lucide (or similar) icon component name — host maps to actual icon. */
|
|
53
55
|
icon?: string;
|
|
54
56
|
end?: boolean;
|
|
@@ -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
|
}
|