@openpeepshq/rn-components 0.6.9 → 0.6.10
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/rn-components",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10",
|
|
4
4
|
"description": "React Native community screens and shared UI (extracted from the Black Ambition app) for the OpenPeeps stack.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { truncateText } from '@openpeepshq/common';
|
|
5
|
+
import { useJamContext } from '@openpeepshq/react';
|
|
6
|
+
import {
|
|
7
|
+
CircleStopIcon,
|
|
8
|
+
DiscIcon,
|
|
9
|
+
HandIcon,
|
|
10
|
+
InfoIcon,
|
|
11
|
+
LaughIcon,
|
|
12
|
+
MessageSquareTextIcon,
|
|
13
|
+
UsersRoundIcon,
|
|
14
|
+
} from '../icons/index';
|
|
15
|
+
import {
|
|
16
|
+
JamAudioOutputSelector,
|
|
17
|
+
JamCameraSelector,
|
|
18
|
+
JamMicSelector,
|
|
19
|
+
} from './JamDeviceSelectors';
|
|
20
|
+
import { JamReactionMenu } from './JamReactionMenu';
|
|
21
|
+
import { JamToolbarButton, toneIconClass } from './JamToolbarButton';
|
|
22
|
+
import { LeaveCloseButton } from './LeaveCloseButton';
|
|
23
|
+
import { type JamFooterProps } from './JamFooter';
|
|
24
|
+
import { useFooterControls } from './JamFooter';
|
|
25
|
+
import { ThemedText } from '../ui/themed-text';
|
|
26
|
+
|
|
27
|
+
export type JamDesktopFooterProps = JamFooterProps;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Wide-screen (tablet/desktop) in-room toolbar, mirroring the web JamFooter
|
|
31
|
+
* `md:flex` DesktopFooter (platform/react/src/components/jams/JamFooter.tsx).
|
|
32
|
+
* Rendered by JamParticipantConference in place of the mobile JamFooter when
|
|
33
|
+
* isMediumScreenOrLarger. Screen sharing and background blur are web-only (no
|
|
34
|
+
* React Native equivalents), so they are intentionally omitted.
|
|
35
|
+
*/
|
|
36
|
+
export const JamDesktopFooter = ({
|
|
37
|
+
chatOpen,
|
|
38
|
+
onToggleChat,
|
|
39
|
+
peopleOpen,
|
|
40
|
+
onTogglePeople,
|
|
41
|
+
detailsOpen,
|
|
42
|
+
onToggleDetails,
|
|
43
|
+
speakerDeviceId,
|
|
44
|
+
speakerEnabled,
|
|
45
|
+
onSpeakerChange,
|
|
46
|
+
onToggleSpeaker,
|
|
47
|
+
}: JamDesktopFooterProps) => {
|
|
48
|
+
const { t } = useTranslation();
|
|
49
|
+
const { jamEvent } = useJamContext();
|
|
50
|
+
const {
|
|
51
|
+
isModerator,
|
|
52
|
+
isRecording,
|
|
53
|
+
recordingLabel,
|
|
54
|
+
recordingEnabled,
|
|
55
|
+
handRaised,
|
|
56
|
+
busy,
|
|
57
|
+
participantCount,
|
|
58
|
+
waitingRoomCount,
|
|
59
|
+
sendReactionEmoji,
|
|
60
|
+
toggleRecording,
|
|
61
|
+
raiseHand,
|
|
62
|
+
} = useFooterControls();
|
|
63
|
+
const [reactionMenuOpen, setReactionMenuOpen] = useState(false);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<View className="w-full flex-none flex-row items-center justify-between bg-background/75 px-4 py-3">
|
|
67
|
+
<ThemedText className="truncate pr-2">
|
|
68
|
+
{truncateText(jamEvent.name, 40)}
|
|
69
|
+
</ThemedText>
|
|
70
|
+
|
|
71
|
+
<View className="relative flex-row items-center gap-x-4">
|
|
72
|
+
{reactionMenuOpen ? (
|
|
73
|
+
<View className="absolute bottom-12 right-0 z-50">
|
|
74
|
+
<JamReactionMenu
|
|
75
|
+
onSelect={(emoji) => void sendReactionEmoji(emoji)}
|
|
76
|
+
/>
|
|
77
|
+
</View>
|
|
78
|
+
) : null}
|
|
79
|
+
|
|
80
|
+
<JamMicSelector />
|
|
81
|
+
<JamCameraSelector />
|
|
82
|
+
<JamAudioOutputSelector
|
|
83
|
+
speakerDeviceId={speakerDeviceId}
|
|
84
|
+
speakerEnabled={speakerEnabled}
|
|
85
|
+
onSpeakerChange={onSpeakerChange}
|
|
86
|
+
onToggleSpeaker={onToggleSpeaker}
|
|
87
|
+
/>
|
|
88
|
+
|
|
89
|
+
{isModerator && recordingEnabled ? (
|
|
90
|
+
<JamToolbarButton
|
|
91
|
+
tone="danger"
|
|
92
|
+
disabled={busy}
|
|
93
|
+
title={recordingLabel}
|
|
94
|
+
action={() => void toggleRecording()}
|
|
95
|
+
>
|
|
96
|
+
{isRecording ? (
|
|
97
|
+
<CircleStopIcon
|
|
98
|
+
size={20}
|
|
99
|
+
className="text-destructive-foreground"
|
|
100
|
+
/>
|
|
101
|
+
) : (
|
|
102
|
+
<DiscIcon size={20} className="text-destructive-foreground" />
|
|
103
|
+
)}
|
|
104
|
+
</JamToolbarButton>
|
|
105
|
+
) : null}
|
|
106
|
+
|
|
107
|
+
<JamToolbarButton
|
|
108
|
+
title={t('jams.hand.raiseTitle')}
|
|
109
|
+
tone={handRaised ? 'active' : 'default'}
|
|
110
|
+
action={() => void raiseHand()}
|
|
111
|
+
>
|
|
112
|
+
<HandIcon
|
|
113
|
+
size={20}
|
|
114
|
+
className={toneIconClass[handRaised ? 'active' : 'default']}
|
|
115
|
+
/>
|
|
116
|
+
</JamToolbarButton>
|
|
117
|
+
|
|
118
|
+
<JamToolbarButton
|
|
119
|
+
title={t('jams.reactions.sendTitle')}
|
|
120
|
+
tone={reactionMenuOpen ? 'active' : 'default'}
|
|
121
|
+
action={() => setReactionMenuOpen((open) => !open)}
|
|
122
|
+
>
|
|
123
|
+
<LaughIcon
|
|
124
|
+
size={20}
|
|
125
|
+
className={toneIconClass[reactionMenuOpen ? 'active' : 'default']}
|
|
126
|
+
/>
|
|
127
|
+
</JamToolbarButton>
|
|
128
|
+
|
|
129
|
+
<JamToolbarButton
|
|
130
|
+
title={t('jams.chat.openEveryoneTitle')}
|
|
131
|
+
tone={chatOpen ? 'active' : 'default'}
|
|
132
|
+
action={onToggleChat}
|
|
133
|
+
>
|
|
134
|
+
<MessageSquareTextIcon
|
|
135
|
+
size={20}
|
|
136
|
+
className={toneIconClass[chatOpen ? 'active' : 'default']}
|
|
137
|
+
/>
|
|
138
|
+
</JamToolbarButton>
|
|
139
|
+
</View>
|
|
140
|
+
|
|
141
|
+
<View className="relative flex-row items-center gap-x-4">
|
|
142
|
+
<JamToolbarButton
|
|
143
|
+
title={t('jams.mobileMenu.jamDetails')}
|
|
144
|
+
tone={detailsOpen ? 'active' : 'default'}
|
|
145
|
+
action={onToggleDetails}
|
|
146
|
+
>
|
|
147
|
+
<InfoIcon
|
|
148
|
+
size={20}
|
|
149
|
+
className={toneIconClass[detailsOpen ? 'active' : 'default']}
|
|
150
|
+
/>
|
|
151
|
+
</JamToolbarButton>
|
|
152
|
+
|
|
153
|
+
<JamToolbarButton
|
|
154
|
+
title={t('jams.participant.showEveryone')}
|
|
155
|
+
tone={peopleOpen ? 'active' : 'default'}
|
|
156
|
+
action={onTogglePeople}
|
|
157
|
+
>
|
|
158
|
+
<View className="relative">
|
|
159
|
+
<UsersRoundIcon
|
|
160
|
+
size={20}
|
|
161
|
+
className={toneIconClass[peopleOpen ? 'active' : 'default']}
|
|
162
|
+
/>
|
|
163
|
+
{participantCount > 0 || waitingRoomCount > 0 ? (
|
|
164
|
+
<View className="bg-border-2 absolute -top-1 -right-1 flex h-5 min-w-[20px] items-center justify-center rounded-full px-1 py-0.5">
|
|
165
|
+
<ThemedText className="text-xs text-foreground">
|
|
166
|
+
{participantCount}
|
|
167
|
+
</ThemedText>
|
|
168
|
+
{waitingRoomCount > 0 ? (
|
|
169
|
+
<ThemedText className="text-destructive">
|
|
170
|
+
{' +' + waitingRoomCount}
|
|
171
|
+
</ThemedText>
|
|
172
|
+
) : null}
|
|
173
|
+
</View>
|
|
174
|
+
) : null}
|
|
175
|
+
</View>
|
|
176
|
+
</JamToolbarButton>
|
|
177
|
+
|
|
178
|
+
<LeaveCloseButton />
|
|
179
|
+
</View>
|
|
180
|
+
</View>
|
|
181
|
+
);
|
|
182
|
+
};
|
|
@@ -39,7 +39,7 @@ export interface JamFooterProps {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/** Native wrapper: `Alert` confirm + toasts. */
|
|
42
|
-
const useFooterControls = () => {
|
|
42
|
+
export const useFooterControls = () => {
|
|
43
43
|
const { t } = useTranslation();
|
|
44
44
|
const room = useRoomContext();
|
|
45
45
|
const participants = useParticipants();
|
|
@@ -14,10 +14,12 @@ import {
|
|
|
14
14
|
useJamContext,
|
|
15
15
|
useJamLocalSettings,
|
|
16
16
|
} from '@openpeepshq/react';
|
|
17
|
+
import { useWindowSize } from '../../hooks/index';
|
|
17
18
|
import { ThemedText } from '../ui/themed-text';
|
|
18
19
|
import { JamChatDrawer } from './JamChatDrawer';
|
|
19
20
|
import { JamDetailsDrawer } from './JamDetailsDrawer';
|
|
20
|
-
import {
|
|
21
|
+
import { JamDesktopFooter } from './JamDesktopFooter';
|
|
22
|
+
import { JamFooter, type JamFooterProps } from './JamFooter';
|
|
21
23
|
import { JamPeopleDrawer } from './JamPeopleDrawer';
|
|
22
24
|
import { JamNetworkQuality, JamRecordingIndicator } from './JamRoomIndicators';
|
|
23
25
|
import { JamVideoLayout } from './JamVideoLayout';
|
|
@@ -27,6 +29,7 @@ type Drawer = 'chat' | 'people' | 'details' | null;
|
|
|
27
29
|
const JamParticipantConferenceInner = () => {
|
|
28
30
|
const room = useRoomContext();
|
|
29
31
|
const { jamEvent } = useJamContext();
|
|
32
|
+
const { isMediumScreenOrLarger } = useWindowSize();
|
|
30
33
|
const [drawer, setDrawer] = useState<Drawer>(null);
|
|
31
34
|
const [settings, updateSettings] = useJamLocalSettings();
|
|
32
35
|
const remoteParticipants = useRemoteParticipants();
|
|
@@ -70,6 +73,20 @@ const JamParticipantConferenceInner = () => {
|
|
|
70
73
|
const toggleDrawer = (next: Exclude<Drawer, null>) =>
|
|
71
74
|
setDrawer((current) => (current === next ? null : next));
|
|
72
75
|
|
|
76
|
+
const footerProps: JamFooterProps = {
|
|
77
|
+
chatOpen: drawer === 'chat',
|
|
78
|
+
onToggleChat: () => toggleDrawer('chat'),
|
|
79
|
+
peopleOpen: drawer === 'people',
|
|
80
|
+
onTogglePeople: () => toggleDrawer('people'),
|
|
81
|
+
detailsOpen: drawer === 'details',
|
|
82
|
+
onToggleDetails: () => toggleDrawer('details'),
|
|
83
|
+
speakerDeviceId: settings.speakerDeviceId,
|
|
84
|
+
speakerEnabled: settings.speakerEnabled,
|
|
85
|
+
onSpeakerChange: (speakerDeviceId) => updateSettings({ speakerDeviceId }),
|
|
86
|
+
onToggleSpeaker: () =>
|
|
87
|
+
updateSettings({ speakerEnabled: !settings.speakerEnabled }),
|
|
88
|
+
};
|
|
89
|
+
|
|
73
90
|
return (
|
|
74
91
|
<View className="relative flex-1 overflow-hidden bg-background">
|
|
75
92
|
<JamNetworkQuality />
|
|
@@ -103,22 +120,11 @@ const JamParticipantConferenceInner = () => {
|
|
|
103
120
|
/>
|
|
104
121
|
</View>
|
|
105
122
|
<View className="w-full shrink-0 bg-background">
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
detailsOpen={drawer === 'details'}
|
|
112
|
-
onToggleDetails={() => toggleDrawer('details')}
|
|
113
|
-
speakerDeviceId={settings.speakerDeviceId}
|
|
114
|
-
speakerEnabled={settings.speakerEnabled}
|
|
115
|
-
onSpeakerChange={(speakerDeviceId) =>
|
|
116
|
-
updateSettings({ speakerDeviceId })
|
|
117
|
-
}
|
|
118
|
-
onToggleSpeaker={() =>
|
|
119
|
-
updateSettings({ speakerEnabled: !settings.speakerEnabled })
|
|
120
|
-
}
|
|
121
|
-
/>
|
|
123
|
+
{isMediumScreenOrLarger ? (
|
|
124
|
+
<JamDesktopFooter {...footerProps} />
|
|
125
|
+
) : (
|
|
126
|
+
<JamFooter {...footerProps} />
|
|
127
|
+
)}
|
|
122
128
|
</View>
|
|
123
129
|
</View>
|
|
124
130
|
);
|