@openpeepshq/rn-components 0.3.9 → 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/conversations/ConversationMessageBubble.tsx +1 -1
- package/src/components/custom/common/index.ts +0 -1
- package/src/components/custom/index.ts +0 -1
- package/src/components/custom/navigation/side-menu.tsx +2 -2
- package/src/components/groups/GroupOptionsMenu.tsx +13 -5
- package/src/components/index.ts +1 -0
- package/src/components/jams/CreateNewJam.tsx +11 -10
- package/src/components/jams/JamActionsFooter.tsx +37 -51
- package/src/components/jams/JamCard.tsx +5 -5
- package/src/components/jams/JamLobby.tsx +2 -1
- 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/parent-back.ts +139 -0
- package/src/components/navigation/tab-navigator.tsx +2 -0
- package/src/components/notifications/types/JamStarted.tsx +8 -6
- package/src/components/notifications/types/Reply.tsx +7 -10
- package/src/components/post/NewEventButton.tsx +23 -16
- package/src/components/post/NewNoteButton.tsx +15 -13
- package/src/components/post/pieces/EventRsvpButton.tsx +22 -18
- package/src/components/post/pieces/ParticipantsCard.tsx +4 -20
- package/src/components/post/types/Article.tsx +3 -1
- package/src/components/post/types/event/CardEvent.tsx +1 -1
- package/src/components/post/types/event/FullEvent.tsx +156 -37
- package/src/components/profile/ProfileCard.tsx +9 -2
- package/src/components/profile/ProfileFromId.tsx +1 -1
- package/src/components/ui/button.tsx +1 -1
- 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 +22 -16
- package/src/pages/Profile.tsx +3 -2
- package/src/pages/Tags.tsx +72 -13
- 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 +24 -22
- 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 +3 -11
- 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/theme/OpenPeepsThemeProvider.tsx +23 -12
- package/src/theme/utils.ts +10 -5
- package/tailwind.config.js +6 -0
- package/src/components/custom/common/plus-fab.tsx +0 -23
- package/src/components/custom/headers/generic-header.tsx +0 -88
- package/src/components/custom/headers/index.ts +0 -2
- package/src/components/custom/headers/tab-screens-header.tsx +0 -199
- package/src/components/navigation/auth-wrapper.tsx +0 -107
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useContext,
|
|
4
|
+
useLayoutEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useState,
|
|
7
|
+
type ReactNode,
|
|
8
|
+
} from 'react';
|
|
9
|
+
|
|
10
|
+
export type PlusButtonAction = {
|
|
11
|
+
action: string | (() => Promise<unknown> | unknown);
|
|
12
|
+
title?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type PlusButtonActions =
|
|
16
|
+
| PlusButtonAction
|
|
17
|
+
| PlusButtonAction[]
|
|
18
|
+
| undefined;
|
|
19
|
+
|
|
20
|
+
export type PageHeaderValue = {
|
|
21
|
+
title?: ReactNode;
|
|
22
|
+
actions?: ReactNode;
|
|
23
|
+
onBack?: () => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type PageChromeContextValue = {
|
|
27
|
+
header: PageHeaderValue | undefined;
|
|
28
|
+
setHeader: (header: PageHeaderValue | undefined) => void;
|
|
29
|
+
plus: PlusButtonActions;
|
|
30
|
+
setPlus: (plus: PlusButtonActions) => void;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const PageChromeContext = createContext<PageChromeContextValue | null>(null);
|
|
34
|
+
|
|
35
|
+
export const PageChromeProvider = ({ children }: { children: ReactNode }) => {
|
|
36
|
+
const [header, setHeader] = useState<PageHeaderValue | undefined>();
|
|
37
|
+
const [plus, setPlus] = useState<PlusButtonActions>(undefined);
|
|
38
|
+
const value = useMemo(
|
|
39
|
+
() => ({ header, setHeader, plus, setPlus }),
|
|
40
|
+
[header, plus]
|
|
41
|
+
);
|
|
42
|
+
return (
|
|
43
|
+
<PageChromeContext.Provider value={value}>
|
|
44
|
+
{children}
|
|
45
|
+
</PageChromeContext.Provider>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const usePageChrome = () => {
|
|
50
|
+
const ctx = useContext(PageChromeContext);
|
|
51
|
+
if (!ctx) {
|
|
52
|
+
throw new Error('usePageChrome must be used within RootLayout');
|
|
53
|
+
}
|
|
54
|
+
return ctx;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const useSetPageHeader = (
|
|
58
|
+
title?: ReactNode,
|
|
59
|
+
actions?: ReactNode,
|
|
60
|
+
onBack?: () => void
|
|
61
|
+
) => {
|
|
62
|
+
const { setHeader } = usePageChrome();
|
|
63
|
+
useLayoutEffect(() => {
|
|
64
|
+
setHeader({ title, actions, onBack });
|
|
65
|
+
return () => setHeader(undefined);
|
|
66
|
+
}, [actions, onBack, setHeader, title]);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const useSetPlusButtonActions = (actions: PlusButtonActions) => {
|
|
70
|
+
const { setPlus } = usePageChrome();
|
|
71
|
+
useLayoutEffect(() => {
|
|
72
|
+
setPlus(actions);
|
|
73
|
+
return () => setPlus(undefined);
|
|
74
|
+
}, [actions, setPlus]);
|
|
75
|
+
};
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ResetPassword,
|
|
13
13
|
} from '../../pages';
|
|
14
14
|
import { AUTH_ROUTES } from './types';
|
|
15
|
-
import {
|
|
15
|
+
import { AuthLayout } from '../layout';
|
|
16
16
|
|
|
17
17
|
const Stack = createNativeStackNavigator<AuthStackParamList>();
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ export const AuthNavigator = () => {
|
|
|
20
20
|
return (
|
|
21
21
|
<Stack.Navigator
|
|
22
22
|
screenOptions={{ headerShown: false, animation: 'fade' }}
|
|
23
|
-
screenLayout={({ children }) => <
|
|
23
|
+
screenLayout={({ children }) => <AuthLayout>{children}</AuthLayout>}
|
|
24
24
|
>
|
|
25
25
|
<Stack.Screen name={AUTH_ROUTES.WELCOME} component={AuthWelcome} />
|
|
26
26
|
<Stack.Screen name={AUTH_ROUTES.LOGIN} component={Login} />
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
} from '../../pages';
|
|
45
45
|
import { MenuWrapper } from './side-menu-wrapper';
|
|
46
46
|
import { SideMenuDrawer } from './side-menu-drawer';
|
|
47
|
+
import { RootLayout } from '../layout';
|
|
47
48
|
|
|
48
49
|
import { MainStackParamList } from './types';
|
|
49
50
|
import { useWindowSize } from '../../hooks/index';
|
|
@@ -52,6 +53,14 @@ import { useOpenpeeps } from '@openpeepshq/react';
|
|
|
52
53
|
|
|
53
54
|
const Stack = createNativeStackNavigator<MainStackParamList>();
|
|
54
55
|
|
|
56
|
+
const NO_ROOT_LAYOUT = new Set([
|
|
57
|
+
'TabNavigator',
|
|
58
|
+
'JamSession',
|
|
59
|
+
'VideoPlayer',
|
|
60
|
+
'About',
|
|
61
|
+
'CodeOfConduct',
|
|
62
|
+
]);
|
|
63
|
+
|
|
55
64
|
export const MainNavigator = () => {
|
|
56
65
|
const { openpeepsApi, queryClient } = useOpenpeeps();
|
|
57
66
|
queryClient.setDefaultOptions({
|
|
@@ -90,7 +99,14 @@ export const MainNavigator = () => {
|
|
|
90
99
|
return (
|
|
91
100
|
<Stack.Navigator
|
|
92
101
|
screenOptions={{ headerShown: false, animation: 'fade' }}
|
|
93
|
-
screenLayout={({ children }) =>
|
|
102
|
+
screenLayout={({ children, route }) => {
|
|
103
|
+
const body = NO_ROOT_LAYOUT.has(route.name) ? (
|
|
104
|
+
children
|
|
105
|
+
) : (
|
|
106
|
+
<RootLayout>{children}</RootLayout>
|
|
107
|
+
);
|
|
108
|
+
return <Wrapper>{body}</Wrapper>;
|
|
109
|
+
}}
|
|
94
110
|
>
|
|
95
111
|
<Stack.Screen name="TabNavigator" component={TabNavigator} />
|
|
96
112
|
<Stack.Screen name="Profile" component={Profile} />
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { NavigatorScreenParams } from '@react-navigation/native';
|
|
2
|
+
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
3
|
+
import type { PublicPost } from '@openpeepshq/common/types';
|
|
4
|
+
import { MainStackParamList, TabStackParamList } from './types';
|
|
5
|
+
|
|
6
|
+
type Nav = NativeStackNavigationProp<MainStackParamList>;
|
|
7
|
+
|
|
8
|
+
const tabs = <S extends keyof TabStackParamList>(
|
|
9
|
+
navigation: Nav,
|
|
10
|
+
screen: S,
|
|
11
|
+
params?: TabStackParamList[S]
|
|
12
|
+
) =>
|
|
13
|
+
navigation.navigate('TabNavigator', {
|
|
14
|
+
screen,
|
|
15
|
+
params,
|
|
16
|
+
} as NavigatorScreenParams<TabStackParamList>);
|
|
17
|
+
|
|
18
|
+
/** Semantic parent when the stack has no in-app history (deep links). */
|
|
19
|
+
export const applySemanticParent = ({
|
|
20
|
+
navigation,
|
|
21
|
+
routeName,
|
|
22
|
+
params,
|
|
23
|
+
post,
|
|
24
|
+
profileHandle,
|
|
25
|
+
}: {
|
|
26
|
+
navigation: Nav;
|
|
27
|
+
routeName: string;
|
|
28
|
+
params?: Record<string, unknown>;
|
|
29
|
+
post?: PublicPost;
|
|
30
|
+
profileHandle?: string;
|
|
31
|
+
}) => {
|
|
32
|
+
switch (routeName) {
|
|
33
|
+
case 'Post':
|
|
34
|
+
case 'EventPage':
|
|
35
|
+
if (post?.replyTo?.type === 'event' && post.inReplyToId) {
|
|
36
|
+
navigation.navigate('Post', { id: post.inReplyToId });
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (post?.groupId) {
|
|
40
|
+
navigation.navigate('Group', {
|
|
41
|
+
id: post.groupId,
|
|
42
|
+
handle: post.group?.handle,
|
|
43
|
+
});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (post?.type === 'event') {
|
|
47
|
+
tabs(navigation, 'Events');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
tabs(navigation, 'Home');
|
|
51
|
+
return;
|
|
52
|
+
case 'Profile':
|
|
53
|
+
tabs(navigation, 'Directory');
|
|
54
|
+
return;
|
|
55
|
+
case 'EditProfile':
|
|
56
|
+
if (typeof params?.handle === 'string') {
|
|
57
|
+
navigation.navigate('Profile', { handle: params.handle });
|
|
58
|
+
} else if (profileHandle) {
|
|
59
|
+
navigation.navigate('Profile', { handle: profileHandle });
|
|
60
|
+
} else {
|
|
61
|
+
tabs(navigation, 'Directory');
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
case 'ProfileFollowers':
|
|
65
|
+
case 'ProfileFollowing':
|
|
66
|
+
tabs(navigation, 'Directory');
|
|
67
|
+
return;
|
|
68
|
+
case 'Conversation':
|
|
69
|
+
tabs(navigation, 'Messages');
|
|
70
|
+
return;
|
|
71
|
+
case 'ConversationInfo':
|
|
72
|
+
if (typeof params?.id === 'string') {
|
|
73
|
+
navigation.navigate('Conversation', { id: params.id });
|
|
74
|
+
} else {
|
|
75
|
+
tabs(navigation, 'Messages');
|
|
76
|
+
}
|
|
77
|
+
return;
|
|
78
|
+
case 'Group':
|
|
79
|
+
tabs(navigation, 'Groups');
|
|
80
|
+
return;
|
|
81
|
+
case 'GroupMembers':
|
|
82
|
+
case 'GroupInfo':
|
|
83
|
+
if (typeof params?.id === 'string') {
|
|
84
|
+
navigation.navigate('Group', { id: params.id });
|
|
85
|
+
} else {
|
|
86
|
+
tabs(navigation, 'Groups');
|
|
87
|
+
}
|
|
88
|
+
return;
|
|
89
|
+
case 'MyEvents':
|
|
90
|
+
case 'NewEvent':
|
|
91
|
+
case 'EditEvent':
|
|
92
|
+
tabs(navigation, 'Events');
|
|
93
|
+
return;
|
|
94
|
+
case 'MyJams':
|
|
95
|
+
case 'JamSession':
|
|
96
|
+
case 'CreateNewJam':
|
|
97
|
+
tabs(navigation, 'Jam');
|
|
98
|
+
return;
|
|
99
|
+
case 'NotificationSettings':
|
|
100
|
+
case 'NotificationsSettings':
|
|
101
|
+
case 'PushEnabledDevices':
|
|
102
|
+
case 'AccountSettings':
|
|
103
|
+
case 'AccessTokensSettings':
|
|
104
|
+
case 'ThemeSettings':
|
|
105
|
+
case 'FeedSettings':
|
|
106
|
+
case 'BlockedSettings':
|
|
107
|
+
case 'LanguageSettings':
|
|
108
|
+
case 'TimezoneSettings':
|
|
109
|
+
tabs(navigation, 'Settings');
|
|
110
|
+
return;
|
|
111
|
+
case 'Settings':
|
|
112
|
+
if (profileHandle) {
|
|
113
|
+
navigation.navigate('Profile', { handle: profileHandle });
|
|
114
|
+
} else {
|
|
115
|
+
tabs(navigation, 'Home');
|
|
116
|
+
}
|
|
117
|
+
return;
|
|
118
|
+
case 'Onboarding':
|
|
119
|
+
case 'HashtagPosts':
|
|
120
|
+
case 'About':
|
|
121
|
+
case 'CodeOfConduct':
|
|
122
|
+
default:
|
|
123
|
+
tabs(navigation, 'Home');
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const goToParentOrBack = (args: {
|
|
128
|
+
navigation: Nav;
|
|
129
|
+
routeName: string;
|
|
130
|
+
params?: Record<string, unknown>;
|
|
131
|
+
post?: PublicPost;
|
|
132
|
+
profileHandle?: string;
|
|
133
|
+
}) => {
|
|
134
|
+
if (args.navigation.canGoBack()) {
|
|
135
|
+
args.navigation.goBack();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
applySemanticParent(args);
|
|
139
|
+
};
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
useServerInfo,
|
|
37
37
|
} from '@openpeepshq/react';
|
|
38
38
|
import { useOpenPeepsTheme } from '../../theme/OpenPeepsThemeProvider';
|
|
39
|
+
import { RootLayout } from '../layout';
|
|
39
40
|
|
|
40
41
|
const Tab = createBottomTabNavigator<TabStackParamList>();
|
|
41
42
|
|
|
@@ -91,6 +92,7 @@ export const TabNavigator = () => {
|
|
|
91
92
|
const display = isMediumScreenOrLarger ? 'none' : 'flex';
|
|
92
93
|
return (
|
|
93
94
|
<Tab.Navigator
|
|
95
|
+
screenLayout={({ children }) => <RootLayout>{children}</RootLayout>}
|
|
94
96
|
screenOptions={({ route }) => ({
|
|
95
97
|
headerShown: false,
|
|
96
98
|
tabBarShowLabel: false,
|
|
@@ -20,17 +20,19 @@ export const JamStarted: React.FC<NotificationTypeProps> = ({
|
|
|
20
20
|
return (
|
|
21
21
|
<NotificationWrapper profile={profile} seen={notification.seen}>
|
|
22
22
|
<View className="w-full">
|
|
23
|
-
<View className="mb-2
|
|
24
|
-
<ThemedText>
|
|
23
|
+
<View className="mb-2 min-w-0 flex-row flex-wrap items-center gap-2">
|
|
24
|
+
<ThemedText className="shrink">
|
|
25
25
|
{t('notification.jamStarted.text', {
|
|
26
26
|
profileName: profileName(profile),
|
|
27
|
-
})}
|
|
27
|
+
})}
|
|
28
28
|
</ThemedText>
|
|
29
29
|
<UpdatingDate date={notification.createdAt} />
|
|
30
30
|
</View>
|
|
31
|
-
{notification.post?.type === 'event'
|
|
32
|
-
<
|
|
33
|
-
|
|
31
|
+
{notification.post?.type === 'event' ? (
|
|
32
|
+
<View className="min-w-0">
|
|
33
|
+
<JamCard jamPost={notification.post} />
|
|
34
|
+
</View>
|
|
35
|
+
) : null}
|
|
34
36
|
</View>
|
|
35
37
|
</NotificationWrapper>
|
|
36
38
|
);
|
|
@@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
9
9
|
import { MainStackParamList } from '../../navigation/types/index';
|
|
10
10
|
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
11
11
|
import { useNavigation } from '@react-navigation/native';
|
|
12
|
-
import {
|
|
12
|
+
import { FeedPostContent } from '../../post/FeedPostContent';
|
|
13
13
|
|
|
14
14
|
interface NotificationTypeProps {
|
|
15
15
|
notification: PublicNotification;
|
|
@@ -25,7 +25,7 @@ export const Reply: React.FC<NotificationTypeProps> = ({ notification }) => {
|
|
|
25
25
|
<NotificationWrapper
|
|
26
26
|
profile={profile}
|
|
27
27
|
seen={notification.seen}
|
|
28
|
-
showProfile
|
|
28
|
+
showProfile
|
|
29
29
|
>
|
|
30
30
|
<Pressable
|
|
31
31
|
onPress={() => navigation.navigate('Post', { id: replyPost.id })}
|
|
@@ -41,14 +41,11 @@ export const Reply: React.FC<NotificationTypeProps> = ({ notification }) => {
|
|
|
41
41
|
</ThemedText>
|
|
42
42
|
</View>
|
|
43
43
|
</View>
|
|
44
|
-
{replyPost
|
|
45
|
-
<
|
|
46
|
-
post={replyPost}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
noReactionHeader
|
|
50
|
-
/>
|
|
51
|
-
)}
|
|
44
|
+
{replyPost ? (
|
|
45
|
+
<View className="min-w-0">
|
|
46
|
+
<FeedPostContent post={replyPost} />
|
|
47
|
+
</View>
|
|
48
|
+
) : null}
|
|
52
49
|
</Pressable>
|
|
53
50
|
</NotificationWrapper>
|
|
54
51
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
type VisibilityType,
|
|
10
10
|
} from '@openpeepshq/common';
|
|
11
11
|
import { getNewPostStores, useAuthData } from '@openpeepshq/react';
|
|
12
|
-
import {
|
|
13
|
-
import { PlusIcon } from '../icons/index';
|
|
12
|
+
import { useSetPlusButtonActions } from '../layout';
|
|
14
13
|
import { MainStackParamList } from '../navigation/types/index';
|
|
15
14
|
|
|
16
15
|
export interface NewEventButtonProps {
|
|
@@ -19,7 +18,7 @@ export interface NewEventButtonProps {
|
|
|
19
18
|
group?: GroupWithMeta;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
/**
|
|
21
|
+
/** Registers the RootLayout plus button for creating an event. */
|
|
23
22
|
export const NewEventButton = ({
|
|
24
23
|
visibility,
|
|
25
24
|
currentProfile,
|
|
@@ -34,17 +33,25 @@ export const NewEventButton = ({
|
|
|
34
33
|
const canPost =
|
|
35
34
|
!!profile && canCreatePost(authData, 'event', visibility, group);
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
const plusActions = useMemo(
|
|
37
|
+
() =>
|
|
38
|
+
canPost
|
|
39
|
+
? {
|
|
40
|
+
title: t('events.form.title'),
|
|
41
|
+
action: () => {
|
|
42
|
+
const stores = getNewPostStores();
|
|
43
|
+
stores.event = {
|
|
44
|
+
...stores.event,
|
|
45
|
+
visibility,
|
|
46
|
+
groupId: group?.id,
|
|
47
|
+
};
|
|
48
|
+
navigation.navigate('NewEvent');
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
: undefined,
|
|
52
|
+
[canPost, group?.id, navigation, t, visibility]
|
|
49
53
|
);
|
|
54
|
+
|
|
55
|
+
useSetPlusButtonActions(plusActions);
|
|
56
|
+
return null;
|
|
50
57
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import {
|
|
4
4
|
canCreatePost,
|
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
type VisibilityType,
|
|
8
8
|
} from '@openpeepshq/common';
|
|
9
9
|
import { useAuthData } from '@openpeepshq/react';
|
|
10
|
-
import {
|
|
11
|
-
import { PencilLineIcon } from '../icons/index';
|
|
10
|
+
import { useSetPlusButtonActions } from '../layout';
|
|
12
11
|
import { useNewPostModal } from './post-form/NewPostModalContext';
|
|
13
12
|
|
|
14
13
|
export interface NewNoteButtonProps {
|
|
@@ -17,7 +16,7 @@ export interface NewNoteButtonProps {
|
|
|
17
16
|
group?: GroupWithMeta;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
/**
|
|
19
|
+
/** Registers the RootLayout plus button for creating a note. */
|
|
21
20
|
export const NewNoteButton = ({
|
|
22
21
|
visibility,
|
|
23
22
|
currentProfile,
|
|
@@ -31,14 +30,17 @@ export const NewNoteButton = ({
|
|
|
31
30
|
const canPost =
|
|
32
31
|
!!profile && canCreatePost(authData, 'note', visibility, group);
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
const plusActions = useMemo(
|
|
34
|
+
() =>
|
|
35
|
+
canPost
|
|
36
|
+
? {
|
|
37
|
+
title: t('posts.form.title'),
|
|
38
|
+
action: () => openNewPost({ visibility, group }),
|
|
39
|
+
}
|
|
40
|
+
: undefined,
|
|
41
|
+
[canPost, group, openNewPost, t, visibility]
|
|
43
42
|
);
|
|
43
|
+
|
|
44
|
+
useSetPlusButtonActions(plusActions);
|
|
45
|
+
return null;
|
|
44
46
|
};
|
|
@@ -135,36 +135,40 @@ export const EventRsvpButton = ({
|
|
|
135
135
|
|
|
136
136
|
return (
|
|
137
137
|
<View className="mt-4 w-full">
|
|
138
|
-
<View className="w-full flex-
|
|
138
|
+
<View className="w-full flex-col gap-2">
|
|
139
139
|
<Button
|
|
140
|
-
className="w-
|
|
140
|
+
className="w-full"
|
|
141
141
|
disabled={full || submitting}
|
|
142
142
|
onPress={() => requestRespond('yes')}
|
|
143
143
|
>
|
|
144
|
-
<ThemedText>
|
|
144
|
+
<ThemedText numberOfLines={1}>
|
|
145
145
|
{full ? t('events.rsvp.full') : t('posts.rsvp.register')}
|
|
146
146
|
</ThemedText>
|
|
147
147
|
</Button>
|
|
148
|
-
|
|
148
|
+
<View className="w-full flex-row gap-x-2">
|
|
149
|
+
{!capacityEvent ? (
|
|
150
|
+
<Button
|
|
151
|
+
variant="ghost"
|
|
152
|
+
className="flex-1"
|
|
153
|
+
disabled={submitting}
|
|
154
|
+
onPress={() => requestRespond('tentative')}
|
|
155
|
+
>
|
|
156
|
+
<ThemedText numberOfLines={1} className="text-muted-foreground">
|
|
157
|
+
{t('posts.rsvp.maybe')}
|
|
158
|
+
</ThemedText>
|
|
159
|
+
</Button>
|
|
160
|
+
) : null}
|
|
149
161
|
<Button
|
|
150
|
-
variant="
|
|
162
|
+
variant="outline"
|
|
163
|
+
className="flex-1"
|
|
151
164
|
disabled={submitting}
|
|
152
|
-
onPress={() => requestRespond('
|
|
165
|
+
onPress={() => requestRespond('no')}
|
|
153
166
|
>
|
|
154
|
-
<ThemedText className="text-
|
|
155
|
-
{t('posts.rsvp.
|
|
167
|
+
<ThemedText numberOfLines={1} className="text-destructive">
|
|
168
|
+
{t('posts.rsvp.no')}
|
|
156
169
|
</ThemedText>
|
|
157
170
|
</Button>
|
|
158
|
-
|
|
159
|
-
<Button
|
|
160
|
-
variant="outline"
|
|
161
|
-
disabled={submitting}
|
|
162
|
-
onPress={() => requestRespond('no')}
|
|
163
|
-
>
|
|
164
|
-
<ThemedText className="text-destructive">
|
|
165
|
-
{t('posts.rsvp.no')}
|
|
166
|
-
</ThemedText>
|
|
167
|
-
</Button>
|
|
171
|
+
</View>
|
|
168
172
|
</View>
|
|
169
173
|
{errorText}
|
|
170
174
|
{scopeDialog}
|
|
@@ -11,26 +11,10 @@ export const ParticipantsCard: React.FC<ParticipantsCardProps> = ({
|
|
|
11
11
|
jamState,
|
|
12
12
|
}) => {
|
|
13
13
|
return (
|
|
14
|
-
<View className="flex
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
{jamState.participants.slice(0, 2).map((participant) => (
|
|
19
|
-
<>
|
|
20
|
-
<ProfileFromId id={participant} />
|
|
21
|
-
</>
|
|
22
|
-
))}
|
|
23
|
-
</>
|
|
24
|
-
) : (
|
|
25
|
-
<>
|
|
26
|
-
{jamState.participants.map((participant) => (
|
|
27
|
-
<>
|
|
28
|
-
<ProfileFromId id={participant} />
|
|
29
|
-
</>
|
|
30
|
-
))}
|
|
31
|
-
</>
|
|
32
|
-
)}
|
|
33
|
-
</View>
|
|
14
|
+
<View className="flex-row items-center">
|
|
15
|
+
{jamState.participants.slice(0, 2).map((participant) => (
|
|
16
|
+
<ProfileFromId key={participant} id={participant} />
|
|
17
|
+
))}
|
|
34
18
|
</View>
|
|
35
19
|
);
|
|
36
20
|
};
|
|
@@ -37,7 +37,9 @@ export const FeedArticle = ({ post }: Props) => {
|
|
|
37
37
|
resizeMode="cover"
|
|
38
38
|
/>
|
|
39
39
|
)}
|
|
40
|
-
<ThemedText className="text-xl font-bold">
|
|
40
|
+
<ThemedText className="text-xl font-bold text-foreground">
|
|
41
|
+
{article.title}
|
|
42
|
+
</ThemedText>
|
|
41
43
|
<OpenpeepsMarkdown source={previewContent} linkPreviewMode="none" />
|
|
42
44
|
<View className="w-full flex flex-row justify-end">
|
|
43
45
|
<Button
|
|
@@ -95,7 +95,7 @@ export const CardEvent = ({ post, showEventDate = true }: CardEventProps) => {
|
|
|
95
95
|
>
|
|
96
96
|
<View className="flex flex-row items-center gap-x-2">
|
|
97
97
|
{jamState?.participants?.length > 0 && (
|
|
98
|
-
<View className="-
|
|
98
|
+
<View className="flex-row items-center">
|
|
99
99
|
<ParticipantsCard jamState={jamState} />
|
|
100
100
|
</View>
|
|
101
101
|
)}
|