@openpeepshq/rn-components 0.3.11 → 0.3.13

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.
Files changed (75) hide show
  1. package/package.json +3 -10
  2. package/src/components/custom/common/index.ts +0 -1
  3. package/src/components/custom/index.ts +0 -1
  4. package/src/components/index.ts +1 -0
  5. package/src/components/jams/CreateNewJam.tsx +11 -10
  6. package/src/components/layout/AuthLayout.tsx +120 -0
  7. package/src/components/layout/ContentHeader.tsx +62 -0
  8. package/src/components/layout/HeaderActionButton.tsx +23 -0
  9. package/src/components/layout/HeaderMobile.tsx +96 -0
  10. package/src/components/layout/PlusButton.tsx +26 -0
  11. package/src/components/layout/RootLayout.tsx +30 -0
  12. package/src/components/layout/index.ts +13 -0
  13. package/src/components/layout/pageChrome.test.tsx +147 -0
  14. package/src/components/layout/pageChrome.tsx +110 -0
  15. package/src/components/navigation/auth-navigator.tsx +2 -2
  16. package/src/components/navigation/main-navigator.tsx +17 -1
  17. package/src/components/navigation/tab-navigator.tsx +2 -0
  18. package/src/components/post/NewEventButton.tsx +23 -16
  19. package/src/components/post/NewNoteButton.tsx +15 -13
  20. package/src/pages/About.tsx +3 -5
  21. package/src/pages/CodeOfConduct.tsx +7 -7
  22. package/src/pages/Explore.tsx +87 -127
  23. package/src/pages/Members.tsx +31 -39
  24. package/src/pages/Notifications.tsx +6 -13
  25. package/src/pages/PostDetail.tsx +12 -16
  26. package/src/pages/Profile.tsx +3 -2
  27. package/src/pages/Tags.tsx +74 -16
  28. package/src/pages/Welcome.tsx +3 -8
  29. package/src/pages/articles/Edit.tsx +18 -15
  30. package/src/pages/articles/Index.tsx +11 -21
  31. package/src/pages/articles/New.tsx +18 -15
  32. package/src/pages/conversations/Index.tsx +44 -68
  33. package/src/pages/conversations/Info.tsx +6 -5
  34. package/src/pages/conversations/New.tsx +14 -13
  35. package/src/pages/conversations/NewDraft.tsx +5 -5
  36. package/src/pages/conversations/Show.tsx +16 -20
  37. package/src/pages/events/Edit.tsx +14 -13
  38. package/src/pages/events/Index.tsx +28 -32
  39. package/src/pages/events/My.tsx +7 -7
  40. package/src/pages/events/New.tsx +14 -13
  41. package/src/pages/feeds/Bookmarks.tsx +3 -9
  42. package/src/pages/feeds/Local.tsx +3 -10
  43. package/src/pages/feeds/My.tsx +3 -9
  44. package/src/pages/groups/Edit.tsx +6 -7
  45. package/src/pages/groups/EditInfo.tsx +20 -17
  46. package/src/pages/groups/EditRoles.tsx +18 -19
  47. package/src/pages/groups/Index.tsx +82 -119
  48. package/src/pages/groups/Info.tsx +22 -23
  49. package/src/pages/groups/Members.tsx +9 -8
  50. package/src/pages/groups/New.tsx +18 -15
  51. package/src/pages/groups/Show.tsx +6 -5
  52. package/src/pages/jams/Index.tsx +8 -26
  53. package/src/pages/jams/New.tsx +14 -11
  54. package/src/pages/posts/Edit.tsx +20 -17
  55. package/src/pages/posts/New.tsx +30 -29
  56. package/src/pages/posts/Reply.tsx +20 -16
  57. package/src/pages/profile/Followers.tsx +9 -10
  58. package/src/pages/profile/Following.tsx +9 -10
  59. package/src/pages/settings/AccessTokens.tsx +6 -5
  60. package/src/pages/settings/Account.tsx +13 -12
  61. package/src/pages/settings/Blocked.tsx +5 -5
  62. package/src/pages/settings/Feed.tsx +13 -12
  63. package/src/pages/settings/Index.tsx +4 -24
  64. package/src/pages/settings/Language.tsx +36 -37
  65. package/src/pages/settings/NotificationPreferences.tsx +10 -12
  66. package/src/pages/settings/Notifications.tsx +10 -9
  67. package/src/pages/settings/PublicProfile.tsx +6 -6
  68. package/src/pages/settings/PushEnabledDevices.tsx +10 -9
  69. package/src/pages/settings/Theme.tsx +13 -12
  70. package/src/pages/settings/Timezone.tsx +27 -28
  71. package/src/components/custom/common/plus-fab.tsx +0 -23
  72. package/src/components/custom/headers/generic-header.tsx +0 -103
  73. package/src/components/custom/headers/index.ts +0 -2
  74. package/src/components/custom/headers/tab-screens-header.tsx +0 -206
  75. package/src/components/navigation/auth-wrapper.tsx +0 -107
