@openpeepshq/react 0.6.2 → 0.6.3
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/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/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 +3 -3
- package/dist/react-native.d.ts +1 -1
- package/dist/react-native.js +1 -1
- package/package.json +2 -2
- 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/hooks/jams/useJamFooterControls.ts +14 -2
- package/src/react-native.ts +2 -0
|
@@ -40,9 +40,7 @@ const useFooterControls = () => {
|
|
|
40
40
|
return { t, room, ...controls };
|
|
41
41
|
};
|
|
42
42
|
/** Record control mirroring `RecordSwitch.svelte` (always red, Disc / SquareStop). */
|
|
43
|
-
const RecordButton = ({ isRecording, busy,
|
|
44
|
-
? t('jams.recording.stopTitle')
|
|
45
|
-
: t('events.recordingInProgress'), action: onToggle, children: isRecording ? _jsx(SquareStop, {}) : _jsx(Disc, {}) }));
|
|
43
|
+
const RecordButton = ({ isRecording, busy, label, onToggle, }) => (_jsx(JamToolbarButton, { tone: "danger", disabled: busy, title: label, action: onToggle, children: isRecording ? _jsx(SquareStop, {}) : _jsx(Disc, {}) }));
|
|
46
44
|
/** People button with count badges mirroring Svelte `UserButton.svelte`. */
|
|
47
45
|
const UserButton = ({ active, count, waitingRoomCount, onToggle, t, }) => (_jsxs(JamToolbarButton, { title: t('jams.participant.showEveryone'), tone: active ? 'active' : 'default', action: onToggle, children: [_jsx("span", { className: "bg-border-2 text-foreground absolute -right-2 -top-2 size-6 rounded-full p-1 px-2 text-xs", children: count }), waitingRoomCount > 0 ? (_jsx("span", { className: "bg-border-2 text-foreground absolute -bottom-2 -right-2 size-6 rounded-full p-1 px-2 text-xs", children: waitingRoomCount })) : null, _jsx(UsersRound, {})] }));
|
|
48
46
|
/** Chat toggle with unread dot mirroring `ChatDrawerButton.svelte`. */
|
|
@@ -71,7 +69,7 @@ const ScreenShareButton = ({ closeMenu, t, mobile = false, }) => {
|
|
|
71
69
|
return (_jsx(JamToolbarButton, { title: t('jams.screenShare.startStopTitle'), tone: enabled ? 'active' : 'default', className: "hidden md:flex", action: action, children: enabled ? _jsx(ScreenShareOff, {}) : _jsx(ScreenShare, {}) }));
|
|
72
70
|
};
|
|
73
71
|
/** Mobile overflow menu mirroring `MobileMenu.svelte`. */
|
|
74
|
-
const MobileMenu = ({ isModerator, recordingEnabled, isRecording, busy, onClose, onOpenChat, onOpenPeople, onOpenDetails, onRaiseHand, onToggleRecording, t, }) => (_jsxs("div", { className: "bg-surface text-foreground absolute bottom-20 left-2 right-2 z-50 grid grid-cols-3 rounded-md p-2", children: [_jsxs("button", { type: "button", className: "flex flex-col items-center justify-center gap-y-2 p-2 md:hidden", onClick: () => {
|
|
72
|
+
const MobileMenu = ({ isModerator, recordingEnabled, isRecording, recordingLabel, busy, onClose, onOpenChat, onOpenPeople, onOpenDetails, onRaiseHand, onToggleRecording, t, }) => (_jsxs("div", { className: "bg-surface text-foreground absolute bottom-20 left-2 right-2 z-50 grid grid-cols-3 rounded-md p-2", children: [_jsxs("button", { type: "button", className: "flex flex-col items-center justify-center gap-y-2 p-2 md:hidden", onClick: () => {
|
|
75
73
|
onClose();
|
|
76
74
|
onOpenChat();
|
|
77
75
|
}, children: [_jsx(MessageSquareText, {}), _jsx("span", { children: t('jams.mobileMenu.inJamMessage') })] }), _jsxs("button", { type: "button", className: "flex flex-col items-center justify-center gap-y-2 p-2 md:hidden", onClick: () => {
|
|
@@ -86,19 +84,17 @@ const MobileMenu = ({ isModerator, recordingEnabled, isRecording, busy, onClose,
|
|
|
86
84
|
}, children: [_jsx(UsersRound, {}), _jsx("span", { children: t('jams.mobileMenu.people') })] }), isModerator && recordingEnabled ? (_jsxs("button", { type: "button", disabled: busy, className: "flex flex-col items-center justify-center gap-y-2 p-2 md:hidden", onClick: () => {
|
|
87
85
|
onClose();
|
|
88
86
|
onToggleRecording();
|
|
89
|
-
}, children: [isRecording ? _jsx(CircleStop, {}) : _jsx(Disc, {}), _jsx("span", { children:
|
|
90
|
-
? t('jams.recording.stopTitle')
|
|
91
|
-
: t('events.recordingInProgress') })] })) : null] }));
|
|
87
|
+
}, children: [isRecording ? _jsx(CircleStop, {}) : _jsx(Disc, {}), _jsx("span", { children: recordingLabel })] })) : null] }));
|
|
92
88
|
/**
|
|
93
89
|
* In-room footer mirroring the Svelte `DesktopFooter` / `MobileFooter` split.
|
|
94
90
|
*/
|
|
95
91
|
export const JamFooter = ({ chatOpen, onToggleChat, peopleOpen, onTogglePeople, detailsOpen, onToggleDetails, speakerDeviceId, speakerEnabled, onSpeakerChange, onToggleSpeaker, blur, onToggleBlur, }) => {
|
|
96
|
-
const { t, isModerator, isRecording, recordingEnabled, handRaised, busy, participantCount, waitingRoomCount, sendReactionEmoji, toggleRecording, raiseHand, } = useFooterControls();
|
|
92
|
+
const { t, isModerator, isRecording, recordingLabel, recordingEnabled, handRaised, busy, participantCount, waitingRoomCount, sendReactionEmoji, toggleRecording, raiseHand, } = useFooterControls();
|
|
97
93
|
const { jamEvent } = useJamContext();
|
|
98
94
|
const [reactionMenuOpen, setReactionMenuOpen] = useState(false);
|
|
99
95
|
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
|
100
96
|
const handleEmojiSelect = async (emoji) => {
|
|
101
97
|
await sendReactionEmoji(emoji);
|
|
102
98
|
};
|
|
103
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "hidden w-full flex-none items-center justify-between px-4 py-3 md:flex", children: [_jsx("h1", { className: "truncate pr-2", children: jamEvent.name }), _jsxs("div", { className: "relative flex items-center gap-x-4", children: [reactionMenuOpen ? (_jsx("div", { className: "absolute bottom-12 right-0 z-50 md:w-max", children: _jsx(JamReactionMenu, { onSelect: handleEmojiSelect }) })) : null, _jsx(JamMicSelector, {}), _jsx(JamCameraSelector, {}), _jsx(JamAudioOutputSelector, { speakerDeviceId: speakerDeviceId, speakerEnabled: speakerEnabled, onSpeakerChange: onSpeakerChange, onToggleSpeaker: onToggleSpeaker }), isModerator && recordingEnabled ? (_jsx(RecordButton, { isRecording: isRecording, busy: busy, onToggle: () => void toggleRecording()
|
|
99
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "hidden w-full flex-none items-center justify-between px-4 py-3 md:flex", children: [_jsx("h1", { className: "truncate pr-2", children: jamEvent.name }), _jsxs("div", { className: "relative flex items-center gap-x-4", children: [reactionMenuOpen ? (_jsx("div", { className: "absolute bottom-12 right-0 z-50 md:w-max", children: _jsx(JamReactionMenu, { onSelect: handleEmojiSelect }) })) : null, _jsx(JamMicSelector, {}), _jsx(JamCameraSelector, {}), _jsx(JamAudioOutputSelector, { speakerDeviceId: speakerDeviceId, speakerEnabled: speakerEnabled, onSpeakerChange: onSpeakerChange, onToggleSpeaker: onToggleSpeaker }), isModerator && recordingEnabled ? (_jsx(RecordButton, { isRecording: isRecording, busy: busy, label: recordingLabel, onToggle: () => void toggleRecording() })) : null, _jsx(JamToolbarButton, { title: blur ? t('jams.blur.turnOff') : t('jams.blur.blurBackground'), tone: blur ? 'active' : 'default', action: onToggleBlur, children: _jsx(Blur, {}) }), _jsx(JamToolbarButton, { title: t('jams.hand.raiseTitle'), tone: handRaised ? 'active' : 'default', action: raiseHand, children: _jsx(Hand, {}) }), _jsx(ScreenShareButton, { t: t }), _jsx(JamToolbarButton, { title: t('jams.reactions.sendTitle'), tone: reactionMenuOpen ? 'active' : 'default', action: () => setReactionMenuOpen((open) => !open), children: _jsx(Laugh, {}) }), _jsx(ChatButton, { active: chatOpen, onToggle: onToggleChat, t: t })] }), _jsxs("div", { className: "relative flex items-center gap-x-4", children: [_jsx(JamToolbarButton, { title: t('jams.mobileMenu.jamDetails'), tone: detailsOpen ? 'active' : 'default', action: onToggleDetails, children: _jsx(Info, {}) }), _jsx(UserButton, { active: peopleOpen, count: participantCount, waitingRoomCount: waitingRoomCount, onToggle: onTogglePeople, t: t }), _jsx(LeaveCloseButton, {})] })] }), _jsxs("div", { className: "bg-background/75 relative flex w-full items-center justify-between gap-x-2 px-2 py-3 md:hidden", children: [reactionMenuOpen ? (_jsx("div", { className: "absolute bottom-20 right-[7%] z-50 mt-2 w-[90%] rounded-md p-2", children: _jsx(JamReactionMenu, { onSelect: handleEmojiSelect, mobile: true }) })) : null, mobileMenuOpen ? (_jsx(MobileMenu, { isModerator: isModerator, recordingEnabled: recordingEnabled, isRecording: isRecording, recordingLabel: recordingLabel, busy: busy, onClose: () => setMobileMenuOpen(false), onOpenChat: onToggleChat, onOpenPeople: onTogglePeople, onOpenDetails: onToggleDetails, onRaiseHand: raiseHand, onToggleRecording: () => void toggleRecording(), t: t })) : null, _jsx(JamMicSelector, {}), _jsx(JamCameraSelector, {}), _jsx(JamAudioOutputSelector, { speakerDeviceId: speakerDeviceId, speakerEnabled: speakerEnabled, onSpeakerChange: onSpeakerChange, onToggleSpeaker: onToggleSpeaker }), _jsx(JamToolbarButton, { title: t('jams.reactions.sendTitle'), tone: reactionMenuOpen ? 'active' : 'default', action: () => setReactionMenuOpen((open) => !open), children: _jsx(Laugh, {}) }), _jsx(JamToolbarButton, { title: t('jams.drawer.jamControls'), action: () => setMobileMenuOpen((open) => !open), children: _jsx(CircleEllipsis, {}) }), _jsx(LeaveCloseButton, {})] })] }));
|
|
104
100
|
};
|
|
@@ -4,7 +4,7 @@ import { useConnectionQualityIndicator, useLocalParticipant, } from '@livekit/co
|
|
|
4
4
|
import { ConnectionQuality } from 'livekit-client';
|
|
5
5
|
import { Circle, X } from 'lucide-react';
|
|
6
6
|
import { useT } from '../../i18n/index.js';
|
|
7
|
-
import { useJamRecordingState } from './jamRecordingState.js';
|
|
7
|
+
import { useJamRecordingElapsed, useJamRecordingState, } from './jamRecordingState.js';
|
|
8
8
|
/**
|
|
9
9
|
* Red "recording" pill shown to every participant while egress is active,
|
|
10
10
|
* mirroring the Svelte `RecordingIndicator` (jam recordStart/recordStop events).
|
|
@@ -12,9 +12,10 @@ import { useJamRecordingState } from './jamRecordingState.js';
|
|
|
12
12
|
export function JamRecordingIndicator() {
|
|
13
13
|
const t = useT();
|
|
14
14
|
const { isRecording } = useJamRecordingState();
|
|
15
|
+
const elapsed = useJamRecordingElapsed();
|
|
15
16
|
if (!isRecording)
|
|
16
17
|
return null;
|
|
17
|
-
return (_jsxs("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", children: [_jsx(Circle, { className: "size-3 animate-pulse fill-current" }), t('events.recordingInProgress', { defaultValue: 'Recording' })] }));
|
|
18
|
+
return (_jsxs("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", children: [_jsx(Circle, { className: "size-3 animate-pulse fill-current" }), t('events.recordingInProgress', { defaultValue: 'Recording' }), elapsed ? _jsx("span", { className: "tabular-nums", children: elapsed }) : null] }));
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Dismissable banner shown when the local connection quality degrades, mirroring
|
|
@@ -14,3 +14,10 @@ export declare const useJamRecordingState: () => {
|
|
|
14
14
|
export declare const useJamRtmpStreamState: () => {
|
|
15
15
|
isStreaming: boolean;
|
|
16
16
|
};
|
|
17
|
+
/** Elapsed milliseconds as m:ss, or h:mm:ss past one hour (recording pill). */
|
|
18
|
+
export declare const formatRecordingElapsed: (ms: number) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Elapsed time of the active recording, ticked once per second. Returns
|
|
21
|
+
* `undefined` while nothing is recording (no timer while idle).
|
|
22
|
+
*/
|
|
23
|
+
export declare const useJamRecordingElapsed: () => string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { getUniqueBy } from '@openpeepshq/common';
|
|
3
3
|
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
4
4
|
import { useJamContext } from './JamContext.js';
|
|
@@ -37,3 +37,34 @@ export const useJamRtmpStreamState = () => {
|
|
|
37
37
|
const eventsQuery = openpeepsApi.useJamEvents(jamPost.id);
|
|
38
38
|
return useMemo(() => calculateRtmpStreamState(eventsQuery.data ?? [], sessionEvents), [eventsQuery.data, sessionEvents]);
|
|
39
39
|
};
|
|
40
|
+
const pad2 = (value) => String(value).padStart(2, '0');
|
|
41
|
+
/** Elapsed milliseconds as m:ss, or h:mm:ss past one hour (recording pill). */
|
|
42
|
+
export const formatRecordingElapsed = (ms) => {
|
|
43
|
+
const totalSeconds = Math.max(0, Math.floor(ms / 1000));
|
|
44
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
45
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
46
|
+
const seconds = totalSeconds % 60;
|
|
47
|
+
return hours > 0
|
|
48
|
+
? `${hours}:${pad2(minutes)}:${pad2(seconds)}`
|
|
49
|
+
: `${pad2(minutes)}:${pad2(seconds)}`;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Elapsed time of the active recording, ticked once per second. Returns
|
|
53
|
+
* `undefined` while nothing is recording (no timer while idle).
|
|
54
|
+
*/
|
|
55
|
+
export const useJamRecordingElapsed = () => {
|
|
56
|
+
const { isRecording, recordingStart } = useJamRecordingState();
|
|
57
|
+
const [now, setNow] = useState(() => Date.now());
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (!isRecording)
|
|
60
|
+
return;
|
|
61
|
+
setNow(Date.now());
|
|
62
|
+
const id = setInterval(() => setNow(Date.now()), 1000);
|
|
63
|
+
return () => clearInterval(id);
|
|
64
|
+
}, [isRecording, recordingStart]);
|
|
65
|
+
return useMemo(() => {
|
|
66
|
+
if (!isRecording || !recordingStart)
|
|
67
|
+
return undefined;
|
|
68
|
+
return formatRecordingElapsed(now - new Date(recordingStart).getTime());
|
|
69
|
+
}, [isRecording, recordingStart, now]);
|
|
70
|
+
};
|