@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
|
@@ -4,10 +4,9 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
import { useOpenpeeps } from '@openpeepshq/react';
|
|
5
5
|
import type { PublicProfile } from '@openpeepshq/common';
|
|
6
6
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
7
|
-
import {
|
|
7
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
8
8
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
9
9
|
import { ThemedView } from '../../components/ui/themed-view';
|
|
10
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
11
10
|
import { Button } from '../../components/ui/button';
|
|
12
11
|
|
|
13
12
|
type BlockedSettingsProps = MainScreenProps<'BlockedSettings'>;
|
|
@@ -19,9 +18,10 @@ export const BlockedSettings: React.FC<BlockedSettingsProps> = () => {
|
|
|
19
18
|
const currentQuery = openpeepsApi.useCurrentProfile();
|
|
20
19
|
const profiles = blockedQuery.data ?? [];
|
|
21
20
|
|
|
21
|
+
useSetPageHeader(t('settings.blocked.title'));
|
|
22
|
+
|
|
22
23
|
return (
|
|
23
|
-
<
|
|
24
|
-
<GenericHeader title={t('settings.blocked.title')} />
|
|
24
|
+
<ThemedView className="flex-1">
|
|
25
25
|
<ThemedView className="flex-1 p-4">
|
|
26
26
|
<ThemedText className="text-muted-foreground mb-4">
|
|
27
27
|
{t('settings.blocked.description')}
|
|
@@ -43,7 +43,7 @@ export const BlockedSettings: React.FC<BlockedSettingsProps> = () => {
|
|
|
43
43
|
))
|
|
44
44
|
)}
|
|
45
45
|
</ThemedView>
|
|
46
|
-
</
|
|
46
|
+
</ThemedView>
|
|
47
47
|
);
|
|
48
48
|
};
|
|
49
49
|
|
|
@@ -5,10 +5,9 @@ import { Pressable } from 'react-native';
|
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import Toast from 'react-native-toast-message';
|
|
7
7
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
8
|
-
import {
|
|
8
|
+
import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
|
|
9
9
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
10
10
|
import { RadioGroup, RadioGroupItem } from '../../components/ui/radio-group';
|
|
11
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
12
11
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
13
12
|
import { ThemedView } from '../../components/ui/themed-view';
|
|
14
13
|
|
|
@@ -33,16 +32,18 @@ export const FeedSettings: React.FC<FeedSettingsProps> = () => {
|
|
|
33
32
|
}
|
|
34
33
|
};
|
|
35
34
|
|
|
35
|
+
useSetPageHeader(
|
|
36
|
+
t('settings.feed.title'),
|
|
37
|
+
<HeaderActionButton
|
|
38
|
+
title={submitting ? t('common.form.loading') : t('common.form.save')}
|
|
39
|
+
onPress={() => void handleSubmit()}
|
|
40
|
+
disabled={submitting}
|
|
41
|
+
loading={submitting}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
|
|
36
45
|
return (
|
|
37
|
-
<
|
|
38
|
-
<GenericHeader
|
|
39
|
-
title={t('settings.feed.title')}
|
|
40
|
-
rightButtonTitle={
|
|
41
|
-
submitting ? t('common.form.loading') : t('common.form.save')
|
|
42
|
-
}
|
|
43
|
-
onRightButtonPress={handleSubmit}
|
|
44
|
-
rightButtonDisabled={submitting}
|
|
45
|
-
/>
|
|
46
|
+
<ThemedView className="flex-1">
|
|
46
47
|
<ThemedView className="flex-1">
|
|
47
48
|
<KeyboardAwareScrollView
|
|
48
49
|
contentContainerClassName="grow"
|
|
@@ -72,6 +73,6 @@ export const FeedSettings: React.FC<FeedSettingsProps> = () => {
|
|
|
72
73
|
</ThemedView>
|
|
73
74
|
</KeyboardAwareScrollView>
|
|
74
75
|
</ThemedView>
|
|
75
|
-
</
|
|
76
|
+
</ThemedView>
|
|
76
77
|
);
|
|
77
78
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import {
|
|
5
5
|
NativeStackNavigationProp,
|
|
@@ -12,9 +12,7 @@ import {
|
|
|
12
12
|
TabStackParamList,
|
|
13
13
|
} from '../../components/navigation/types/index';
|
|
14
14
|
import { ConfigMenuButton } from '../../components/configuration/index';
|
|
15
|
-
import {
|
|
16
|
-
import { ChevronLeftIcon } from '../../components/icons/index';
|
|
17
|
-
import { ThemedText } from '../../components/ui/themed-text';
|
|
15
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
18
16
|
import { ThemedView } from '../../components/ui/themed-view';
|
|
19
17
|
|
|
20
18
|
export const Settings = ({}: NativeStackScreenProps<
|
|
@@ -26,28 +24,10 @@ export const Settings = ({}: NativeStackScreenProps<
|
|
|
26
24
|
const navigation =
|
|
27
25
|
useNavigation<NativeStackNavigationProp<MainStackParamList>>();
|
|
28
26
|
|
|
27
|
+
useSetPageHeader(t('settings.menu'));
|
|
28
|
+
|
|
29
29
|
return (
|
|
30
30
|
<ThemedView className="flex-1 relative">
|
|
31
|
-
<TabScreensHeader
|
|
32
|
-
children={
|
|
33
|
-
<View className="flex-row items-center p-2">
|
|
34
|
-
{profile ? (
|
|
35
|
-
<Pressable
|
|
36
|
-
accessibilityRole="button"
|
|
37
|
-
onPress={() =>
|
|
38
|
-
navigation.navigate('Profile', { handle: profile.handle })
|
|
39
|
-
}
|
|
40
|
-
className="mr-1 p-1"
|
|
41
|
-
>
|
|
42
|
-
<ChevronLeftIcon size={28} className="text-foreground" />
|
|
43
|
-
</Pressable>
|
|
44
|
-
) : null}
|
|
45
|
-
<ThemedText className="text-2xl font-semibold">
|
|
46
|
-
{t('settings.menu')}
|
|
47
|
-
</ThemedText>
|
|
48
|
-
</View>
|
|
49
|
-
}
|
|
50
|
-
/>
|
|
51
31
|
<View className="grow p-4">
|
|
52
32
|
{profile ? (
|
|
53
33
|
<ConfigMenuButton
|
|
@@ -6,10 +6,9 @@ import {
|
|
|
6
6
|
AVAILABLE_UI_LANGUAGES,
|
|
7
7
|
useLanguagePreference,
|
|
8
8
|
} from '@openpeepshq/react';
|
|
9
|
-
import {
|
|
9
|
+
import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
|
|
10
10
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
11
11
|
import { RadioGroup, RadioGroupItem } from '../../components/ui/radio-group';
|
|
12
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
13
12
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
14
13
|
import { ThemedView } from '../../components/ui/themed-view';
|
|
15
14
|
|
|
@@ -40,43 +39,43 @@ export const LanguageSettings: React.FC<LanguageSettingsProps> = () => {
|
|
|
40
39
|
clearStatus();
|
|
41
40
|
}, [status, clearStatus]);
|
|
42
41
|
|
|
42
|
+
useSetPageHeader(
|
|
43
|
+
t('settings.language.title'),
|
|
44
|
+
<HeaderActionButton
|
|
45
|
+
title={saving ? t('common.form.loading') : t('common.form.save')}
|
|
46
|
+
onPress={() => void save()}
|
|
47
|
+
disabled={saving}
|
|
48
|
+
loading={saving}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
|
|
43
52
|
if (!profile) return null;
|
|
44
53
|
|
|
45
54
|
return (
|
|
46
|
-
<
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{' '}
|
|
72
|
-
{t('settings.language.default')}
|
|
73
|
-
</ThemedText>
|
|
74
|
-
) : null}
|
|
75
|
-
</ThemedText>
|
|
76
|
-
</Pressable>
|
|
77
|
-
))}
|
|
78
|
-
</RadioGroup>
|
|
79
|
-
</ThemedView>
|
|
80
|
-
</ThemedSafeAreaView>
|
|
55
|
+
<ThemedView className="flex-1 p-4">
|
|
56
|
+
<ThemedText className="text-lg text-muted-foreground mb-4">
|
|
57
|
+
{t('settings.language.languageDescription')}
|
|
58
|
+
</ThemedText>
|
|
59
|
+
<RadioGroup value={language} onValueChange={setLanguage}>
|
|
60
|
+
{AVAILABLE_UI_LANGUAGES.map((code) => (
|
|
61
|
+
<Pressable
|
|
62
|
+
key={code}
|
|
63
|
+
onPress={() => setLanguage(code)}
|
|
64
|
+
className="mb-2 flex-row items-center gap-x-3 py-3"
|
|
65
|
+
>
|
|
66
|
+
<RadioGroupItem value={code} />
|
|
67
|
+
<ThemedText className="text-lg">
|
|
68
|
+
{LANGUAGE_LABELS[code]}
|
|
69
|
+
{code === communityDefaultLanguage ? (
|
|
70
|
+
<ThemedText className="text-sm text-muted-foreground">
|
|
71
|
+
{' '}
|
|
72
|
+
{t('settings.language.default')}
|
|
73
|
+
</ThemedText>
|
|
74
|
+
) : null}
|
|
75
|
+
</ThemedText>
|
|
76
|
+
</Pressable>
|
|
77
|
+
))}
|
|
78
|
+
</RadioGroup>
|
|
79
|
+
</ThemedView>
|
|
81
80
|
);
|
|
82
81
|
};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
GenericHeader,
|
|
5
|
-
} from '../../components/custom/index';
|
|
2
|
+
import { EditNotificationsSheet } from '../../components/custom/index';
|
|
3
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
6
4
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
7
5
|
import { Pressable, View } from 'react-native';
|
|
8
6
|
import { useTranslation } from 'react-i18next';
|
|
9
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
10
7
|
import React, { useCallback, useRef } from 'react';
|
|
11
8
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
12
9
|
import { ThemedView } from '../../components/ui/themed-view';
|
|
@@ -37,13 +34,14 @@ export const NotificationPreferences: React.FC<
|
|
|
37
34
|
const { t } = useTranslation();
|
|
38
35
|
const { types } = useNotificationPreferences();
|
|
39
36
|
|
|
37
|
+
useSetPageHeader(
|
|
38
|
+
t('settings.notifications.title', {
|
|
39
|
+
defaultValue: 'Notification Settings',
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
|
|
40
43
|
return (
|
|
41
|
-
<
|
|
42
|
-
<GenericHeader
|
|
43
|
-
title={t('settings.notifications.title', {
|
|
44
|
-
defaultValue: 'Notification Settings',
|
|
45
|
-
})}
|
|
46
|
-
/>
|
|
44
|
+
<ThemedView className="flex-1">
|
|
47
45
|
<KeyboardAwareScrollView
|
|
48
46
|
contentContainerClassName="grow"
|
|
49
47
|
className="w-full flex py-3 px-5"
|
|
@@ -82,7 +80,7 @@ export const NotificationPreferences: React.FC<
|
|
|
82
80
|
</KeyboardAwareScrollView>
|
|
83
81
|
</ThemedView>
|
|
84
82
|
</KeyboardAwareScrollView>
|
|
85
|
-
</
|
|
83
|
+
</ThemedView>
|
|
86
84
|
);
|
|
87
85
|
};
|
|
88
86
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import {
|
|
4
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
5
5
|
import { ConfigMenuButton } from '../../components/configuration/index';
|
|
6
6
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
7
|
-
import {
|
|
7
|
+
import { ThemedView } from '../../components/ui/themed-view';
|
|
8
8
|
|
|
9
9
|
type NotificationSettingsProps = MainScreenProps<'NotificationSettings'>;
|
|
10
10
|
|
|
@@ -13,13 +13,14 @@ export const NotificationSettings: React.FC<NotificationSettingsProps> = ({
|
|
|
13
13
|
}) => {
|
|
14
14
|
const { t } = useTranslation();
|
|
15
15
|
|
|
16
|
+
useSetPageHeader(
|
|
17
|
+
t('settings.notifications.title', {
|
|
18
|
+
defaultValue: 'Notifications',
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
|
|
16
22
|
return (
|
|
17
|
-
<
|
|
18
|
-
<GenericHeader
|
|
19
|
-
title={t('settings.notifications.title', {
|
|
20
|
-
defaultValue: 'Notifications',
|
|
21
|
-
})}
|
|
22
|
-
/>
|
|
23
|
+
<ThemedView className="flex-1">
|
|
23
24
|
<View className="p-4">
|
|
24
25
|
<ConfigMenuButton
|
|
25
26
|
translationPrefix="settings.notifications.preferences"
|
|
@@ -30,6 +31,6 @@ export const NotificationSettings: React.FC<NotificationSettingsProps> = ({
|
|
|
30
31
|
onPress={() => navigation.navigate('PushEnabledDevices')}
|
|
31
32
|
/>
|
|
32
33
|
</View>
|
|
33
|
-
</
|
|
34
|
+
</ThemedView>
|
|
34
35
|
);
|
|
35
36
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
3
3
|
import { useOpenpeeps } from '@openpeepshq/react';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
4
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
5
|
+
import { ThemedView } from '../../components/ui/themed-view';
|
|
7
6
|
|
|
8
7
|
import { EditProfileForm } from '../../components/profile/index';
|
|
9
8
|
type EditProfileProps = MainScreenProps<'EditProfile'>;
|
|
@@ -11,10 +10,11 @@ type EditProfileProps = MainScreenProps<'EditProfile'>;
|
|
|
11
10
|
export const PublicProfileSettings: React.FC<EditProfileProps> = () => {
|
|
12
11
|
const { currentProfile } = useOpenpeeps();
|
|
13
12
|
|
|
13
|
+
useSetPageHeader('Edit Profile');
|
|
14
|
+
|
|
14
15
|
return (
|
|
15
|
-
<
|
|
16
|
-
<GenericHeader title="Edit Profile" />
|
|
16
|
+
<ThemedView className="flex-1">
|
|
17
17
|
<EditProfileForm handle={currentProfile?.handle as string} />
|
|
18
|
-
</
|
|
18
|
+
</ThemedView>
|
|
19
19
|
);
|
|
20
20
|
};
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
pushSubscriptionIsMobile,
|
|
10
10
|
} from '@openpeepshq/common/lib';
|
|
11
11
|
import { usePushEnabledDevices } from '@openpeepshq/react';
|
|
12
|
-
import {
|
|
12
|
+
import { useSetPageHeader } from '../../components/layout';
|
|
13
13
|
import {
|
|
14
14
|
LaptopIcon,
|
|
15
15
|
SmartphoneIcon,
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
19
19
|
import { Button } from '../../components/ui/button';
|
|
20
20
|
import { Text } from '../../components/ui/text';
|
|
21
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
22
21
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
22
|
+
import { ThemedView } from '../../components/ui/themed-view';
|
|
23
23
|
|
|
24
24
|
type PushEnabledDevicesProps = MainScreenProps<'PushEnabledDevices'>;
|
|
25
25
|
|
|
@@ -45,13 +45,14 @@ export const PushEnabledDevices: React.FC<PushEnabledDevicesProps> = () => {
|
|
|
45
45
|
clearStatus();
|
|
46
46
|
}, [status, clearStatus]);
|
|
47
47
|
|
|
48
|
+
useSetPageHeader(
|
|
49
|
+
t('settings.notifications.pushEnabledDevices.title', {
|
|
50
|
+
defaultValue: 'Push-enabled devices',
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
|
|
48
54
|
return (
|
|
49
|
-
<
|
|
50
|
-
<GenericHeader
|
|
51
|
-
title={t('settings.notifications.pushEnabledDevices.title', {
|
|
52
|
-
defaultValue: 'Push-enabled devices',
|
|
53
|
-
})}
|
|
54
|
-
/>
|
|
55
|
+
<ThemedView className="flex-1">
|
|
55
56
|
<ScrollView contentContainerClassName="p-4">
|
|
56
57
|
{subscriptions.length === 0 ? (
|
|
57
58
|
<View className="w-full items-center justify-center p-4">
|
|
@@ -145,6 +146,6 @@ export const PushEnabledDevices: React.FC<PushEnabledDevicesProps> = () => {
|
|
|
145
146
|
</View>
|
|
146
147
|
)}
|
|
147
148
|
</ScrollView>
|
|
148
|
-
</
|
|
149
|
+
</ThemedView>
|
|
149
150
|
);
|
|
150
151
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
2
2
|
import { useServerInfo, useThemePreference } from '@openpeepshq/react';
|
|
3
|
-
import {
|
|
3
|
+
import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
6
6
|
import { ThemedView } from '../../components/ui/themed-view';
|
|
@@ -8,7 +8,6 @@ import Toast from 'react-native-toast-message';
|
|
|
8
8
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
9
9
|
import { Pressable } from 'react-native';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
12
11
|
import { RadioGroup, RadioGroupItem } from '../../components/ui/radio-group';
|
|
13
12
|
import { getTheme, THEME_OPTIONS } from '@openpeepshq/common';
|
|
14
13
|
import { useOpenPeepsTheme } from '../../theme/OpenPeepsThemeProvider';
|
|
@@ -56,16 +55,18 @@ export const ThemeSettings: React.FC<ThemeSettingsProps> = ({}) => {
|
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
57
|
|
|
58
|
+
useSetPageHeader(
|
|
59
|
+
t('settings.theme.title'),
|
|
60
|
+
<HeaderActionButton
|
|
61
|
+
title={submitting ? t('common.form.loading') : t('common.form.save')}
|
|
62
|
+
onPress={() => void handleSubmit()}
|
|
63
|
+
disabled={submitting}
|
|
64
|
+
loading={submitting}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
|
|
59
68
|
return (
|
|
60
|
-
<
|
|
61
|
-
<GenericHeader
|
|
62
|
-
title={t('settings.theme.title')}
|
|
63
|
-
rightButtonTitle={
|
|
64
|
-
submitting ? t('common.form.loading') : t('common.form.save')
|
|
65
|
-
}
|
|
66
|
-
onRightButtonPress={handleSubmit}
|
|
67
|
-
rightButtonDisabled={submitting}
|
|
68
|
-
/>
|
|
69
|
+
<ThemedView className="flex-1">
|
|
69
70
|
<ThemedView className="flex-1">
|
|
70
71
|
<KeyboardAwareScrollView
|
|
71
72
|
contentContainerClassName="grow"
|
|
@@ -96,6 +97,6 @@ export const ThemeSettings: React.FC<ThemeSettingsProps> = ({}) => {
|
|
|
96
97
|
</ThemedView>
|
|
97
98
|
</KeyboardAwareScrollView>
|
|
98
99
|
</ThemedView>
|
|
99
|
-
</
|
|
100
|
+
</ThemedView>
|
|
100
101
|
);
|
|
101
102
|
};
|
|
@@ -4,10 +4,9 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
import Toast from 'react-native-toast-message';
|
|
5
5
|
import { BottomSheetModal } from '@gorhom/bottom-sheet';
|
|
6
6
|
import { useTimezonePreference } from '@openpeepshq/react';
|
|
7
|
-
import {
|
|
7
|
+
import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
|
|
8
8
|
import { TimeZoneSelect } from '../../components/form/index';
|
|
9
9
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
10
|
-
import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
|
|
11
10
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
12
11
|
import { ThemedView } from '../../components/ui/themed-view';
|
|
13
12
|
import { ChevronRightIcon } from '../../components/icons/index';
|
|
@@ -35,42 +34,42 @@ export const TimezoneSettings: React.FC<TimezoneSettingsProps> = () => {
|
|
|
35
34
|
clearStatus();
|
|
36
35
|
}, [status, clearStatus]);
|
|
37
36
|
|
|
38
|
-
if (!profile) return null;
|
|
39
|
-
|
|
40
37
|
const label =
|
|
41
38
|
timeZone === communityDefaultTimeZone
|
|
42
39
|
? `${timeZone} ${t('settings.timezone.communityDefault')}`
|
|
43
40
|
: timeZone;
|
|
44
41
|
|
|
42
|
+
useSetPageHeader(
|
|
43
|
+
t('settings.timezone.title'),
|
|
44
|
+
<HeaderActionButton
|
|
45
|
+
title={saving ? t('common.form.loading') : t('common.form.save')}
|
|
46
|
+
onPress={() => void save()}
|
|
47
|
+
disabled={saving}
|
|
48
|
+
loading={saving}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
if (!profile) return null;
|
|
53
|
+
|
|
45
54
|
return (
|
|
46
|
-
<
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<Pressable
|
|
60
|
-
onPress={() => bottomSheetPresent(sheetRef)}
|
|
61
|
-
className="py-3 flex-row justify-between items-center border-b border-border"
|
|
62
|
-
>
|
|
63
|
-
<View className="flex-1">
|
|
64
|
-
<ThemedText className="text-lg">{label}</ThemedText>
|
|
65
|
-
</View>
|
|
66
|
-
<ChevronRightIcon className="text-foreground" />
|
|
67
|
-
</Pressable>
|
|
68
|
-
</ThemedView>
|
|
55
|
+
<ThemedView className="flex-1 p-4">
|
|
56
|
+
<ThemedText className="mb-4 text-lg text-muted-foreground">
|
|
57
|
+
{t('settings.timezone.timezoneDescription')}
|
|
58
|
+
</ThemedText>
|
|
59
|
+
<Pressable
|
|
60
|
+
onPress={() => bottomSheetPresent(sheetRef)}
|
|
61
|
+
className="flex-row items-center justify-between border-b border-border py-3"
|
|
62
|
+
>
|
|
63
|
+
<View className="flex-1">
|
|
64
|
+
<ThemedText className="text-lg">{label}</ThemedText>
|
|
65
|
+
</View>
|
|
66
|
+
<ChevronRightIcon className="text-foreground" />
|
|
67
|
+
</Pressable>
|
|
69
68
|
<TimeZoneSelect
|
|
70
69
|
ref={sheetRef}
|
|
71
70
|
initialTimeZone={timeZone}
|
|
72
71
|
onDone={(next) => next && setTimeZone(next)}
|
|
73
72
|
/>
|
|
74
|
-
</
|
|
73
|
+
</ThemedView>
|
|
75
74
|
);
|
|
76
75
|
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { type ReactNode } from 'react';
|
|
2
|
-
import { Pressable } from 'react-native';
|
|
3
|
-
|
|
4
|
-
interface PlusFabProps {
|
|
5
|
-
accessibilityLabel: string;
|
|
6
|
-
onPress: () => void;
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const PlusFab = ({
|
|
11
|
-
accessibilityLabel,
|
|
12
|
-
onPress,
|
|
13
|
-
children,
|
|
14
|
-
}: PlusFabProps) => (
|
|
15
|
-
<Pressable
|
|
16
|
-
accessibilityRole="button"
|
|
17
|
-
accessibilityLabel={accessibilityLabel}
|
|
18
|
-
onPress={onPress}
|
|
19
|
-
className="absolute bottom-10 right-6 z-20 size-16 items-center justify-center rounded-full bg-foreground"
|
|
20
|
-
>
|
|
21
|
-
{children}
|
|
22
|
-
</Pressable>
|
|
23
|
-
);
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { View, Pressable, ActivityIndicator } from 'react-native';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Button } from '../../ui/button';
|
|
4
|
-
import { ChevronLeftIcon } from '../../icons/index';
|
|
5
|
-
import { ThemedText } from '../../ui/themed-text';
|
|
6
|
-
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
7
|
-
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
8
|
-
import { useCurrentProfile } from '@openpeepshq/react';
|
|
9
|
-
import { goToParentOrBack } from '../../navigation/parent-back';
|
|
10
|
-
import type { MainStackParamList } from '../../navigation/types';
|
|
11
|
-
|
|
12
|
-
interface GenericHeaderProps {
|
|
13
|
-
title?: string | React.ReactNode;
|
|
14
|
-
handleGoBack?: () => void;
|
|
15
|
-
onRightButtonPress?: () => void;
|
|
16
|
-
rightType?: 'button' | 'icon' | 'string';
|
|
17
|
-
rightButtonTitle?: string;
|
|
18
|
-
rightButtonDisabled?: boolean;
|
|
19
|
-
rightButtonLoading?: boolean;
|
|
20
|
-
rightButtonIcon?: React.ReactNode;
|
|
21
|
-
rightButtonVariant?: 'primary' | 'secondary' | 'outline';
|
|
22
|
-
hideBackButton?: boolean;
|
|
23
|
-
/** Arbitrary right-side content, e.g. a page-specific action button. */
|
|
24
|
-
rightElement?: React.ReactNode;
|
|
25
|
-
}
|
|
26
|
-
export const GenericHeader = ({
|
|
27
|
-
title,
|
|
28
|
-
onRightButtonPress,
|
|
29
|
-
rightButtonTitle,
|
|
30
|
-
rightButtonDisabled,
|
|
31
|
-
rightButtonLoading,
|
|
32
|
-
rightType = 'button',
|
|
33
|
-
rightButtonIcon,
|
|
34
|
-
handleGoBack,
|
|
35
|
-
hideBackButton = false,
|
|
36
|
-
rightElement,
|
|
37
|
-
}: GenericHeaderProps) => {
|
|
38
|
-
const navigation =
|
|
39
|
-
useNavigation<NativeStackNavigationProp<MainStackParamList>>();
|
|
40
|
-
const route = useRoute();
|
|
41
|
-
const me = useCurrentProfile();
|
|
42
|
-
return (
|
|
43
|
-
<View className="sticky top-0 z-20 w-full px-4 py-2 flex flex-row justify-between items-center">
|
|
44
|
-
<View className="flex gap-4 mb-2 flex-row items-center">
|
|
45
|
-
{!hideBackButton && (
|
|
46
|
-
<Pressable
|
|
47
|
-
accessibilityRole="button"
|
|
48
|
-
onPress={() => {
|
|
49
|
-
if (handleGoBack) {
|
|
50
|
-
handleGoBack();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
goToParentOrBack({
|
|
54
|
-
navigation,
|
|
55
|
-
routeName: route.name,
|
|
56
|
-
params: route.params as Record<string, unknown> | undefined,
|
|
57
|
-
profileHandle: me?.handle,
|
|
58
|
-
});
|
|
59
|
-
}}
|
|
60
|
-
className="items-center justify-center p-2"
|
|
61
|
-
>
|
|
62
|
-
<ChevronLeftIcon size={28} className="text-foreground" />
|
|
63
|
-
</Pressable>
|
|
64
|
-
)}
|
|
65
|
-
{typeof title === 'string' ? (
|
|
66
|
-
<ThemedText className="text-xl tracking-wider font-semibold">
|
|
67
|
-
{title}
|
|
68
|
-
</ThemedText>
|
|
69
|
-
) : (
|
|
70
|
-
<>{title}</>
|
|
71
|
-
)}
|
|
72
|
-
</View>
|
|
73
|
-
{rightButtonTitle && rightType === 'button' && (
|
|
74
|
-
<Button disabled={rightButtonDisabled} onPress={onRightButtonPress}>
|
|
75
|
-
{rightButtonLoading && <ActivityIndicator size={'small'} />}
|
|
76
|
-
|
|
77
|
-
<ThemedText className="text-base font-semibold">
|
|
78
|
-
{rightButtonTitle}
|
|
79
|
-
</ThemedText>
|
|
80
|
-
</Button>
|
|
81
|
-
)}
|
|
82
|
-
{rightButtonTitle && rightType === 'string' && (
|
|
83
|
-
<Pressable
|
|
84
|
-
disabled={rightButtonDisabled}
|
|
85
|
-
className="px-4 py-2 border rounded-lg"
|
|
86
|
-
onPress={onRightButtonPress}
|
|
87
|
-
>
|
|
88
|
-
{rightButtonLoading && <ActivityIndicator size={'small'} />}
|
|
89
|
-
<ThemedText className="text-base font-semibold">
|
|
90
|
-
{rightButtonTitle}
|
|
91
|
-
</ThemedText>
|
|
92
|
-
</Pressable>
|
|
93
|
-
)}
|
|
94
|
-
|
|
95
|
-
{rightButtonIcon && rightType === 'icon' && (
|
|
96
|
-
<Pressable disabled={rightButtonDisabled} onPress={onRightButtonPress}>
|
|
97
|
-
{rightButtonIcon}
|
|
98
|
-
</Pressable>
|
|
99
|
-
)}
|
|
100
|
-
{rightElement}
|
|
101
|
-
</View>
|
|
102
|
-
);
|
|
103
|
-
};
|