@@ -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 [filterBy, setFilterBy] = useState<'all-groups' | 'my-groups'>(
56
- 'all-groups'
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
- searchQuery
72
- ? g.displayName?.toLowerCase().includes(searchQuery.toLowerCase())
56
+ search
57
+ ? g.displayName?.toLowerCase().includes(search.toLowerCase())
73
58
  : true
74
- )
75
- .filter((g) => (filterBy === 'my-groups' ? isMember(g.id) : true)),
76
- [groups, searchQuery, filterBy, isMember]
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
- <TabScreensHeader
82
- children={
83
- <View className="flex-row items-center justify-between p-4">
84
- {!isSearchToggled && (
85
- <ThemedText className="text-2xl font-semibold">Groups</ThemedText>
86
- )}
87
- <View
88
- className={
89
- isSearchToggled
90
- ? 'flex justify-end'
91
- : 'flex-row items-center gap-x-6'
92
- }
93
- >
94
- {isSearchToggled ? (
95
- <View className="ml-4 w-full flex-row justify-end">
96
- <Input
97
- className="flex-1"
98
- placeholder="Enter Group Name"
99
- value={searchQuery}
100
- onChangeText={setSearchQuery}
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 flex bg-background relative pt-2 px-4"
104
+ className="relative flex w-full bg-background px-4 pt-2"
156
105
  >
157
- {isLoading && <ActivityIndicator size={'small'} />}
106
+ {isLoading && <ActivityIndicator size="small" />}
158
107
  {!isLoading && visibleGroups.length === 0 && (
159
108
  <EmptyStateContainer
160
109
  type="groups"
161
110
  copyKey={
162
- !searchQuery && filterBy === 'my-groups'
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
- isMember(group.id) ? (unseenByGroup[group.id] ?? 0) : 0
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 { GenericHeader, UpdatingDate } from '../../components/custom/index';
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
- <ThemedSafeAreaView className="flex-1 relative">
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
- </ThemedSafeAreaView>
76
+ </ThemedView>
78
77
  );
79
78
  };
80
79
 
@@ -4,13 +4,13 @@ import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { groupName } from '@openpeepshq/common/lib';
6
6
  import { useOpenpeeps } from '@openpeepshq/react';
7
- import { GenericHeader } from '../../components/custom/index';
7
+ import { useSetPageHeader } from '../../components/layout';
8
+ import { ThemedView } from '../../components/ui/themed-view';
8
9
  import {
9
10
  AddGroupMembersButton,
10
11
  GroupMembersList,
11
12
  } from '../../components/groups/index';
12
13
  import { MainScreenProps } from '../../components/navigation/types/index';
13
- import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
14
14
  import { ThemedText } from '../../components/ui/themed-text';
15
15
  import { truncateText } from '../../lib/utils';
16
16
 
@@ -27,12 +27,13 @@ export const GroupMembers = ({ route }: GroupMembersProps) => {
27
27
  ? `${truncateText(groupName(group), 20)} - ${t('groups.members.title')}`
28
28
  : t('groups.members.title');
29
29
 
30
+ useSetPageHeader(
31
+ title,
32
+ group ? <AddGroupMembersButton group={group} /> : undefined
33
+ );
34
+
30
35
  return (
31
- <ThemedSafeAreaView className="relative flex-1">
32
- <GenericHeader
33
- title={title}
34
- rightElement={group ? <AddGroupMembersButton group={group} /> : null}
35
- />
36
+ <ThemedView className="relative flex-1">
36
37
  <KeyboardAwareScrollView
37
38
  contentContainerClassName="grow"
38
39
  className="relative flex w-full bg-background"
@@ -49,6 +50,6 @@ export const GroupMembers = ({ route }: GroupMembersProps) => {
49
50
  <GroupMembersList group={group} />
50
51
  )}
51
52
  </KeyboardAwareScrollView>
52
- </ThemedSafeAreaView>
53
+ </ThemedView>
53
54
  );
54
55
  };
@@ -4,12 +4,12 @@ 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 { useCurrentProfile, useNewGroup } from '@openpeepshq/react';
7
- import { GenericHeader } from '../../components/custom/index';
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
11
  import { ProfilesInput } from '../../components/profile/index';
11
12
  import { Label } from '../../components/ui/label';
12
- import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
13
13
 
14
14
  type NewGroupProps = MainScreenProps<'CreateGroup'>;
15
15
 
@@ -34,19 +34,22 @@ export const NewGroup: React.FC<NewGroupProps> = () => {
34
34
  clearError();
35
35
  }, [error, clearError]);
36
36
 
37
+ useSetPageHeader(
38
+ t('groups.new.title', { defaultValue: 'Create group' }),
39
+ <HeaderActionButton
40
+ title={
41
+ submitting
42
+ ? t('common.submitting', { defaultValue: 'Creating…' })
43
+ : t('common.submit', { defaultValue: 'Create group' })
44
+ }
45
+ onPress={() => void submit()}
46
+ disabled={submitting}
47
+ loading={submitting}
48
+ />
49
+ );
50
+
37
51
  return (
38
- <ThemedSafeAreaView className="flex-1">
39
- <GenericHeader
40
- title={t('groups.new.title', { defaultValue: 'Create group' })}
41
- rightButtonTitle={
42
- submitting
43
- ? t('common.submitting', { defaultValue: 'Creating…' })
44
- : t('common.submit', { defaultValue: 'Create group' })
45
- }
46
- onRightButtonPress={() => void submit()}
47
- rightButtonDisabled={submitting}
48
- rightType="button"
49
- />
52
+ <ThemedView className="flex-1">
50
53
  <KeyboardAwareScrollView
51
54
  contentContainerClassName="grow"
52
55
  className="w-full p-4"
@@ -72,6 +75,6 @@ export const NewGroup: React.FC<NewGroupProps> = () => {
72
75
  </View>
73
76
  </View>
74
77
  </KeyboardAwareScrollView>
75
- </ThemedSafeAreaView>
78
+ </ThemedView>
76
79
  );
77
80
  };
@@ -11,7 +11,8 @@ import { CompositeScreenProps } from '@react-navigation/native';
11
11
  import { NativeStackScreenProps } from '@react-navigation/native-stack';
12
12
  import { groupName } from '@openpeepshq/common/lib';
13
13
  import { useCurrentProfile, useOpenpeeps } from '@openpeepshq/react';
14
- import { GenericHeader } from '../../components/custom/index';
14
+ import { useSetPageHeader } from '../../components/layout';
15
+ import { ThemedView } from '../../components/ui/themed-view';
15
16
  import { GroupFeed, GroupHeader } from '../../components/groups/index';
16
17
  import {
17
18
  MainStackParamList,
@@ -28,7 +29,6 @@ import {
28
29
  TabsList,
29
30
  TabsTrigger,
30
31
  } from '../../components/ui/tabs';
31
- import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
32
32
  import { ThemedText } from '../../components/ui/themed-text';
33
33
  import { truncateText } from '../../lib/utils';
34
34
  import { GroupInfoAsComponent } from './Info';
@@ -77,9 +77,10 @@ export const GroupShow = ({ route, navigation }: GroupProps) => {
77
77
  const tabClass = (value: Tab) =>
78
78
  tab === value ? 'border-b-2 border-primary font-semibold' : '';
79
79
 
80
+ useSetPageHeader(truncateText(group ? groupName(group) : '', 30));
81
+
80
82
  return (
81
- <ThemedSafeAreaView className="relative flex-1">
82
- <GenericHeader title={truncateText(group ? groupName(group) : '', 30)} />
83
+ <ThemedView className="relative flex-1">
83
84
  <KeyboardAwareScrollView
84
85
  refreshControl={
85
86
  <RefreshControl
@@ -179,6 +180,6 @@ export const GroupShow = ({ route, navigation }: GroupProps) => {
179
180
  group={group}
180
181
  />
181
182
  ) : null}
182
- </ThemedSafeAreaView>
183
+ </ThemedView>
183
184
  );
184
185
  };
@@ -4,7 +4,8 @@ import { useTranslation } from 'react-i18next';
4
4
  import { useNavigation } from '@react-navigation/native';
5
5
  import { NativeStackNavigationProp } from '@react-navigation/native-stack';
6
6
  import { useOpenpeeps, useServerInfo } from '@openpeepshq/react';
7
- import { GenericHeader, TabScreensHeader } from '../../components/custom/index';
7
+ import { useSetPageHeader } from '../../components/layout';
8
+ import { ThemedView } from '../../components/ui/themed-view';
8
9
  import {
9
10
  ChevronRightIcon,
10
11
  MoreHorizontalIcon,
@@ -20,7 +21,6 @@ import {
20
21
  DropdownMenuItem,
21
22
  DropdownMenuTrigger,
22
23
  } from '../../components/ui/dropdown-menu';
23
- import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
24
24
  import { ThemedText } from '../../components/ui/themed-text';
25
25
 
26
26
  interface Props {
@@ -123,33 +123,15 @@ export const JamsIndex = ({ my = false }: Props) => {
123
123
  </ScrollView>
124
124
  );
125
125
 
126
- if (my) {
127
- return (
128
- <ThemedSafeAreaView className="relative flex-1">
129
- <GenericHeader
130
- title={t('navigation.myJams')}
131
- rightElement={headerActions}
132
- />
133
- {livekitEnabled ? <CreateNewJam /> : null}
134
- {body}
135
- </ThemedSafeAreaView>
136
- );
137
- }
126
+ useSetPageHeader(
127
+ my ? t('navigation.myJams') : t('navigation.jams'),
128
+ headerActions
129
+ );
138
130
 
139
131
  return (
140
- <View className="relative flex-1">
141
- <TabScreensHeader
142
- children={
143
- <View className="flex-row items-center justify-between p-2">
144
- <ThemedText className="text-2xl font-semibold">
145
- {t('navigation.jams')}
146
- </ThemedText>
147
- {headerActions}
148
- </View>
149
- }
150
- />
132
+ <ThemedView className="relative flex-1">
151
133
  {livekitEnabled ? <CreateNewJam /> : null}
152
134
  {body}
153
- </View>
135
+ </ThemedView>
154
136
  );
155
137
  };
@@ -3,7 +3,8 @@ import { View } from 'react-native';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
5
5
  import { useCreateNewJamForm } from '@openpeepshq/react';
6
- import { GenericHeader } from '../../components/custom/index';
6
+ import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
7
+ import { ThemedView } from '../../components/ui/themed-view';
7
8
  import { EyeOnIcon } from '../../components/icons/index';
8
9
  import { MainScreenProps } from '../../components/navigation/types/index';
9
10
  import { VisibilitySelector } from '../../components/post/post-form/VisibilitySelector';
@@ -12,7 +13,6 @@ import { Button } from '../../components/ui/button';
12
13
  import { Checkbox } from '../../components/ui/checkbox';
13
14
  import { Input } from '../../components/ui/input';
14
15
  import { Label } from '../../components/ui/label';
15
- import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
16
16
  import { ThemedText } from '../../components/ui/themed-text';
17
17
 
18
18
  type NewJamProps = MainScreenProps<'CreateNewJam'>;
@@ -34,15 +34,18 @@ export const NewJam: React.FC<NewJamProps> = ({ navigation }) => {
34
34
  handleSchedule,
35
35
  } = useCreateNewJamForm({ onClose: () => navigation.goBack() });
36
36
 
37
+ useSetPageHeader(
38
+ t('jams.create.title'),
39
+ <HeaderActionButton
40
+ title={t('jams.start.submit')}
41
+ onPress={() => void handleCreate()}
42
+ disabled={submitting}
43
+ loading={submitting}
44
+ />
45
+ );
46
+
37
47
  return (
38
- <ThemedSafeAreaView className="grow">
39
- <GenericHeader
40
- title={t('jams.create.title')}
41
- rightButtonTitle={t('jams.start.submit')}
42
- onRightButtonPress={() => void handleCreate()}
43
- rightButtonDisabled={submitting}
44
- rightType="button"
45
- />
48
+ <ThemedView className="grow">
46
49
  <KeyboardAwareScrollView
47
50
  className="w-full bg-background p-4"
48
51
  contentContainerClassName="gap-4"
@@ -113,6 +116,6 @@ export const NewJam: React.FC<NewJamProps> = ({ navigation }) => {
113
116
  </Button>
114
117
  ) : null}
115
118
  </KeyboardAwareScrollView>
116
- </ThemedSafeAreaView>
119
+ </ThemedView>
117
120
  );
118
121
  };
@@ -1,8 +1,8 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
2
  import { useOpenpeeps } from '@openpeepshq/react';
3
- import { GenericHeader } from '../../components/custom/index';
3
+ import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
4
+ import { ThemedView } from '../../components/ui/themed-view';
4
5
  import Toast from 'react-native-toast-message';
5
- import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
6
6
  import { PostForm } from '../../components/post/post-form/PostForm';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { MainScreenProps } from '../../components/navigation/types/index';
@@ -110,25 +110,28 @@ export const EditPost = ({ route, navigation }: PostProps) => {
110
110
  });
111
111
  };
