@oxyhq/services 5.21.6 → 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/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/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/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/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/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/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/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/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 +1 -1
- package/src/crypto/keyManager.ts +23 -22
- package/src/index.ts +25 -0
- 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/screens/FileManagementScreen.tsx +2 -2
- package/src/ui/utils/authHelpers.ts +183 -0
- package/src/ui/utils/avatarUtils.ts +25 -65
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React
|
|
4
|
-
import {
|
|
5
|
-
import { Ionicons } from '@expo/vector-icons';
|
|
6
|
-
import { useThemeStyles } from "../../hooks/useThemeStyles.js";
|
|
7
|
-
import { useColorScheme } from "../../hooks/use-color-scheme.js";
|
|
8
|
-
import { useI18n } from "../../hooks/useI18n.js";
|
|
9
|
-
import { fontFamilies } from "../../styles/fonts.js";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { EditFieldModal } from "./EditFieldModal.js";
|
|
10
5
|
import { useProfileEditing } from "../../hooks/useProfileEditing.js";
|
|
11
|
-
import {
|
|
6
|
+
import { useI18n } from "../../hooks/useI18n.js";
|
|
7
|
+
import { EMAIL_REGEX } from "../../../utils/validationUtils.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
9
|
export const EditEmailModal = ({
|
|
13
10
|
visible,
|
|
14
11
|
onClose,
|
|
@@ -19,160 +16,36 @@ export const EditEmailModal = ({
|
|
|
19
16
|
const {
|
|
20
17
|
t
|
|
21
18
|
} = useI18n();
|
|
22
|
-
const colorScheme = useColorScheme();
|
|
23
|
-
const themeStyles = useThemeStyles(theme || 'light', colorScheme);
|
|
24
|
-
const colors = themeStyles.colors;
|
|
25
19
|
const {
|
|
26
|
-
updateField
|
|
27
|
-
isSaving
|
|
20
|
+
updateField
|
|
28
21
|
} = useProfileEditing();
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (visible) {
|
|
32
|
-
setEmail(initialValue);
|
|
33
|
-
}
|
|
34
|
-
}, [visible, initialValue]);
|
|
35
|
-
const handleSave = async () => {
|
|
36
|
-
const success = await updateField('email', email);
|
|
37
|
-
if (success) {
|
|
38
|
-
onSave?.();
|
|
39
|
-
onClose();
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const isValidEmail = email => {
|
|
43
|
-
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
44
|
-
};
|
|
45
|
-
return /*#__PURE__*/_jsx(Modal, {
|
|
22
|
+
return /*#__PURE__*/_jsx(EditFieldModal, {
|
|
46
23
|
visible: visible,
|
|
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
|
-
onPress: handleSave,
|
|
73
|
-
disabled: isSaving || !isValidEmail(email),
|
|
74
|
-
style: [styles.saveButton, {
|
|
75
|
-
opacity: isSaving || !isValidEmail(email) ? 0.5 : 1
|
|
76
|
-
}],
|
|
77
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
78
|
-
style: [styles.saveButtonText, {
|
|
79
|
-
color: colors.tint
|
|
80
|
-
}],
|
|
81
|
-
children: isSaving ? 'Saving...' : 'Save'
|
|
82
|
-
})
|
|
83
|
-
})]
|
|
84
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
85
|
-
style: styles.modalBody,
|
|
86
|
-
children: /*#__PURE__*/_jsxs(View, {
|
|
87
|
-
style: styles.inputGroup,
|
|
88
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
89
|
-
style: [styles.label, {
|
|
90
|
-
color: colors.text
|
|
91
|
-
}],
|
|
92
|
-
children: t('editProfile.items.email.label') || 'Email Address'
|
|
93
|
-
}), /*#__PURE__*/_jsx(TextInput, {
|
|
94
|
-
style: [styles.input, {
|
|
95
|
-
backgroundColor: colors.card,
|
|
96
|
-
color: colors.text,
|
|
97
|
-
borderColor: colors.border
|
|
98
|
-
}],
|
|
99
|
-
value: email,
|
|
100
|
-
onChangeText: setEmail,
|
|
101
|
-
placeholder: t('editProfile.items.email.placeholder') || 'Enter your email address',
|
|
102
|
-
placeholderTextColor: colors.secondaryText,
|
|
103
|
-
autoFocus: true,
|
|
104
|
-
keyboardType: "email-address",
|
|
105
|
-
autoCapitalize: "none",
|
|
106
|
-
autoCorrect: false,
|
|
107
|
-
selectionColor: colors.tint
|
|
108
|
-
})]
|
|
109
|
-
})
|
|
110
|
-
})]
|
|
111
|
-
})
|
|
112
|
-
})
|
|
24
|
+
onClose: onClose,
|
|
25
|
+
title: t('editProfile.items.email.title') || 'Email',
|
|
26
|
+
theme: theme,
|
|
27
|
+
onSave: onSave,
|
|
28
|
+
variant: "single",
|
|
29
|
+
fields: [{
|
|
30
|
+
key: 'email',
|
|
31
|
+
label: t('editProfile.items.email.label') || 'Email Address',
|
|
32
|
+
initialValue,
|
|
33
|
+
placeholder: t('editProfile.items.email.placeholder') || 'Enter your email address',
|
|
34
|
+
validation: value => {
|
|
35
|
+
if (!EMAIL_REGEX.test(value)) {
|
|
36
|
+
return t('editProfile.items.email.invalid') || 'Please enter a valid email address';
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
},
|
|
40
|
+
inputProps: {
|
|
41
|
+
keyboardType: 'email-address',
|
|
42
|
+
autoCapitalize: 'none',
|
|
43
|
+
autoCorrect: false
|
|
44
|
+
}
|
|
45
|
+
}],
|
|
46
|
+
onSubmit: async data => {
|
|
47
|
+
return await updateField('email', data.email);
|
|
48
|
+
}
|
|
113
49
|
});
|
|
114
50
|
};
|
|
115
|
-
const styles = StyleSheet.create({
|
|
116
|
-
modalOverlay: {
|
|
117
|
-
flex: 1,
|
|
118
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
119
|
-
justifyContent: 'flex-end'
|
|
120
|
-
},
|
|
121
|
-
modalContent: {
|
|
122
|
-
borderTopLeftRadius: 20,
|
|
123
|
-
borderTopRightRadius: 20,
|
|
124
|
-
paddingTop: Platform.OS === 'ios' ? 20 : 16,
|
|
125
|
-
maxHeight: '80%'
|
|
126
|
-
},
|
|
127
|
-
modalHeader: {
|
|
128
|
-
flexDirection: 'row',
|
|
129
|
-
alignItems: 'center',
|
|
130
|
-
justifyContent: 'space-between',
|
|
131
|
-
paddingHorizontal: 16,
|
|
132
|
-
paddingBottom: 16,
|
|
133
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
134
|
-
borderBottomColor: '#E5E5EA'
|
|
135
|
-
},
|
|
136
|
-
closeButton: {
|
|
137
|
-
width: 40,
|
|
138
|
-
height: 40,
|
|
139
|
-
alignItems: 'center',
|
|
140
|
-
justifyContent: 'center'
|
|
141
|
-
},
|
|
142
|
-
modalTitle: {
|
|
143
|
-
fontSize: 18,
|
|
144
|
-
fontWeight: '600',
|
|
145
|
-
fontFamily: fontFamilies.phuduSemiBold,
|
|
146
|
-
flex: 1,
|
|
147
|
-
textAlign: 'center'
|
|
148
|
-
},
|
|
149
|
-
saveButton: {
|
|
150
|
-
paddingHorizontal: 16,
|
|
151
|
-
paddingVertical: 8
|
|
152
|
-
},
|
|
153
|
-
saveButtonText: {
|
|
154
|
-
fontSize: 16,
|
|
155
|
-
fontWeight: '600',
|
|
156
|
-
fontFamily: fontFamilies.phuduSemiBold
|
|
157
|
-
},
|
|
158
|
-
modalBody: {
|
|
159
|
-
padding: 16,
|
|
160
|
-
gap: 16
|
|
161
|
-
},
|
|
162
|
-
inputGroup: {
|
|
163
|
-
gap: 8
|
|
164
|
-
},
|
|
165
|
-
label: {
|
|
166
|
-
fontSize: 14,
|
|
167
|
-
fontWeight: '600',
|
|
168
|
-
fontFamily: fontFamilies.phuduSemiBold
|
|
169
|
-
},
|
|
170
|
-
input: {
|
|
171
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
172
|
-
borderRadius: 12,
|
|
173
|
-
padding: 16,
|
|
174
|
-
fontSize: 16,
|
|
175
|
-
minHeight: 52
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
51
|
//# sourceMappingURL=EditEmailModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","EditFieldModal","useProfileEditing","useI18n","EMAIL_REGEX","jsx","_jsx","EditEmailModal","visible","onClose","initialValue","theme","onSave","t","updateField","title","variant","fields","key","label","placeholder","validation","value","test","undefined","inputProps","keyboardType","autoCapitalize","autoCorrect","onSubmit","data","email"],"sourceRoot":"../../../../../src","sources":["ui/components/profile/EditEmailModal.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,iBAAiB,QAAQ,kCAA+B;AACjE,SAASC,OAAO,QAAQ,wBAAqB;AAC7C,SAASC,WAAW,QAAQ,mCAAgC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAU7D,OAAO,MAAMC,cAA6C,GAAGA,CAAC;EAC5DC,OAAO;EACPC,OAAO;EACPC,YAAY,GAAG,EAAE;EACjBC,KAAK,GAAG,OAAO;EACfC;AACF,CAAC,KAAK;EACJ,MAAM;IAAEC;EAAE,CAAC,GAAGV,OAAO,CAAC,CAAC;EACvB,MAAM;IAAEW;EAAY,CAAC,GAAGZ,iBAAiB,CAAC,CAAC;EAE3C,oBACEI,IAAA,CAACL,cAAc;IACbO,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjBM,KAAK,EAAEF,CAAC,CAAC,+BAA+B,CAAC,IAAI,OAAQ;IACrDF,KAAK,EAAEA,KAAM;IACbC,MAAM,EAAEA,MAAO;IACfI,OAAO,EAAC,QAAQ;IAChBC,MAAM,EAAE,CACN;MACEC,GAAG,EAAE,OAAO;MACZC,KAAK,EAAEN,CAAC,CAAC,+BAA+B,CAAC,IAAI,eAAe;MAC5DH,YAAY;MACZU,WAAW,EAAEP,CAAC,CAAC,qCAAqC,CAAC,IAAI,0BAA0B;MACnFQ,UAAU,EAAGC,KAAK,IAAK;QACrB,IAAI,CAAClB,WAAW,CAACmB,IAAI,CAACD,KAAK,CAAC,EAAE;UAC5B,OAAOT,CAAC,CAAC,iCAAiC,CAAC,IAAI,oCAAoC;QACrF;QACA,OAAOW,SAAS;MAClB,CAAC;MACDC,UAAU,EAAE;QACVC,YAAY,EAAE,eAAe;QAC7BC,cAAc,EAAE,MAAM;QACtBC,WAAW,EAAE;MACf;IACF,CAAC,CACD;IACFC,QAAQ,EAAE,MAAOC,IAAI,IAAK;MACxB,OAAO,MAAMhB,WAAW,CAAC,OAAO,EAAEgB,IAAI,CAACC,KAAe,CAAC;IACzD;EAAE,CACH,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React
|
|
4
|
-
import { View, Text,
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
|
|
5
5
|
import { Ionicons } from '@expo/vector-icons';
|
|
6
|
-
import {
|
|
7
|
-
import { useColorScheme } from "../../hooks/use-color-scheme.js";
|
|
8
|
-
import { useI18n } from "../../hooks/useI18n.js";
|
|
9
|
-
import { fontFamilies } from "../../styles/fonts.js";
|
|
6
|
+
import { EditFieldModal } from "./EditFieldModal.js";
|
|
10
7
|
import { useProfileEditing } from "../../hooks/useProfileEditing.js";
|
|
8
|
+
import { useI18n } from "../../hooks/useI18n.js";
|
|
11
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
10
|
export const EditLocationModal = ({
|
|
13
11
|
visible,
|
|
@@ -19,242 +17,62 @@ export const EditLocationModal = ({
|
|
|
19
17
|
const {
|
|
20
18
|
t
|
|
21
19
|
} = useI18n();
|
|
22
|
-
const colorScheme = useColorScheme();
|
|
23
|
-
const themeStyles = useThemeStyles(theme || 'light', colorScheme);
|
|
24
|
-
const colors = themeStyles.colors;
|
|
25
20
|
const {
|
|
26
|
-
saveProfile
|
|
27
|
-
isSaving
|
|
21
|
+
saveProfile
|
|
28
22
|
} = useProfileEditing();
|
|
29
|
-
|
|
30
|
-
const [newLocation, setNewLocation] = useState('');
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (visible) {
|
|
33
|
-
setLocations(initialLocations);
|
|
34
|
-
setNewLocation('');
|
|
35
|
-
}
|
|
36
|
-
}, [visible, initialLocations]);
|
|
37
|
-
const handleAddLocation = () => {
|
|
38
|
-
if (!newLocation.trim()) return;
|
|
39
|
-
const location = {
|
|
40
|
-
id: `location-${Date.now()}`,
|
|
41
|
-
name: newLocation.trim()
|
|
42
|
-
};
|
|
43
|
-
setLocations([...locations, location]);
|
|
44
|
-
setNewLocation('');
|
|
45
|
-
};
|
|
46
|
-
const handleRemoveLocation = id => {
|
|
47
|
-
setLocations(locations.filter(loc => loc.id !== id));
|
|
48
|
-
};
|
|
49
|
-
const handleSave = async () => {
|
|
50
|
-
const success = await saveProfile({
|
|
51
|
-
locations
|
|
52
|
-
});
|
|
53
|
-
if (success) {
|
|
54
|
-
onSave?.();
|
|
55
|
-
onClose();
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
return /*#__PURE__*/_jsx(Modal, {
|
|
23
|
+
return /*#__PURE__*/_jsx(EditFieldModal, {
|
|
59
24
|
visible: visible,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
25
|
+
onClose: onClose,
|
|
26
|
+
title: t('editProfile.items.locations.title') || 'Locations',
|
|
27
|
+
theme: theme,
|
|
28
|
+
onSave: onSave,
|
|
29
|
+
variant: "list",
|
|
30
|
+
listConfig: {
|
|
31
|
+
items: initialLocations,
|
|
32
|
+
addItemLabel: t('editProfile.items.locations.add') || 'Add Location',
|
|
33
|
+
listTitle: t('editProfile.items.locations.yourLocations') || 'Your Locations',
|
|
34
|
+
addItemPlaceholder: t('editProfile.items.locations.placeholder') || 'Enter location name',
|
|
35
|
+
createItem: value => ({
|
|
36
|
+
id: `location-${Date.now()}`,
|
|
37
|
+
name: value.trim()
|
|
38
|
+
}),
|
|
39
|
+
renderItem: (item, onRemove, colors) => /*#__PURE__*/_jsxs(View, {
|
|
40
|
+
style: [styles.locationItem, {
|
|
41
|
+
backgroundColor: colors.card,
|
|
42
|
+
borderColor: colors.border
|
|
68
43
|
}],
|
|
69
|
-
children: [/*#__PURE__*/
|
|
70
|
-
style: styles.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}],
|
|
83
|
-
children: t('editProfile.items.locations.title') || 'Locations'
|
|
84
|
-
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
85
|
-
onPress: handleSave,
|
|
86
|
-
disabled: isSaving,
|
|
87
|
-
style: [styles.saveButton, {
|
|
88
|
-
opacity: isSaving ? 0.5 : 1
|
|
89
|
-
}],
|
|
90
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
91
|
-
style: [styles.saveButtonText, {
|
|
92
|
-
color: colors.tint
|
|
93
|
-
}],
|
|
94
|
-
children: isSaving ? 'Saving...' : 'Save'
|
|
95
|
-
})
|
|
96
|
-
})]
|
|
97
|
-
}), /*#__PURE__*/_jsxs(ScrollView, {
|
|
98
|
-
style: styles.modalBody,
|
|
99
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
100
|
-
style: styles.inputGroup,
|
|
101
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
102
|
-
style: [styles.label, {
|
|
103
|
-
color: colors.text
|
|
104
|
-
}],
|
|
105
|
-
children: t('editProfile.items.locations.add') || 'Add Location'
|
|
106
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
107
|
-
style: styles.addLocationRow,
|
|
108
|
-
children: [/*#__PURE__*/_jsx(TextInput, {
|
|
109
|
-
style: [styles.input, {
|
|
110
|
-
backgroundColor: colors.card,
|
|
111
|
-
color: colors.text,
|
|
112
|
-
borderColor: colors.border,
|
|
113
|
-
flex: 1
|
|
114
|
-
}],
|
|
115
|
-
value: newLocation,
|
|
116
|
-
onChangeText: setNewLocation,
|
|
117
|
-
placeholder: t('editProfile.items.locations.placeholder') || 'Enter location name',
|
|
118
|
-
placeholderTextColor: colors.secondaryText,
|
|
119
|
-
selectionColor: colors.tint
|
|
120
|
-
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
121
|
-
style: [styles.addButton, {
|
|
122
|
-
backgroundColor: colors.tint
|
|
123
|
-
}],
|
|
124
|
-
onPress: handleAddLocation,
|
|
125
|
-
disabled: !newLocation.trim(),
|
|
126
|
-
children: /*#__PURE__*/_jsx(Ionicons, {
|
|
127
|
-
name: "add",
|
|
128
|
-
size: 20,
|
|
129
|
-
color: "#fff"
|
|
130
|
-
})
|
|
131
|
-
})]
|
|
132
|
-
})]
|
|
133
|
-
}), locations.length > 0 && /*#__PURE__*/_jsxs(View, {
|
|
134
|
-
style: styles.locationsList,
|
|
135
|
-
children: [/*#__PURE__*/_jsxs(Text, {
|
|
136
|
-
style: [styles.listTitle, {
|
|
137
|
-
color: colors.text
|
|
138
|
-
}],
|
|
139
|
-
children: [t('editProfile.items.locations.yourLocations') || 'Your Locations', " (", locations.length, ")"]
|
|
140
|
-
}), locations.map((location, index) => /*#__PURE__*/_jsxs(View, {
|
|
141
|
-
style: [styles.locationItem, {
|
|
142
|
-
backgroundColor: colors.card,
|
|
143
|
-
borderColor: colors.border
|
|
144
|
-
}, index < locations.length - 1 && {
|
|
145
|
-
borderBottomWidth: StyleSheet.hairlineWidth
|
|
146
|
-
}],
|
|
147
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
148
|
-
style: [styles.locationName, {
|
|
149
|
-
color: colors.text
|
|
150
|
-
}],
|
|
151
|
-
children: location.name
|
|
152
|
-
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
153
|
-
onPress: () => handleRemoveLocation(location.id),
|
|
154
|
-
style: styles.removeButton,
|
|
155
|
-
children: /*#__PURE__*/_jsx(Ionicons, {
|
|
156
|
-
name: "trash-outline",
|
|
157
|
-
size: 18,
|
|
158
|
-
color: "#FF3B30"
|
|
159
|
-
})
|
|
160
|
-
})]
|
|
161
|
-
}, location.id))]
|
|
162
|
-
})]
|
|
44
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
45
|
+
style: [styles.locationName, {
|
|
46
|
+
color: colors.text
|
|
47
|
+
}],
|
|
48
|
+
children: item.name
|
|
49
|
+
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
50
|
+
onPress: onRemove,
|
|
51
|
+
style: styles.removeButton,
|
|
52
|
+
children: /*#__PURE__*/_jsx(Ionicons, {
|
|
53
|
+
name: "trash-outline",
|
|
54
|
+
size: 18,
|
|
55
|
+
color: "#FF3B30"
|
|
56
|
+
})
|
|
163
57
|
})]
|
|
164
58
|
})
|
|
165
|
-
}
|
|
59
|
+
},
|
|
60
|
+
onSubmit: async data => {
|
|
61
|
+
return await saveProfile({
|
|
62
|
+
locations: data.items
|
|
63
|
+
});
|
|
64
|
+
}
|
|
166
65
|
});
|
|
167
66
|
};
|
|
168
67
|
const styles = StyleSheet.create({
|
|
169
|
-
modalOverlay: {
|
|
170
|
-
flex: 1,
|
|
171
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
172
|
-
justifyContent: 'flex-end'
|
|
173
|
-
},
|
|
174
|
-
modalContent: {
|
|
175
|
-
borderTopLeftRadius: 20,
|
|
176
|
-
borderTopRightRadius: 20,
|
|
177
|
-
paddingTop: Platform.OS === 'ios' ? 20 : 16,
|
|
178
|
-
maxHeight: '80%'
|
|
179
|
-
},
|
|
180
|
-
modalHeader: {
|
|
181
|
-
flexDirection: 'row',
|
|
182
|
-
alignItems: 'center',
|
|
183
|
-
justifyContent: 'space-between',
|
|
184
|
-
paddingHorizontal: 16,
|
|
185
|
-
paddingBottom: 16,
|
|
186
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
187
|
-
borderBottomColor: '#E5E5EA'
|
|
188
|
-
},
|
|
189
|
-
closeButton: {
|
|
190
|
-
width: 40,
|
|
191
|
-
height: 40,
|
|
192
|
-
alignItems: 'center',
|
|
193
|
-
justifyContent: 'center'
|
|
194
|
-
},
|
|
195
|
-
modalTitle: {
|
|
196
|
-
fontSize: 18,
|
|
197
|
-
fontWeight: '600',
|
|
198
|
-
fontFamily: fontFamilies.phuduSemiBold,
|
|
199
|
-
flex: 1,
|
|
200
|
-
textAlign: 'center'
|
|
201
|
-
},
|
|
202
|
-
saveButton: {
|
|
203
|
-
paddingHorizontal: 16,
|
|
204
|
-
paddingVertical: 8
|
|
205
|
-
},
|
|
206
|
-
saveButtonText: {
|
|
207
|
-
fontSize: 16,
|
|
208
|
-
fontWeight: '600',
|
|
209
|
-
fontFamily: fontFamilies.phuduSemiBold
|
|
210
|
-
},
|
|
211
|
-
modalBody: {
|
|
212
|
-
padding: 16
|
|
213
|
-
},
|
|
214
|
-
inputGroup: {
|
|
215
|
-
gap: 8,
|
|
216
|
-
marginBottom: 24
|
|
217
|
-
},
|
|
218
|
-
label: {
|
|
219
|
-
fontSize: 14,
|
|
220
|
-
fontWeight: '600',
|
|
221
|
-
fontFamily: fontFamilies.phuduSemiBold
|
|
222
|
-
},
|
|
223
|
-
addLocationRow: {
|
|
224
|
-
flexDirection: 'row',
|
|
225
|
-
gap: 8,
|
|
226
|
-
alignItems: 'center'
|
|
227
|
-
},
|
|
228
|
-
input: {
|
|
229
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
230
|
-
borderRadius: 12,
|
|
231
|
-
padding: 16,
|
|
232
|
-
fontSize: 16,
|
|
233
|
-
minHeight: 52
|
|
234
|
-
},
|
|
235
|
-
addButton: {
|
|
236
|
-
width: 52,
|
|
237
|
-
height: 52,
|
|
238
|
-
borderRadius: 12,
|
|
239
|
-
alignItems: 'center',
|
|
240
|
-
justifyContent: 'center'
|
|
241
|
-
},
|
|
242
|
-
locationsList: {
|
|
243
|
-
gap: 8
|
|
244
|
-
},
|
|
245
|
-
listTitle: {
|
|
246
|
-
fontSize: 16,
|
|
247
|
-
fontWeight: '600',
|
|
248
|
-
fontFamily: fontFamilies.phuduSemiBold,
|
|
249
|
-
marginBottom: 8
|
|
250
|
-
},
|
|
251
68
|
locationItem: {
|
|
252
69
|
flexDirection: 'row',
|
|
253
70
|
alignItems: 'center',
|
|
254
71
|
justifyContent: 'space-between',
|
|
255
72
|
padding: 16,
|
|
256
73
|
borderRadius: 12,
|
|
257
|
-
borderWidth: StyleSheet.hairlineWidth
|
|
74
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
75
|
+
marginBottom: 8
|
|
258
76
|
},
|
|
259
77
|
locationName: {
|
|
260
78
|
fontSize: 16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","View","Text","TouchableOpacity","StyleSheet","Ionicons","EditFieldModal","useProfileEditing","useI18n","jsx","_jsx","jsxs","_jsxs","EditLocationModal","visible","onClose","initialLocations","theme","onSave","t","saveProfile","title","variant","listConfig","items","addItemLabel","listTitle","addItemPlaceholder","createItem","value","id","Date","now","name","trim","renderItem","item","onRemove","colors","style","styles","locationItem","backgroundColor","card","borderColor","border","children","locationName","color","text","onPress","removeButton","size","onSubmit","data","locations","create","flexDirection","alignItems","justifyContent","padding","borderRadius","borderWidth","hairlineWidth","marginBottom","fontSize","flex"],"sourceRoot":"../../../../../src","sources":["ui/components/profile/EditLocationModal.tsx"],"mappings":"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","ignoreList":[]}
|