@openpeepshq/rn-components 0.3.11 → 0.3.12
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/custom/common/index.ts +0 -1
- package/src/components/custom/index.ts +0 -1
- package/src/components/index.ts +1 -0
- package/src/components/jams/CreateNewJam.tsx +11 -10
- package/src/components/layout/AuthLayout.tsx +120 -0
- package/src/components/layout/ContentHeader.tsx +62 -0
- package/src/components/layout/HeaderActionButton.tsx +23 -0
- package/src/components/layout/HeaderMobile.tsx +96 -0
- package/src/components/layout/PlusButton.tsx +26 -0
- package/src/components/layout/RootLayout.tsx +30 -0
- package/src/components/layout/index.ts +13 -0
- package/src/components/layout/pageChrome.tsx +75 -0
- package/src/components/navigation/auth-navigator.tsx +2 -2
- package/src/components/navigation/main-navigator.tsx +17 -1
- package/src/components/navigation/tab-navigator.tsx +2 -0
- package/src/components/post/NewEventButton.tsx +23 -16
- package/src/components/post/NewNoteButton.tsx +15 -13
- package/src/pages/About.tsx +3 -5
- package/src/pages/CodeOfConduct.tsx +7 -7
- package/src/pages/Explore.tsx +87 -127
- package/src/pages/Members.tsx +31 -39
- package/src/pages/Notifications.tsx +6 -13
- package/src/pages/PostDetail.tsx +12 -16
- package/src/pages/Profile.tsx +3 -2
- package/src/pages/Tags.tsx +74 -16
- package/src/pages/Welcome.tsx +3 -8
- package/src/pages/articles/Edit.tsx +18 -15
- package/src/pages/articles/Index.tsx +11 -21
- package/src/pages/articles/New.tsx +18 -15
- package/src/pages/conversations/Index.tsx +44 -68
- package/src/pages/conversations/Info.tsx +6 -5
- package/src/pages/conversations/New.tsx +14 -13
- package/src/pages/conversations/NewDraft.tsx +5 -5
- package/src/pages/conversations/Show.tsx +16 -20
- package/src/pages/events/Edit.tsx +14 -13
- package/src/pages/events/Index.tsx +28 -32
- package/src/pages/events/My.tsx +7 -7
- package/src/pages/events/New.tsx +14 -13
- package/src/pages/feeds/Bookmarks.tsx +3 -9
- package/src/pages/feeds/Local.tsx +3 -10
- package/src/pages/feeds/My.tsx +3 -9
- package/src/pages/groups/Edit.tsx +6 -7
- package/src/pages/groups/EditInfo.tsx +20 -17
- package/src/pages/groups/EditRoles.tsx +18 -19
- package/src/pages/groups/Index.tsx +82 -119
- package/src/pages/groups/Info.tsx +22 -23
- package/src/pages/groups/Members.tsx +9 -8
- package/src/pages/groups/New.tsx +18 -15
- package/src/pages/groups/Show.tsx +6 -5
- package/src/pages/jams/Index.tsx +8 -26
- package/src/pages/jams/New.tsx +14 -11
- package/src/pages/posts/Edit.tsx +20 -17
- package/src/pages/posts/New.tsx +30 -29
- package/src/pages/posts/Reply.tsx +20 -16
- package/src/pages/profile/Followers.tsx +9 -10
- package/src/pages/profile/Following.tsx +9 -10
- package/src/pages/settings/AccessTokens.tsx +6 -5
- package/src/pages/settings/Account.tsx +13 -12
- package/src/pages/settings/Blocked.tsx +5 -5
- package/src/pages/settings/Feed.tsx +13 -12
- package/src/pages/settings/Index.tsx +4 -24
- package/src/pages/settings/Language.tsx +36 -37
- package/src/pages/settings/NotificationPreferences.tsx +10 -12
- package/src/pages/settings/Notifications.tsx +10 -9
- package/src/pages/settings/PublicProfile.tsx +6 -6
- package/src/pages/settings/PushEnabledDevices.tsx +10 -9
- package/src/pages/settings/Theme.tsx +13 -12
- package/src/pages/settings/Timezone.tsx +27 -28
- package/src/components/custom/common/plus-fab.tsx +0 -23
- package/src/components/custom/headers/generic-header.tsx +0 -103
- package/src/components/custom/headers/index.ts +0 -2
- package/src/components/custom/headers/tab-screens-header.tsx +0 -206
- package/src/components/navigation/auth-wrapper.tsx +0 -107
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Image,
|
|
4
|
-
View,
|
|
5
|
-
ImageBackground,
|
|
6
|
-
StatusBar,
|
|
7
|
-
Platform,
|
|
8
|
-
StyleSheet,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
|
|
11
|
-
import { ThemedText } from '../../ui/themed-text';
|
|
12
|
-
import { Avatar, AvatarImage, AvatarFallback } from '../../ui/avatar';
|
|
13
|
-
import { Button } from '../../ui/button';
|
|
14
|
-
import { BellIcon, UserIcon } from '../../icons/index';
|
|
15
|
-
import { useDrawer } from '../../../contexts/drawer-context';
|
|
16
|
-
import { formatBadgeCount } from '@openpeepshq/common';
|
|
17
|
-
import { useOpenpeeps } from '@openpeepshq/react';
|
|
18
|
-
import {
|
|
19
|
-
useNavigation,
|
|
20
|
-
useFocusEffect,
|
|
21
|
-
useNavigationState,
|
|
22
|
-
} from '@react-navigation/native';
|
|
23
|
-
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
24
|
-
import { useAppImagesStore } from '../../../stores/useAppImagesStore';
|
|
25
|
-
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
26
|
-
import { BASE_URL, isProduction } from '../../../lib/constants';
|
|
27
|
-
import { useWindowSize } from '../../../hooks/index';
|
|
28
|
-
import { ThemedSafeAreaView } from '../../ui/themed-safe-area-view';
|
|
29
|
-
import { TabStackParamList, TAB_ROUTES } from '../../navigation/types/index';
|
|
30
|
-
import { setAppBadgeCount } from '../../../lib/notification-helpers';
|
|
31
|
-
|
|
32
|
-
interface TabScreensHeaderProps {
|
|
33
|
-
showIcons?: boolean;
|
|
34
|
-
showVerification?: boolean;
|
|
35
|
-
children?: React.ReactNode;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const TabScreensHeader = ({
|
|
39
|
-
showIcons = true,
|
|
40
|
-
showVerification = false,
|
|
41
|
-
children,
|
|
42
|
-
}: TabScreensHeaderProps) => {
|
|
43
|
-
const { openDrawer } = useDrawer();
|
|
44
|
-
|
|
45
|
-
const { isMediumScreenOrLarger } = useWindowSize();
|
|
46
|
-
|
|
47
|
-
const { currentProfile, openpeepsApi } = useOpenpeeps();
|
|
48
|
-
const {
|
|
49
|
-
data: notificationsStats,
|
|
50
|
-
isSuccess,
|
|
51
|
-
refetch,
|
|
52
|
-
} = openpeepsApi.useCurrentProfileNotificationStats();
|
|
53
|
-
const navigation =
|
|
54
|
-
useNavigation<NativeStackNavigationProp<TabStackParamList>>();
|
|
55
|
-
const { background, logoSmall } = useAppImagesStore();
|
|
56
|
-
const lastFetchRef = React.useRef<number>(0);
|
|
57
|
-
const isOnNotificationsScreen = useNavigationState(
|
|
58
|
-
(state) => state.routes[state.index]?.name === TAB_ROUTES.NOTIFICATIONS
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
const onNotificationPress = () => {
|
|
62
|
-
navigation.navigate('Notifications');
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
useFocusEffect(
|
|
66
|
-
React.useCallback(() => {
|
|
67
|
-
if (isOnNotificationsScreen) {
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
const MIN_REFRESH_INTERVAL_MS = 10_000;
|
|
71
|
-
const now = Date.now();
|
|
72
|
-
if (now - (lastFetchRef.current || 0) > MIN_REFRESH_INTERVAL_MS) {
|
|
73
|
-
lastFetchRef.current = now;
|
|
74
|
-
refetch();
|
|
75
|
-
}
|
|
76
|
-
return undefined;
|
|
77
|
-
}, [refetch, isOnNotificationsScreen])
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
React.useEffect(() => {
|
|
81
|
-
setAppBadgeCount(notificationsStats?.unseen ?? 0);
|
|
82
|
-
lastFetchRef.current = Date.now();
|
|
83
|
-
}, [notificationsStats]);
|
|
84
|
-
|
|
85
|
-
if (isMediumScreenOrLarger) {
|
|
86
|
-
return (
|
|
87
|
-
<ThemedSafeAreaView className="p-4 pb-6 pl-1">
|
|
88
|
-
<View className="mb-4 flex-row items-center">
|
|
89
|
-
<Image
|
|
90
|
-
source={{ uri: logoSmall! }}
|
|
91
|
-
resizeMode="contain"
|
|
92
|
-
className="h-12 w-48"
|
|
93
|
-
/>
|
|
94
|
-
</View>
|
|
95
|
-
{children}
|
|
96
|
-
</ThemedSafeAreaView>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<>
|
|
102
|
-
<ImageBackground
|
|
103
|
-
resizeMode="cover"
|
|
104
|
-
source={{
|
|
105
|
-
uri: background!,
|
|
106
|
-
}}
|
|
107
|
-
style={styles.header}
|
|
108
|
-
className="pb-3 px-4"
|
|
109
|
-
>
|
|
110
|
-
<SafeAreaView edges={['top']} className="">
|
|
111
|
-
{!isProduction && (
|
|
112
|
-
<View className="mb-2 w-full rounded-lg bg-white/50 p-2">
|
|
113
|
-
<ThemedText className="text-center text-destructive">
|
|
114
|
-
Test Backend ({BASE_URL})
|
|
115
|
-
</ThemedText>
|
|
116
|
-
</View>
|
|
117
|
-
)}
|
|
118
|
-
<View className="flex-row items-center justify-between">
|
|
119
|
-
<Button
|
|
120
|
-
variant={'outline'}
|
|
121
|
-
size={'icon'}
|
|
122
|
-
onPress={() => {
|
|
123
|
-
openDrawer();
|
|
124
|
-
}}
|
|
125
|
-
className="native:px-0 active:bg-none rounded-full bg-black"
|
|
126
|
-
>
|
|
127
|
-
<Avatar
|
|
128
|
-
alt={(currentProfile?.displayName as string) || 'Profile'}
|
|
129
|
-
>
|
|
130
|
-
{currentProfile?.avatar ? (
|
|
131
|
-
<AvatarImage source={{ uri: currentProfile.avatar }} />
|
|
132
|
-
) : (
|
|
133
|
-
<AvatarFallback className="h-6 w-6 -bottom-2 -right-2 bg-black">
|
|
134
|
-
<UserIcon size={20} className="text-muted-foreground" />
|
|
135
|
-
</AvatarFallback>
|
|
136
|
-
)}
|
|
137
|
-
</Avatar>
|
|
138
|
-
</Button>
|
|
139
|
-
|
|
140
|
-
<Image
|
|
141
|
-
source={{
|
|
142
|
-
uri: logoSmall!,
|
|
143
|
-
}}
|
|
144
|
-
resizeMode="contain"
|
|
145
|
-
className="w-[216px] h-[64px]"
|
|
146
|
-
/>
|
|
147
|
-
{showIcons && (
|
|
148
|
-
<Button
|
|
149
|
-
variant={'outline'}
|
|
150
|
-
size={'icon'}
|
|
151
|
-
onPress={onNotificationPress}
|
|
152
|
-
className="relative"
|
|
153
|
-
>
|
|
154
|
-
<BellIcon className="text-muted-foreground" size={18} />
|
|
155
|
-
{isSuccess &&
|
|
156
|
-
!isOnNotificationsScreen &&
|
|
157
|
-
notificationsStats.unseen > 0 && (
|
|
158
|
-
<View className="absolute -top-3 -right-2 h-6 w-6 items-center justify-center rounded-full bg-foreground">
|
|
159
|
-
<ThemedText className="text-background text-xs">
|
|
160
|
-
{formatBadgeCount(notificationsStats.unseen)}
|
|
161
|
-
</ThemedText>
|
|
162
|
-
</View>
|
|
163
|
-
)}
|
|
164
|
-
</Button>
|
|
165
|
-
)}
|
|
166
|
-
</View>
|
|
167
|
-
|
|
168
|
-
{children ? children : null}
|
|
169
|
-
{showVerification && (
|
|
170
|
-
<>
|
|
171
|
-
<View className="mt-4">
|
|
172
|
-
<Image
|
|
173
|
-
source={{
|
|
174
|
-
uri: logoSmall!,
|
|
175
|
-
}}
|
|
176
|
-
className=""
|
|
177
|
-
resizeMode="cover"
|
|
178
|
-
/>
|
|
179
|
-
</View>
|
|
180
|
-
<View className="mt-7 border border-input rounded-md p-4">
|
|
181
|
-
<ThemedText className="text-xl leading-8 tracking-wider">
|
|
182
|
-
Your email is not yet verified. Tap “Get link” below to get
|
|
183
|
-
the verification link.
|
|
184
|
-
</ThemedText>
|
|
185
|
-
<View className="flex-row justify-end mt-5 gap-4">
|
|
186
|
-
<Button variant={'ghost'} onPress={onNotificationPress}>
|
|
187
|
-
<ThemedText> Remove</ThemedText>
|
|
188
|
-
</Button>
|
|
189
|
-
<Button onPress={onNotificationPress}>
|
|
190
|
-
<ThemedText>Get link</ThemedText>
|
|
191
|
-
</Button>
|
|
192
|
-
</View>
|
|
193
|
-
</View>
|
|
194
|
-
</>
|
|
195
|
-
)}
|
|
196
|
-
</SafeAreaView>
|
|
197
|
-
</ImageBackground>
|
|
198
|
-
</>
|
|
199
|
-
);
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const styles = StyleSheet.create({
|
|
203
|
-
header: {
|
|
204
|
-
paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0,
|
|
205
|
-
},
|
|
206
|
-
});
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { useOpenpeeps } from '@openpeepshq/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import { Image, ImageBackground, View } from 'react-native';
|
|
5
|
-
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
6
|
-
import { ThemedText } from '../ui/themed-text';
|
|
7
|
-
import { isProduction } from '../../lib/constants';
|
|
8
|
-
import { BASE_URL } from '../../lib/constants';
|
|
9
|
-
import { useWindowSize } from '../../hooks/index';
|
|
10
|
-
import { getTheme } from '@openpeepshq/common';
|
|
11
|
-
import { toAbsoluteMediaUrl } from '../../lib/media-url';
|
|
12
|
-
|
|
13
|
-
const DevBanner = () =>
|
|
14
|
-
(!isProduction && (
|
|
15
|
-
<View className="absolute bg-white/80 z-10 ml-8 mr-8 w-auto top-64 p-4 rounded-lg">
|
|
16
|
-
<ThemedText className="text-center text-destructive">
|
|
17
|
-
Test Backend ({BASE_URL})
|
|
18
|
-
</ThemedText>
|
|
19
|
-
</View>
|
|
20
|
-
)) ||
|
|
21
|
-
null;
|
|
22
|
-
|
|
23
|
-
const Logo = ({ uri }: { uri?: string }) => {
|
|
24
|
-
if (!uri) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Image
|
|
30
|
-
source={{ uri }}
|
|
31
|
-
className="absolute z-10 top-16 left-2 max-w-fit w-[206px] h-[26px]"
|
|
32
|
-
resizeMode="contain"
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const AuthImage = ({ children }: { children?: React.ReactNode }) => {
|
|
38
|
-
const { openpeepsApi } = useOpenpeeps();
|
|
39
|
-
const { data: serverInfo, isLoading } = openpeepsApi.useServerInfo();
|
|
40
|
-
const resolvedTheme = serverInfo
|
|
41
|
-
? getTheme(serverInfo.communityConfig)
|
|
42
|
-
: undefined;
|
|
43
|
-
const authBackgroundUri = resolvedTheme?.backgroundAuth;
|
|
44
|
-
const resolvedAuthBackgroundUri = toAbsoluteMediaUrl(authBackgroundUri);
|
|
45
|
-
const resolvedLogoUri = toAbsoluteMediaUrl(resolvedTheme?.logoSmall);
|
|
46
|
-
|
|
47
|
-
const content = (
|
|
48
|
-
<>
|
|
49
|
-
<Logo uri={resolvedLogoUri} />
|
|
50
|
-
<DevBanner />
|
|
51
|
-
{children}
|
|
52
|
-
</>
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
if (resolvedAuthBackgroundUri && !isLoading) {
|
|
56
|
-
return (
|
|
57
|
-
<ImageBackground
|
|
58
|
-
source={{ uri: resolvedAuthBackgroundUri }}
|
|
59
|
-
className="w-full justify-end flex-1"
|
|
60
|
-
>
|
|
61
|
-
{content}
|
|
62
|
-
</ImageBackground>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<View className="w-full justify-end flex-1 bg-background">{content}</View>
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const NarrowAuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
|
72
|
-
return (
|
|
73
|
-
<AuthImage>
|
|
74
|
-
<View className="px-2 pt-4 w-full bg-background min-h-[400px] pb-10">
|
|
75
|
-
{children}
|
|
76
|
-
</View>
|
|
77
|
-
</AuthImage>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const WideAuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
|
82
|
-
return (
|
|
83
|
-
<View className="flex flex-1 flex-row">
|
|
84
|
-
<View className="flex-1">
|
|
85
|
-
<AuthImage />
|
|
86
|
-
</View>
|
|
87
|
-
<View className="flex flex-1 justify-center p-6">{children}</View>
|
|
88
|
-
</View>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
|
93
|
-
const { isMediumScreenOrLarger } = useWindowSize();
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<KeyboardAwareScrollView
|
|
97
|
-
contentContainerClassName="grow"
|
|
98
|
-
className="w-full flex bg-background"
|
|
99
|
-
>
|
|
100
|
-
{isMediumScreenOrLarger ? (
|
|
101
|
-
<WideAuthWrapper>{children}</WideAuthWrapper>
|
|
102
|
-
) : (
|
|
103
|
-
<NarrowAuthWrapper>{children}</NarrowAuthWrapper>
|
|
104
|
-
)}
|
|
105
|
-
</KeyboardAwareScrollView>
|
|
106
|
-
);
|
|
107
|
-
};
|