@openpeepshq/react 0.6.2 → 0.7.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/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/JamFooter.js +5 -9
- package/dist/components/jams/JamRoomIndicators.js +3 -2
- package/dist/components/jams/jamRecordingState.d.ts +7 -0
- package/dist/components/jams/jamRecordingState.js +32 -1
- package/dist/components/post/types/event/FullEvent.js +3 -2
- package/dist/hooks/groups/useGroupNotificationLevel.d.ts +9 -0
- package/dist/hooks/groups/useGroupNotificationLevel.js +57 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/jams/useJamDetails.d.ts +153 -153
- package/dist/hooks/jams/useJamFooterControls.d.ts +1 -0
- package/dist/hooks/jams/useJamFooterControls.js +10 -2
- package/dist/hooks/jams/useJamLobby.d.ts +1 -1
- package/dist/hooks/jams/useJamRoom.d.ts +307 -307
- package/dist/hooks/posts/usePostDetailTitle.d.ts +153 -153
- package/dist/pages/admin/configurationSsoShared.d.ts +7 -3
- package/dist/pages/groups/Show.js +22 -19
- package/dist/react-native.d.ts +2 -2
- package/dist/react-native.js +2 -2
- package/package.json +4 -4
- 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/JamFooter.tsx +9 -13
- package/src/components/jams/JamRoomIndicators.tsx +6 -1
- package/src/components/jams/jamRecordingState.ts +35 -1
- package/src/components/post/types/event/FullEvent.tsx +6 -1
- package/src/hooks/groups/useGroupNotificationLevel.ts +57 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/jams/useJamFooterControls.ts +14 -2
- package/src/pages/groups/Show.tsx +60 -53
- package/src/react-native.ts +3 -1
|
@@ -40,7 +40,7 @@ export declare const toOidc: (form: ProviderFormState) => {
|
|
|
40
40
|
tokenUrl: string;
|
|
41
41
|
userinfoUrl: string;
|
|
42
42
|
clientId: string;
|
|
43
|
-
kind?: "oidc" | "
|
|
43
|
+
kind?: "oidc" | "github" | "gitlab" | "gitlab-selfhosted" | "google" | "entra" | "auth0" | "keycloak" | "authentik" | "okta" | "discord" | "pocketid" | undefined;
|
|
44
44
|
instanceUrl?: string | undefined;
|
|
45
45
|
tenant?: string | undefined;
|
|
46
46
|
emailsUrl?: string | undefined;
|
|
@@ -115,6 +115,10 @@ export declare const useSsoConfig: () => {
|
|
|
115
115
|
local: {
|
|
116
116
|
path: string;
|
|
117
117
|
};
|
|
118
|
+
retention: {
|
|
119
|
+
zipAfterDays: number;
|
|
120
|
+
deleteAfterDays: number;
|
|
121
|
+
};
|
|
118
122
|
};
|
|
119
123
|
media: {
|
|
120
124
|
maxUploadMb: number;
|
|
@@ -186,7 +190,7 @@ export declare const useSsoConfig: () => {
|
|
|
186
190
|
tokenUrl: string;
|
|
187
191
|
userinfoUrl: string;
|
|
188
192
|
clientId: string;
|
|
189
|
-
kind?: "oidc" | "
|
|
193
|
+
kind?: "oidc" | "github" | "gitlab" | "gitlab-selfhosted" | "google" | "entra" | "auth0" | "keycloak" | "authentik" | "okta" | "discord" | "pocketid" | undefined;
|
|
190
194
|
instanceUrl?: string | undefined;
|
|
191
195
|
tenant?: string | undefined;
|
|
192
196
|
emailsUrl?: string | undefined;
|
|
@@ -269,7 +273,7 @@ export declare const useSsoConfig: () => {
|
|
|
269
273
|
tokenUrl: string;
|
|
270
274
|
userinfoUrl: string;
|
|
271
275
|
clientId: string;
|
|
272
|
-
kind?: "oidc" | "
|
|
276
|
+
kind?: "oidc" | "github" | "gitlab" | "gitlab-selfhosted" | "google" | "entra" | "auth0" | "keycloak" | "authentik" | "okta" | "discord" | "pocketid" | undefined;
|
|
273
277
|
instanceUrl?: string | undefined;
|
|
274
278
|
tenant?: string | undefined;
|
|
275
279
|
emailsUrl?: string | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { useNavigate, useParams } from 'react-router-dom';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Link, useLocation, useNavigate, useParams } from 'react-router-dom';
|
|
4
|
+
import { groupSectionFromHash } from '@openpeepshq/common/lib';
|
|
4
5
|
import { useT, useOpenpeeps } from '../../index.js';
|
|
5
6
|
import { EventsView, Feed, GroupFeed, GroupHeader, NewEventButton, NewResourceButton, PostMarkdown, useCurrentProfile, } from '../../components/index.js';
|
|
6
7
|
import { routeHandleParam } from '../../lib/routeHandles.js';
|
|
@@ -9,13 +10,25 @@ import { ResourceLibrary } from '../../components/resources/ResourceLibrary.js';
|
|
|
9
10
|
export function GroupShow() {
|
|
10
11
|
const t = useT();
|
|
11
12
|
const navigate = useNavigate();
|
|
13
|
+
const location = useLocation();
|
|
12
14
|
const { handle: handleParam = '' } = useParams();
|
|
13
15
|
const handle = routeHandleParam(handleParam);
|
|
14
16
|
const { openpeepsApi } = useOpenpeeps();
|
|
15
17
|
const groupQuery = openpeepsApi.useGroupByHandle(handle);
|
|
16
18
|
const group = groupQuery.data;
|
|
17
19
|
const currentProfile = useCurrentProfile();
|
|
18
|
-
const
|
|
20
|
+
const tab = groupSectionFromHash(location.hash);
|
|
21
|
+
// Raw anchors (shared links, markdown) change the hash without going
|
|
22
|
+
// through the router. Mirror that into the location so the tab follows.
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const syncHash = () => {
|
|
25
|
+
if (window.location.hash === location.hash)
|
|
26
|
+
return;
|
|
27
|
+
navigate({ pathname: location.pathname, hash: window.location.hash }, { replace: true });
|
|
28
|
+
};
|
|
29
|
+
window.addEventListener('hashchange', syncHash);
|
|
30
|
+
return () => window.removeEventListener('hashchange', syncHash);
|
|
31
|
+
}, [location.hash, location.pathname, navigate]);
|
|
19
32
|
const upcomingEvents = openpeepsApi.useGroupUpcomingEventsFeed(group?.id ?? '');
|
|
20
33
|
const pastEvents = openpeepsApi.useGroupPastEventsFeed(group?.id ?? '');
|
|
21
34
|
const [eventsTab, setEventsTab] = useState('upcoming');
|
|
@@ -47,22 +60,12 @@ export function GroupShow() {
|
|
|
47
60
|
}
|
|
48
61
|
return (_jsxs("div", { children: [_jsx(GroupHeader, { group: group }), _jsxs("nav", { "aria-label": t('groups.sections.label', {
|
|
49
62
|
defaultValue: 'Group sections',
|
|
50
|
-
}), className: "border-border flex border-b", "data-testid": "tab-group", children: [_jsx(
|
|
51
|
-
setTab('posts');
|
|
52
|
-
window.history.replaceState(null, '', window.location.pathname);
|
|
53
|
-
}, children: t('groups.sections.posts', { defaultValue: 'Posts' }) }), _jsx(TabButton, { active: tab === 'events', onClick: () => {
|
|
54
|
-
setTab('events');
|
|
55
|
-
window.history.replaceState(null, '', `${window.location.pathname}#events`);
|
|
56
|
-
}, testId: "groups-tab-events", children: t('groups.sections.events', { defaultValue: 'Events' }) }), _jsx(TabButton, { active: tab === 'resources', onClick: () => {
|
|
57
|
-
setTab('resources');
|
|
58
|
-
window.history.replaceState(null, '', `${window.location.pathname}#resources`);
|
|
59
|
-
}, testId: "groups-tab-resources", children: t('groups.sections.resources', { defaultValue: 'Resources' }) }), _jsx(TabButton, { active: tab === 'description', onClick: () => {
|
|
60
|
-
setTab('description');
|
|
61
|
-
window.history.replaceState(null, '', `${window.location.pathname}#description`);
|
|
62
|
-
}, testId: "groups-tab-description", children: t('groups.sections.description', { defaultValue: 'Description' }) })] }), tab === 'posts' && _jsx(GroupFeed, { group: group }), tab === 'events' && (_jsxs("div", { children: [_jsx(NewEventButton, { visibility: "group", currentProfile: currentProfile, group: group, onNavigate: () => navigate('/events/new') }), _jsxs("nav", { "aria-label": t('groups.eventsTabs.label', {
|
|
63
|
+
}), className: "border-border flex border-b", "data-testid": "tab-group", children: [_jsx(TabLink, { active: tab === 'posts', hash: "", children: t('groups.sections.posts', { defaultValue: 'Posts' }) }), _jsx(TabLink, { active: tab === 'events', hash: "#events", testId: "groups-tab-events", children: t('groups.sections.events', { defaultValue: 'Events' }) }), _jsx(TabLink, { active: tab === 'resources', hash: "#resources", testId: "groups-tab-resources", children: t('groups.sections.resources', { defaultValue: 'Resources' }) }), _jsx(TabLink, { active: tab === 'description', hash: "#description", testId: "groups-tab-description", children: t('groups.sections.description', { defaultValue: 'Description' }) })] }), tab === 'posts' && _jsx(GroupFeed, { group: group }), tab === 'events' && (_jsxs("div", { children: [_jsx(NewEventButton, { visibility: "group", currentProfile: currentProfile, group: group, onNavigate: () => navigate('/events/new') }), _jsxs("nav", { "aria-label": t('groups.eventsTabs.label', {
|
|
63
64
|
defaultValue: 'Event timeframe',
|
|
64
65
|
}), className: "border-border flex border-b", children: [_jsx(TabButton, { active: eventsTab === 'upcoming', onClick: () => setEventsTab('upcoming'), children: t('events.feed.upcoming', { defaultValue: 'Upcoming' }) }), _jsx(TabButton, { active: eventsTab === 'past', onClick: () => setEventsTab('past'), children: t('events.feed.past', { defaultValue: 'Past' }) })] }), _jsx(EventsView, { query: eventsTab === 'upcoming' ? upcomingEvents : pastEvents, agenda: eventsTab, list: _jsx(Feed, { query: eventsTab === 'upcoming' ? upcomingEvents : pastEvents, formatSwitch: false }) })] })), tab === 'resources' && (_jsxs("div", { children: [_jsx(NewResourceButton, { visibility: "group", currentProfile: currentProfile, group: group }), _jsx(ResourceLibrary, { groupId: group.id })] })), tab === 'description' && (_jsxs("div", { className: "space-y-2 p-4", children: [_jsxs("section", { className: "border-b py-2", children: [_jsx("h3", { className: "text-lg font-semibold", children: "Description" }), _jsx(PostMarkdown, { source: group.description || 'No description yet' })] }), _jsxs("section", { className: "space-y-2 border-b py-2", children: [_jsx("h3", { className: "text-lg font-semibold", children: "Details" }), _jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: "Created" }), _jsx("p", { children: new Date(group.createdAt).toLocaleDateString() })] }), _jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: t('groups.visibility.title') }), _jsx("p", { children: t(`groups.visibility.${visibilityValue}.description`) })] }), _jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: t('groups.whoCanJoin.title') }), _jsx("p", { children: t(`groups.whoCanJoin.${whoCanJoinValue}.description`) })] }), _jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: t('groups.whoCanPost.title') }), _jsxs("p", { children: [t(`groups.whoCanPost.${whoCanPostValue}.description`), ".", ' ', t(`groups.whoCanPostEvents.${whoCanPostEventsValue}.description`)] })] }), _jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: t('groups.postsVisibility.title') }), _jsx("p", { children: t(`groups.postsVisibility.${postsVisibilityValue}.description`) })] })] }), _jsxs("section", { className: "border-b py-2", children: [_jsx("h3", { className: "text-lg font-semibold", children: "Rules" }), _jsx(PostMarkdown, { source: group.rules || 'No rules yet' })] })] }))] }));
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
67
|
+
const TabLink = ({ active, hash, children, testId, }) => {
|
|
68
|
+
const location = useLocation();
|
|
69
|
+
return (_jsx(Link, { replace: true, to: { pathname: location.pathname, hash }, "data-testid": testId, "aria-current": active ? 'page' : undefined, className: `px-4 py-2 text-sm no-underline ${active ? 'border-primary border-b-2 font-semibold' : 'text-muted-foreground hover:text-foreground'}`, children: children }));
|
|
70
|
+
};
|
|
71
|
+
const TabButton = ({ active, onClick, children, }) => (_jsx("button", { type: "button", onClick: onClick, className: `px-4 py-2 text-sm ${active ? 'border-primary border-b-2 font-semibold' : 'text-muted-foreground hover:text-foreground'}`, children: children }));
|
package/dist/react-native.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export * from './lib/unseenCountsOptimistic';
|
|
|
11
11
|
export * from './lib/postUnread';
|
|
12
12
|
export * from './lib/notificationBadge';
|
|
13
13
|
export { getInitials, hueFromHandle, initialsBackground, } from './lib/initialsAvatar';
|
|
14
|
-
export { svgCoverSrc } from './lib/svgCover';
|
|
14
|
+
export { isSvgUrl, svgCoverSrc } from './lib/svgCover';
|
|
15
15
|
export * from './lib/capabilityMatrix';
|
|
16
16
|
export * from './lib/groupFormErrors';
|
|
17
17
|
export * from './lib/passwordStrength';
|
|
@@ -52,7 +52,7 @@ export type { JamEventsContextValue } from './components/jams/JamEventsContext';
|
|
|
52
52
|
export { mentionProfilesFromParticipants, parseJamEventPayload, parseParticipantMetadata, sendAttendance, sendJamEvent, sendReaction, toggleHand, } from './components/jams/jamEventActions';
|
|
53
53
|
export type { JamParticipantMetadata } from './components/jams/jamEventActions';
|
|
54
54
|
export { useRaisedHands } from './components/jams/useJamHands';
|
|
55
|
-
export { calculateRecordingState, calculateRtmpStreamState, useJamRecordingState, useJamRtmpStreamState, } from './components/jams/jamRecordingState';
|
|
55
|
+
export { calculateRecordingState, calculateRtmpStreamState, formatRecordingElapsed, useJamRecordingElapsed, useJamRecordingState, useJamRtmpStreamState, } from './components/jams/jamRecordingState';
|
|
56
56
|
export { shouldReconnectAfterDisconnect } from './components/jams/disconnectReason';
|
|
57
57
|
export { JAM_EMOJIS, defaultRoomOptions, emojis, } from './components/jams/constants';
|
|
58
58
|
export * from './lib/reactionEmojis';
|
package/dist/react-native.js
CHANGED
|
@@ -11,7 +11,7 @@ export * from './lib/unseenCountsOptimistic.js';
|
|
|
11
11
|
export * from './lib/postUnread.js';
|
|
12
12
|
export * from './lib/notificationBadge.js';
|
|
13
13
|
export { getInitials, hueFromHandle, initialsBackground, } from './lib/initialsAvatar.js';
|
|
14
|
-
export { svgCoverSrc } from './lib/svgCover.js';
|
|
14
|
+
export { isSvgUrl, svgCoverSrc } from './lib/svgCover.js';
|
|
15
15
|
export * from './lib/capabilityMatrix.js';
|
|
16
16
|
export * from './lib/groupFormErrors.js';
|
|
17
17
|
export * from './lib/passwordStrength.js';
|
|
@@ -40,7 +40,7 @@ export { JamProvider, useJamContext, useJamObserver, } from './components/jams/J
|
|
|
40
40
|
export { JamEventsProvider, useJamEventsContext, useMaybeJamEventsContext, } from './components/jams/JamEventsContext.js';
|
|
41
41
|
export { mentionProfilesFromParticipants, parseJamEventPayload, parseParticipantMetadata, sendAttendance, sendJamEvent, sendReaction, toggleHand, } from './components/jams/jamEventActions.js';
|
|
42
42
|
export { useRaisedHands } from './components/jams/useJamHands.js';
|
|
43
|
-
export { calculateRecordingState, calculateRtmpStreamState, useJamRecordingState, useJamRtmpStreamState, } from './components/jams/jamRecordingState.js';
|
|
43
|
+
export { calculateRecordingState, calculateRtmpStreamState, formatRecordingElapsed, useJamRecordingElapsed, useJamRecordingState, useJamRtmpStreamState, } from './components/jams/jamRecordingState.js';
|
|
44
44
|
export { shouldReconnectAfterDisconnect } from './components/jams/disconnectReason.js';
|
|
45
45
|
export { JAM_EMOJIS, defaultRoomOptions, emojis, } from './components/jams/constants.js';
|
|
46
46
|
export * from './lib/reactionEmojis.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"react-i18next": "^15.4.1",
|
|
52
52
|
"simple-icons": "^16.31.0",
|
|
53
53
|
"uuidv7": "^1.0.2",
|
|
54
|
-
"@openpeepshq/common": "^0.3.2",
|
|
55
54
|
"@openpeepshq/client": "^0.2.1",
|
|
56
|
-
"@openpeepshq/
|
|
57
|
-
"@openpeepshq/
|
|
55
|
+
"@openpeepshq/react-ui": "^0.4.1",
|
|
56
|
+
"@openpeepshq/common": "^0.4.0",
|
|
57
|
+
"@openpeepshq/greenscreen": "^0.2.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"react": "^18.3.0 || ^19.0.0",
|
|
@@ -4,6 +4,7 @@ import { groupName } from '@openpeepshq/common/lib';
|
|
|
4
4
|
import { useT } from '../../i18n';
|
|
5
5
|
import { useCurrentProfile } from '../layout/IdentityContext';
|
|
6
6
|
import { JoinGroupButton } from './JoinGroupButton';
|
|
7
|
+
import { GroupNotificationButton } from './GroupNotificationSettingsModal';
|
|
7
8
|
import { GroupOptionsMenu } from './GroupOptionsMenu';
|
|
8
9
|
import { GroupShareMenu } from './GroupShareMenu';
|
|
9
10
|
import { GroupAvatar } from './GroupAvatar';
|
|
@@ -42,6 +43,7 @@ export function GroupHeader({ group }: GroupHeaderProps) {
|
|
|
42
43
|
) : (
|
|
43
44
|
<>
|
|
44
45
|
<GroupShareMenu group={group} />
|
|
46
|
+
<GroupNotificationButton group={group} />
|
|
45
47
|
<GroupOptionsMenu group={group} />
|
|
46
48
|
</>
|
|
47
49
|
)}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { Bell } from 'lucide-react';
|
|
3
|
+
import {
|
|
4
|
+
groupName,
|
|
5
|
+
groupNotificationLevelOptions,
|
|
6
|
+
type GroupNotificationLevel,
|
|
7
|
+
type GroupWithMeta,
|
|
8
|
+
} from '@openpeepshq/common';
|
|
9
|
+
import {
|
|
10
|
+
Dialog,
|
|
11
|
+
DialogActions,
|
|
12
|
+
DialogContent,
|
|
13
|
+
DialogHeader,
|
|
14
|
+
DialogTitle,
|
|
15
|
+
LoadingSpinner,
|
|
16
|
+
RadioGroup,
|
|
17
|
+
RadioGroupItem,
|
|
18
|
+
} from '@openpeepshq/react-ui';
|
|
19
|
+
import { useT } from '../../i18n';
|
|
20
|
+
import { useGroupNotificationLevel } from '../../hooks';
|
|
21
|
+
import { useToast } from '../layout/ToastProvider';
|
|
22
|
+
|
|
23
|
+
export interface GroupNotificationSettingsModalProps {
|
|
24
|
+
group: GroupWithMeta;
|
|
25
|
+
onClose: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const optionLabelKey: Record<GroupNotificationLevel, string> = {
|
|
29
|
+
all: 'groups.modals.manageNotifications.options.all',
|
|
30
|
+
mostRelevant: 'groups.modals.manageNotifications.options.mostRelevant',
|
|
31
|
+
off: 'groups.modals.manageNotifications.options.off',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const optionDescriptionKey: Record<GroupNotificationLevel, string> = {
|
|
35
|
+
all: 'groups.modals.manageNotifications.options.allDescription',
|
|
36
|
+
mostRelevant:
|
|
37
|
+
'groups.modals.manageNotifications.options.mostRelevantDescription',
|
|
38
|
+
off: 'groups.modals.manageNotifications.options.offDescription',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const optionDescriptionDefault: Record<GroupNotificationLevel, string> = {
|
|
42
|
+
all: 'Every post and membership change, using your account notification settings.',
|
|
43
|
+
mostRelevant: 'Posts from people you follow.',
|
|
44
|
+
off: 'No posts or membership changes from this group.',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export function GroupNotificationSettingsModal({
|
|
48
|
+
group,
|
|
49
|
+
onClose,
|
|
50
|
+
}: GroupNotificationSettingsModalProps) {
|
|
51
|
+
const t = useT();
|
|
52
|
+
const { success } = useToast();
|
|
53
|
+
const { level, setLevel, save, saving, ready, loadFailed, error } =
|
|
54
|
+
useGroupNotificationLevel(group.id);
|
|
55
|
+
|
|
56
|
+
const onSave = async () => {
|
|
57
|
+
const saved = await save();
|
|
58
|
+
if (!saved) return;
|
|
59
|
+
success(
|
|
60
|
+
t('groups.modals.manageNotifications.saved', {
|
|
61
|
+
defaultValue: 'Group notification settings updated.',
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
onClose();
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Dialog open onOpenChange={(open) => !open && onClose()}>
|
|
69
|
+
<DialogContent className="max-h-[85vh] max-w-md overflow-y-auto">
|
|
70
|
+
<DialogHeader>
|
|
71
|
+
<DialogTitle>
|
|
72
|
+
{t('groups.modals.manageNotifications.title', {
|
|
73
|
+
defaultValue: 'Manage notifications',
|
|
74
|
+
})}
|
|
75
|
+
</DialogTitle>
|
|
76
|
+
</DialogHeader>
|
|
77
|
+
<p className="text-muted-foreground px-1 text-sm">
|
|
78
|
+
{t('groups.modals.manageNotifications.description', {
|
|
79
|
+
defaultValue: 'Manage notifications about {{groupName}}.',
|
|
80
|
+
groupName: groupName(group),
|
|
81
|
+
})}
|
|
82
|
+
</p>
|
|
83
|
+
{ready ? (
|
|
84
|
+
<RadioGroup
|
|
85
|
+
value={level}
|
|
86
|
+
onValueChange={(value) => setLevel(value as GroupNotificationLevel)}
|
|
87
|
+
className="gap-3 px-1"
|
|
88
|
+
>
|
|
89
|
+
{groupNotificationLevelOptions.map((option) => (
|
|
90
|
+
<label key={option} className="flex items-start gap-2 text-sm">
|
|
91
|
+
<RadioGroupItem value={option} className="mt-0.5" />
|
|
92
|
+
<span>
|
|
93
|
+
<span className="font-medium">
|
|
94
|
+
{t(optionLabelKey[option], { defaultValue: option })}
|
|
95
|
+
</span>
|
|
96
|
+
<span className="text-muted-foreground mt-0.5 block">
|
|
97
|
+
{t(optionDescriptionKey[option], {
|
|
98
|
+
defaultValue: optionDescriptionDefault[option],
|
|
99
|
+
})}
|
|
100
|
+
</span>
|
|
101
|
+
</span>
|
|
102
|
+
</label>
|
|
103
|
+
))}
|
|
104
|
+
</RadioGroup>
|
|
105
|
+
) : loadFailed ? (
|
|
106
|
+
<p className="text-error px-1 text-sm">
|
|
107
|
+
{t('groups.modals.manageNotifications.loadError', {
|
|
108
|
+
defaultValue: 'Could not load notification settings.',
|
|
109
|
+
})}
|
|
110
|
+
</p>
|
|
111
|
+
) : (
|
|
112
|
+
<div className="text-muted-foreground flex h-24 items-center justify-center">
|
|
113
|
+
<LoadingSpinner />
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
116
|
+
{error ? (
|
|
117
|
+
<p className="border-error/40 text-error rounded-md border p-2 text-sm">
|
|
118
|
+
{error}
|
|
119
|
+
</p>
|
|
120
|
+
) : null}
|
|
121
|
+
<DialogActions
|
|
122
|
+
cancelLabel={t('common.cancel', { defaultValue: 'Cancel' })}
|
|
123
|
+
onCancel={onClose}
|
|
124
|
+
actionLabel={
|
|
125
|
+
saving
|
|
126
|
+
? t('common.saving', { defaultValue: 'Saving…' })
|
|
127
|
+
: t('common.save', { defaultValue: 'Save' })
|
|
128
|
+
}
|
|
129
|
+
onAction={onSave}
|
|
130
|
+
disabled={saving || !ready}
|
|
131
|
+
/>
|
|
132
|
+
</DialogContent>
|
|
133
|
+
</Dialog>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function GroupNotificationButton({ group }: { group: GroupWithMeta }) {
|
|
138
|
+
const t = useT();
|
|
139
|
+
const [open, setOpen] = useState(false);
|
|
140
|
+
const label = t('groups.modals.manageNotifications.title', {
|
|
141
|
+
defaultValue: 'Manage notifications',
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<>
|
|
146
|
+
<button
|
|
147
|
+
type="button"
|
|
148
|
+
title={label}
|
|
149
|
+
aria-label={label}
|
|
150
|
+
className="rounded-button inline-flex items-center justify-center"
|
|
151
|
+
onClick={() => setOpen(true)}
|
|
152
|
+
>
|
|
153
|
+
<Bell size={16} aria-hidden="true" />
|
|
154
|
+
</button>
|
|
155
|
+
{open ? (
|
|
156
|
+
<GroupNotificationSettingsModal
|
|
157
|
+
group={group}
|
|
158
|
+
onClose={() => setOpen(false)}
|
|
159
|
+
/>
|
|
160
|
+
) : null}
|
|
161
|
+
</>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Link, Pencil, Share } from 'lucide-react';
|
|
2
|
+
import { groupSectionPath, type GroupSection } from '@openpeepshq/common/lib';
|
|
2
3
|
import type { GroupWithMeta } from '@openpeepshq/common/types';
|
|
3
4
|
import {
|
|
4
5
|
PopupMenu,
|
|
@@ -20,11 +21,22 @@ export function GroupShareMenu({ group }: GroupShareMenuProps) {
|
|
|
20
21
|
const { openNewPost } = useNewPostModal();
|
|
21
22
|
const { openCreateConversation } = useCreateNewConversation();
|
|
22
23
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const sectionUrl = (section: GroupSection = 'posts') => {
|
|
25
|
+
const path = groupSectionPath(group.handle, section);
|
|
26
|
+
return typeof window !== 'undefined'
|
|
27
|
+
? `${window.location.origin}${path}`
|
|
28
|
+
: path;
|
|
29
|
+
};
|
|
30
|
+
const groupUrl = sectionUrl();
|
|
27
31
|
const inviteBlurb = t('groups.share.inviteBlurb', { url: groupUrl });
|
|
32
|
+
const copySectionLink = (
|
|
33
|
+
section: GroupSection,
|
|
34
|
+
copiedKey: string,
|
|
35
|
+
copiedDefault: string,
|
|
36
|
+
) => {
|
|
37
|
+
void navigator.clipboard.writeText(sectionUrl(section));
|
|
38
|
+
success(t(copiedKey, { defaultValue: copiedDefault }));
|
|
39
|
+
};
|
|
28
40
|
|
|
29
41
|
return (
|
|
30
42
|
<PopupMenu
|
|
@@ -39,7 +51,9 @@ export function GroupShareMenu({ group }: GroupShareMenuProps) {
|
|
|
39
51
|
})}
|
|
40
52
|
/>
|
|
41
53
|
<PopupMenuButton
|
|
42
|
-
title={t('groups.actions.shareToFeed', {
|
|
54
|
+
title={t('groups.actions.shareToFeed', {
|
|
55
|
+
defaultValue: 'Share to feed',
|
|
56
|
+
})}
|
|
43
57
|
text={t('groups.share.postToFeed', { defaultValue: 'Post to feed' })}
|
|
44
58
|
icon={Pencil}
|
|
45
59
|
action={() =>
|
|
@@ -57,18 +71,69 @@ export function GroupShareMenu({ group }: GroupShareMenuProps) {
|
|
|
57
71
|
action={() => openCreateConversation({ message: inviteBlurb })}
|
|
58
72
|
/>
|
|
59
73
|
<PopupSection
|
|
60
|
-
title={t('groups.actions.otherOptions', {
|
|
74
|
+
title={t('groups.actions.otherOptions', {
|
|
75
|
+
defaultValue: 'Other options',
|
|
76
|
+
})}
|
|
61
77
|
/>
|
|
62
78
|
<PopupMenuButton
|
|
63
79
|
title={t('groups.share.copyLink', { defaultValue: 'Copy link' })}
|
|
64
80
|
text={t('groups.share.copyLink', { defaultValue: 'Copy link' })}
|
|
65
81
|
icon={Link}
|
|
66
|
-
action={() =>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
82
|
+
action={() =>
|
|
83
|
+
copySectionLink(
|
|
84
|
+
'posts',
|
|
85
|
+
'groups.share.linkCopied',
|
|
86
|
+
'Group link copied',
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
/>
|
|
90
|
+
<PopupMenuButton
|
|
91
|
+
title={t('groups.share.copyEventsLink', {
|
|
92
|
+
defaultValue: 'Copy events link',
|
|
93
|
+
})}
|
|
94
|
+
text={t('groups.share.copyEventsLink', {
|
|
95
|
+
defaultValue: 'Copy events link',
|
|
96
|
+
})}
|
|
97
|
+
icon={Link}
|
|
98
|
+
action={() =>
|
|
99
|
+
copySectionLink(
|
|
100
|
+
'events',
|
|
101
|
+
'groups.share.eventsLinkCopied',
|
|
102
|
+
'Events link copied',
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
/>
|
|
106
|
+
<PopupMenuButton
|
|
107
|
+
title={t('groups.share.copyResourcesLink', {
|
|
108
|
+
defaultValue: 'Copy resources link',
|
|
109
|
+
})}
|
|
110
|
+
text={t('groups.share.copyResourcesLink', {
|
|
111
|
+
defaultValue: 'Copy resources link',
|
|
112
|
+
})}
|
|
113
|
+
icon={Link}
|
|
114
|
+
action={() =>
|
|
115
|
+
copySectionLink(
|
|
116
|
+
'resources',
|
|
117
|
+
'groups.share.resourcesLinkCopied',
|
|
118
|
+
'Resources link copied',
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
/>
|
|
122
|
+
<PopupMenuButton
|
|
123
|
+
title={t('groups.share.copyDescriptionLink', {
|
|
124
|
+
defaultValue: 'Copy description link',
|
|
125
|
+
})}
|
|
126
|
+
text={t('groups.share.copyDescriptionLink', {
|
|
127
|
+
defaultValue: 'Copy description link',
|
|
128
|
+
})}
|
|
129
|
+
icon={Link}
|
|
130
|
+
action={() =>
|
|
131
|
+
copySectionLink(
|
|
132
|
+
'description',
|
|
133
|
+
'groups.share.descriptionLinkCopied',
|
|
134
|
+
'Description link copied',
|
|
135
|
+
)
|
|
136
|
+
}
|
|
72
137
|
/>
|
|
73
138
|
</PopupMenu>
|
|
74
139
|
);
|
|
@@ -18,6 +18,11 @@ export { GroupCapabilityMatrix } from './GroupCapabilityMatrix';
|
|
|
18
18
|
export type { GroupCapabilityMatrixProps } from './GroupCapabilityMatrix';
|
|
19
19
|
export { GroupOptionsMenu } from './GroupOptionsMenu';
|
|
20
20
|
export type { GroupOptionsMenuProps } from './GroupOptionsMenu';
|
|
21
|
+
export {
|
|
22
|
+
GroupNotificationButton,
|
|
23
|
+
GroupNotificationSettingsModal,
|
|
24
|
+
} from './GroupNotificationSettingsModal';
|
|
25
|
+
export type { GroupNotificationSettingsModalProps } from './GroupNotificationSettingsModal';
|
|
21
26
|
export { GroupShareMenu } from './GroupShareMenu';
|
|
22
27
|
export type { GroupShareMenuProps } from './GroupShareMenu';
|
|
23
28
|
export { AddGroupMemberModal } from './AddGroupMemberModal';
|
|
@@ -85,22 +85,18 @@ const useFooterControls = () => {
|
|
|
85
85
|
const RecordButton = ({
|
|
86
86
|
isRecording,
|
|
87
87
|
busy,
|
|
88
|
+
label,
|
|
88
89
|
onToggle,
|
|
89
|
-
t,
|
|
90
90
|
}: {
|
|
91
91
|
isRecording: boolean;
|
|
92
92
|
busy: boolean;
|
|
93
|
+
label: string;
|
|
93
94
|
onToggle: () => void;
|
|
94
|
-
t: ReturnType<typeof useT>;
|
|
95
95
|
}) => (
|
|
96
96
|
<JamToolbarButton
|
|
97
97
|
tone="danger"
|
|
98
98
|
disabled={busy}
|
|
99
|
-
title={
|
|
100
|
-
isRecording
|
|
101
|
-
? t('jams.recording.stopTitle')
|
|
102
|
-
: t('events.recordingInProgress')
|
|
103
|
-
}
|
|
99
|
+
title={label}
|
|
104
100
|
action={onToggle}
|
|
105
101
|
>
|
|
106
102
|
{isRecording ? <SquareStop /> : <Disc />}
|
|
@@ -224,6 +220,7 @@ const MobileMenu = ({
|
|
|
224
220
|
isModerator,
|
|
225
221
|
recordingEnabled,
|
|
226
222
|
isRecording,
|
|
223
|
+
recordingLabel,
|
|
227
224
|
busy,
|
|
228
225
|
onClose,
|
|
229
226
|
onOpenChat,
|
|
@@ -236,6 +233,7 @@ const MobileMenu = ({
|
|
|
236
233
|
isModerator: boolean;
|
|
237
234
|
recordingEnabled: boolean;
|
|
238
235
|
isRecording: boolean;
|
|
236
|
+
recordingLabel: string;
|
|
239
237
|
busy: boolean;
|
|
240
238
|
onClose: () => void;
|
|
241
239
|
onOpenChat: () => void;
|
|
@@ -302,11 +300,7 @@ const MobileMenu = ({
|
|
|
302
300
|
}}
|
|
303
301
|
>
|
|
304
302
|
{isRecording ? <CircleStop /> : <Disc />}
|
|
305
|
-
<span>
|
|
306
|
-
{isRecording
|
|
307
|
-
? t('jams.recording.stopTitle')
|
|
308
|
-
: t('events.recordingInProgress')}
|
|
309
|
-
</span>
|
|
303
|
+
<span>{recordingLabel}</span>
|
|
310
304
|
</button>
|
|
311
305
|
) : null}
|
|
312
306
|
</div>
|
|
@@ -333,6 +327,7 @@ export const JamFooter = ({
|
|
|
333
327
|
t,
|
|
334
328
|
isModerator,
|
|
335
329
|
isRecording,
|
|
330
|
+
recordingLabel,
|
|
336
331
|
recordingEnabled,
|
|
337
332
|
handRaised,
|
|
338
333
|
busy,
|
|
@@ -377,8 +372,8 @@ export const JamFooter = ({
|
|
|
377
372
|
<RecordButton
|
|
378
373
|
isRecording={isRecording}
|
|
379
374
|
busy={busy}
|
|
375
|
+
label={recordingLabel}
|
|
380
376
|
onToggle={() => void toggleRecording()}
|
|
381
|
-
t={t}
|
|
382
377
|
/>
|
|
383
378
|
) : null}
|
|
384
379
|
|
|
@@ -444,6 +439,7 @@ export const JamFooter = ({
|
|
|
444
439
|
isModerator={isModerator}
|
|
445
440
|
recordingEnabled={recordingEnabled}
|
|
446
441
|
isRecording={isRecording}
|
|
442
|
+
recordingLabel={recordingLabel}
|
|
447
443
|
busy={busy}
|
|
448
444
|
onClose={() => setMobileMenuOpen(false)}
|
|
449
445
|
onOpenChat={onToggleChat}
|
|
@@ -6,7 +6,10 @@ import {
|
|
|
6
6
|
import { ConnectionQuality } from 'livekit-client';
|
|
7
7
|
import { Circle, X } from 'lucide-react';
|
|
8
8
|
import { useT } from '../../i18n';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
useJamRecordingElapsed,
|
|
11
|
+
useJamRecordingState,
|
|
12
|
+
} from './jamRecordingState';
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* Red "recording" pill shown to every participant while egress is active,
|
|
@@ -15,6 +18,7 @@ import { useJamRecordingState } from './jamRecordingState';
|
|
|
15
18
|
export function JamRecordingIndicator() {
|
|
16
19
|
const t = useT();
|
|
17
20
|
const { isRecording } = useJamRecordingState();
|
|
21
|
+
const elapsed = useJamRecordingElapsed();
|
|
18
22
|
|
|
19
23
|
if (!isRecording) return null;
|
|
20
24
|
|
|
@@ -22,6 +26,7 @@ export function JamRecordingIndicator() {
|
|
|
22
26
|
<div className="bg-error/90 text-error-foreground pointer-events-none fixed left-4 top-4 z-50 flex items-center gap-2 rounded-full px-3 py-1 text-sm font-medium shadow-lg">
|
|
23
27
|
<Circle className="size-3 animate-pulse fill-current" />
|
|
24
28
|
{t('events.recordingInProgress', { defaultValue: 'Recording' })}
|
|
29
|
+
{elapsed ? <span className="tabular-nums">{elapsed}</span> : null}
|
|
25
30
|
</div>
|
|
26
31
|
);
|
|
27
32
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import type { JamEvent } from '@openpeepshq/common/types';
|
|
3
3
|
import { getUniqueBy } from '@openpeepshq/common';
|
|
4
4
|
import { useOpenpeeps } from '../../contexts/openpeeps';
|
|
@@ -70,3 +70,37 @@ export const useJamRtmpStreamState = () => {
|
|
|
70
70
|
[eventsQuery.data, sessionEvents],
|
|
71
71
|
);
|
|
72
72
|
};
|
|
73
|
+
|
|
74
|
+
const pad2 = (value: number) => String(value).padStart(2, '0');
|
|
75
|
+
|
|
76
|
+
/** Elapsed milliseconds as m:ss, or h:mm:ss past one hour (recording pill). */
|
|
77
|
+
export const formatRecordingElapsed = (ms: number) => {
|
|
78
|
+
const totalSeconds = Math.max(0, Math.floor(ms / 1000));
|
|
79
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
80
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
81
|
+
const seconds = totalSeconds % 60;
|
|
82
|
+
return hours > 0
|
|
83
|
+
? `${hours}:${pad2(minutes)}:${pad2(seconds)}`
|
|
84
|
+
: `${pad2(minutes)}:${pad2(seconds)}`;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Elapsed time of the active recording, ticked once per second. Returns
|
|
89
|
+
* `undefined` while nothing is recording (no timer while idle).
|
|
90
|
+
*/
|
|
91
|
+
export const useJamRecordingElapsed = () => {
|
|
92
|
+
const { isRecording, recordingStart } = useJamRecordingState();
|
|
93
|
+
const [now, setNow] = useState(() => Date.now());
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (!isRecording) return;
|
|
97
|
+
setNow(Date.now());
|
|
98
|
+
const id = setInterval(() => setNow(Date.now()), 1000);
|
|
99
|
+
return () => clearInterval(id);
|
|
100
|
+
}, [isRecording, recordingStart]);
|
|
101
|
+
|
|
102
|
+
return useMemo(() => {
|
|
103
|
+
if (!isRecording || !recordingStart) return undefined;
|
|
104
|
+
return formatRecordingElapsed(now - new Date(recordingStart).getTime());
|
|
105
|
+
}, [isRecording, recordingStart, now]);
|
|
106
|
+
};
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
canModerateJam,
|
|
14
14
|
canViewJamAttendees,
|
|
15
15
|
countYesRsvps,
|
|
16
|
+
defaultRsvpRecurrenceId,
|
|
16
17
|
effectiveEventTimes,
|
|
17
18
|
eventTimeZoneOptions,
|
|
18
19
|
formatEventClockTime,
|
|
@@ -104,7 +105,11 @@ export function FullEvent({ post, occurrence }: FullEventProps) {
|
|
|
104
105
|
(!event.recurrence || occurrenceId)
|
|
105
106
|
? event.maxAttendees - countYesRsvps(post, occurrenceId)
|
|
106
107
|
: null;
|
|
107
|
-
const times = effectiveEventTimes(
|
|
108
|
+
const times = effectiveEventTimes(
|
|
109
|
+
event,
|
|
110
|
+
occurrenceId ??
|
|
111
|
+
(event.recurrence ? defaultRsvpRecurrenceId(event) : undefined),
|
|
112
|
+
);
|
|
108
113
|
const recurrenceLabel = event.recurrence
|
|
109
114
|
? formatEventRecurrence(event.recurrence, t, event.start)
|
|
110
115
|
: '';
|