@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
|
@@ -11,7 +11,9 @@ import type { ReactNode } from 'react';
|
|
|
11
11
|
import { profileName, groupName } from '@openpeepshq/common';
|
|
12
12
|
import {
|
|
13
13
|
isRsvpCancelNotice,
|
|
14
|
+
isWaitlistOfferNotice,
|
|
14
15
|
rsvpCancelWhenLabels,
|
|
16
|
+
waitlistClaimPath,
|
|
15
17
|
} from '@openpeepshq/common/lib';
|
|
16
18
|
import type {
|
|
17
19
|
GroupWithMeta,
|
|
@@ -388,6 +390,54 @@ function RsvpCanceledNotification({
|
|
|
388
390
|
);
|
|
389
391
|
}
|
|
390
392
|
|
|
393
|
+
function WaitlistOfferNotification({
|
|
394
|
+
notification,
|
|
395
|
+
}: {
|
|
396
|
+
notification: PublicNotification;
|
|
397
|
+
}) {
|
|
398
|
+
const t = useT();
|
|
399
|
+
const profile = notification.senderProfile ?? notification.post?.profile;
|
|
400
|
+
const post = notification.post;
|
|
401
|
+
const event =
|
|
402
|
+
post?.data?.type === 'event' ? post.data.name?.trim() : undefined;
|
|
403
|
+
const notice = isWaitlistOfferNotice(notification.data)
|
|
404
|
+
? notification.data
|
|
405
|
+
: undefined;
|
|
406
|
+
const href = post
|
|
407
|
+
? waitlistClaimPath(post.id, notice?.recurrenceId)
|
|
408
|
+
: '/notifications';
|
|
409
|
+
if (!profile) return null;
|
|
410
|
+
return (
|
|
411
|
+
<NotificationWrapper
|
|
412
|
+
profile={profile}
|
|
413
|
+
seen={notification.seen}
|
|
414
|
+
showProfile={false}
|
|
415
|
+
>
|
|
416
|
+
<a href={href} className="block w-full px-4 py-2">
|
|
417
|
+
<p className="mb-1 text-sm font-semibold">
|
|
418
|
+
{t('notification.waitlistOffer.text', {
|
|
419
|
+
defaultValue: 'A spot opened at {{eventName}}',
|
|
420
|
+
eventName:
|
|
421
|
+
event ||
|
|
422
|
+
t('notification.waitlistOffer.eventFallback', {
|
|
423
|
+
defaultValue: 'an event',
|
|
424
|
+
}),
|
|
425
|
+
})}
|
|
426
|
+
</p>
|
|
427
|
+
{notice?.offerExpiresAt ? (
|
|
428
|
+
<p className="text-muted-foreground mb-2 text-sm">
|
|
429
|
+
{t('notification.waitlistOffer.expires', {
|
|
430
|
+
defaultValue: 'Claim it before {{until}}.',
|
|
431
|
+
until: new Date(notice.offerExpiresAt).toLocaleString(),
|
|
432
|
+
})}
|
|
433
|
+
</p>
|
|
434
|
+
) : null}
|
|
435
|
+
{post ? <FeedPost post={post} /> : null}
|
|
436
|
+
</a>
|
|
437
|
+
</NotificationWrapper>
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
|
|
391
441
|
function GroupAvatarThumb({ group }: { group: GroupWithMeta }) {
|
|
392
442
|
return <GroupAvatar group={group} size={2.5} borderless />;
|
|
393
443
|
}
|
|
@@ -577,21 +627,42 @@ function JamNotification({
|
|
|
577
627
|
const t = useT();
|
|
578
628
|
const profile = notification.senderProfile!;
|
|
579
629
|
const name = profileName(profile);
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
630
|
+
const eventName =
|
|
631
|
+
notification.post?.data?.type === 'event'
|
|
632
|
+
? notification.post.data.name?.trim()
|
|
633
|
+
: undefined;
|
|
634
|
+
const message = t(
|
|
635
|
+
notification.type === 'jamStarted'
|
|
636
|
+
? eventName
|
|
637
|
+
? 'notification.jamStarted.text'
|
|
638
|
+
: 'notification.jamStarted.textNoEvent'
|
|
639
|
+
: `notification.${notification.type}.text`,
|
|
640
|
+
{
|
|
641
|
+
defaultValue:
|
|
642
|
+
notification.type === 'jamStarted'
|
|
643
|
+
? eventName
|
|
644
|
+
? '{{profileName}} started a jam: {{eventName}}'
|
|
645
|
+
: '{{profileName}} started a jam'
|
|
646
|
+
: `${name} — ${notification.type}`,
|
|
647
|
+
profileName: name,
|
|
648
|
+
groupName: notification.group?.displayName,
|
|
649
|
+
eventName,
|
|
650
|
+
},
|
|
651
|
+
);
|
|
652
|
+
const postId = notification.post?.id;
|
|
653
|
+
const occurrence = notification.post?.occurrenceRecurrenceId;
|
|
654
|
+
const href = postId
|
|
655
|
+
? `/posts/${postId}${
|
|
656
|
+
occurrence ? `?occurrence=${encodeURIComponent(occurrence)}` : ''
|
|
657
|
+
}`
|
|
658
|
+
: `/posts/${postId}`;
|
|
585
659
|
return (
|
|
586
660
|
<NotificationWrapper
|
|
587
661
|
profile={profile}
|
|
588
662
|
group={notification.group}
|
|
589
663
|
seen={notification.seen}
|
|
590
664
|
>
|
|
591
|
-
<a
|
|
592
|
-
href={`/posts/${notification.post?.id}`}
|
|
593
|
-
className="block w-full px-4 py-2"
|
|
594
|
-
>
|
|
665
|
+
<a href={href} className="block w-full px-4 py-2">
|
|
595
666
|
<p className="mb-2 flex items-center gap-2 text-sm font-semibold">
|
|
596
667
|
{message}
|
|
597
668
|
<span className="text-muted-foreground text-xs font-normal">
|
|
@@ -664,6 +735,7 @@ const TYPED: Partial<
|
|
|
664
735
|
pollEnded: PollEndedNotification,
|
|
665
736
|
rsvp: RsvpNotification,
|
|
666
737
|
rsvpCanceled: RsvpCanceledNotification,
|
|
738
|
+
waitlistOffer: WaitlistOfferNotification,
|
|
667
739
|
groupAdded: NewGroupInvitationNotification,
|
|
668
740
|
groupMemberJoined: NewGroupMemberNotification,
|
|
669
741
|
groupMemberLeft: GroupMemberExitNotification,
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
1
|
+
export {
|
|
2
|
+
OpenpeepsMarkdown,
|
|
3
|
+
OpenpeepsMarkdown as PostMarkdown,
|
|
4
|
+
} from '../markdown';
|
|
5
|
+
export type {
|
|
6
|
+
OpenpeepsMarkdownProps,
|
|
7
|
+
OpenpeepsMarkdownProps as PostMarkdownProps,
|
|
8
|
+
} from '../markdown';
|
|
@@ -18,7 +18,5 @@ export const resolveAttachmentPreviewUrl = (
|
|
|
18
18
|
localPreviewUrl,
|
|
19
19
|
].filter((url): url is string => !!url);
|
|
20
20
|
|
|
21
|
-
return (
|
|
22
|
-
candidates.find((url) => !isBlobUrl(url)) ?? candidates[0] ?? ''
|
|
23
|
-
);
|
|
21
|
+
return candidates.find((url) => !isBlobUrl(url)) ?? candidates[0] ?? '';
|
|
24
22
|
};
|
|
@@ -29,14 +29,44 @@ export function Attachments({ post }: AttachmentsProps) {
|
|
|
29
29
|
|
|
30
30
|
if (attachments.length === 0) return null;
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
32
|
+
// A lone audio or video file plays inline. Anything else stays a gallery
|
|
33
|
+
// tile, including an audio or video file that shares the post with others.
|
|
34
|
+
const sole = attachments.length === 1 ? attachments[0] : undefined;
|
|
35
|
+
const inline =
|
|
36
|
+
sole && (isAudioAttachment(sole) || isVideo(sole)) ? sole : undefined;
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
if (inline && isVideo(inline)) {
|
|
39
|
+
return (
|
|
40
|
+
<div className="bg-surface mt-2 w-full overflow-hidden rounded-md">
|
|
41
|
+
<video
|
|
42
|
+
src={inline.url}
|
|
43
|
+
poster={inline.previewUrl ?? undefined}
|
|
44
|
+
controls
|
|
45
|
+
playsInline
|
|
46
|
+
preload="metadata"
|
|
47
|
+
className="max-h-[70vh] w-full"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (inline) {
|
|
54
|
+
return (
|
|
55
|
+
<div className="mt-2">
|
|
56
|
+
<AudioAttachment
|
|
57
|
+
src={inline.url}
|
|
58
|
+
label={inline.filename ?? inline.description}
|
|
59
|
+
size={inline.meta?.size}
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const indexed = attachments.map((att, idx) => ({ att, idx }));
|
|
66
|
+
const single = indexed.length === 1;
|
|
37
67
|
const cols = single
|
|
38
68
|
? ''
|
|
39
|
-
:
|
|
69
|
+
: indexed.length === 2
|
|
40
70
|
? 'grid grid-cols-2'
|
|
41
71
|
: 'grid grid-cols-2 grid-rows-2';
|
|
42
72
|
// With a single attachment the grid has no fixed height, so the children
|
|
@@ -51,81 +81,66 @@ export function Attachments({ post }: AttachmentsProps) {
|
|
|
51
81
|
|
|
52
82
|
return (
|
|
53
83
|
<>
|
|
54
|
-
<div
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
</div>
|
|
88
|
-
)}
|
|
89
|
-
</>
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
if (staticRender) {
|
|
93
|
-
return (
|
|
94
|
-
<div
|
|
95
|
-
key={`${att.url ?? idx}-${idx}`}
|
|
96
|
-
className={`${tileClass} bg-surface overflow-hidden`}
|
|
97
|
-
>
|
|
98
|
-
{tile}
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
84
|
+
<div
|
|
85
|
+
className={`mt-2 w-full gap-1 overflow-hidden rounded-md ${cols} ${height}`}
|
|
86
|
+
>
|
|
87
|
+
{indexed.map(({ att, idx }) => {
|
|
88
|
+
const tile = (
|
|
89
|
+
<>
|
|
90
|
+
{isImage(att) && (att.previewUrl || att.url) ? (
|
|
91
|
+
<img
|
|
92
|
+
src={att.previewUrl ?? att.url ?? ''}
|
|
93
|
+
alt={att.description ?? `attachment ${idx + 1}`}
|
|
94
|
+
className={mediaClass}
|
|
95
|
+
/>
|
|
96
|
+
) : isVideo(att) && (att.previewUrl || att.url) ? (
|
|
97
|
+
<div className="relative h-full w-full">
|
|
98
|
+
<img
|
|
99
|
+
src={att.previewUrl ?? att.url ?? ''}
|
|
100
|
+
alt={att.description ?? `attachment ${idx + 1}`}
|
|
101
|
+
className={mediaClass}
|
|
102
|
+
/>
|
|
103
|
+
<VideoPlayOverlay video />
|
|
104
|
+
</div>
|
|
105
|
+
) : (
|
|
106
|
+
<div className="text-muted-foreground flex min-h-24 w-full flex-col items-center justify-center gap-1 p-4 text-center text-xs">
|
|
107
|
+
<span className="text-foreground break-all font-medium">
|
|
108
|
+
{att.filename ?? att.description ?? `Attachment ${idx + 1}`}
|
|
109
|
+
</span>
|
|
110
|
+
{att.meta?.mimetype ? (
|
|
111
|
+
<span className="uppercase">{att.meta.mimetype}</span>
|
|
112
|
+
) : null}
|
|
113
|
+
</div>
|
|
114
|
+
)}
|
|
115
|
+
</>
|
|
116
|
+
);
|
|
102
117
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
>
|
|
114
|
-
{tile}
|
|
115
|
-
</button>
|
|
116
|
-
);
|
|
117
|
-
})}
|
|
118
|
-
</div>
|
|
119
|
-
) : null}
|
|
118
|
+
if (staticRender) {
|
|
119
|
+
return (
|
|
120
|
+
<div
|
|
121
|
+
key={`${att.url ?? idx}-${idx}`}
|
|
122
|
+
className={`${tileClass} bg-surface overflow-hidden`}
|
|
123
|
+
>
|
|
124
|
+
{tile}
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
120
128
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
return (
|
|
130
|
+
<button
|
|
131
|
+
key={`${att.url ?? idx}-${idx}`}
|
|
132
|
+
type="button"
|
|
133
|
+
className={`${tileClass} bg-surface overflow-hidden`}
|
|
134
|
+
onClick={(e) => {
|
|
135
|
+
e.preventDefault();
|
|
136
|
+
e.stopPropagation();
|
|
137
|
+
setGalleryIndex(idx);
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
{tile}
|
|
141
|
+
</button>
|
|
142
|
+
);
|
|
143
|
+
})}
|
|
129
144
|
</div>
|
|
130
145
|
|
|
131
146
|
{galleryIndex !== null ? (
|
|
@@ -3,6 +3,7 @@ import { useT } from '../../../i18n';
|
|
|
3
3
|
import { Button } from '@openpeepshq/react-ui';
|
|
4
4
|
import { useEventRsvp } from '../../../hooks/events/useEventRsvp';
|
|
5
5
|
import { EventRsvpScopeDialog } from './EventRsvpScopeDialog';
|
|
6
|
+
import { EventWaitlistJoinDialog } from './EventWaitlistJoinDialog';
|
|
6
7
|
|
|
7
8
|
export interface EventRsvpButtonProps {
|
|
8
9
|
post: PublicPost;
|
|
@@ -27,11 +28,18 @@ export const EventRsvpButton = ({
|
|
|
27
28
|
occurrences,
|
|
28
29
|
capacityEvent,
|
|
29
30
|
full,
|
|
31
|
+
onWaitlist,
|
|
32
|
+
offerExpiresAt,
|
|
30
33
|
error,
|
|
31
34
|
pending,
|
|
32
35
|
setPending,
|
|
36
|
+
confirmingWaitlist,
|
|
37
|
+
setConfirmingWaitlist,
|
|
33
38
|
submitting,
|
|
34
39
|
requestRespond,
|
|
40
|
+
requestJoinWaitlist,
|
|
41
|
+
confirmJoinWaitlist,
|
|
42
|
+
claimSpot,
|
|
35
43
|
confirmScope,
|
|
36
44
|
} = useEventRsvp({ post, recurrenceId, lockToOccurrence });
|
|
37
45
|
|
|
@@ -57,9 +65,13 @@ export const EventRsvpButton = ({
|
|
|
57
65
|
? t('posts.rsvp.attendingMessage', {
|
|
58
66
|
defaultValue: 'You are attending.',
|
|
59
67
|
})
|
|
60
|
-
:
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
: myRsvp.response === 'waitlist'
|
|
69
|
+
? t('events.rsvp.onWaitlist', {
|
|
70
|
+
defaultValue: 'You are on the waitlist.',
|
|
71
|
+
})
|
|
72
|
+
: t('posts.rsvp.maybeMessage', {
|
|
73
|
+
defaultValue: 'You responded maybe.',
|
|
74
|
+
})}
|
|
63
75
|
</p>
|
|
64
76
|
) : null}
|
|
65
77
|
<p className="text-muted-foreground mt-2 text-center text-sm">
|
|
@@ -90,6 +102,86 @@ export const EventRsvpButton = ({
|
|
|
90
102
|
/>
|
|
91
103
|
) : null;
|
|
92
104
|
|
|
105
|
+
const waitlistDialog = (
|
|
106
|
+
<EventWaitlistJoinDialog
|
|
107
|
+
open={confirmingWaitlist}
|
|
108
|
+
post={post}
|
|
109
|
+
error={error}
|
|
110
|
+
submitting={submitting}
|
|
111
|
+
onClose={() => {
|
|
112
|
+
if (!submitting) setConfirmingWaitlist(false);
|
|
113
|
+
}}
|
|
114
|
+
onConfirm={async () => {
|
|
115
|
+
await confirmJoinWaitlist();
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
if (offerExpiresAt) {
|
|
121
|
+
return (
|
|
122
|
+
<div className="mt-4 w-full">
|
|
123
|
+
<p className="text-center text-sm">
|
|
124
|
+
{t('events.rsvp.offerOpen', {
|
|
125
|
+
defaultValue: 'A spot is open for you until {{until}}.',
|
|
126
|
+
until: new Date(offerExpiresAt).toLocaleString(),
|
|
127
|
+
})}
|
|
128
|
+
</p>
|
|
129
|
+
<Button
|
|
130
|
+
variant="default"
|
|
131
|
+
className="mt-2 w-full"
|
|
132
|
+
disabled={submitting}
|
|
133
|
+
action={claimSpot}
|
|
134
|
+
>
|
|
135
|
+
{t('events.rsvp.claimSpot', { defaultValue: 'Claim spot' })}
|
|
136
|
+
</Button>
|
|
137
|
+
<Button
|
|
138
|
+
variant="outline"
|
|
139
|
+
className="text-error mt-2 w-full"
|
|
140
|
+
disabled={submitting}
|
|
141
|
+
action={() => requestRespond('no')}
|
|
142
|
+
>
|
|
143
|
+
{t('events.rsvp.leaveWaitlist', {
|
|
144
|
+
defaultValue: 'Leave waitlist',
|
|
145
|
+
})}
|
|
146
|
+
</Button>
|
|
147
|
+
{error ? (
|
|
148
|
+
<p className="text-error mt-2 text-center text-sm">{error}</p>
|
|
149
|
+
) : null}
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (onWaitlist) {
|
|
155
|
+
return (
|
|
156
|
+
<div className="mt-4 w-full">
|
|
157
|
+
<p className="text-center text-sm">
|
|
158
|
+
{t('events.rsvp.onWaitlist', {
|
|
159
|
+
defaultValue: 'You are on the waitlist.',
|
|
160
|
+
})}
|
|
161
|
+
</p>
|
|
162
|
+
<p className="text-muted-foreground mt-1 text-center text-sm">
|
|
163
|
+
{t('events.rsvp.atCapacity', {
|
|
164
|
+
defaultValue: 'This event is at capacity.',
|
|
165
|
+
})}
|
|
166
|
+
</p>
|
|
167
|
+
<Button
|
|
168
|
+
variant="outline"
|
|
169
|
+
className="text-error mt-2 w-full"
|
|
170
|
+
disabled={submitting}
|
|
171
|
+
action={() => requestRespond('no')}
|
|
172
|
+
>
|
|
173
|
+
{t('events.rsvp.leaveWaitlist', {
|
|
174
|
+
defaultValue: 'Leave waitlist',
|
|
175
|
+
})}
|
|
176
|
+
</Button>
|
|
177
|
+
{error && !pending ? (
|
|
178
|
+
<p className="text-error mt-2 text-center text-sm">{error}</p>
|
|
179
|
+
) : null}
|
|
180
|
+
{scopeDialog}
|
|
181
|
+
</div>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
93
185
|
if (myRsvp && myRsvp.response !== 'no') {
|
|
94
186
|
return (
|
|
95
187
|
<div className="w-full">
|
|
@@ -122,15 +214,22 @@ export const EventRsvpButton = ({
|
|
|
122
214
|
|
|
123
215
|
return (
|
|
124
216
|
<div className="mt-4 w-full">
|
|
217
|
+
{full ? (
|
|
218
|
+
<p className="text-muted-foreground mb-2 text-center text-sm">
|
|
219
|
+
{t('events.rsvp.atCapacity', {
|
|
220
|
+
defaultValue: 'This event is at capacity.',
|
|
221
|
+
})}
|
|
222
|
+
</p>
|
|
223
|
+
) : null}
|
|
125
224
|
<div className="flex w-full gap-x-2">
|
|
126
225
|
<Button
|
|
127
226
|
variant="default"
|
|
128
227
|
className="w-[70%]"
|
|
129
|
-
disabled={
|
|
130
|
-
action={() => requestRespond('yes')}
|
|
228
|
+
disabled={submitting}
|
|
229
|
+
action={() => (full ? requestJoinWaitlist() : requestRespond('yes'))}
|
|
131
230
|
>
|
|
132
231
|
{full
|
|
133
|
-
? t('events.rsvp.
|
|
232
|
+
? t('events.rsvp.joinWaitlist', { defaultValue: 'Join waitlist' })
|
|
134
233
|
: t('posts.rsvp.register', { defaultValue: 'Register' })}
|
|
135
234
|
</Button>
|
|
136
235
|
{!capacityEvent ? (
|
|
@@ -150,10 +249,11 @@ export const EventRsvpButton = ({
|
|
|
150
249
|
{t('posts.rsvp.no', { defaultValue: 'No' })}
|
|
151
250
|
</Button>
|
|
152
251
|
</div>
|
|
153
|
-
{error && !pending ? (
|
|
252
|
+
{error && !pending && !confirmingWaitlist ? (
|
|
154
253
|
<p className="text-error mt-2 text-center text-sm">{error}</p>
|
|
155
254
|
) : null}
|
|
156
255
|
{scopeDialog}
|
|
256
|
+
{waitlistDialog}
|
|
157
257
|
</div>
|
|
158
258
|
);
|
|
159
259
|
};
|
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
isRecurringEvent,
|
|
15
15
|
listedRsvps,
|
|
16
16
|
listRsvpCancellations,
|
|
17
|
+
offerStillOpen,
|
|
18
|
+
orderedWaitlist,
|
|
17
19
|
profileName,
|
|
18
20
|
rsvpCancelWhenLabels,
|
|
19
21
|
sameRecurrenceId,
|
|
@@ -126,6 +128,9 @@ export const EventRsvpList = ({
|
|
|
126
128
|
onMessage={onMessage}
|
|
127
129
|
onManage={onManage}
|
|
128
130
|
/>
|
|
131
|
+
{canManageRsvps ? (
|
|
132
|
+
<WaitlistSection post={post} recurrenceId={occurrenceId} />
|
|
133
|
+
) : null}
|
|
129
134
|
{history}
|
|
130
135
|
</>
|
|
131
136
|
);
|
|
@@ -168,6 +173,9 @@ export const EventRsvpList = ({
|
|
|
168
173
|
onMessage={onMessage}
|
|
169
174
|
onManage={onManage}
|
|
170
175
|
/>
|
|
176
|
+
{canManageRsvps ? (
|
|
177
|
+
<WaitlistSection post={post} recurrenceId={key} />
|
|
178
|
+
) : null}
|
|
171
179
|
</RsvpPanel>
|
|
172
180
|
);
|
|
173
181
|
})}
|
|
@@ -176,6 +184,62 @@ export const EventRsvpList = ({
|
|
|
176
184
|
);
|
|
177
185
|
};
|
|
178
186
|
|
|
187
|
+
const WaitlistSection = ({
|
|
188
|
+
post,
|
|
189
|
+
recurrenceId,
|
|
190
|
+
}: {
|
|
191
|
+
post: PublicPost;
|
|
192
|
+
recurrenceId?: string;
|
|
193
|
+
}) => {
|
|
194
|
+
const t = useT();
|
|
195
|
+
const waiting = orderedWaitlist(post, recurrenceId);
|
|
196
|
+
if (!waiting.length) return null;
|
|
197
|
+
const profiles = new Map(
|
|
198
|
+
(post.rsvps ?? []).map((rsvp) => [rsvp.profile.id, rsvp.profile]),
|
|
199
|
+
);
|
|
200
|
+
return (
|
|
201
|
+
<div className="mt-4 border-t pt-3">
|
|
202
|
+
<h3 className="mb-2 text-sm font-semibold">
|
|
203
|
+
{t('events.rsvp.waitlistTitle', { defaultValue: 'Waitlist' })}
|
|
204
|
+
</h3>
|
|
205
|
+
<ol className="flex flex-col gap-2">
|
|
206
|
+
{waiting.map((member, index) => {
|
|
207
|
+
const profile = profiles.get(member.profileId);
|
|
208
|
+
if (!profile) return null;
|
|
209
|
+
const until = member.offerExpiresAt;
|
|
210
|
+
const offered = !!until && offerStillOpen({ offerExpiresAt: until });
|
|
211
|
+
return (
|
|
212
|
+
<li key={member.profileId} className="text-sm">
|
|
213
|
+
<span className="text-muted-foreground">{index + 1}. </span>
|
|
214
|
+
<span className="font-medium">{profileName(profile)}</span>
|
|
215
|
+
{offered ? (
|
|
216
|
+
<span className="text-muted-foreground">
|
|
217
|
+
{' '}
|
|
218
|
+
—{' '}
|
|
219
|
+
{t('events.rsvp.waitlistOffered', {
|
|
220
|
+
defaultValue: 'offered until {{until}}',
|
|
221
|
+
until: new Date(until ?? '').toLocaleString(),
|
|
222
|
+
})}
|
|
223
|
+
</span>
|
|
224
|
+
) : null}
|
|
225
|
+
{profile.type === 'federated' ? (
|
|
226
|
+
<span className="text-muted-foreground">
|
|
227
|
+
{' '}
|
|
228
|
+
—{' '}
|
|
229
|
+
{t('events.rsvp.waitlistRemote', {
|
|
230
|
+
defaultValue:
|
|
231
|
+
'Remote member, not offered a spot automatically',
|
|
232
|
+
})}
|
|
233
|
+
</span>
|
|
234
|
+
) : null}
|
|
235
|
+
</li>
|
|
236
|
+
);
|
|
237
|
+
})}
|
|
238
|
+
</ol>
|
|
239
|
+
</div>
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
|
|
179
243
|
const RsvpCancellationHistory = ({ post }: { post: PublicPost }) => {
|
|
180
244
|
const t = useT();
|
|
181
245
|
const cancellations = listRsvpCancellations(post);
|