@openpeepshq/rn-components 0.6.8 → 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 +3 -3
- package/src/components/jams/JamDesktopFooter.tsx +182 -0
- package/src/components/jams/JamFooter.tsx +1 -1
- package/src/components/jams/JamParticipantConference.tsx +23 -17
- package/src/components/layout/AuthLayout.tsx +43 -6
- package/src/components/navigation/main-navigator.tsx +14 -7
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",
|
|
@@ -142,8 +142,8 @@
|
|
|
142
142
|
"timezones-list": "^3.1.0",
|
|
143
143
|
"validator": "^13.15.23",
|
|
144
144
|
"zustand": "^5.0.3",
|
|
145
|
-
"@openpeepshq/
|
|
146
|
-
"@openpeepshq/
|
|
145
|
+
"@openpeepshq/common": "^0.3.2",
|
|
146
|
+
"@openpeepshq/react": "^0.6.3"
|
|
147
147
|
},
|
|
148
148
|
"devDependencies": {
|
|
149
149
|
"@babel/core": "^7.26.7",
|
|
@@ -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
|
);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
|
-
import { Image, ImageBackground, View } from 'react-native';
|
|
2
|
+
import { Image, ImageBackground, Pressable, View } from 'react-native';
|
|
3
3
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import { getTheme } from '@openpeepshq/common';
|
|
5
|
-
import { useOpenpeeps } from '@openpeepshq/react';
|
|
6
|
+
import { useCurrentProfile, useOpenpeeps, useRouter } from '@openpeepshq/react';
|
|
6
7
|
import { useWindowSize } from '../../hooks/index';
|
|
7
8
|
import { BASE_URL, isProduction } from '../../lib/constants';
|
|
8
9
|
import { toAbsoluteMediaUrl } from '../../lib/media-url';
|
|
10
|
+
import { ProfileAvatar } from '../profile/Avatar';
|
|
9
11
|
import { ThemedText } from '../ui/themed-text';
|
|
10
12
|
|
|
11
13
|
export interface AuthLayoutProps {
|
|
@@ -24,13 +26,46 @@ const DevBanner = () =>
|
|
|
24
26
|
) : null;
|
|
25
27
|
|
|
26
28
|
const Logo = ({ uri }: { uri?: string }) => {
|
|
29
|
+
const router = useRouter();
|
|
27
30
|
if (!uri) return null;
|
|
28
31
|
return (
|
|
29
|
-
<
|
|
30
|
-
|
|
32
|
+
<Pressable
|
|
33
|
+
onPress={() => router.navigate({ type: 'home' })}
|
|
34
|
+
hitSlop={24}
|
|
31
35
|
className="absolute left-2 top-16 z-10 h-[26px] w-[206px] max-w-fit"
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
>
|
|
37
|
+
<Image
|
|
38
|
+
source={{ uri }}
|
|
39
|
+
className="h-[26px] w-[206px] max-w-fit"
|
|
40
|
+
resizeMode="contain"
|
|
41
|
+
/>
|
|
42
|
+
</Pressable>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Mirror web Auth.tsx: on shell-less auth pages (about/code-of-conduct) show a
|
|
47
|
+
// signed-in user's avatar and a Go-to-community link so navigation back to the
|
|
48
|
+
// app is still available without the side-menu Wrapper.
|
|
49
|
+
const SignedInRow = () => {
|
|
50
|
+
const me = useCurrentProfile();
|
|
51
|
+
const router = useRouter();
|
|
52
|
+
const { t } = useTranslation();
|
|
53
|
+
if (!me) return null;
|
|
54
|
+
const name = me.displayName?.trim() || (me.handle ? `@${me.handle}` : '');
|
|
55
|
+
return (
|
|
56
|
+
<View className="flex-row items-center gap-3 px-2 pb-2 pt-1">
|
|
57
|
+
<ProfileAvatar profile={me} className="size-8 border-0" />
|
|
58
|
+
<View>
|
|
59
|
+
<ThemedText className="text-sm text-muted-foreground">
|
|
60
|
+
{t('auth.signedInAs', { name })}
|
|
61
|
+
</ThemedText>
|
|
62
|
+
<Pressable onPress={() => router.navigate({ type: 'home' })}>
|
|
63
|
+
<ThemedText className="text-sm font-medium text-primary">
|
|
64
|
+
{t('auth.goToCommunity')}
|
|
65
|
+
</ThemedText>
|
|
66
|
+
</Pressable>
|
|
67
|
+
</View>
|
|
68
|
+
</View>
|
|
34
69
|
);
|
|
35
70
|
};
|
|
36
71
|
|
|
@@ -76,6 +111,7 @@ const NarrowAuthLayout = ({
|
|
|
76
111
|
}) => (
|
|
77
112
|
<AuthImage>
|
|
78
113
|
<View className="bg-background w-full min-h-[400px] px-2 pb-10 pt-4">
|
|
114
|
+
<SignedInRow />
|
|
79
115
|
{description}
|
|
80
116
|
{children}
|
|
81
117
|
</View>
|
|
@@ -94,6 +130,7 @@ const WideAuthLayout = ({
|
|
|
94
130
|
<AuthImage />
|
|
95
131
|
</View>
|
|
96
132
|
<View className="flex flex-1 justify-center p-6">
|
|
133
|
+
<SignedInRow />
|
|
97
134
|
{description}
|
|
98
135
|
{children}
|
|
99
136
|
</View>
|
|
@@ -55,13 +55,17 @@ import { useOpenpeeps } from '@openpeepshq/react';
|
|
|
55
55
|
|
|
56
56
|
const Stack = createNativeStackNavigator<MainStackParamList>();
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
// Routes that skip the inner RootLayout (HeaderMobile, ContentHeader, PlusButton)
|
|
59
|
+
// but still live inside the outer side-menu Wrapper. TabNavigator defers its
|
|
60
|
+
// inner RootLayout to the per-tab screen: bottom-tabs keeps tab content mounted,
|
|
61
|
+
// so each tab needs its own PageChromeProvider.
|
|
62
|
+
const NO_ROOT_LAYOUT = new Set(['TabNavigator', 'VideoPlayer']);
|
|
63
|
+
|
|
64
|
+
// Routes rendered full-screen with no shell at all, mirroring the web app's
|
|
65
|
+
// standalone routes declared outside the sidebar RootLayout: the jam room
|
|
66
|
+
// (/events/:eventId/jam, which also hosts the lobby and the guest form) and the
|
|
67
|
+
// about / code-of-conduct auth pages (see AuthLayout back-to-app link).
|
|
68
|
+
const STANDALONE = new Set(['JamSession', 'About', 'CodeOfConduct']);
|
|
65
69
|
|
|
66
70
|
export const MainNavigator = () => {
|
|
67
71
|
const { openpeepsApi, queryClient } = useOpenpeeps();
|
|
@@ -102,6 +106,9 @@ export const MainNavigator = () => {
|
|
|
102
106
|
<Stack.Navigator
|
|
103
107
|
screenOptions={{ headerShown: false, animation: 'fade' }}
|
|
104
108
|
screenLayout={({ children, route }) => {
|
|
109
|
+
if (STANDALONE.has(route.name)) {
|
|
110
|
+
return children;
|
|
111
|
+
}
|
|
105
112
|
const body = NO_ROOT_LAYOUT.has(route.name) ? (
|
|
106
113
|
children
|
|
107
114
|
) : (
|