112
112
 
113
+ useSetPageHeader(
114
+ t('posts.edit.title'),
115
+ <HeaderActionButton
116
+ title={
117
+ isPosting
118
+ ? t('posts.edit.loading')
119
+ : attachmentsProcessing
120
+ ? t('posts.create.processing', 'Processing…')
121
+ : t('posts.edit.submit')
122
+ }
123
+ onPress={() => void handlePostUpdate()}
124
+ disabled={!canSubmit}
125
+ loading={isPosting}
126
+ />
127
+ );
128
+
113
129
  return (
114
- <ThemedSafeAreaView className="flex-1 bg-background">
130
+ <ThemedView className="flex-1 bg-background">
115
131
  {isLoading && !postData ? (
116
132
  <ActivityIndicator />
117
133
  ) : (
118
134
  <>
119
- <GenericHeader
120
- title={t('posts.edit.title')}
121
- rightType="button"
122
- rightButtonTitle={
123
- isPosting
124
- ? t('posts.edit.loading')
125
- : attachmentsProcessing
126
- ? t('posts.create.processing', 'Processing…')
127
- : t('posts.edit.submit')
128
- }
129
- onRightButtonPress={handlePostUpdate}
130
- rightButtonDisabled={!canSubmit}
131
- />
132
135
  {postData && (
133
136
  <>
134
137
  {postData.type === 'article' && (
@@ -149,6 +152,6 @@ export const EditPost = ({ route, navigation }: PostProps) => {
149
152
  )}
150
153
  </>
151
154
  )}
152
- </ThemedSafeAreaView>
155
+ </ThemedView>
153
156
  );
154
157
  };