@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
package/src/pages/events/My.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { useOpenpeeps } from '@openpeepshq/react';
|
|
4
|
-
import { AgendaTabs
|
|
4
|
+
import { AgendaTabs } from '../../components/custom/index';
|
|
5
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
6
|
+
import { ThemedView } from '../../components/ui/themed-view';
|
|
5
7
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
6
8
|
import { EventsView, Feed } from '../../components/post/index';
|
|
7
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
8
9
|
|
|
9
10
|
type Tab = 'upcoming' | 'current' | 'past';
|
|
10
11
|
|
|
@@ -24,11 +25,10 @@ export const EventsMy: React.FC<MainScreenProps<'MyEvents'>> = () => {
|
|
|
24
25
|
? currentQuery
|
|
25
26
|
: pastQuery;
|
|
26
27
|
|
|
28
|
+
useSetPageHeader(t('navigation.myEvents', { defaultValue: 'My events' }));
|
|
29
|
+
|
|
27
30
|
return (
|
|
28
|
-
<
|
|
29
|
-
<GenericHeader
|
|
30
|
-
title={t('navigation.myEvents', { defaultValue: 'My events' })}
|
|
31
|
-
/>
|
|
31
|
+
<ThemedView className="flex-1">
|
|
32
32
|
<AgendaTabs<Tab>
|
|
33
33
|
accessibilityLabel={t('events.feed.label', {
|
|
34
34
|
defaultValue: 'Event timeframe',
|
|
@@ -55,6 +55,6 @@ export const EventsMy: React.FC<MainScreenProps<'MyEvents'>> = () => {
|
|
|
55
55
|
agenda={tab}
|
|
56
56
|
list={<Feed query={activeQuery} formatSwitch={false} />}
|
|
57
57
|
/>
|
|
58
|
-
</
|
|
58
|
+
</ThemedView>
|
|
59
59
|
);
|
|
60
60
|
};
|
package/src/pages/events/New.tsx
CHANGED
|
@@ -3,10 +3,10 @@ import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view
|
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import Toast from 'react-native-toast-message';
|
|
5
5
|
import { useNewEvent } from '@openpeepshq/react';
|
|
6
|
-
import {
|
|
6
|
+
import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
|
|
7
|
+
import { ThemedView } from '../../components/ui/themed-view';
|
|
7
8
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
8
9
|
import { EventForm } from '../../components/post/index';
|
|
9
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
10
10
|
|
|
11
11
|
type NewEventProps = MainScreenProps<'NewEvent'>;
|
|
12
12
|
|
|
@@ -28,23 +28,24 @@ export const NewEvent = (_props: NewEventProps) => {
|
|
|
28
28
|
clearError();
|
|
29
29
|
}, [error, clearError]);
|
|
30
30
|
|
|
31
|
+
useSetPageHeader(
|
|
32
|
+
t('events.create.title'),
|
|
33
|
+
<HeaderActionButton
|
|
34
|
+
title={submitting ? t('common.submitting') : t('events.create.title')}
|
|
35
|
+
onPress={() => void submit()}
|
|
36
|
+
disabled={submitting || !canSubmit}
|
|
37
|
+
loading={submitting}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
|
|
31
41
|
return (
|
|
32
|
-
<
|
|
33
|
-
<GenericHeader
|
|
34
|
-
title={t('events.create.title')}
|
|
35
|
-
rightButtonTitle={
|
|
36
|
-
submitting ? t('common.submitting') : t('events.create.title')
|
|
37
|
-
}
|
|
38
|
-
onRightButtonPress={() => void submit()}
|
|
39
|
-
rightButtonDisabled={submitting || !canSubmit}
|
|
40
|
-
rightType="button"
|
|
41
|
-
/>
|
|
42
|
+
<ThemedView className="flex-1">
|
|
42
43
|
<KeyboardAwareScrollView
|
|
43
44
|
contentContainerClassName="grow"
|
|
44
45
|
className="pb-12"
|
|
45
46
|
>
|
|
46
47
|
<EventForm postData={postData} onChange={setPostData} />
|
|
47
48
|
</KeyboardAwareScrollView>
|
|
48
|
-
</
|
|
49
|
+
</ThemedView>
|
|
49
50
|
);
|
|
50
51
|
};
|
|
@@ -4,8 +4,7 @@ import {
|
|
|
4
4
|
TabStackParamList,
|
|
5
5
|
} from '../../components/navigation/types/index';
|
|
6
6
|
import { useFeedListParams, useOpenpeeps } from '@openpeepshq/react';
|
|
7
|
-
import {
|
|
8
|
-
import { ThemedText } from '../../components/ui/themed-text';
|
|
7
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
9
8
|
import { CompositeScreenProps } from '@react-navigation/native';
|
|
10
9
|
import { NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
11
10
|
import { RefreshControl, ScrollView } from 'react-native';
|
|
@@ -31,15 +30,10 @@ export const FeedsBookmarks: React.FC<HomeScreenProps> = ({}) => {
|
|
|
31
30
|
setRefreshing(false);
|
|
32
31
|
}, [query]);
|
|
33
32
|
|
|
33
|
+
useSetPageHeader(t('navigation.bookmarks'));
|
|
34
|
+
|
|
34
35
|
return (
|
|
35
36
|
<>
|
|
36
|
-
<TabScreensHeader
|
|
37
|
-
children={
|
|
38
|
-
<ThemedText className="text-xl font-bold">
|
|
39
|
-
{t('navigation.bookmarks')}
|
|
40
|
-
</ThemedText>
|
|
41
|
-
}
|
|
42
|
-
/>
|
|
43
37
|
<ScrollView
|
|
44
38
|
className="bg-background"
|
|
45
39
|
refreshControl={
|
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
useOpenpeeps,
|
|
11
11
|
} from '@openpeepshq/react';
|
|
12
12
|
import { CompositeScreenProps } from '@react-navigation/native';
|
|
13
|
-
import {
|
|
14
|
-
import { ThemedText } from '../../components/ui/themed-text';
|
|
13
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
15
14
|
import { useTranslation } from 'react-i18next';
|
|
16
15
|
import { Feed, NewNoteButton } from '../../components/post/index';
|
|
17
16
|
|
|
@@ -31,16 +30,10 @@ export const FeedsLocal: React.FC<HomeScreenProps> = () => {
|
|
|
31
30
|
|
|
32
31
|
const query = openpeepsApi.useLocalFeed(useFeedListParams({ limit: 15 }));
|
|
33
32
|
|
|
33
|
+
useSetPageHeader(t('navigation.community'));
|
|
34
|
+
|
|
34
35
|
return (
|
|
35
36
|
<>
|
|
36
|
-
<TabScreensHeader
|
|
37
|
-
children={
|
|
38
|
-
<ThemedText className="text-xl font-bold">
|
|
39
|
-
{t('navigation.community')}
|
|
40
|
-
</ThemedText>
|
|
41
|
-
}
|
|
42
|
-
/>
|
|
43
|
-
|
|
44
37
|
<Feed
|
|
45
38
|
query={query}
|
|
46
39
|
pinnedPostId={pinnedPostId}
|
package/src/pages/feeds/My.tsx
CHANGED
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
useOpenpeeps,
|
|
11
11
|
} from '@openpeepshq/react';
|
|
12
12
|
import { CompositeScreenProps } from '@react-navigation/native';
|
|
13
|
-
import {
|
|
14
|
-
import { ThemedText } from '../../components/ui/themed-text';
|
|
13
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
15
14
|
|
|
16
15
|
import { useTranslation } from 'react-i18next';
|
|
17
16
|
import { Feed, NewNoteButton } from '../../components/post/index';
|
|
@@ -27,15 +26,10 @@ export const FeedsMy: React.FC<HomeScreenProps> = () => {
|
|
|
27
26
|
const query = openpeepsApi.useMyFeed(useFeedListParams({ limit: 15 }));
|
|
28
27
|
const visibility = useDefaultVisibility();
|
|
29
28
|
|
|
29
|
+
useSetPageHeader(t('navigation.myFeed'));
|
|
30
|
+
|
|
30
31
|
return (
|
|
31
32
|
<>
|
|
32
|
-
<TabScreensHeader
|
|
33
|
-
children={
|
|
34
|
-
<ThemedText className="text-xl font-bold">
|
|
35
|
-
{t('navigation.myFeed')}
|
|
36
|
-
</ThemedText>
|
|
37
|
-
}
|
|
38
|
-
/>
|
|
39
33
|
<Feed query={query} />
|
|
40
34
|
<NewNoteButton visibility={visibility} />
|
|
41
35
|
</>
|
|
@@ -4,9 +4,9 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
import { checkGroupCapabilities } from '@openpeepshq/common';
|
|
5
5
|
import { useAuthData, useOpenpeeps } from '@openpeepshq/react';
|
|
6
6
|
import { ConfigMenuButton } from '../../components/configuration/index';
|
|
7
|
-
import {
|
|
7
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
8
|
+
import { ThemedView } from '../../components/ui/themed-view';
|
|
8
9
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
9
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
10
10
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
11
11
|
|
|
12
12
|
type EditGroupProps = MainScreenProps<'EditGroupDetails'>;
|
|
@@ -27,11 +27,10 @@ export const EditGroup = ({ route, navigation }: EditGroupProps) => {
|
|
|
27
27
|
checkGroupCapabilities(authData, ['core-groups-updateCapabilities'], group)
|
|
28
28
|
.success;
|
|
29
29
|
|
|
30
|
+
useSetPageHeader(t('groups.edit.title', { defaultValue: 'Edit group' }));
|
|
31
|
+
|
|
30
32
|
return (
|
|
31
|
-
<
|
|
32
|
-
<GenericHeader
|
|
33
|
-
title={t('groups.edit.title', { defaultValue: 'Edit group' })}
|
|
34
|
-
/>
|
|
33
|
+
<ThemedView className="flex-1">
|
|
35
34
|
{groupQuery.isLoading ? (
|
|
36
35
|
<ActivityIndicator size="small" />
|
|
37
36
|
) : !group ? (
|
|
@@ -54,6 +53,6 @@ export const EditGroup = ({ route, navigation }: EditGroupProps) => {
|
|
|
54
53
|
) : null}
|
|
55
54
|
</View>
|
|
56
55
|
)}
|
|
57
|
-
</
|
|
56
|
+
</ThemedView>
|
|
58
57
|
);
|
|
59
58
|
};
|
|
@@ -4,10 +4,10 @@ import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view
|
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import Toast from 'react-native-toast-message';
|
|
6
6
|
import { useEditGroup } from '@openpeepshq/react';
|
|
7
|
-
import {
|
|
7
|
+
import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
|
|
8
|
+
import { ThemedView } from '../../components/ui/themed-view';
|
|
8
9
|
import { GroupForm } from '../../components/groups/index';
|
|
9
10
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
10
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
11
11
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
12
12
|
|
|
13
13
|
type EditGroupInfoProps = MainScreenProps<'EditGroupInfo'>;
|
|
@@ -32,21 +32,24 @@ export const EditGroupInfo = ({ route }: EditGroupInfoProps) => {
|
|
|
32
32
|
clearError();
|
|
33
33
|
}, [error, clearError]);
|
|
34
34
|
|
|
35
|
+
useSetPageHeader(
|
|
36
|
+
t('groups.edit.info.title', {
|
|
37
|
+
defaultValue: 'Group information',
|
|
38
|
+
}),
|
|
39
|
+
<HeaderActionButton
|
|
40
|
+
title={
|
|
41
|
+
submitting
|
|
42
|
+
? t('common.saving', { defaultValue: 'Saving…' })
|
|
43
|
+
: t('common.save', { defaultValue: 'Save' })
|
|
44
|
+
}
|
|
45
|
+
onPress={() => void submit()}
|
|
46
|
+
disabled={submitting || !groupData}
|
|
47
|
+
loading={submitting}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
|
|
35
51
|
return (
|
|
36
|
-
<
|
|
37
|
-
<GenericHeader
|
|
38
|
-
title={t('groups.edit.info.title', {
|
|
39
|
-
defaultValue: 'Group information',
|
|
40
|
-
})}
|
|
41
|
-
rightButtonTitle={
|
|
42
|
-
submitting
|
|
43
|
-
? t('common.saving', { defaultValue: 'Saving…' })
|
|
44
|
-
: t('common.save', { defaultValue: 'Save' })
|
|
45
|
-
}
|
|
46
|
-
onRightButtonPress={() => void submit()}
|
|
47
|
-
rightButtonDisabled={submitting || !groupData}
|
|
48
|
-
rightType="button"
|
|
49
|
-
/>
|
|
52
|
+
<ThemedView className="flex-1">
|
|
50
53
|
{groupQuery.isLoading || !groupData ? (
|
|
51
54
|
groupQuery.isLoading ? (
|
|
52
55
|
<ActivityIndicator size="small" />
|
|
@@ -71,6 +74,6 @@ export const EditGroupInfo = ({ route }: EditGroupInfoProps) => {
|
|
|
71
74
|
</View>
|
|
72
75
|
</KeyboardAwareScrollView>
|
|
73
76
|
)}
|
|
74
|
-
</
|
|
77
|
+
</ThemedView>
|
|
75
78
|
);
|
|
76
79
|
};
|
|
@@ -3,10 +3,10 @@ import { ActivityIndicator, ScrollView, View } from 'react-native';
|
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import Toast from 'react-native-toast-message';
|
|
5
5
|
import { useEditGroup } from '@openpeepshq/react';
|
|
6
|
-
import {
|
|
6
|
+
import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
|
|
7
|
+
import { ThemedView } from '../../components/ui/themed-view';
|
|
7
8
|
import { GroupForm } from '../../components/groups/index';
|
|
8
9
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
9
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
10
10
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
11
11
|
|
|
12
12
|
type EditGroupRolesProps = MainScreenProps<'EditGroupRoles'>;
|
|
@@ -64,22 +64,21 @@ export const EditGroupRoles = ({ route }: EditGroupRolesProps) => {
|
|
|
64
64
|
);
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
/>
|
|
82
|
-
{body()}
|
|
83
|
-
</ThemedSafeAreaView>
|
|
67
|
+
useSetPageHeader(
|
|
68
|
+
t('groups.edit.roles.title', {
|
|
69
|
+
defaultValue: 'Roles & capabilities',
|
|
70
|
+
}),
|
|
71
|
+
<HeaderActionButton
|
|
72
|
+
title={
|
|
73
|
+
submitting
|
|
74
|
+
? t('common.saving', { defaultValue: 'Saving…' })
|
|
75
|
+
: t('common.save', { defaultValue: 'Save' })
|
|
76
|
+
}
|
|
77
|
+
onPress={() => void submit()}
|
|
78
|
+
disabled={submitting || !groupData || !canEditCapabilities}
|
|
79
|
+
loading={submitting}
|
|
80
|
+
/>
|
|
84
81
|
);
|
|
82
|
+
|
|
83
|
+
return <ThemedView className="flex-1">{body()}</ThemedView>;
|
|
85
84
|
};
|
|
@@ -1,45 +1,32 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
ActivityIndicator,
|
|
4
|
+
Pressable,
|
|
4
5
|
RefreshControl,
|
|
5
|
-
TouchableOpacity,
|
|
6
6
|
View,
|
|
7
7
|
} from 'react-native';
|
|
8
8
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
9
9
|
import { CompositeScreenProps } from '@react-navigation/native';
|
|
10
10
|
import { NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
11
|
-
|
|
12
11
|
import { checkRoleCapabilities } from '@openpeepshq/common';
|
|
13
|
-
import {
|
|
14
|
-
CheckIcon,
|
|
15
|
-
MoreVerticalIcon,
|
|
16
|
-
PlusIcon,
|
|
17
|
-
SearchIcon,
|
|
18
|
-
XIcon,
|
|
19
|
-
} from '../../components/icons/index';
|
|
20
|
-
import {
|
|
21
|
-
EmptyStateContainer,
|
|
22
|
-
PlusFab,
|
|
23
|
-
TabScreensHeader,
|
|
24
|
-
} from '../../components/custom/index';
|
|
25
|
-
import { ThemedView } from '../../components/ui/themed-view';
|
|
26
|
-
import { ThemedText } from '../../components/ui/themed-text';
|
|
27
|
-
import { Input } from '../../components/ui/input';
|
|
28
|
-
import {
|
|
29
|
-
DropdownMenu,
|
|
30
|
-
DropdownMenuContent,
|
|
31
|
-
DropdownMenuGroup,
|
|
32
|
-
DropdownMenuItem,
|
|
33
|
-
DropdownMenuTrigger,
|
|
34
|
-
} from '../../components/ui/dropdown-menu';
|
|
35
|
-
import { useTranslation } from 'react-i18next';
|
|
36
12
|
import { useOpenpeeps } from '@openpeepshq/react';
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import {
|
|
15
|
+
useSetPageHeader,
|
|
16
|
+
useSetPlusButtonActions,
|
|
17
|
+
} from '../../components/layout';
|
|
18
|
+
import { EmptyStateContainer } from '../../components/custom/index';
|
|
19
|
+
import { GroupCard } from '../../components/groups/index';
|
|
37
20
|
import {
|
|
38
21
|
MainStackParamList,
|
|
39
22
|
TabStackParamList,
|
|
40
23
|
} from '../../components/navigation/types/index';
|
|
24
|
+
import { Input } from '../../components/ui/input';
|
|
25
|
+
import { ThemedText } from '../../components/ui/themed-text';
|
|
26
|
+
import { ThemedView } from '../../components/ui/themed-view';
|
|
27
|
+
|
|
28
|
+
type GroupsTab = 'mine' | 'all';
|
|
41
29
|
|
|
42
|
-
import { GroupCard } from '../../components/groups/index';
|
|
43
30
|
type GroupsProps = CompositeScreenProps<
|
|
44
31
|
NativeStackScreenProps<TabStackParamList, 'Groups'>,
|
|
45
32
|
NativeStackScreenProps<MainStackParamList>
|
|
@@ -52,11 +39,8 @@ export const GroupsIndex: React.FC<GroupsProps> = ({ navigation }) => {
|
|
|
52
39
|
const unseenCountsQuery = openpeepsApi.useUnseenPostCounts();
|
|
53
40
|
const unseenByGroup = unseenCountsQuery.data?.groups ?? {};
|
|
54
41
|
|
|
55
|
-
const [
|
|
56
|
-
|
|
57
|
-
);
|
|
58
|
-
const [isSearchToggled, setIsSearchToggled] = useState(false);
|
|
59
|
-
const [searchQuery, setSearchQuery] = useState('');
|
|
42
|
+
const [tab, setTab] = useState<GroupsTab>('mine');
|
|
43
|
+
const [search, setSearch] = useState('');
|
|
60
44
|
|
|
61
45
|
const isMember = useCallback(
|
|
62
46
|
(groupId: string) =>
|
|
@@ -67,99 +51,64 @@ export const GroupsIndex: React.FC<GroupsProps> = ({ navigation }) => {
|
|
|
67
51
|
const visibleGroups = useMemo(
|
|
68
52
|
() =>
|
|
69
53
|
(groups ?? [])
|
|
54
|
+
.filter((g) => (tab === 'mine' ? isMember(g.id) : true))
|
|
70
55
|
.filter((g) =>
|
|
71
|
-
|
|
72
|
-
? g.displayName?.toLowerCase().includes(
|
|
56
|
+
search
|
|
57
|
+
? g.displayName?.toLowerCase().includes(search.toLowerCase())
|
|
73
58
|
: true
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
),
|
|
60
|
+
[groups, isMember, search, tab]
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const canCreate = checkRoleCapabilities(currentProfile?.roles ?? [], [
|
|
64
|
+
'core-groups-create',
|
|
65
|
+
]).success;
|
|
66
|
+
|
|
67
|
+
useSetPageHeader(t('navigation.groups', { defaultValue: 'Groups' }));
|
|
68
|
+
useSetPlusButtonActions(
|
|
69
|
+
canCreate
|
|
70
|
+
? {
|
|
71
|
+
title: t('groups.new'),
|
|
72
|
+
action: () => navigation.navigate('CreateGroup'),
|
|
73
|
+
}
|
|
74
|
+
: undefined
|
|
77
75
|
);
|
|
78
76
|
|
|
79
77
|
return (
|
|
80
78
|
<ThemedView className="flex-1">
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/>
|
|
102
|
-
<TouchableOpacity
|
|
103
|
-
className="items-center justify-center px-4"
|
|
104
|
-
onPress={() => {
|
|
105
|
-
setSearchQuery('');
|
|
106
|
-
setIsSearchToggled(false);
|
|
107
|
-
}}
|
|
108
|
-
>
|
|
109
|
-
<XIcon size={24} className="text-foreground" />
|
|
110
|
-
</TouchableOpacity>
|
|
111
|
-
</View>
|
|
112
|
-
) : (
|
|
113
|
-
<>
|
|
114
|
-
<TouchableOpacity onPress={() => setIsSearchToggled(true)}>
|
|
115
|
-
<SearchIcon size={24} className="text-foreground" />
|
|
116
|
-
</TouchableOpacity>
|
|
117
|
-
<DropdownMenu>
|
|
118
|
-
<DropdownMenuTrigger asChild>
|
|
119
|
-
<MoreVerticalIcon className="text-foreground" />
|
|
120
|
-
</DropdownMenuTrigger>
|
|
121
|
-
<DropdownMenuContent className="mt-1">
|
|
122
|
-
<DropdownMenuGroup>
|
|
123
|
-
<DropdownMenuItem
|
|
124
|
-
className="flex-row gap-x-2 items-center"
|
|
125
|
-
onPress={() => setFilterBy('all-groups')}
|
|
126
|
-
>
|
|
127
|
-
<ThemedText>All Groups</ThemedText>
|
|
128
|
-
{filterBy === 'all-groups' && (
|
|
129
|
-
<CheckIcon size={12} className="text-foreground" />
|
|
130
|
-
)}
|
|
131
|
-
</DropdownMenuItem>
|
|
132
|
-
<DropdownMenuItem
|
|
133
|
-
className="flex-row gap-x-2 items-center"
|
|
134
|
-
onPress={() => setFilterBy('my-groups')}
|
|
135
|
-
>
|
|
136
|
-
<ThemedText>My Groups</ThemedText>
|
|
137
|
-
{filterBy === 'my-groups' && (
|
|
138
|
-
<CheckIcon size={12} className="text-foreground" />
|
|
139
|
-
)}
|
|
140
|
-
</DropdownMenuItem>
|
|
141
|
-
</DropdownMenuGroup>
|
|
142
|
-
</DropdownMenuContent>
|
|
143
|
-
</DropdownMenu>
|
|
144
|
-
</>
|
|
145
|
-
)}
|
|
146
|
-
</View>
|
|
147
|
-
</View>
|
|
148
|
-
}
|
|
149
|
-
/>
|
|
79
|
+
<View
|
|
80
|
+
accessibilityRole="tablist"
|
|
81
|
+
className="border-border mb-4 flex-row border-b px-4"
|
|
82
|
+
>
|
|
83
|
+
<TabButton active={tab === 'mine'} onPress={() => setTab('mine')}>
|
|
84
|
+
{t('groups.tabs.myGroups', { defaultValue: 'My groups' })}
|
|
85
|
+
</TabButton>
|
|
86
|
+
<TabButton active={tab === 'all'} onPress={() => setTab('all')}>
|
|
87
|
+
{t('groups.tabs.allGroups', { defaultValue: 'All groups' })}
|
|
88
|
+
</TabButton>
|
|
89
|
+
</View>
|
|
90
|
+
<View className="px-4">
|
|
91
|
+
<Input
|
|
92
|
+
placeholder={t('groups.searchPlaceholder', {
|
|
93
|
+
defaultValue: 'Search by group name',
|
|
94
|
+
})}
|
|
95
|
+
value={search}
|
|
96
|
+
onChangeText={setSearch}
|
|
97
|
+
/>
|
|
98
|
+
</View>
|
|
150
99
|
<KeyboardAwareScrollView
|
|
151
100
|
refreshControl={
|
|
152
101
|
<RefreshControl refreshing={isLoading} onRefresh={refetch} />
|
|
153
102
|
}
|
|
154
103
|
contentContainerClassName="grow"
|
|
155
|
-
className="w-full
|
|
104
|
+
className="relative flex w-full bg-background px-4 pt-2"
|
|
156
105
|
>
|
|
157
|
-
{isLoading && <ActivityIndicator size=
|
|
106
|
+
{isLoading && <ActivityIndicator size="small" />}
|
|
158
107
|
{!isLoading && visibleGroups.length === 0 && (
|
|
159
108
|
<EmptyStateContainer
|
|
160
109
|
type="groups"
|
|
161
110
|
copyKey={
|
|
162
|
-
!
|
|
111
|
+
!search && tab === 'mine'
|
|
163
112
|
? 'groups.noGroupsYet'
|
|
164
113
|
: 'groups.noGroupsFound'
|
|
165
114
|
}
|
|
@@ -172,7 +121,9 @@ export const GroupsIndex: React.FC<GroupsProps> = ({ navigation }) => {
|
|
|
172
121
|
group={group}
|
|
173
122
|
isGroupMember={isMember(group.id)}
|
|
174
123
|
unreadCount={
|
|
175
|
-
|
|
124
|
+
tab === 'mine' && isMember(group.id)
|
|
125
|
+
? (unseenByGroup[group.id] ?? 0)
|
|
126
|
+
: 0
|
|
176
127
|
}
|
|
177
128
|
handleViewGroup={() =>
|
|
178
129
|
navigation.navigate('Group', { id: group.id })
|
|
@@ -181,16 +132,28 @@ export const GroupsIndex: React.FC<GroupsProps> = ({ navigation }) => {
|
|
|
181
132
|
))}
|
|
182
133
|
<View className="mb-24" />
|
|
183
134
|
</KeyboardAwareScrollView>
|
|
184
|
-
{checkRoleCapabilities(currentProfile?.roles ?? [], [
|
|
185
|
-
'core-groups-create',
|
|
186
|
-
]).success ? (
|
|
187
|
-
<PlusFab
|
|
188
|
-
accessibilityLabel={t('groups.new')}
|
|
189
|
-
onPress={() => navigation.navigate('CreateGroup')}
|
|
190
|
-
>
|
|
191
|
-
<PlusIcon size={24} className="text-background" />
|
|
192
|
-
</PlusFab>
|
|
193
|
-
) : null}
|
|
194
135
|
</ThemedView>
|
|
195
136
|
);
|
|
196
137
|
};
|
|
138
|
+
|
|
139
|
+
const TabButton = ({
|
|
140
|
+
active,
|
|
141
|
+
onPress,
|
|
142
|
+
children,
|
|
143
|
+
}: {
|
|
144
|
+
active: boolean;
|
|
145
|
+
onPress: () => void;
|
|
146
|
+
children: React.ReactNode;
|
|
147
|
+
}) => (
|
|
148
|
+
<Pressable
|
|
149
|
+
accessibilityRole="tab"
|
|
150
|
+
onPress={onPress}
|
|
151
|
+
className={`px-4 py-2 ${active ? 'border-primary border-b-2' : ''}`}
|
|
152
|
+
>
|
|
153
|
+
<ThemedText
|
|
154
|
+
className={`text-sm ${active ? 'font-semibold' : 'text-muted-foreground'}`}
|
|
155
|
+
>
|
|
156
|
+
{children}
|
|
157
|
+
</ThemedText>
|
|
158
|
+
</Pressable>
|
|
159
|
+
);
|
|
@@ -2,13 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
3
3
|
import { useOpenpeeps } from '@openpeepshq/react';
|
|
4
4
|
import { ThemedView } from '../../components/ui/themed-view';
|
|
5
|
-
import {
|
|
5
|
+
import { UpdatingDate } from '../../components/custom/index';
|
|
6
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
6
7
|
import { truncateText } from '../../lib/utils';
|
|
7
8
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
8
9
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
9
10
|
import { ActivityIndicator, View } from 'react-native';
|
|
10
11
|
import { Avatar, AvatarImage } from '../../components/ui/avatar';
|
|
11
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
13
|
import { getGroupAvatar } from '@openpeepshq/common';
|
|
14
14
|
|
|
@@ -21,27 +21,26 @@ export const GroupInfo = ({ route }: GroupInfoProps) => {
|
|
|
21
21
|
const { data: groupData, isLoading } = openpeepsApi.useGroup(id);
|
|
22
22
|
const { data: server } = openpeepsApi.useServerInfo();
|
|
23
23
|
|
|
24
|
+
useSetPageHeader(
|
|
25
|
+
<View className="flex-row items-center gap-x-2">
|
|
26
|
+
<Avatar alt={groupData?.displayName as string} className="size-8">
|
|
27
|
+
<AvatarImage
|
|
28
|
+
source={{
|
|
29
|
+
uri:
|
|
30
|
+
(groupData && server
|
|
31
|
+
? getGroupAvatar(groupData, server.communityConfig)
|
|
32
|
+
: groupData?.avatar) ?? undefined,
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
</Avatar>
|
|
36
|
+
<ThemedText className="text-lg">
|
|
37
|
+
{truncateText(groupData?.displayName, 30)}
|
|
38
|
+
</ThemedText>
|
|
39
|
+
</View>
|
|
40
|
+
);
|
|
41
|
+
|
|
24
42
|
return (
|
|
25
|
-
<
|
|
26
|
-
<GenericHeader
|
|
27
|
-
title={
|
|
28
|
-
<View className="flex-row gap-x-2 items-center">
|
|
29
|
-
<Avatar alt={groupData?.displayName as string} className=" size-14">
|
|
30
|
-
<AvatarImage
|
|
31
|
-
source={{
|
|
32
|
-
uri:
|
|
33
|
-
(groupData && server
|
|
34
|
-
? getGroupAvatar(groupData, server.communityConfig)
|
|
35
|
-
: groupData?.avatar) ?? undefined,
|
|
36
|
-
}}
|
|
37
|
-
/>
|
|
38
|
-
</Avatar>
|
|
39
|
-
<ThemedText className="text-lg">
|
|
40
|
-
{truncateText(groupData?.displayName, 30)}
|
|
41
|
-
</ThemedText>
|
|
42
|
-
</View>
|
|
43
|
-
}
|
|
44
|
-
/>
|
|
43
|
+
<ThemedView className="relative flex-1">
|
|
45
44
|
<KeyboardAwareScrollView
|
|
46
45
|
contentContainerClassName="grow"
|
|
47
46
|
className="w-full flex bg-background relative p-4"
|
|
@@ -74,7 +73,7 @@ export const GroupInfo = ({ route }: GroupInfoProps) => {
|
|
|
74
73
|
</>
|
|
75
74
|
)}
|
|
76
75
|
</KeyboardAwareScrollView>
|
|
77
|
-
</
|
|
76
|
+
</ThemedView>
|
|
78
77
|
);
|
|
79
78
|
};
|
|
80
79
|
|