@openpeepshq/rn-components 0.6.8 → 0.6.9
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.9",
|
|
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",
|
|
@@ -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
|
) : (
|