@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { ZodObject, ZodArray } from '@openpeepshq/common/zod';
|
|
3
|
+
import { ZodObject, ZodArray, } from '@openpeepshq/common/zod';
|
|
4
4
|
import { capitalizeFirstLetter } from '@openpeepshq/common';
|
|
5
5
|
import { ExpandableBox } from '@openpeepshq/react-ui';
|
|
6
6
|
import { useT } from '../../i18n/index.js';
|
|
@@ -57,5 +57,6 @@ export function ConfigurationCategory({ schema, config, defaults, path = [], val
|
|
|
57
57
|
}
|
|
58
58
|
return (_jsx(ConfigurationValueEditor, { schema: field.def, path: field.path.map(String), config: config[field.key], defaults: defaults[field.key], value: value[field.key], onChange: (v) => updateField(String(field.key), v), disabled: disabled }, String(field.key)));
|
|
59
59
|
}) }));
|
|
60
|
-
return (_jsxs("div", { className: collapsible ? 'mt-4 pl-4' : '', children: [collapsible && (_jsx("p", { className: dirty ? 'font-bold' : '', children: pathName ||
|
|
60
|
+
return (_jsxs("div", { className: collapsible ? 'mt-4 pl-4' : '', children: [collapsible && (_jsx("p", { className: dirty ? 'font-bold' : '', children: pathName ||
|
|
61
|
+
t('configuration.title', { defaultValue: 'Configuration' }) })), body] }));
|
|
61
62
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from 'react';
|
|
3
|
-
import { z, ZodArray } from '@openpeepshq/common/zod';
|
|
3
|
+
import { z, ZodArray, } from '@openpeepshq/common/zod';
|
|
4
4
|
import { Minus, Plus } from 'lucide-react';
|
|
5
5
|
import { useT } from '../../i18n/index.js';
|
|
6
6
|
import { defaultFromSchema, equal, unwrap, } from '../../lib/configuration/helpers.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { MapPin } from 'lucide-react';
|
|
4
|
-
import { Button, Input, Label, LoadingSpinner, cn } from '@openpeepshq/react-ui';
|
|
4
|
+
import { Button, Input, Label, LoadingSpinner, cn, } from '@openpeepshq/react-ui';
|
|
5
5
|
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
6
6
|
import { useT } from '../../i18n/index.js';
|
|
7
7
|
/**
|
|
@@ -7,7 +7,7 @@ export const JamCapacityGate = ({ jamPost, reason, eventName, occurrence, }) =>
|
|
|
7
7
|
const t = useT();
|
|
8
8
|
const me = useCurrentProfile();
|
|
9
9
|
const eventData = jamPost.data?.type === 'event' ? jamPost.data : undefined;
|
|
10
|
-
const showRsvp = reason === 'rsvp-required' &&
|
|
10
|
+
const showRsvp = (reason === 'rsvp-required' || reason === 'full') &&
|
|
11
11
|
!!me &&
|
|
12
12
|
!!eventData &&
|
|
13
13
|
isCapacityEvent(eventData);
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { RoomAudioRenderer, isTrackReference, useRoomContext, useTracks, } from '@livekit/components-react';
|
|
3
3
|
import { Track } from 'livekit-client';
|
|
4
4
|
import { useJamObserver } from './JamContext.js';
|
|
5
|
+
import { useDropLateAudio } from './dropLateAudio.js';
|
|
5
6
|
import { JamParticipantConference } from './JamParticipantConference.js';
|
|
6
7
|
import { JamEventsProvider } from './JamEventsContext.js';
|
|
7
8
|
import { JamObserverShell } from './JamObserverShell.js';
|
|
@@ -21,6 +22,7 @@ function JamObserverConference() {
|
|
|
21
22
|
}
|
|
22
23
|
function JamObserverRoom() {
|
|
23
24
|
const room = useRoomContext();
|
|
25
|
+
useDropLateAudio(room);
|
|
24
26
|
return (_jsxs(JamEventsProvider, { room: room, children: [_jsx(JamObserverConference, {}), _jsx(RoomAudioRenderer, {})] }));
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
@@ -13,6 +13,7 @@ import { JamPeopleDrawer } from './JamPeopleDrawer.js';
|
|
|
13
13
|
import { JamNetworkQuality, JamRecordingIndicator } from './JamRoomIndicators.js';
|
|
14
14
|
import { JamVideoLayout } from './JamVideoLayout.js';
|
|
15
15
|
import { useJamLocalSettings } from './jamLocalSettings.js';
|
|
16
|
+
import { useDropLateAudio } from './dropLateAudio.js';
|
|
16
17
|
function JamParticipantConferenceInner() {
|
|
17
18
|
const room = useRoomContext();
|
|
18
19
|
const { jamEvent } = useJamContext();
|
|
@@ -79,5 +80,6 @@ function JamParticipantConferenceInner() {
|
|
|
79
80
|
*/
|
|
80
81
|
export function JamParticipantConference() {
|
|
81
82
|
const room = useRoomContext();
|
|
83
|
+
useDropLateAudio(room);
|
|
82
84
|
return (_jsxs(JamEventsProvider, { room: room, children: [_jsx(JamParticipantConferenceInner, {}), _jsx(RoomAudioRenderer, {})] }));
|
|
83
85
|
}
|
|
@@ -10,6 +10,7 @@ import { JamLobby } from './JamLobby.js';
|
|
|
10
10
|
import { JamCapacityGate } from './JamCapacityGate.js';
|
|
11
11
|
import { JamRequestJoin } from './JamRequestJoin.js';
|
|
12
12
|
import { JamVideoCall } from './JamVideoCall.js';
|
|
13
|
+
import { LivekitUnavailableNotice } from './LivekitUnavailableNotice.js';
|
|
13
14
|
/**
|
|
14
15
|
* Top-level React port of `core/jams/room/Room.svelte`. Decides whether to
|
|
15
16
|
* render the lobby, the live video call, an "access denied / jam not active"
|
|
@@ -37,9 +38,7 @@ function JamRoomInner() {
|
|
|
37
38
|
return () => document.removeEventListener('visibilitychange', onVisibility);
|
|
38
39
|
}, [reconnectPrefs, tryReconnect]);
|
|
39
40
|
if (!livekitEnabled) {
|
|
40
|
-
return (_jsx("div", { className: "mx-auto flex h-full w-full items-center justify-center p-4", children: _jsxs("div", { className: "w-full max-w-md space-y-5 text-center", children: [_jsx("h3", { className: "text-lg", children: jamEvent.name }), _jsxs("div", { className: "bg-surface flex w-full flex-col items-center justify-center space-y-3 rounded border p-4", children: [_jsx("
|
|
41
|
-
defaultValue: 'Jams are unavailable because LiveKit is not connected.',
|
|
42
|
-
}) }), _jsx("a", { href: `/posts/${jamPost.id}`, className: "text-primary text-sm underline", children: t('jams.room.viewEvent', { defaultValue: 'View event' }) })] })] }) }));
|
|
41
|
+
return (_jsx("div", { className: "mx-auto flex h-full w-full items-center justify-center p-4", children: _jsxs("div", { className: "w-full max-w-md space-y-5 text-center", children: [_jsx("h3", { className: "text-lg", children: jamEvent.name }), _jsxs("div", { className: "bg-surface flex w-full flex-col items-center justify-center space-y-3 rounded border p-4", children: [_jsx(LivekitUnavailableNotice, {}), _jsx("a", { href: `/posts/${jamPost.id}`, className: "text-primary text-sm underline", children: t('jams.room.viewEvent', { defaultValue: 'View event' }) })] })] }) }));
|
|
43
42
|
}
|
|
44
43
|
if (connection) {
|
|
45
44
|
return (_jsx(JamVideoCall, { token: connection.token, serverUrl: connection.livekitUrl, audio: connection.audio, video: connection.video, onDisconnected: handleDisconnected }));
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { ChevronDown, ChevronRight, PhoneOff } from 'lucide-react';
|
|
4
4
|
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
5
5
|
import { useT } from '../../i18n/index.js';
|
|
6
6
|
import { AccessDeniedLoader } from '../layout/AccessDeniedLoader.js';
|
|
7
7
|
import { CardEvent } from '../post/types/event/CardEvent.js';
|
|
8
|
+
import { LivekitUnavailableNotice } from './LivekitUnavailableNotice.js';
|
|
8
9
|
export function LiveJamsSection() {
|
|
9
10
|
const t = useT();
|
|
10
11
|
const { openpeepsApi } = useOpenpeeps();
|
|
11
12
|
const liveJamsQuery = openpeepsApi.useJams();
|
|
12
13
|
const [open, setOpen] = useState(true);
|
|
13
|
-
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (!liveJamsQuery.isError)
|
|
16
|
+
return;
|
|
17
|
+
console.error('[openpeeps] Live jams failed to load. Community admins can diagnose LiveKit at /admin/diagnostics/livekit.', liveJamsQuery.error);
|
|
18
|
+
}, [liveJamsQuery.isError, liveJamsQuery.error]);
|
|
19
|
+
return (_jsxs("section", { className: "mb-8", children: [_jsxs("button", { type: "button", className: "mb-3 flex items-center gap-3 px-1", onClick: () => setOpen((value) => !value), children: [open ? (_jsx(ChevronDown, { className: "size-5" })) : (_jsx(ChevronRight, { className: "size-5" })), _jsx("h2", { className: "text-lg font-semibold", children: t('jams.liveJams', { defaultValue: 'Live jams' }) })] }), open ? (_jsx(AccessDeniedLoader, { queries: [liveJamsQuery], fallbackError: _jsx(LivekitUnavailableNotice, { className: "text-destructive text-sm" }), children: (liveJamsQuery.data ?? []).length ? (_jsx("div", { role: "feed", className: "grid grid-cols-1 gap-2 md:grid-cols-2 md:gap-4", children: (liveJamsQuery.data ?? []).map((jam) => (_jsx(CardEvent, { post: jam, showEventDate: false }, jam.id))) })) : (_jsxs("div", { className: "flex h-72 w-full flex-col items-center justify-center gap-y-6", children: [_jsx(PhoneOff, { size: 60, className: "text-muted-foreground" }), _jsx("p", { children: t('jams.noLiveJams', {
|
|
14
20
|
defaultValue: 'No live jams right now',
|
|
15
21
|
}) })] })) })) : null] }));
|
|
16
22
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const LIVEKIT_DIAGNOSTICS_PATH = "/admin/diagnostics/livekit";
|
|
2
|
+
/**
|
|
3
|
+
* Shown when live jams are off or the live list fails. Only admins who can open
|
|
4
|
+
* Diagnostics get a link to the LiveKit diagnosis page; others just see the
|
|
5
|
+
* message (the failure itself is logged where the query is consumed).
|
|
6
|
+
*/
|
|
7
|
+
export declare const LivekitUnavailableNotice: ({ className, }: {
|
|
8
|
+
className?: string;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import { useT } from '../../i18n/index.js';
|
|
4
|
+
import { useCanDiagnoseLivekit } from '../../hooks/jams/useCanDiagnoseLivekit.js';
|
|
5
|
+
export const LIVEKIT_DIAGNOSTICS_PATH = '/admin/diagnostics/livekit';
|
|
6
|
+
/**
|
|
7
|
+
* Shown when live jams are off or the live list fails. Only admins who can open
|
|
8
|
+
* Diagnostics get a link to the LiveKit diagnosis page; others just see the
|
|
9
|
+
* message (the failure itself is logged where the query is consumed).
|
|
10
|
+
*/
|
|
11
|
+
export const LivekitUnavailableNotice = ({ className = 'text-destructive text-sm', }) => {
|
|
12
|
+
const t = useT();
|
|
13
|
+
const canDiagnose = useCanDiagnoseLivekit();
|
|
14
|
+
return (_jsxs("p", { role: "status", className: className, children: [t('jams.unavailable.message', {
|
|
15
|
+
defaultValue: 'Jams are unavailable because LiveKit is not connected.',
|
|
16
|
+
}), canDiagnose ? (_jsxs(_Fragment, { children: [' ', _jsx(Link, { to: LIVEKIT_DIAGNOSTICS_PATH, className: "text-primary underline", children: t('jams.unavailable.diagnose', {
|
|
17
|
+
defaultValue: 'Diagnose LiveKit',
|
|
18
|
+
}) })] })) : null] }));
|
|
19
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Room } from 'livekit-client';
|
|
2
|
+
type StampedFrame = {
|
|
3
|
+
timestamp: number;
|
|
4
|
+
};
|
|
5
|
+
type EncodedReceiver = RTCRtpReceiver & {
|
|
6
|
+
createEncodedStreams?: () => {
|
|
7
|
+
readable: ReadableStream<StampedFrame>;
|
|
8
|
+
writable: WritableStream<StampedFrame>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
/** Opus frames are 20ms apart. The median gap is the receiver clock. */
|
|
12
|
+
export declare const audioClockPerMs: (deltas: number[]) => number | undefined;
|
|
13
|
+
export declare const isLateAudioFrame: (timestamp: number, expectedTimestamp: number, clockPerMs: number) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Drop microphone frames that arrive already late, so Chromium's jitter
|
|
16
|
+
* buffer never builds the backlog it later time-stretches.
|
|
17
|
+
* Returns when the receiver has no encoded-stream hook or it was already taken.
|
|
18
|
+
*/
|
|
19
|
+
export declare const installLateAudioDrop: (receiver: EncodedReceiver, now?: () => number) => Promise<void> | undefined;
|
|
20
|
+
/** Skip late remote microphone audio for everyone in this room. */
|
|
21
|
+
export declare const useDropLateAudio: (room: Room) => void;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { RoomEvent, Track, isRemoteTrack, } from 'livekit-client';
|
|
3
|
+
const FRAME_MS = 20;
|
|
4
|
+
const CALIBRATION_DELTAS = 3;
|
|
5
|
+
const WARMUP_FRAMES = 8;
|
|
6
|
+
/**
|
|
7
|
+
* Audio older than this is the backlog Chromium otherwise holds and then
|
|
8
|
+
* plays faster until it matches the person speaking now.
|
|
9
|
+
*/
|
|
10
|
+
const LATE_MS = 200;
|
|
11
|
+
/** Opus frames are 20ms apart. The median gap is the receiver clock. */
|
|
12
|
+
export const audioClockPerMs = (deltas) => {
|
|
13
|
+
if (deltas.length < CALIBRATION_DELTAS)
|
|
14
|
+
return undefined;
|
|
15
|
+
const sorted = [...deltas].sort((a, b) => a - b);
|
|
16
|
+
const mid = sorted[Math.floor(sorted.length / 2)];
|
|
17
|
+
if (mid === undefined || mid <= 0)
|
|
18
|
+
return undefined;
|
|
19
|
+
return mid / FRAME_MS;
|
|
20
|
+
};
|
|
21
|
+
export const isLateAudioFrame = (timestamp, expectedTimestamp, clockPerMs) => clockPerMs > 0 && (expectedTimestamp - timestamp) / clockPerMs > LATE_MS;
|
|
22
|
+
/**
|
|
23
|
+
* Drop microphone frames that arrive already late, so Chromium's jitter
|
|
24
|
+
* buffer never builds the backlog it later time-stretches.
|
|
25
|
+
* Returns when the receiver has no encoded-stream hook or it was already taken.
|
|
26
|
+
*/
|
|
27
|
+
export const installLateAudioDrop = (receiver, now = () => performance.now()) => {
|
|
28
|
+
if (!receiver.createEncodedStreams)
|
|
29
|
+
return undefined;
|
|
30
|
+
let readable;
|
|
31
|
+
let writable;
|
|
32
|
+
try {
|
|
33
|
+
({ readable, writable } = receiver.createEncodedStreams());
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
let anchorTimestamp;
|
|
39
|
+
let anchorWall;
|
|
40
|
+
let lastTimestamp;
|
|
41
|
+
let seen = 0;
|
|
42
|
+
const deltas = [];
|
|
43
|
+
let clockPerMs;
|
|
44
|
+
return readable
|
|
45
|
+
.pipeThrough(new TransformStream({
|
|
46
|
+
transform: (frame, controller) => {
|
|
47
|
+
let forwarded = false;
|
|
48
|
+
const forward = () => {
|
|
49
|
+
if (forwarded)
|
|
50
|
+
return;
|
|
51
|
+
forwarded = true;
|
|
52
|
+
controller.enqueue(frame);
|
|
53
|
+
};
|
|
54
|
+
try {
|
|
55
|
+
const wall = now();
|
|
56
|
+
if (lastTimestamp !== undefined &&
|
|
57
|
+
deltas.length < CALIBRATION_DELTAS) {
|
|
58
|
+
deltas.push(frame.timestamp - lastTimestamp);
|
|
59
|
+
clockPerMs = audioClockPerMs(deltas);
|
|
60
|
+
}
|
|
61
|
+
if (anchorTimestamp === undefined) {
|
|
62
|
+
anchorTimestamp = frame.timestamp;
|
|
63
|
+
anchorWall = wall;
|
|
64
|
+
}
|
|
65
|
+
lastTimestamp = frame.timestamp;
|
|
66
|
+
seen += 1;
|
|
67
|
+
const expected = anchorTimestamp +
|
|
68
|
+
(wall - (anchorWall ?? wall)) * (clockPerMs ?? 0);
|
|
69
|
+
if (clockPerMs !== undefined &&
|
|
70
|
+
seen > WARMUP_FRAMES &&
|
|
71
|
+
isLateAudioFrame(frame.timestamp, expected, clockPerMs)) {
|
|
72
|
+
// Closing a skipped frame tears the receiver down and the
|
|
73
|
+
// rest of the call goes silent.
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
forward();
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
forward();
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
}))
|
|
83
|
+
.pipeTo(writable)
|
|
84
|
+
.catch(() => undefined);
|
|
85
|
+
};
|
|
86
|
+
/** Skip late remote microphone audio for everyone in this room. */
|
|
87
|
+
export const useDropLateAudio = (room) => {
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const installed = new WeakSet();
|
|
90
|
+
const install = (track, source) => {
|
|
91
|
+
if (track.kind !== Track.Kind.Audio ||
|
|
92
|
+
source !== Track.Source.Microphone ||
|
|
93
|
+
!track.receiver ||
|
|
94
|
+
installed.has(track.receiver)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
installed.add(track.receiver);
|
|
98
|
+
installLateAudioDrop(track.receiver);
|
|
99
|
+
};
|
|
100
|
+
room.remoteParticipants.forEach((participant) => {
|
|
101
|
+
participant.audioTrackPublications.forEach((publication) => {
|
|
102
|
+
if (isRemoteTrack(publication.track)) {
|
|
103
|
+
install(publication.track, publication.source);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
const onSubscribed = (track, publication) => {
|
|
108
|
+
install(track, publication.source);
|
|
109
|
+
};
|
|
110
|
+
room.on(RoomEvent.TrackSubscribed, onSubscribed);
|
|
111
|
+
return () => {
|
|
112
|
+
room.off(RoomEvent.TrackSubscribed, onSubscribed);
|
|
113
|
+
};
|
|
114
|
+
}, [room]);
|
|
115
|
+
};
|
|
@@ -21,4 +21,5 @@ export { JamDetailsDrawer } from './JamDetailsDrawer';
|
|
|
21
21
|
export { JamEventsProvider, useJamEventsContext } from './JamEventsContext';
|
|
22
22
|
export { JamGuestForm } from './JamGuestForm';
|
|
23
23
|
export { LiveJamsSection } from './LiveJamsSection';
|
|
24
|
+
export { LivekitUnavailableNotice } from './LivekitUnavailableNotice';
|
|
24
25
|
export { defaultRoomOptions, JAM_EMOJIS } from './constants';
|
|
@@ -16,4 +16,5 @@ export { JamDetailsDrawer } from './JamDetailsDrawer.js';
|
|
|
16
16
|
export { JamEventsProvider, useJamEventsContext } from './JamEventsContext.js';
|
|
17
17
|
export { JamGuestForm } from './JamGuestForm.js';
|
|
18
18
|
export { LiveJamsSection } from './LiveJamsSection.js';
|
|
19
|
+
export { LivekitUnavailableNotice } from './LivekitUnavailableNotice.js';
|
|
19
20
|
export { defaultRoomOptions, JAM_EMOJIS } from './constants.js';
|
|
@@ -35,6 +35,7 @@ export const compileMarkdownToHtml = (source, options = {}) => {
|
|
|
35
35
|
}
|
|
36
36
|
if (isExternalLink(cleaned, origin) || opensNewTab) {
|
|
37
37
|
out += ' target="_blank" rel="noopener noreferrer"';
|
|
38
|
+
out += ' class="external-link"';
|
|
38
39
|
}
|
|
39
40
|
out += `>${text}</a>`;
|
|
40
41
|
return out;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Bell, Home, Newspaper, PlusSquare, Users } from 'lucide-react';
|
|
3
|
+
import { TooltipProvider } from '@openpeepshq/react-ui';
|
|
3
4
|
import { MobileMenuItem } from './MobileMenuItem.js';
|
|
4
5
|
import { useHrefOf } from '../../contexts/router/index.js';
|
|
5
6
|
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
@@ -9,7 +10,7 @@ export function FooterMobile({ onNewPost } = {}) {
|
|
|
9
10
|
const hrefOf = useHrefOf();
|
|
10
11
|
const { openpeepsApi } = useOpenpeeps();
|
|
11
12
|
const notificationStats = openpeepsApi.useCurrentProfileNotificationStats();
|
|
12
|
-
return (_jsxs("nav", { "aria-label": t('navigation.primaryMobile', {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
return (_jsx(TooltipProvider, { delayDuration: 300, children: _jsxs("nav", { "aria-label": t('navigation.primaryMobile', {
|
|
14
|
+
defaultValue: 'Primary',
|
|
15
|
+
}), className: "bg-surface flex h-20 w-full items-center justify-evenly md:hidden", children: [_jsx(MobileMenuItem, { title: t('navigation.home'), tooltip: t('navigation.tooltips.community'), icon: Home, action: hrefOf({ type: 'feed', feed: 'local' }) }), _jsx(MobileMenuItem, { title: t('navigation.myFeed'), tooltip: t('navigation.tooltips.myFeed'), icon: Newspaper, action: hrefOf({ type: 'feed', feed: 'my' }) }), _jsx(MobileMenuItem, { title: t('navigation.newPost'), tooltip: t('navigation.tooltips.newPost'), icon: PlusSquare, action: onNewPost ?? hrefOf({ type: 'postNew' }) }), _jsx(MobileMenuItem, { title: t('navigation.groups'), tooltip: t('navigation.tooltips.groups'), icon: Users, action: hrefOf({ type: 'groups' }) }), _jsx(MobileMenuItem, { title: t('navigation.openNotifications'), tooltip: t('navigation.tooltips.notifications'), icon: Bell, action: hrefOf({ type: 'notifications' }), badge: notificationStats.data?.unseen })] }) }));
|
|
15
16
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { MessageSquareText, Menu } from 'lucide-react';
|
|
4
|
-
import { Dialog, DialogContent, DialogPortal, DialogOverlay, DialogTrigger, } from '@openpeepshq/react-ui';
|
|
4
|
+
import { Dialog, DialogContent, DialogPortal, DialogOverlay, DialogTrigger, TooltipProvider, } from '@openpeepshq/react-ui';
|
|
5
|
+
import { NavWithTooltip } from './NavWithTooltip.js';
|
|
5
6
|
import { getTheme } from '@openpeepshq/common';
|
|
6
7
|
import { useServerInfo } from '../server-data/index.js';
|
|
7
8
|
import { useCurrentProfile, useCurrentProfileSettings, } from '../layout/IdentityContext.js';
|
|
@@ -18,13 +19,15 @@ export function HeaderMobile({ avatar, sideBar } = {}) {
|
|
|
18
19
|
const t = useT();
|
|
19
20
|
const [open, setOpen] = useState(false);
|
|
20
21
|
const menuLabel = t('navigation.openMenu', { defaultValue: 'Open menu' });
|
|
22
|
+
const menuTooltip = t('navigation.tooltips.openMenu');
|
|
21
23
|
const messagesLabel = t('navigation.openMessages', {
|
|
22
24
|
defaultValue: 'Open messages',
|
|
23
25
|
});
|
|
26
|
+
const messagesTooltip = t('navigation.tooltips.openMessages');
|
|
24
27
|
const logoSmall = getTheme(serverInfo.communityConfig, profileSettings).logoSmall;
|
|
25
28
|
// Mirror Svelte HeaderMobile: the avatar is the drawer trigger for signed-in
|
|
26
29
|
// users; guests fall back to a generic menu icon.
|
|
27
30
|
const trigger = avatar ??
|
|
28
31
|
(profile ? (_jsx(Avatar, { profile: profile, size: 2.5, borderless: true })) : (_jsx(Menu, { "aria-hidden": "true" })));
|
|
29
|
-
return (_jsx("header", { className: "bg-background sticky top-0 z-10 flex px-4 py-2 md:hidden", children: _jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, children: _jsxs("button", { type: "button", title:
|
|
32
|
+
return (_jsx("header", { className: "bg-background sticky top-0 z-10 flex px-4 py-2 md:hidden", children: _jsx(TooltipProvider, { delayDuration: 300, children: _jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(NavWithTooltip, { label: menuTooltip, side: "bottom", children: _jsx(DialogTrigger, { asChild: true, children: _jsxs("button", { type: "button", title: menuTooltip, "aria-label": menuLabel, children: [trigger, _jsx("span", { className: "sr-only", children: menuLabel })] }) }) }), _jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsx(DialogContent, { showCloseButton: false, className: "left-0 top-0 h-screen w-[380px] translate-x-0 translate-y-0 rounded-none border-r p-0", children: _jsx(SidebarNavCloseContext.Provider, { value: () => setOpen(false), children: _jsx(SideBar, { onClose: () => setOpen(false), mainMenu: sideBar?.mainMenu?.(), profileMenu: sideBar?.profileMenu?.() }) }) })] })] }), _jsx("div", { children: logoSmall && (_jsx("a", { href: "/", children: _jsx("img", { src: logoSmall, alt: "logo", className: "h-6 px-4" }) })) }), _jsx(NavWithTooltip, { label: messagesTooltip, side: "bottom", children: _jsxs("button", { type: "button", title: messagesTooltip, "aria-label": messagesLabel, onClick: () => router.navigate({ type: 'conversation' }), children: [_jsx(MessageSquareText, { "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: messagesLabel })] }) })] }) }) }));
|
|
30
33
|
}
|
|
@@ -3,7 +3,9 @@ export interface MobileMenuItemProps {
|
|
|
3
3
|
action: string | (() => unknown);
|
|
4
4
|
icon: IconType;
|
|
5
5
|
title?: string;
|
|
6
|
+
/** Describes the action on hover (icon-only mobile footer). */
|
|
7
|
+
tooltip?: string;
|
|
6
8
|
/** Unread/unseen count shown as a badge on the icon. */
|
|
7
9
|
badge?: number;
|
|
8
10
|
}
|
|
9
|
-
export declare function MobileMenuItem({ action, icon: Icon, title, badge, }: MobileMenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function MobileMenuItem({ action, icon: Icon, title, tooltip, badge, }: MobileMenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,14 +2,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { formatBadgeCount } from '@openpeepshq/common';
|
|
3
3
|
import { cn } from '@openpeepshq/react-ui';
|
|
4
4
|
import { useRouter } from '../../contexts/router/index.js';
|
|
5
|
-
|
|
5
|
+
import { NavWithTooltip } from './NavWithTooltip.js';
|
|
6
|
+
export function MobileMenuItem({ action, icon: Icon, title, tooltip, badge, }) {
|
|
6
7
|
const router = useRouter();
|
|
7
8
|
const active = typeof action === 'string' && router.pathname === action;
|
|
8
9
|
const showBadge = (badge ?? 0) > 0;
|
|
9
|
-
|
|
10
|
+
const hint = tooltip ?? title;
|
|
11
|
+
const button = (_jsx("button", { type: "button", title: hint, "aria-label": title, className: "relative", onClick: () => {
|
|
10
12
|
if (typeof action === 'function')
|
|
11
13
|
action();
|
|
12
14
|
else
|
|
13
15
|
router.navigate(action);
|
|
14
16
|
}, children: _jsxs("span", { className: cn('relative flex items-center gap-x-2', active ? 'text-primary font-bold' : 'text-foreground/70'), children: [_jsx("span", { "aria-hidden": "true", children: _jsx(Icon, { className: "h-5 w-5" }) }), title ? _jsx("span", { className: "sr-only", children: title }) : null, showBadge ? (_jsx("span", { className: "bg-destructive text-destructive-foreground absolute -right-2.5 -top-2 flex size-5 min-w-5 items-center justify-center rounded-full px-1 text-xs font-semibold leading-none", "aria-label": `${badge} unread`, children: formatBadgeCount(badge ?? 0) })) : null] }) }));
|
|
17
|
+
if (!hint)
|
|
18
|
+
return button;
|
|
19
|
+
return (_jsx(NavWithTooltip, { label: hint, side: "top", children: button }));
|
|
15
20
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export type NavTooltipSide = 'top' | 'bottom' | 'left' | 'right';
|
|
3
|
+
export type NavWithTooltipProps = {
|
|
4
|
+
label: string;
|
|
5
|
+
side?: NavTooltipSide;
|
|
6
|
+
children: ReactElement;
|
|
7
|
+
};
|
|
8
|
+
/** Hover tooltip for a single nav control; wrap the list in `TooltipProvider`. */
|
|
9
|
+
export declare const NavWithTooltip: ({ label, side, children, }: NavWithTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TooltipContent, TooltipRoot, TooltipTrigger, } from '@openpeepshq/react-ui';
|
|
3
|
+
/** Hover tooltip for a single nav control; wrap the list in `TooltipProvider`. */
|
|
4
|
+
export const NavWithTooltip = ({ label, side = 'right', children, }) => (_jsxs(TooltipRoot, { children: [_jsx(TooltipTrigger, { asChild: true, children: children }), _jsx(TooltipContent, { side: side, children: label })] }));
|
|
@@ -8,6 +8,8 @@ export { FooterMobile } from './FooterMobile';
|
|
|
8
8
|
export type { FooterMobileProps } from './FooterMobile';
|
|
9
9
|
export { MobileMenuItem } from './MobileMenuItem';
|
|
10
10
|
export type { MobileMenuItemProps } from './MobileMenuItem';
|
|
11
|
+
export { NavWithTooltip } from './NavWithTooltip';
|
|
12
|
+
export type { NavWithTooltipProps, NavTooltipSide } from './NavWithTooltip';
|
|
11
13
|
export { ContentHeader } from './ContentHeader';
|
|
12
14
|
export { PageHeaderAction } from './PageHeaderAction';
|
|
13
15
|
export type { PageHeaderActionProps } from './PageHeaderAction';
|
|
@@ -4,6 +4,7 @@ export { SidebarNavCloseContext, useSidebarNavClose, } from './SidebarNavContext
|
|
|
4
4
|
export { HeaderMobile } from './HeaderMobile.js';
|
|
5
5
|
export { FooterMobile } from './FooterMobile.js';
|
|
6
6
|
export { MobileMenuItem } from './MobileMenuItem.js';
|
|
7
|
+
export { NavWithTooltip } from './NavWithTooltip.js';
|
|
7
8
|
export { ContentHeader } from './ContentHeader.js';
|
|
8
9
|
export { PageHeaderAction } from './PageHeaderAction.js';
|
|
9
10
|
export { PlusButton } from './PlusButton.js';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Sidebar nav link classes. A string so Radix Tooltip's Slot can merge
|
|
3
|
+
* `className` — a NavLink callback gets stringified and the flex row is lost.
|
|
4
|
+
* Active state uses `aria-current="page"`, which NavLink sets itself.
|
|
5
|
+
*/
|
|
6
|
+
export declare const sideBarNavLinkClass: string;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { cn } from '@openpeepshq/react-ui';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Sidebar nav link classes. A string so Radix Tooltip's Slot can merge
|
|
4
|
+
* `className` — a NavLink callback gets stringified and the flex row is lost.
|
|
5
|
+
* Active state uses `aria-current="page"`, which NavLink sets itself.
|
|
6
|
+
*/
|
|
7
|
+
export const sideBarNavLinkClass = cn('flex items-center gap-2 rounded-md px-3 py-2 text-foreground/70 hover:bg-surface', 'aria-[current=page]:font-bold aria-[current=page]:text-primary');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { AtSign, ChartColumnBig, Megaphone, MessageSquare, Repeat, Reply, Users, } from 'lucide-react';
|
|
3
3
|
import { profileName, groupName } from '@openpeepshq/common';
|
|
4
|
-
import { isRsvpCancelNotice, rsvpCancelWhenLabels, } from '@openpeepshq/common/lib';
|
|
4
|
+
import { isRsvpCancelNotice, isWaitlistOfferNotice, rsvpCancelWhenLabels, waitlistClaimPath, } from '@openpeepshq/common/lib';
|
|
5
5
|
import { useT } from '../../i18n/index.js';
|
|
6
6
|
import { UpdatingDate } from '@openpeepshq/react-ui';
|
|
7
7
|
import { NotificationWrapper } from './NotificationWrapper.js';
|
|
@@ -127,6 +127,30 @@ function RsvpCanceledNotification({ notification, }) {
|
|
|
127
127
|
}),
|
|
128
128
|
}) }), whenLabel ? (_jsx("p", { className: "text-muted-foreground mb-1 text-sm", children: whenLabel })) : null, _jsx("p", { className: "text-muted-foreground mb-2 text-xs", children: _jsx(UpdatingDate, { date: notification.createdAt }) }), post ? _jsx(FeedPost, { post: post }) : null] }) }));
|
|
129
129
|
}
|
|
130
|
+
function WaitlistOfferNotification({ notification, }) {
|
|
131
|
+
const t = useT();
|
|
132
|
+
const profile = notification.senderProfile ?? notification.post?.profile;
|
|
133
|
+
const post = notification.post;
|
|
134
|
+
const event = post?.data?.type === 'event' ? post.data.name?.trim() : undefined;
|
|
135
|
+
const notice = isWaitlistOfferNotice(notification.data)
|
|
136
|
+
? notification.data
|
|
137
|
+
: undefined;
|
|
138
|
+
const href = post
|
|
139
|
+
? waitlistClaimPath(post.id, notice?.recurrenceId)
|
|
140
|
+
: '/notifications';
|
|
141
|
+
if (!profile)
|
|
142
|
+
return null;
|
|
143
|
+
return (_jsx(NotificationWrapper, { profile: profile, seen: notification.seen, showProfile: false, children: _jsxs("a", { href: href, className: "block w-full px-4 py-2", children: [_jsx("p", { className: "mb-1 text-sm font-semibold", children: t('notification.waitlistOffer.text', {
|
|
144
|
+
defaultValue: 'A spot opened at {{eventName}}',
|
|
145
|
+
eventName: event ||
|
|
146
|
+
t('notification.waitlistOffer.eventFallback', {
|
|
147
|
+
defaultValue: 'an event',
|
|
148
|
+
}),
|
|
149
|
+
}) }), notice?.offerExpiresAt ? (_jsx("p", { className: "text-muted-foreground mb-2 text-sm", children: t('notification.waitlistOffer.expires', {
|
|
150
|
+
defaultValue: 'Claim it before {{until}}.',
|
|
151
|
+
until: new Date(notice.offerExpiresAt).toLocaleString(),
|
|
152
|
+
}) })) : null, post ? _jsx(FeedPost, { post: post }) : null] }) }));
|
|
153
|
+
}
|
|
130
154
|
function GroupAvatarThumb({ group }) {
|
|
131
155
|
return _jsx(GroupAvatar, { group: group, size: 2.5, borderless: true });
|
|
132
156
|
}
|
|
@@ -191,12 +215,29 @@ function JamNotification({ notification, }) {
|
|
|
191
215
|
const t = useT();
|
|
192
216
|
const profile = notification.senderProfile;
|
|
193
217
|
const name = profileName(profile);
|
|
194
|
-
const
|
|
195
|
-
|
|
218
|
+
const eventName = notification.post?.data?.type === 'event'
|
|
219
|
+
? notification.post.data.name?.trim()
|
|
220
|
+
: undefined;
|
|
221
|
+
const message = t(notification.type === 'jamStarted'
|
|
222
|
+
? eventName
|
|
223
|
+
? 'notification.jamStarted.text'
|
|
224
|
+
: 'notification.jamStarted.textNoEvent'
|
|
225
|
+
: `notification.${notification.type}.text`, {
|
|
226
|
+
defaultValue: notification.type === 'jamStarted'
|
|
227
|
+
? eventName
|
|
228
|
+
? '{{profileName}} started a jam: {{eventName}}'
|
|
229
|
+
: '{{profileName}} started a jam'
|
|
230
|
+
: `${name} — ${notification.type}`,
|
|
196
231
|
profileName: name,
|
|
197
232
|
groupName: notification.group?.displayName,
|
|
233
|
+
eventName,
|
|
198
234
|
});
|
|
199
|
-
|
|
235
|
+
const postId = notification.post?.id;
|
|
236
|
+
const occurrence = notification.post?.occurrenceRecurrenceId;
|
|
237
|
+
const href = postId
|
|
238
|
+
? `/posts/${postId}${occurrence ? `?occurrence=${encodeURIComponent(occurrence)}` : ''}`
|
|
239
|
+
: `/posts/${postId}`;
|
|
240
|
+
return (_jsx(NotificationWrapper, { profile: profile, group: notification.group, seen: notification.seen, children: _jsxs("a", { href: href, className: "block w-full px-4 py-2", children: [_jsxs("p", { className: "mb-2 flex items-center gap-2 text-sm font-semibold", children: [message, _jsx("span", { className: "text-muted-foreground text-xs font-normal", children: _jsx(UpdatingDate, { date: notification.createdAt }) })] }), notification.post ? _jsx(CardEvent, { post: notification.post }) : null] }) }));
|
|
200
241
|
}
|
|
201
242
|
function GenericNotification({ notification, }) {
|
|
202
243
|
const t = useT();
|
|
@@ -228,6 +269,7 @@ const TYPED = {
|
|
|
228
269
|
pollEnded: PollEndedNotification,
|
|
229
270
|
rsvp: RsvpNotification,
|
|
230
271
|
rsvpCanceled: RsvpCanceledNotification,
|
|
272
|
+
waitlistOffer: WaitlistOfferNotification,
|
|
231
273
|
groupAdded: NewGroupInvitationNotification,
|
|
232
274
|
groupMemberJoined: NewGroupMemberNotification,
|
|
233
275
|
groupMemberLeft: GroupMemberExitNotification,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { formatEventWhen, isHiddenPost
|
|
2
|
+
import { formatEventWhen, isHiddenPost } from '@openpeepshq/common/lib';
|
|
3
3
|
import { AudioLines, Calendar, CirclePlay, Paperclip } from 'lucide-react';
|
|
4
4
|
import { cn } from '@openpeepshq/react-ui';
|
|
5
5
|
import { useT } from '../../i18n/index.js';
|
|
6
6
|
import { Avatar } from '../profile/index.js';
|
|
7
7
|
import { isAudioAttachment } from './pieces/AudioAttachment.js';
|
|
8
|
+
import { TruncatedMarkdown } from './TruncatedMarkdown.js';
|
|
8
9
|
const attachmentsOf = (post) => {
|
|
9
10
|
const data = post.data;
|
|
10
11
|
return data?.attachments ?? [];
|
|
@@ -49,7 +50,6 @@ const CompactNoteBody = ({ post, t }) => {
|
|
|
49
50
|
if (post.data?.type !== 'note')
|
|
50
51
|
return null;
|
|
51
52
|
const attachments = attachmentsOf(post);
|
|
52
|
-
const text = markdownPlainText(post.data.content);
|
|
53
53
|
const hasVisual = !!visualAttachment(attachments);
|
|
54
54
|
const file = !hasVisual ? attachments[0] : undefined;
|
|
55
55
|
const audio = !!file && isAudioAttachment(file);
|
|
@@ -59,17 +59,16 @@ const CompactNoteBody = ({ post, t }) => {
|
|
|
59
59
|
? t('posts.compact.audio', { defaultValue: 'Audio' })
|
|
60
60
|
: t('posts.compact.document', { defaultValue: 'Document' }))
|
|
61
61
|
: undefined;
|
|
62
|
-
if (!
|
|
62
|
+
if (!post.data.content && !docName)
|
|
63
63
|
return null;
|
|
64
|
-
return (_jsxs(_Fragment, { children: [
|
|
64
|
+
return (_jsxs(_Fragment, { children: [_jsx(TruncatedMarkdown, { source: post.data.content ?? '', maxBlocks: 1, maxChars: 80, maxLines: 1, className: "break-words text-sm text-muted-foreground" }), docName ? (_jsxs("p", { className: "text-muted-foreground flex items-center gap-1 text-xs", children: [audio ? (_jsx(AudioLines, { className: "size-3.5 shrink-0", "aria-hidden": true })) : (_jsx(Paperclip, { className: "size-3.5 shrink-0", "aria-hidden": true })), _jsx("span", { className: "truncate", children: docName })] })) : null] }));
|
|
65
65
|
};
|
|
66
66
|
const CompactQuestionBody = ({ post, t, }) => {
|
|
67
67
|
if (post.data?.type !== 'question')
|
|
68
68
|
return null;
|
|
69
69
|
const data = post.data;
|
|
70
|
-
const text = markdownPlainText(data.content);
|
|
71
70
|
const optionCount = data.options?.length ?? 0;
|
|
72
|
-
return (_jsxs(_Fragment, { children: [
|
|
71
|
+
return (_jsxs(_Fragment, { children: [_jsx(TruncatedMarkdown, { source: data.content ?? '', maxBlocks: 1, maxChars: 80, maxLines: 1, className: "break-words text-sm text-muted-foreground" }), optionCount > 0 ? (_jsx("p", { className: "text-muted-foreground truncate text-xs", children: t('posts.compact.pollOptions', {
|
|
73
72
|
defaultValue: '{{count}} options',
|
|
74
73
|
count: optionCount,
|
|
75
74
|
}) })) : null] }));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { OpenpeepsMarkdown, OpenpeepsMarkdown as PostMarkdown } from '../markdown';
|
|
2
|
-
export type { OpenpeepsMarkdownProps, OpenpeepsMarkdownProps as PostMarkdownProps } from '../markdown';
|
|
1
|
+
export { OpenpeepsMarkdown, OpenpeepsMarkdown as PostMarkdown, } from '../markdown';
|
|
2
|
+
export type { OpenpeepsMarkdownProps, OpenpeepsMarkdownProps as PostMarkdownProps, } from '../markdown';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { OpenpeepsMarkdown, OpenpeepsMarkdown as PostMarkdown } from '../markdown/index.js';
|
|
1
|
+
export { OpenpeepsMarkdown, OpenpeepsMarkdown as PostMarkdown, } from '../markdown/index.js';
|