@oxyhq/services 5.21.5 → 5.21.7
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/lib/commonjs/crypto/keyManager.js +67 -22
- package/lib/commonjs/crypto/keyManager.js.map +1 -1
- package/lib/commonjs/index.js +66 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/BottomSheetRouter.js +100 -286
- package/lib/commonjs/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedItem.js +0 -3
- package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +14 -19
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/AnimatedButton.js +57 -0
- package/lib/commonjs/ui/components/fileManagement/AnimatedButton.js.map +1 -0
- package/lib/commonjs/ui/components/profile/EditBioModal.js +24 -156
- package/lib/commonjs/ui/components/profile/EditBioModal.js.map +1 -1
- package/lib/commonjs/ui/components/profile/EditDisplayNameModal.js +28 -178
- package/lib/commonjs/ui/components/profile/EditDisplayNameModal.js.map +1 -1
- package/lib/commonjs/ui/components/profile/EditEmailModal.js +32 -159
- package/lib/commonjs/ui/components/profile/EditEmailModal.js.map +1 -1
- package/lib/commonjs/ui/components/profile/EditLocationModal.js +45 -227
- package/lib/commonjs/ui/components/profile/EditLocationModal.js.map +1 -1
- package/lib/commonjs/ui/components/profile/EditUsernameModal.js +30 -155
- package/lib/commonjs/ui/components/profile/EditUsernameModal.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/mutationFactory.js +177 -0
- package/lib/commonjs/ui/hooks/mutations/mutationFactory.js.map +1 -0
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +10 -123
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +2 -32
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +2 -31
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/useFileFiltering.js +76 -0
- package/lib/commonjs/ui/hooks/useFileFiltering.js.map +1 -0
- package/lib/commonjs/ui/navigation/bottomSheetManager.js +43 -145
- package/lib/commonjs/ui/navigation/bottomSheetManager.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +0 -2
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +2 -2
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/utils/authHelpers.js +164 -0
- package/lib/commonjs/ui/utils/authHelpers.js.map +1 -0
- package/lib/commonjs/ui/utils/avatarUtils.js +18 -61
- package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
- package/lib/module/crypto/keyManager.js +67 -22
- package/lib/module/crypto/keyManager.js.map +1 -1
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/BottomSheetRouter.js +102 -284
- package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/module/ui/components/GroupedItem.js +0 -3
- package/lib/module/ui/components/GroupedItem.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +14 -19
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/fileManagement/AnimatedButton.js +50 -0
- package/lib/module/ui/components/fileManagement/AnimatedButton.js.map +1 -0
- package/lib/module/ui/components/profile/EditBioModal.js +24 -156
- package/lib/module/ui/components/profile/EditBioModal.js.map +1 -1
- package/lib/module/ui/components/profile/EditDisplayNameModal.js +28 -178
- package/lib/module/ui/components/profile/EditDisplayNameModal.js.map +1 -1
- package/lib/module/ui/components/profile/EditEmailModal.js +32 -159
- package/lib/module/ui/components/profile/EditEmailModal.js.map +1 -1
- package/lib/module/ui/components/profile/EditLocationModal.js +45 -227
- package/lib/module/ui/components/profile/EditLocationModal.js.map +1 -1
- package/lib/module/ui/components/profile/EditUsernameModal.js +30 -155
- package/lib/module/ui/components/profile/EditUsernameModal.js.map +1 -1
- package/lib/module/ui/hooks/mutations/mutationFactory.js +173 -0
- package/lib/module/ui/hooks/mutations/mutationFactory.js.map +1 -0
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +10 -122
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +2 -32
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/useServicesQueries.js +2 -31
- package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/module/ui/hooks/useFileFiltering.js +72 -0
- package/lib/module/ui/hooks/useFileFiltering.js.map +1 -0
- package/lib/module/ui/navigation/bottomSheetManager.js +37 -135
- package/lib/module/ui/navigation/bottomSheetManager.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +0 -2
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +2 -2
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/utils/authHelpers.js +154 -0
- package/lib/module/ui/utils/authHelpers.js.map +1 -0
- package/lib/module/ui/utils/avatarUtils.js +18 -61
- package/lib/module/ui/utils/avatarUtils.js.map +1 -1
- package/lib/typescript/commonjs/crypto/keyManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +6 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/BottomSheetRouter.d.ts +2 -7
- package/lib/typescript/commonjs/ui/components/BottomSheetRouter.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/GroupedItem.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/AnimatedButton.d.ts +16 -0
- package/lib/typescript/commonjs/ui/components/fileManagement/AnimatedButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/profile/EditBioModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/profile/EditDisplayNameModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/profile/EditEmailModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/profile/EditLocationModal.d.ts +1 -0
- package/lib/typescript/commonjs/ui/components/profile/EditLocationModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/profile/EditUsernameModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/mutationFactory.d.ts +76 -0
- package/lib/typescript/commonjs/ui/hooks/mutations/mutationFactory.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +29 -4
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useFileFiltering.d.ts +29 -0
- package/lib/typescript/commonjs/ui/hooks/useFileFiltering.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts +11 -60
- package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/authHelpers.d.ts +99 -0
- package/lib/typescript/commonjs/ui/utils/authHelpers.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts.map +1 -1
- package/lib/typescript/module/crypto/keyManager.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +6 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/BottomSheetRouter.d.ts +2 -7
- package/lib/typescript/module/ui/components/BottomSheetRouter.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/GroupedItem.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/fileManagement/AnimatedButton.d.ts +16 -0
- package/lib/typescript/module/ui/components/fileManagement/AnimatedButton.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/profile/EditBioModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/profile/EditDisplayNameModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/profile/EditEmailModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/profile/EditLocationModal.d.ts +1 -0
- package/lib/typescript/module/ui/components/profile/EditLocationModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/profile/EditUsernameModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/mutationFactory.d.ts +76 -0
- package/lib/typescript/module/ui/hooks/mutations/mutationFactory.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +29 -4
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useFileFiltering.d.ts +29 -0
- package/lib/typescript/module/ui/hooks/useFileFiltering.d.ts.map +1 -0
- package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts +11 -60
- package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/authHelpers.d.ts +99 -0
- package/lib/typescript/module/ui/utils/authHelpers.d.ts.map +1 -0
- package/lib/typescript/module/ui/utils/avatarUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/crypto/keyManager.ts +23 -22
- package/src/index.ts +25 -0
- package/src/ui/components/BottomSheetRouter.tsx +97 -319
- package/src/ui/components/GroupedItem.tsx +0 -4
- package/src/ui/components/OxyProvider.tsx +13 -18
- package/src/ui/components/fileManagement/AnimatedButton.tsx +56 -0
- package/src/ui/components/profile/EditBioModal.tsx +38 -176
- package/src/ui/components/profile/EditDisplayNameModal.tsx +48 -195
- package/src/ui/components/profile/EditEmailModal.tsx +49 -180
- package/src/ui/components/profile/EditLocationModal.tsx +76 -263
- package/src/ui/components/profile/EditUsernameModal.tsx +47 -175
- package/src/ui/hooks/mutations/mutationFactory.ts +215 -0
- package/src/ui/hooks/mutations/useAccountMutations.ts +48 -136
- package/src/ui/hooks/queries/useAccountQueries.ts +6 -33
- package/src/ui/hooks/queries/useServicesQueries.ts +6 -32
- package/src/ui/hooks/useFileFiltering.ts +115 -0
- package/src/ui/navigation/bottomSheetManager.ts +43 -150
- package/src/ui/screens/AccountSettingsScreen.tsx +0 -2
- package/src/ui/screens/FileManagementScreen.tsx +2 -2
- package/src/ui/utils/authHelpers.ts +183 -0
- package/src/ui/utils/avatarUtils.ts +25 -65
- package/lib/commonjs/ui/hooks/use-haptic-press.js +0 -21
- package/lib/commonjs/ui/hooks/use-haptic-press.js.map +0 -1
- package/lib/module/ui/hooks/use-haptic-press.js +0 -17
- package/lib/module/ui/hooks/use-haptic-press.js.map +0 -1
- package/lib/typescript/commonjs/ui/hooks/use-haptic-press.d.ts +0 -8
- package/lib/typescript/commonjs/ui/hooks/use-haptic-press.d.ts.map +0 -1
- package/lib/typescript/module/ui/hooks/use-haptic-press.d.ts +0 -8
- package/lib/typescript/module/ui/hooks/use-haptic-press.d.ts.map +0 -1
- package/src/ui/hooks/use-haptic-press.ts +0 -15
|
@@ -1,184 +1,46 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
TextInput,
|
|
6
|
-
TouchableOpacity,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
Modal,
|
|
9
|
-
Platform,
|
|
10
|
-
} from 'react-native';
|
|
11
|
-
import { Ionicons } from '@expo/vector-icons';
|
|
12
|
-
import { useThemeStyles } from '../../hooks/useThemeStyles';
|
|
13
|
-
import { useColorScheme } from '../../hooks/use-color-scheme';
|
|
14
|
-
import { useI18n } from '../../hooks/useI18n';
|
|
15
|
-
import { fontFamilies } from '../../styles/fonts';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EditFieldModal } from './EditFieldModal';
|
|
16
3
|
import { useProfileEditing } from '../../hooks/useProfileEditing';
|
|
4
|
+
import { useI18n } from '../../hooks/useI18n';
|
|
17
5
|
|
|
18
6
|
interface EditBioModalProps {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
visible: boolean;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
initialValue?: string;
|
|
10
|
+
theme?: 'light' | 'dark';
|
|
11
|
+
onSave?: () => void;
|
|
24
12
|
}
|
|
25
13
|
|
|
26
14
|
export const EditBioModal: React.FC<EditBioModalProps> = ({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
visible,
|
|
16
|
+
onClose,
|
|
17
|
+
initialValue = '',
|
|
18
|
+
theme = 'light',
|
|
19
|
+
onSave,
|
|
32
20
|
}) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
animationType="slide"
|
|
59
|
-
transparent={true}
|
|
60
|
-
onRequestClose={onClose}
|
|
61
|
-
>
|
|
62
|
-
<View style={styles.modalOverlay}>
|
|
63
|
-
<View style={[styles.modalContent, { backgroundColor: colors.background }]}>
|
|
64
|
-
<View style={styles.modalHeader}>
|
|
65
|
-
<TouchableOpacity onPress={onClose} style={styles.closeButton}>
|
|
66
|
-
<Ionicons name="close" size={24} color={colors.text} />
|
|
67
|
-
</TouchableOpacity>
|
|
68
|
-
<Text style={[styles.modalTitle, { color: colors.text }]}>
|
|
69
|
-
{t('editProfile.items.bio.title') || 'Bio'}
|
|
70
|
-
</Text>
|
|
71
|
-
<TouchableOpacity
|
|
72
|
-
onPress={handleSave}
|
|
73
|
-
disabled={isSaving}
|
|
74
|
-
style={[styles.saveButton, { opacity: isSaving ? 0.5 : 1 }]}
|
|
75
|
-
>
|
|
76
|
-
<Text style={[styles.saveButtonText, { color: colors.tint }]}>
|
|
77
|
-
{isSaving ? 'Saving...' : 'Save'}
|
|
78
|
-
</Text>
|
|
79
|
-
</TouchableOpacity>
|
|
80
|
-
</View>
|
|
81
|
-
|
|
82
|
-
<View style={styles.modalBody}>
|
|
83
|
-
<View style={styles.inputGroup}>
|
|
84
|
-
<Text style={[styles.label, { color: colors.text }]}>
|
|
85
|
-
{t('editProfile.items.bio.label') || 'Bio'}
|
|
86
|
-
</Text>
|
|
87
|
-
<TextInput
|
|
88
|
-
style={[
|
|
89
|
-
styles.textArea,
|
|
90
|
-
{
|
|
91
|
-
backgroundColor: colors.card,
|
|
92
|
-
color: colors.text,
|
|
93
|
-
borderColor: colors.border,
|
|
94
|
-
},
|
|
95
|
-
]}
|
|
96
|
-
value={bio}
|
|
97
|
-
onChangeText={setBio}
|
|
98
|
-
placeholder={t('editProfile.items.bio.placeholder') || 'Tell people about yourself...'}
|
|
99
|
-
placeholderTextColor={colors.secondaryText}
|
|
100
|
-
autoFocus
|
|
101
|
-
multiline
|
|
102
|
-
numberOfLines={6}
|
|
103
|
-
textAlignVertical="top"
|
|
104
|
-
selectionColor={colors.tint}
|
|
105
|
-
/>
|
|
106
|
-
</View>
|
|
107
|
-
</View>
|
|
108
|
-
</View>
|
|
109
|
-
</View>
|
|
110
|
-
</Modal>
|
|
111
|
-
);
|
|
21
|
+
const { t } = useI18n();
|
|
22
|
+
const { updateField } = useProfileEditing();
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<EditFieldModal
|
|
26
|
+
visible={visible}
|
|
27
|
+
onClose={onClose}
|
|
28
|
+
title={t('editProfile.items.bio.title') || 'Bio'}
|
|
29
|
+
theme={theme}
|
|
30
|
+
onSave={onSave}
|
|
31
|
+
variant="single"
|
|
32
|
+
fields={[
|
|
33
|
+
{
|
|
34
|
+
key: 'bio',
|
|
35
|
+
label: t('editProfile.items.bio.label') || 'Bio',
|
|
36
|
+
initialValue,
|
|
37
|
+
placeholder: t('editProfile.items.bio.placeholder') || 'Tell people about yourself...',
|
|
38
|
+
inputProps: { multiline: true, numberOfLines: 6 },
|
|
39
|
+
},
|
|
40
|
+
]}
|
|
41
|
+
onSubmit={async (data) => {
|
|
42
|
+
return await updateField('bio', data.bio as string);
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
112
46
|
};
|
|
113
|
-
|
|
114
|
-
const styles = StyleSheet.create({
|
|
115
|
-
modalOverlay: {
|
|
116
|
-
flex: 1,
|
|
117
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
118
|
-
justifyContent: 'flex-end',
|
|
119
|
-
},
|
|
120
|
-
modalContent: {
|
|
121
|
-
borderTopLeftRadius: 20,
|
|
122
|
-
borderTopRightRadius: 20,
|
|
123
|
-
paddingTop: Platform.OS === 'ios' ? 20 : 16,
|
|
124
|
-
maxHeight: '80%',
|
|
125
|
-
},
|
|
126
|
-
modalHeader: {
|
|
127
|
-
flexDirection: 'row',
|
|
128
|
-
alignItems: 'center',
|
|
129
|
-
justifyContent: 'space-between',
|
|
130
|
-
paddingHorizontal: 16,
|
|
131
|
-
paddingBottom: 16,
|
|
132
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
133
|
-
borderBottomColor: '#E5E5EA',
|
|
134
|
-
},
|
|
135
|
-
closeButton: {
|
|
136
|
-
width: 40,
|
|
137
|
-
height: 40,
|
|
138
|
-
alignItems: 'center',
|
|
139
|
-
justifyContent: 'center',
|
|
140
|
-
},
|
|
141
|
-
modalTitle: {
|
|
142
|
-
fontSize: 18,
|
|
143
|
-
fontWeight: '600',
|
|
144
|
-
fontFamily: fontFamilies.phuduSemiBold,
|
|
145
|
-
flex: 1,
|
|
146
|
-
textAlign: 'center',
|
|
147
|
-
},
|
|
148
|
-
saveButton: {
|
|
149
|
-
paddingHorizontal: 16,
|
|
150
|
-
paddingVertical: 8,
|
|
151
|
-
},
|
|
152
|
-
saveButtonText: {
|
|
153
|
-
fontSize: 16,
|
|
154
|
-
fontWeight: '600',
|
|
155
|
-
fontFamily: fontFamilies.phuduSemiBold,
|
|
156
|
-
},
|
|
157
|
-
modalBody: {
|
|
158
|
-
padding: 16,
|
|
159
|
-
gap: 16,
|
|
160
|
-
},
|
|
161
|
-
inputGroup: {
|
|
162
|
-
gap: 8,
|
|
163
|
-
},
|
|
164
|
-
label: {
|
|
165
|
-
fontSize: 14,
|
|
166
|
-
fontWeight: '600',
|
|
167
|
-
fontFamily: fontFamilies.phuduSemiBold,
|
|
168
|
-
},
|
|
169
|
-
textArea: {
|
|
170
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
171
|
-
borderRadius: 12,
|
|
172
|
-
padding: 16,
|
|
173
|
-
fontSize: 16,
|
|
174
|
-
minHeight: 120,
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
@@ -1,203 +1,56 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
TextInput,
|
|
6
|
-
TouchableOpacity,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
Modal,
|
|
9
|
-
Platform,
|
|
10
|
-
} from 'react-native';
|
|
11
|
-
import { Ionicons } from '@expo/vector-icons';
|
|
12
|
-
import { useThemeStyles } from '../../hooks/useThemeStyles';
|
|
13
|
-
import { useColorScheme } from '../../hooks/use-color-scheme';
|
|
14
|
-
import { useI18n } from '../../hooks/useI18n';
|
|
15
|
-
import { fontFamilies } from '../../styles/fonts';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EditFieldModal } from './EditFieldModal';
|
|
16
3
|
import { useProfileEditing } from '../../hooks/useProfileEditing';
|
|
4
|
+
import { useI18n } from '../../hooks/useI18n';
|
|
17
5
|
|
|
18
6
|
interface EditDisplayNameModalProps {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
visible: boolean;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
initialDisplayName?: string;
|
|
10
|
+
initialLastName?: string;
|
|
11
|
+
theme?: 'light' | 'dark';
|
|
12
|
+
onSave?: () => void;
|
|
25
13
|
}
|
|
26
14
|
|
|
27
15
|
export const EditDisplayNameModal: React.FC<EditDisplayNameModalProps> = ({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
visible,
|
|
17
|
+
onClose,
|
|
18
|
+
initialDisplayName = '',
|
|
19
|
+
initialLastName = '',
|
|
20
|
+
theme = 'light',
|
|
21
|
+
onSave,
|
|
34
22
|
}) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
onRequestClose={onClose}
|
|
69
|
-
>
|
|
70
|
-
<View style={styles.modalOverlay}>
|
|
71
|
-
<View style={[styles.modalContent, { backgroundColor: colors.background }]}>
|
|
72
|
-
<View style={styles.modalHeader}>
|
|
73
|
-
<TouchableOpacity onPress={onClose} style={styles.closeButton}>
|
|
74
|
-
<Ionicons name="close" size={24} color={colors.text} />
|
|
75
|
-
</TouchableOpacity>
|
|
76
|
-
<Text style={[styles.modalTitle, { color: colors.text }]}>
|
|
77
|
-
{t('editProfile.items.displayName.title') || 'Display Name'}
|
|
78
|
-
</Text>
|
|
79
|
-
<TouchableOpacity
|
|
80
|
-
onPress={handleSave}
|
|
81
|
-
disabled={isSaving}
|
|
82
|
-
style={[styles.saveButton, { opacity: isSaving ? 0.5 : 1 }]}
|
|
83
|
-
>
|
|
84
|
-
<Text style={[styles.saveButtonText, { color: colors.tint }]}>
|
|
85
|
-
{isSaving ? 'Saving...' : 'Save'}
|
|
86
|
-
</Text>
|
|
87
|
-
</TouchableOpacity>
|
|
88
|
-
</View>
|
|
89
|
-
|
|
90
|
-
<View style={styles.modalBody}>
|
|
91
|
-
<View style={styles.inputGroup}>
|
|
92
|
-
<Text style={[styles.label, { color: colors.text }]}>
|
|
93
|
-
{t('editProfile.items.displayName.firstName') || 'First Name'}
|
|
94
|
-
</Text>
|
|
95
|
-
<TextInput
|
|
96
|
-
style={[
|
|
97
|
-
styles.input,
|
|
98
|
-
{
|
|
99
|
-
backgroundColor: colors.card,
|
|
100
|
-
color: colors.text,
|
|
101
|
-
borderColor: colors.border,
|
|
102
|
-
},
|
|
103
|
-
]}
|
|
104
|
-
value={displayName}
|
|
105
|
-
onChangeText={setDisplayName}
|
|
106
|
-
placeholder={t('editProfile.items.displayName.firstNamePlaceholder') || 'Enter first name'}
|
|
107
|
-
placeholderTextColor={colors.secondaryText}
|
|
108
|
-
autoFocus
|
|
109
|
-
selectionColor={colors.tint}
|
|
110
|
-
/>
|
|
111
|
-
</View>
|
|
112
|
-
|
|
113
|
-
<View style={styles.inputGroup}>
|
|
114
|
-
<Text style={[styles.label, { color: colors.text }]}>
|
|
115
|
-
{t('editProfile.items.displayName.lastName') || 'Last Name'}
|
|
116
|
-
</Text>
|
|
117
|
-
<TextInput
|
|
118
|
-
style={[
|
|
119
|
-
styles.input,
|
|
120
|
-
{
|
|
121
|
-
backgroundColor: colors.card,
|
|
122
|
-
color: colors.text,
|
|
123
|
-
borderColor: colors.border,
|
|
124
|
-
},
|
|
125
|
-
]}
|
|
126
|
-
value={lastName}
|
|
127
|
-
onChangeText={setLastName}
|
|
128
|
-
placeholder={t('editProfile.items.displayName.lastNamePlaceholder') || 'Enter last name (optional)'}
|
|
129
|
-
placeholderTextColor={colors.secondaryText}
|
|
130
|
-
selectionColor={colors.tint}
|
|
131
|
-
/>
|
|
132
|
-
</View>
|
|
133
|
-
</View>
|
|
134
|
-
</View>
|
|
135
|
-
</View>
|
|
136
|
-
</Modal>
|
|
137
|
-
);
|
|
23
|
+
const { t } = useI18n();
|
|
24
|
+
const { saveProfile } = useProfileEditing();
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<EditFieldModal
|
|
28
|
+
visible={visible}
|
|
29
|
+
onClose={onClose}
|
|
30
|
+
title={t('editProfile.items.displayName.title') || 'Display Name'}
|
|
31
|
+
theme={theme}
|
|
32
|
+
onSave={onSave}
|
|
33
|
+
variant="multi"
|
|
34
|
+
fields={[
|
|
35
|
+
{
|
|
36
|
+
key: 'displayName',
|
|
37
|
+
label: t('editProfile.items.displayName.firstName') || 'First Name',
|
|
38
|
+
initialValue: initialDisplayName,
|
|
39
|
+
placeholder: t('editProfile.items.displayName.firstNamePlaceholder') || 'Enter first name',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: 'lastName',
|
|
43
|
+
label: t('editProfile.items.displayName.lastName') || 'Last Name',
|
|
44
|
+
initialValue: initialLastName,
|
|
45
|
+
placeholder: t('editProfile.items.displayName.lastNamePlaceholder') || 'Enter last name (optional)',
|
|
46
|
+
},
|
|
47
|
+
]}
|
|
48
|
+
onSubmit={async (data) => {
|
|
49
|
+
return await saveProfile({
|
|
50
|
+
displayName: data.displayName as string,
|
|
51
|
+
lastName: data.lastName as string,
|
|
52
|
+
});
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
138
56
|
};
|
|
139
|
-
|
|
140
|
-
const styles = StyleSheet.create({
|
|
141
|
-
modalOverlay: {
|
|
142
|
-
flex: 1,
|
|
143
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
144
|
-
justifyContent: 'flex-end',
|
|
145
|
-
},
|
|
146
|
-
modalContent: {
|
|
147
|
-
borderTopLeftRadius: 20,
|
|
148
|
-
borderTopRightRadius: 20,
|
|
149
|
-
paddingTop: Platform.OS === 'ios' ? 20 : 16,
|
|
150
|
-
maxHeight: '80%',
|
|
151
|
-
},
|
|
152
|
-
modalHeader: {
|
|
153
|
-
flexDirection: 'row',
|
|
154
|
-
alignItems: 'center',
|
|
155
|
-
justifyContent: 'space-between',
|
|
156
|
-
paddingHorizontal: 16,
|
|
157
|
-
paddingBottom: 16,
|
|
158
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
159
|
-
borderBottomColor: '#E5E5EA',
|
|
160
|
-
},
|
|
161
|
-
closeButton: {
|
|
162
|
-
width: 40,
|
|
163
|
-
height: 40,
|
|
164
|
-
alignItems: 'center',
|
|
165
|
-
justifyContent: 'center',
|
|
166
|
-
},
|
|
167
|
-
modalTitle: {
|
|
168
|
-
fontSize: 18,
|
|
169
|
-
fontWeight: '600',
|
|
170
|
-
fontFamily: fontFamilies.phuduSemiBold,
|
|
171
|
-
flex: 1,
|
|
172
|
-
textAlign: 'center',
|
|
173
|
-
},
|
|
174
|
-
saveButton: {
|
|
175
|
-
paddingHorizontal: 16,
|
|
176
|
-
paddingVertical: 8,
|
|
177
|
-
},
|
|
178
|
-
saveButtonText: {
|
|
179
|
-
fontSize: 16,
|
|
180
|
-
fontWeight: '600',
|
|
181
|
-
fontFamily: fontFamilies.phuduSemiBold,
|
|
182
|
-
},
|
|
183
|
-
modalBody: {
|
|
184
|
-
padding: 16,
|
|
185
|
-
gap: 16,
|
|
186
|
-
},
|
|
187
|
-
inputGroup: {
|
|
188
|
-
gap: 8,
|
|
189
|
-
},
|
|
190
|
-
label: {
|
|
191
|
-
fontSize: 14,
|
|
192
|
-
fontWeight: '600',
|
|
193
|
-
fontFamily: fontFamilies.phuduSemiBold,
|
|
194
|
-
},
|
|
195
|
-
input: {
|
|
196
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
197
|
-
borderRadius: 12,
|
|
198
|
-
padding: 16,
|
|
199
|
-
fontSize: 16,
|
|
200
|
-
minHeight: 52,
|
|
201
|
-
},
|
|
202
|
-
});
|
|
203
|
-
|