@fto-consult/expo-ui 2.16.3 → 2.16.6
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 +117 -117
- package/src/auth/ThemeSelector/index.js +4 -2
- package/src/components/AppBar/index.js +5 -2
- package/src/components/AppBar/utils.js +1 -1
- package/src/components/Countries/resources/countries-normalized.json +1987 -1987
- package/src/components/Countries/resources/countries-with-not-extra.json +1211 -1211
- package/src/components/Countries/resources/countries.sql +243 -243
- package/src/components/Dialog/Provider.js +8 -4
- package/src/components/Drawer/index.js +1 -1
- package/src/components/Dropdown/utils.js +5 -2
- package/src/components/Form/FormData/DialogProvider.js +3 -1
- package/src/components/Label/index.js +5 -1
- package/src/components/Logo/Logo.js +26 -20
- package/src/layouts/DatabaseStatistics/DatabaseStatistic.js +1 -1
- package/src/layouts/ProfilAvatar/index.js +200 -0
- package/src/{navigation/Drawer → layouts}/ProfilAvatar/style.css +0 -0
- package/src/layouts/Screen/Screen.js +4 -0
- package/src/layouts/Screen/ScreenWithOrWithoutAuthContainer.js +19 -1
- package/src/navigation/Drawer/index.js +8 -2
- package/src/navigation/Drawer/items/index.js +3 -2
- package/src/screens/Auth/Profile.js +1 -1
- package/src/screens/Auth/utils.js +3 -1
- package/src/auth/ThemeSelector/utils.js +0 -141
- package/src/navigation/Drawer/ProfilAvatar/index.js +0 -157
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import {defaultObj} from "$utils";
|
|
2
|
-
import i18n from "$i18n"
|
|
3
|
-
import Auth from "$cauth";
|
|
4
|
-
import Menu from "$ecomponents/Menu";
|
|
5
|
-
import React from "$react";
|
|
6
|
-
import { screenName } from "$escreens/Auth/Profile";
|
|
7
|
-
import Image from "$ecomponents/Image";
|
|
8
|
-
import { StyleSheet,View} from "react-native";
|
|
9
|
-
import avatarProps from "$eauth/avatarProps";
|
|
10
|
-
import Button from "$ecomponents/Button";
|
|
11
|
-
import Label from "$ecomponents/Label";
|
|
12
|
-
import Icon from "$ecomponents/Icon";
|
|
13
|
-
import {navigate} from "$cnavigation";
|
|
14
|
-
import theme from "$theme";
|
|
15
|
-
import {isMobileNative} from "$cplatform";
|
|
16
|
-
import appConfig from "$capp/config";
|
|
17
|
-
import Preloader from "$preloader";
|
|
18
|
-
const UserProfileAvatarComponent = React.forwardRef(({drawerRef,...props},ref)=>{
|
|
19
|
-
let u = defaultObj(Auth.getLoggedUser());
|
|
20
|
-
const deviceNameRef = React.useRef(null);
|
|
21
|
-
const deviceName = appConfig.deviceName;
|
|
22
|
-
props = defaultObj(props);
|
|
23
|
-
const closeDrawer = cb => {
|
|
24
|
-
if(drawerRef && drawerRef.current && drawerRef.current.close){
|
|
25
|
-
return drawerRef && drawerRef.current && drawerRef.current.close(cb);
|
|
26
|
-
}
|
|
27
|
-
return typeof cb =='function'? cb() : null;
|
|
28
|
-
}
|
|
29
|
-
props.src = u.avatar;
|
|
30
|
-
props.size = 60;
|
|
31
|
-
const menItems = [
|
|
32
|
-
{
|
|
33
|
-
label : i18n.lang("preferences",'Préférences'),
|
|
34
|
-
icon : "account-cog",
|
|
35
|
-
onPress : (a)=>{
|
|
36
|
-
closeDrawer(()=>{
|
|
37
|
-
return navigate({
|
|
38
|
-
routeName : screenName,
|
|
39
|
-
params : {
|
|
40
|
-
user : u,
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
label : i18n.lang("logout",'Déconnexion'),
|
|
48
|
-
icon : "logout",
|
|
49
|
-
onPress : (a)=>{
|
|
50
|
-
closeDrawer(()=>{
|
|
51
|
-
Preloader.open("Déconnexion en cours...");
|
|
52
|
-
Auth.signOut().finally(Preloader.close)
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
];
|
|
57
|
-
const userPseudo = Auth.getUserPseudo();
|
|
58
|
-
const pseudo = defaultStr(userPseudo,Auth.getUserEmail(),Auth.getUserCode());
|
|
59
|
-
const label = defaultStr(Auth.getUserFullName(),userPseudo)
|
|
60
|
-
return <View ref ={ref}>
|
|
61
|
-
<Menu
|
|
62
|
-
anchor = { (aProps)=>{
|
|
63
|
-
return <Button
|
|
64
|
-
normal
|
|
65
|
-
upperCase = {false}
|
|
66
|
-
disableRipple
|
|
67
|
-
title = {"Pressez longtemps pour définir un identifiant unique pour l'appareil"}
|
|
68
|
-
{...aProps}
|
|
69
|
-
style = {[styles.container]}
|
|
70
|
-
onLongPress = {()=>{
|
|
71
|
-
appConfig.setDeviceId().then((r)=>{
|
|
72
|
-
if(deviceNameRef.current && deviceNameRef.current.update){
|
|
73
|
-
deviceNameRef.current.update(r?("["+r+"]"):"");
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}}
|
|
77
|
-
left={props1 => <Image
|
|
78
|
-
{...props}
|
|
79
|
-
{...props1}
|
|
80
|
-
size={60}
|
|
81
|
-
style = {styles.itemLeft}
|
|
82
|
-
testID = {"RN_ProfilAvatar_Avatar"}
|
|
83
|
-
editable
|
|
84
|
-
defaultSource ={avatarProps.defaultSrc}
|
|
85
|
-
onChange = {({dataURL})=>{
|
|
86
|
-
if(u.avatar === dataURL) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
if(!dataURL){
|
|
90
|
-
u.avatar = null;
|
|
91
|
-
} else {
|
|
92
|
-
u.avatar = dataURL;
|
|
93
|
-
}
|
|
94
|
-
Auth.upsertUser({...u,avatar:u.avatar},false);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/>}
|
|
98
|
-
right = {(p)=>{
|
|
99
|
-
return <Icon
|
|
100
|
-
{...p}
|
|
101
|
-
{...aProps}
|
|
102
|
-
secondary
|
|
103
|
-
size={20}
|
|
104
|
-
icon={"chevron-down"}
|
|
105
|
-
style = {styles.icon}
|
|
106
|
-
/>
|
|
107
|
-
}}
|
|
108
|
-
>
|
|
109
|
-
<View style={styles.labelContainer}>
|
|
110
|
-
<Label splitText numberOfLines={1} style={{color:theme.colors.primaryOnSurface,fontSize:14}}>{pseudo}</Label>
|
|
111
|
-
<Label splitText numberOfLines={1} style={{fontSize:12,color:theme.colors.secondaryOnSurface,marginTop:6}}>
|
|
112
|
-
{label}
|
|
113
|
-
</Label>
|
|
114
|
-
{deviceName && <Label.withRef textBold splitText title={"Identifiant unique de l'application, installé sur cet appareil"} ref={deviceNameRef} secondary style={{fontSize:10}}>
|
|
115
|
-
[{deviceName}]
|
|
116
|
-
</Label.withRef> || null}
|
|
117
|
-
</View>
|
|
118
|
-
</Button>
|
|
119
|
-
} }
|
|
120
|
-
items={menItems}
|
|
121
|
-
/>
|
|
122
|
-
</View>
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
const styles = StyleSheet.create({
|
|
126
|
-
itemLeft : {
|
|
127
|
-
marginHorizontal : 5,
|
|
128
|
-
marginTop : isMobileNative()? 10 : 0,
|
|
129
|
-
},
|
|
130
|
-
container : {
|
|
131
|
-
marginLeft : 0,
|
|
132
|
-
marginVertical : 10,
|
|
133
|
-
},
|
|
134
|
-
labelContainer : {
|
|
135
|
-
flexDirection : 'column',
|
|
136
|
-
paddingRight : 5,
|
|
137
|
-
maxWidth : 150,
|
|
138
|
-
minWidth : 100,
|
|
139
|
-
},
|
|
140
|
-
pseudo : {
|
|
141
|
-
flexDirection : "row",
|
|
142
|
-
justifyContent : "center",
|
|
143
|
-
alignItems : "center"
|
|
144
|
-
},
|
|
145
|
-
appName : {
|
|
146
|
-
marginLeft : 5,
|
|
147
|
-
fontWeight : "bold",
|
|
148
|
-
},
|
|
149
|
-
icon : {
|
|
150
|
-
marginHorizontal:0,
|
|
151
|
-
paddingHorizontal : 0,
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
export default UserProfileAvatarComponent;
|
|
156
|
-
|
|
157
|
-
UserProfileAvatarComponent.displayName = "UserProfileAvatarComponent";
|