@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
|
@@ -12,17 +12,17 @@ import {
|
|
|
12
12
|
canManageEventRsvps,
|
|
13
13
|
canModerateJam,
|
|
14
14
|
canViewJamAttendees,
|
|
15
|
-
|
|
15
|
+
availableSpots,
|
|
16
16
|
effectiveEventTimes,
|
|
17
17
|
eventTimeZoneOptions,
|
|
18
18
|
formatEventClockTime,
|
|
19
19
|
formatEventRecurrence,
|
|
20
20
|
getJamUrl,
|
|
21
21
|
groupName,
|
|
22
|
-
isCapacityEvent,
|
|
23
22
|
parseOccurrenceQuery,
|
|
24
23
|
listRsvpOccurrences,
|
|
25
24
|
profileName,
|
|
25
|
+
rsvpExportFilename,
|
|
26
26
|
} from '@openpeepshq/common/lib';
|
|
27
27
|
import {
|
|
28
28
|
Button,
|
|
@@ -98,12 +98,7 @@ export function FullEvent({ post, occurrence }: FullEventProps) {
|
|
|
98
98
|
const myEvent = post.profile?.id === profile?.id;
|
|
99
99
|
const iAmModerator = canModerateJam(profile, post);
|
|
100
100
|
const canManageRsvps = canManageEventRsvps(profile, post);
|
|
101
|
-
const slotsLeft =
|
|
102
|
-
isCapacityEvent(event) &&
|
|
103
|
-
event.maxAttendees !== undefined &&
|
|
104
|
-
(!event.recurrence || occurrenceId)
|
|
105
|
-
? event.maxAttendees - countYesRsvps(post, occurrenceId)
|
|
106
|
-
: null;
|
|
101
|
+
const slotsLeft = availableSpots(post, occurrenceId) ?? null;
|
|
107
102
|
const times = effectiveEventTimes(event, occurrenceId);
|
|
108
103
|
const recurrenceLabel = event.recurrence
|
|
109
104
|
? formatEventRecurrence(event.recurrence, t, event.start)
|
|
@@ -128,6 +123,22 @@ export function FullEvent({ post, occurrence }: FullEventProps) {
|
|
|
128
123
|
}
|
|
129
124
|
}, [client, post.id, t, toastError]);
|
|
130
125
|
|
|
126
|
+
const exportRsvps = useCallback(async () => {
|
|
127
|
+
try {
|
|
128
|
+
const csv = await client.posts.exportRsvps({
|
|
129
|
+
id: post.id,
|
|
130
|
+
occurrence: occurrenceId,
|
|
131
|
+
});
|
|
132
|
+
downloadCsv(csv, rsvpExportFilename(event.name, new Date()));
|
|
133
|
+
} catch {
|
|
134
|
+
toastError(
|
|
135
|
+
t('events.exportRsvpsError', {
|
|
136
|
+
defaultValue: 'Failed to export RSVPs',
|
|
137
|
+
}),
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}, [client, event.name, occurrenceId, post.id, t, toastError]);
|
|
141
|
+
|
|
131
142
|
const descendentThreads = useMemo(
|
|
132
143
|
() =>
|
|
133
144
|
(contextQuery.data && buildThreads(contextQuery.data.descendants)) || [],
|
|
@@ -188,11 +199,8 @@ export function FullEvent({ post, occurrence }: FullEventProps) {
|
|
|
188
199
|
<div className="flex items-center gap-2">
|
|
189
200
|
<ShareMenu
|
|
190
201
|
post={post}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
<Share className="size-4" />
|
|
194
|
-
</span>
|
|
195
|
-
}
|
|
202
|
+
text={t('posts.footer.share', { defaultValue: 'Share' })}
|
|
203
|
+
menuButton={<Share className="size-4" />}
|
|
196
204
|
/>
|
|
197
205
|
{myEvent ? (
|
|
198
206
|
<EventMenu
|
|
@@ -328,22 +336,32 @@ export function FullEvent({ post, occurrence }: FullEventProps) {
|
|
|
328
336
|
) : null}
|
|
329
337
|
|
|
330
338
|
{tab === 'rsvps' ? (
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
339
|
+
<>
|
|
340
|
+
{canManageRsvps ? (
|
|
341
|
+
<div className="flex justify-end py-2">
|
|
342
|
+
<Button variant="outline" compact action={exportRsvps}>
|
|
343
|
+
<Download className="mr-1 h-4 w-4" />
|
|
344
|
+
{t('events.exportRsvps', { defaultValue: 'Export RSVPs' })}
|
|
345
|
+
</Button>
|
|
346
|
+
</div>
|
|
347
|
+
) : null}
|
|
348
|
+
<EventRsvpList
|
|
349
|
+
post={post}
|
|
350
|
+
occurrenceId={occurrenceId}
|
|
351
|
+
occurrences={upcomingOccurrences}
|
|
352
|
+
currentProfile={profile}
|
|
353
|
+
canManageRsvps={canManageRsvps}
|
|
354
|
+
onMessage={(target) =>
|
|
355
|
+
openCreateConversation({
|
|
356
|
+
profiles: [target],
|
|
357
|
+
skipProfileSelection: true,
|
|
358
|
+
})
|
|
359
|
+
}
|
|
360
|
+
onManage={(response, profileId, recurrenceId) =>
|
|
361
|
+
rsvpManage({ response, recurrenceId }, { id: post.id, profileId })
|
|
362
|
+
}
|
|
363
|
+
/>
|
|
364
|
+
</>
|
|
347
365
|
) : null}
|
|
348
366
|
|
|
349
367
|
{tab === 'attendees' && showJamAttendeesTab ? (
|
|
@@ -58,6 +58,14 @@ export const ProfileEventRelationship = ({
|
|
|
58
58
|
variant: 'outline',
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
if (myRsvp?.response === 'waitlist') {
|
|
62
|
+
return {
|
|
63
|
+
status: t('events.profileRelationship.waitlisted', {
|
|
64
|
+
defaultValue: 'Waitlisted',
|
|
65
|
+
}),
|
|
66
|
+
variant: 'outline',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
61
69
|
return null;
|
|
62
70
|
})();
|
|
63
71
|
|
|
@@ -7,9 +7,6 @@ export interface FullNoteProps {
|
|
|
7
7
|
|
|
8
8
|
export function FullNote({ post }: FullNoteProps) {
|
|
9
9
|
return (
|
|
10
|
-
<FullPostLayout
|
|
11
|
-
post={post}
|
|
12
|
-
deleteCallback={() => window.history.back()}
|
|
13
|
-
/>
|
|
10
|
+
<FullPostLayout post={post} deleteCallback={() => window.history.back()} />
|
|
14
11
|
);
|
|
15
12
|
}
|
|
@@ -9,10 +9,7 @@ export interface FullPollProps {
|
|
|
9
9
|
|
|
10
10
|
export function FullPoll({ post }: FullPollProps) {
|
|
11
11
|
return (
|
|
12
|
-
<FullPostLayout
|
|
13
|
-
post={post}
|
|
14
|
-
deleteCallback={() => window.history.back()}
|
|
15
|
-
>
|
|
12
|
+
<FullPostLayout post={post} deleteCallback={() => window.history.back()}>
|
|
16
13
|
<FeedPost
|
|
17
14
|
post={post}
|
|
18
15
|
noReactionHeader
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { isGroupPath, isJamPath, isPostPath } from './helpers';
|
|
1
|
+
import { isGroupPath, isJamPath, isPostPath, isWelcomePath } from './helpers';
|
|
2
2
|
import { GroupPreview } from './local/GroupPreview';
|
|
3
3
|
import { PostPreview } from './local/PostPreview';
|
|
4
4
|
import { JamPreview } from './local/JamPreview';
|
|
5
|
+
import { WelcomePreview } from './local/WelcomePreview';
|
|
5
6
|
|
|
6
7
|
export interface LocalPreviewLinkProps {
|
|
7
8
|
url: string;
|
|
@@ -12,6 +13,7 @@ export function LocalPreviewLink({ url }: LocalPreviewLinkProps) {
|
|
|
12
13
|
const isPost = isPostPath(path);
|
|
13
14
|
const isJam = isJamPath(path);
|
|
14
15
|
const isGroup = isGroupPath(path);
|
|
16
|
+
const isWelcome = isWelcomePath(path);
|
|
15
17
|
|
|
16
18
|
return (
|
|
17
19
|
<a
|
|
@@ -22,6 +24,7 @@ export function LocalPreviewLink({ url }: LocalPreviewLinkProps) {
|
|
|
22
24
|
{isPost ? <PostPreview path={path} /> : null}
|
|
23
25
|
{isGroup ? <GroupPreview path={path} /> : null}
|
|
24
26
|
{isJam ? <JamPreview path={path} /> : null}
|
|
27
|
+
{isWelcome ? <WelcomePreview /> : null}
|
|
25
28
|
</a>
|
|
26
29
|
);
|
|
27
30
|
}
|
|
@@ -9,17 +9,12 @@ export interface PreviewLinkProps {
|
|
|
9
9
|
export function PreviewLink({ url = '' }: PreviewLinkProps) {
|
|
10
10
|
if (!isValidUrl(url)) return null;
|
|
11
11
|
|
|
12
|
-
const origin =
|
|
13
|
-
typeof window !== 'undefined' ? window.location.origin : '';
|
|
12
|
+
const origin = typeof window !== 'undefined' ? window.location.origin : '';
|
|
14
13
|
const local = isLocalLink(url, origin);
|
|
15
14
|
|
|
16
15
|
return (
|
|
17
16
|
<div className="min-w-0 max-w-full overflow-hidden">
|
|
18
|
-
{local ?
|
|
19
|
-
<LocalPreviewLink url={url} />
|
|
20
|
-
) : (
|
|
21
|
-
<RemotePreviewLink url={url} />
|
|
22
|
-
)}
|
|
17
|
+
{local ? <LocalPreviewLink url={url} /> : <RemotePreviewLink url={url} />}
|
|
23
18
|
</div>
|
|
24
19
|
);
|
|
25
20
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { markdownPlainText } from '@openpeepshq/common';
|
|
2
|
+
|
|
1
3
|
const UUID_RE =
|
|
2
4
|
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
3
5
|
|
|
6
|
+
const EXCERPT_MAX = 180;
|
|
7
|
+
|
|
4
8
|
export const isPostPath = (path: string) =>
|
|
5
9
|
path.startsWith('/posts/') && UUID_RE.test(path.substring(7));
|
|
6
10
|
|
|
@@ -11,6 +15,9 @@ export const isJamPath = (path: string) =>
|
|
|
11
15
|
|
|
12
16
|
export const isGroupPath = (path: string) => path.startsWith('/groups/@');
|
|
13
17
|
|
|
18
|
+
export const isWelcomePath = (path: string) =>
|
|
19
|
+
path === '/welcome' || path === '/welcome/';
|
|
20
|
+
|
|
14
21
|
export const isLocalLink = (url: string, origin: string) => {
|
|
15
22
|
try {
|
|
16
23
|
const urlObj = new URL(url);
|
|
@@ -18,13 +25,37 @@ export const isLocalLink = (url: string, origin: string) => {
|
|
|
18
25
|
urlObj.origin === origin &&
|
|
19
26
|
(isPostPath(urlObj.pathname) ||
|
|
20
27
|
isJamPath(urlObj.pathname) ||
|
|
21
|
-
isGroupPath(urlObj.pathname)
|
|
28
|
+
isGroupPath(urlObj.pathname) ||
|
|
29
|
+
isWelcomePath(urlObj.pathname))
|
|
22
30
|
);
|
|
23
31
|
} catch {
|
|
24
32
|
return false;
|
|
25
33
|
}
|
|
26
34
|
};
|
|
27
35
|
|
|
36
|
+
/** Plain-text clip of the welcome page, without image markup. */
|
|
37
|
+
export const welcomePreviewExcerpt = (markdown?: string) => {
|
|
38
|
+
const plain = markdownPlainText(
|
|
39
|
+
(markdown ?? '').replace(/!\[[^\]]*]\([^)]*\)/g, ' '),
|
|
40
|
+
);
|
|
41
|
+
if (plain.length <= EXCERPT_MAX) return plain;
|
|
42
|
+
const cut = plain.slice(0, EXCERPT_MAX);
|
|
43
|
+
const lastSpace = cut.lastIndexOf(' ');
|
|
44
|
+
const clipped = lastSpace > 80 ? cut.slice(0, lastSpace) : cut;
|
|
45
|
+
return `${clipped.trimEnd()}…`;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** First content image on the welcome page, ignoring inline data URLs. */
|
|
49
|
+
export const firstMarkdownImage = (markdown?: string) => {
|
|
50
|
+
if (!markdown) return undefined;
|
|
51
|
+
const pattern = /!\[[^\]]*]\(\s*(<([^>]+)>|([^\s)]+))/g;
|
|
52
|
+
for (const match of markdown.matchAll(pattern)) {
|
|
53
|
+
const src = (match[2] ?? match[3])?.trim();
|
|
54
|
+
if (src && !src.startsWith('data:')) return src;
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
};
|
|
58
|
+
|
|
28
59
|
export const isValidUrl = (url?: string) => {
|
|
29
60
|
if (!url) return false;
|
|
30
61
|
try {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useWelcomePreview } from '../../../hooks/useWelcomePreview';
|
|
2
|
+
|
|
3
|
+
export const WelcomePreview = () => {
|
|
4
|
+
const { eyebrow, title, description, imageUrl, imageFit } =
|
|
5
|
+
useWelcomePreview();
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
data-testid="welcome-preview-card"
|
|
10
|
+
className="flex w-full min-w-0 flex-row items-center gap-4"
|
|
11
|
+
>
|
|
12
|
+
{imageUrl ? (
|
|
13
|
+
<div className="flex h-24 w-24 shrink-0 items-center justify-center overflow-hidden rounded-md">
|
|
14
|
+
<img
|
|
15
|
+
src={imageUrl}
|
|
16
|
+
alt=""
|
|
17
|
+
className={`h-full w-full ${
|
|
18
|
+
imageFit === 'cover' ? 'object-cover' : 'object-contain'
|
|
19
|
+
}`}
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
) : null}
|
|
23
|
+
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
24
|
+
{eyebrow ? (
|
|
25
|
+
<p className="text-muted-foreground truncate text-xs">{eyebrow}</p>
|
|
26
|
+
) : null}
|
|
27
|
+
<p className="line-clamp-2 font-semibold">{title}</p>
|
|
28
|
+
{description ? (
|
|
29
|
+
<p className="text-muted-foreground line-clamp-3 break-words text-sm">
|
|
30
|
+
{description}
|
|
31
|
+
</p>
|
|
32
|
+
) : null}
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { PublicProfile } from '@openpeepshq/common/types';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DELETED_AUTHOR_DISPLAY_NAME,
|
|
4
|
+
getTheme,
|
|
5
|
+
isDeletedProfile,
|
|
6
|
+
} from '@openpeepshq/common';
|
|
3
7
|
import { UserX } from 'lucide-react';
|
|
4
8
|
|
|
5
9
|
import { useServerInfo } from '../server-data';
|
|
@@ -62,7 +66,7 @@ export function Avatar({
|
|
|
62
66
|
>
|
|
63
67
|
{deleted ? (
|
|
64
68
|
<UserX
|
|
65
|
-
aria-label={profile?.displayName ||
|
|
69
|
+
aria-label={profile?.displayName || DELETED_AUTHOR_DISPLAY_NAME}
|
|
66
70
|
className="text-muted-foreground"
|
|
67
71
|
size={iconSize}
|
|
68
72
|
/>
|
|
@@ -18,11 +18,7 @@ export function ProfileFromId({
|
|
|
18
18
|
const profile = profileQuery.data;
|
|
19
19
|
|
|
20
20
|
if (profileQuery.isLoading) {
|
|
21
|
-
return
|
|
22
|
-
<div className="text-muted-foreground py-2 text-sm">
|
|
23
|
-
Loading…
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
21
|
+
return <div className="text-muted-foreground py-2 text-sm">Loading…</div>;
|
|
26
22
|
}
|
|
27
23
|
|
|
28
24
|
if (!profile) return null;
|
|
@@ -19,9 +19,7 @@ const useHasAccountJwt = (): boolean => {
|
|
|
19
19
|
const refresh = async () => {
|
|
20
20
|
const token = (await credentialsStore.get())?.token;
|
|
21
21
|
const next =
|
|
22
|
-
!!token &&
|
|
23
|
-
!isAccountlessJwt(token) &&
|
|
24
|
-
!isServiceOnlyJwt(token);
|
|
22
|
+
!!token && !isAccountlessJwt(token) && !isServiceOnlyJwt(token);
|
|
25
23
|
if (!cancelled) setHasAccount(next);
|
|
26
24
|
};
|
|
27
25
|
|
|
@@ -39,6 +39,10 @@ const adminBackupsConfig = (client: OpenpeepsClientInstance) => ({
|
|
|
39
39
|
restoreBackupAction: payloadMutation(client.admin.backups.restore, [
|
|
40
40
|
['admin', 'backups'],
|
|
41
41
|
]),
|
|
42
|
+
useMediaList: () => apiHook(client.admin.media.list),
|
|
43
|
+
deleteMediaAction: noPayloadMutation(client.admin.media.delete, [
|
|
44
|
+
['admin', 'media'],
|
|
45
|
+
]),
|
|
42
46
|
useConfigRead: (namespace: string, name: string) =>
|
|
43
47
|
apiHook(client.admin.config.read, { pathParams: { namespace, name } }),
|
|
44
48
|
updateConfigAction: payloadMutation(client.admin.config.update, [
|
|
@@ -68,14 +72,17 @@ const adminDbInvites = (client: OpenpeepsClientInstance) => ({
|
|
|
68
72
|
['admin', 'db', 'sql'],
|
|
69
73
|
]),
|
|
70
74
|
createInviteAction: payloadMutation(client.admin.invites.create, [
|
|
71
|
-
['
|
|
75
|
+
['invite-links'],
|
|
72
76
|
]),
|
|
73
77
|
useInvitesList: () => apiHook(client.admin.invites.list),
|
|
78
|
+
updateInviteAction: payloadMutation(client.admin.invites.update, [
|
|
79
|
+
['invite-links'],
|
|
80
|
+
]),
|
|
74
81
|
activateInviteAction: noPayloadMutation(client.admin.invites.activate, [
|
|
75
|
-
['
|
|
82
|
+
['invite-links'],
|
|
76
83
|
]),
|
|
77
84
|
deactivateInviteAction: noPayloadMutation(client.admin.invites.deactivate, [
|
|
78
|
-
['
|
|
85
|
+
['invite-links'],
|
|
79
86
|
]),
|
|
80
87
|
useLogsList: (date?: string, refetchInterval?: number) =>
|
|
81
88
|
apiHook(client.admin.logs.list, {
|
|
@@ -189,6 +196,7 @@ const adminDiagnostics = (client: OpenpeepsClientInstance) => ({
|
|
|
189
196
|
apiHook(client.admin.diagnostics.performance, {
|
|
190
197
|
refetchInterval: 15_000,
|
|
191
198
|
}),
|
|
199
|
+
useLivekitDiagnosis: () => apiHook(client.admin.diagnostics.livekit),
|
|
192
200
|
useJobDetail: (queue: string, jobId: string) =>
|
|
193
201
|
apiHook(client.admin.diagnostics.jobs.jobDetail, {
|
|
194
202
|
pathParams: { queue, jobId },
|
|
@@ -54,18 +54,15 @@ export const otherHooks = (client: OpenpeepsClient) => ({
|
|
|
54
54
|
const ctrl = new AbortController();
|
|
55
55
|
setController(ctrl);
|
|
56
56
|
setState({ uploading: true, uploadPercent: 0 });
|
|
57
|
-
const result = await client.mediaAttachment.createWithProgress(
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})),
|
|
67
|
-
},
|
|
68
|
-
);
|
|
57
|
+
const result = await client.mediaAttachment.createWithProgress(input, {
|
|
58
|
+
signal: ctrl.signal,
|
|
59
|
+
onUploadProgress: ({ percent, estimatedRemainingMs }) =>
|
|
60
|
+
setState((s) => ({
|
|
61
|
+
...s,
|
|
62
|
+
uploadPercent: percent,
|
|
63
|
+
uploadEstimatedRemainingMs: estimatedRemainingMs,
|
|
64
|
+
})),
|
|
65
|
+
});
|
|
69
66
|
if ('data' in result) {
|
|
70
67
|
setState({
|
|
71
68
|
uploading: false,
|
|
@@ -20,6 +20,6 @@ export type VodStreamStatusHook = ReturnType<
|
|
|
20
20
|
StreamingHooks['useVodStreamStatus']
|
|
21
21
|
>;
|
|
22
22
|
|
|
23
|
-
export type CreateVodStreamAction = (
|
|
24
|
-
|
|
25
|
-
) => Promise<MediaStream>;
|
|
23
|
+
export type CreateVodStreamAction = (input: {
|
|
24
|
+
url: string;
|
|
25
|
+
}) => Promise<MediaStream>;
|
package/src/css.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminSections,
|
|
3
|
+
canAccessAdminSection,
|
|
4
|
+
type AdminSectionKey,
|
|
5
|
+
} from '@openpeepshq/common/lib';
|
|
6
|
+
import { useCurrentProfile } from '../../components/layout/IdentityContext';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Local profile roles. Non-local profiles (e.g. remote or SAML) expose no role
|
|
10
|
+
* set, so every admin-section capability check resolves to false for them,
|
|
11
|
+
* mirroring the backend `ensureRoleCapabilities` gating.
|
|
12
|
+
*/
|
|
13
|
+
export const useAdminRoles = () => {
|
|
14
|
+
const profile = useCurrentProfile();
|
|
15
|
+
return profile?.type === 'local' ? profile.roles : undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Whether the current profile may access a given admin section. Reuses the
|
|
20
|
+
* shared `adminSections` definitions so Web, native, and route guards agree
|
|
21
|
+
* with the backend's capability checks.
|
|
22
|
+
*/
|
|
23
|
+
export const useCanAccessAdminSection = (section: AdminSectionKey) => {
|
|
24
|
+
const roles = useAdminRoles();
|
|
25
|
+
const sectionDef = adminSections.find((s) => s.key === section);
|
|
26
|
+
return sectionDef ? canAccessAdminSection(roles, sectionDef) : false;
|
|
27
|
+
};
|
|
@@ -2,15 +2,16 @@ import { useMemo, useState } from 'react';
|
|
|
2
2
|
import type { PublicPost } from '@openpeepshq/common/types';
|
|
3
3
|
import type { ExpandedOccurrence } from '@openpeepshq/common/lib';
|
|
4
4
|
import {
|
|
5
|
+
canClaimYesRsvp,
|
|
5
6
|
checkPostCapabilities,
|
|
6
|
-
countYesRsvps,
|
|
7
7
|
defaultRsvpRecurrenceId,
|
|
8
8
|
displayRsvpForProfile,
|
|
9
9
|
eventRsvpOpen,
|
|
10
10
|
isCapacityEvent,
|
|
11
11
|
isRecurringEvent,
|
|
12
12
|
listRsvpOccurrences,
|
|
13
|
-
|
|
13
|
+
offerStillOpen,
|
|
14
|
+
seriesHasClaimableOccurrence,
|
|
14
15
|
} from '@openpeepshq/common/lib';
|
|
15
16
|
import { useOpenpeeps } from '../../contexts/openpeeps';
|
|
16
17
|
import { useT } from '../../i18n/context';
|
|
@@ -21,7 +22,7 @@ import {
|
|
|
21
22
|
} from '../../components/layout/IdentityContext';
|
|
22
23
|
import { useCapabilities } from '../../components/server-data';
|
|
23
24
|
|
|
24
|
-
export type RsvpChoice = 'yes' | 'tentative' | 'no';
|
|
25
|
+
export type RsvpChoice = 'yes' | 'tentative' | 'no' | 'waitlist';
|
|
25
26
|
|
|
26
27
|
export type RsvpScopeChoice =
|
|
27
28
|
| { kind: 'this'; recurrenceId: string }
|
|
@@ -52,6 +53,7 @@ export const useEventRsvp = ({
|
|
|
52
53
|
const rsvpToEvent = openpeepsApi.rsvpToEventAction({ id: post.id });
|
|
53
54
|
const [error, setError] = useState<string | null>(null);
|
|
54
55
|
const [pending, setPending] = useState<RsvpChoice | null>(null);
|
|
56
|
+
const [confirmingWaitlist, setConfirmingWaitlist] = useState(false);
|
|
55
57
|
const [submitting, setSubmitting] = useState(false);
|
|
56
58
|
|
|
57
59
|
const eventData = post.data?.type === 'event' ? post.data : undefined;
|
|
@@ -71,14 +73,18 @@ export const useEventRsvp = ({
|
|
|
71
73
|
: undefined;
|
|
72
74
|
const occurrences: ExpandedOccurrence[] =
|
|
73
75
|
eventData && recurring ? listRsvpOccurrences(eventData) : [];
|
|
74
|
-
const capacityRecurrenceId =
|
|
76
|
+
const capacityRecurrenceId = recurring
|
|
77
|
+
? lockToOccurrence
|
|
78
|
+
? recurrenceId
|
|
79
|
+
: defaultId
|
|
80
|
+
: undefined;
|
|
75
81
|
const capacityEvent = eventData ? isCapacityEvent(eventData) : false;
|
|
76
82
|
const atCapacity =
|
|
77
83
|
capacityEvent &&
|
|
78
|
-
|
|
84
|
+
!!profile &&
|
|
79
85
|
(recurring && !lockToOccurrence
|
|
80
|
-
? !
|
|
81
|
-
:
|
|
86
|
+
? !seriesHasClaimableOccurrence(post, profile.id)
|
|
87
|
+
: !canClaimYesRsvp(post, profile.id, capacityRecurrenceId));
|
|
82
88
|
|
|
83
89
|
const myEvent = post.profile?.id === profile?.id;
|
|
84
90
|
const myRsvp = useMemo(
|
|
@@ -98,6 +104,9 @@ export const useEventRsvp = ({
|
|
|
98
104
|
[authData, post, capabilities],
|
|
99
105
|
);
|
|
100
106
|
const full = atCapacity && myRsvp?.response !== 'yes';
|
|
107
|
+
const onWaitlist = myRsvp?.response === 'waitlist';
|
|
108
|
+
const offerExpiresAt =
|
|
109
|
+
onWaitlist && offerStillOpen(myRsvp) ? myRsvp.offerExpiresAt : undefined;
|
|
101
110
|
|
|
102
111
|
const writeRsvp = async (response: RsvpChoice, recurrenceIds?: string[]) => {
|
|
103
112
|
setError(null);
|
|
@@ -121,6 +130,34 @@ export const useEventRsvp = ({
|
|
|
121
130
|
}
|
|
122
131
|
};
|
|
123
132
|
|
|
133
|
+
const requestJoinWaitlist = () => {
|
|
134
|
+
if (rsvpClosed) return;
|
|
135
|
+
if (!recurring || lockToOccurrence) {
|
|
136
|
+
setError(null);
|
|
137
|
+
setConfirmingWaitlist(true);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
setError(null);
|
|
141
|
+
setPending('waitlist');
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const confirmJoinWaitlist = async () => {
|
|
145
|
+
try {
|
|
146
|
+
await writeRsvp('waitlist', recurrenceId ? [recurrenceId] : undefined);
|
|
147
|
+
setConfirmingWaitlist(false);
|
|
148
|
+
return true;
|
|
149
|
+
} catch {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const claimSpot = () => {
|
|
155
|
+
const id = recurring
|
|
156
|
+
? (myRsvp?.recurrenceId ?? (lockToOccurrence ? recurrenceId : defaultId))
|
|
157
|
+
: undefined;
|
|
158
|
+
writeRsvp('yes', id ? [id] : undefined).catch(() => undefined);
|
|
159
|
+
};
|
|
160
|
+
|
|
124
161
|
const requestRespond = (response: RsvpChoice) => {
|
|
125
162
|
if (rsvpClosed) return;
|
|
126
163
|
if (!recurring || lockToOccurrence) {
|
|
@@ -161,11 +198,18 @@ export const useEventRsvp = ({
|
|
|
161
198
|
occurrences,
|
|
162
199
|
capacityEvent,
|
|
163
200
|
full,
|
|
201
|
+
onWaitlist,
|
|
202
|
+
offerExpiresAt,
|
|
164
203
|
error,
|
|
165
204
|
pending,
|
|
166
205
|
setPending,
|
|
206
|
+
confirmingWaitlist,
|
|
207
|
+
setConfirmingWaitlist,
|
|
167
208
|
submitting,
|
|
168
209
|
requestRespond,
|
|
210
|
+
requestJoinWaitlist,
|
|
211
|
+
confirmJoinWaitlist,
|
|
212
|
+
claimSpot,
|
|
169
213
|
confirmScope,
|
|
170
214
|
};
|
|
171
215
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import type { GroupNotificationLevel } from '@openpeepshq/common';
|
|
3
|
+
import { useOpenpeeps } from '../../contexts/openpeeps';
|
|
4
|
+
|
|
5
|
+
export const useGroupNotificationLevel = (groupId: string) => {
|
|
6
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
7
|
+
const settingsQuery = openpeepsApi.useCurrentProfileSettings();
|
|
8
|
+
const updateSettings = openpeepsApi.updateCurrentProfileSettingsAction();
|
|
9
|
+
const [level, setLevel] = useState<GroupNotificationLevel>('all');
|
|
10
|
+
const [ready, setReady] = useState(false);
|
|
11
|
+
const [saving, setSaving] = useState(false);
|
|
12
|
+
const [error, setError] = useState<string | null>(null);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const settings = settingsQuery.data;
|
|
16
|
+
if (!settings || ready) return;
|
|
17
|
+
setLevel(settings.groupNotificationLevels?.[groupId] ?? 'all');
|
|
18
|
+
setReady(true);
|
|
19
|
+
}, [settingsQuery.data, groupId, ready]);
|
|
20
|
+
|
|
21
|
+
const save = async () => {
|
|
22
|
+
const current = settingsQuery.data;
|
|
23
|
+
if (!current) return false;
|
|
24
|
+
setError(null);
|
|
25
|
+
setSaving(true);
|
|
26
|
+
try {
|
|
27
|
+
const groupNotificationLevels = {
|
|
28
|
+
...(current.groupNotificationLevels ?? {}),
|
|
29
|
+
};
|
|
30
|
+
if (level === 'all') {
|
|
31
|
+
delete groupNotificationLevels[groupId];
|
|
32
|
+
} else {
|
|
33
|
+
groupNotificationLevels[groupId] = level;
|
|
34
|
+
}
|
|
35
|
+
await updateSettings({
|
|
36
|
+
...current,
|
|
37
|
+
groupNotificationLevels,
|
|
38
|
+
});
|
|
39
|
+
return true;
|
|
40
|
+
} catch (err) {
|
|
41
|
+
setError((err as Error).message);
|
|
42
|
+
return false;
|
|
43
|
+
} finally {
|
|
44
|
+
setSaving(false);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
level,
|
|
50
|
+
setLevel,
|
|
51
|
+
save,
|
|
52
|
+
saving,
|
|
53
|
+
ready: ready && !settingsQuery.isLoading,
|
|
54
|
+
loadFailed: settingsQuery.isError,
|
|
55
|
+
error,
|
|
56
|
+
};
|
|
57
|
+
};
|