|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
import { View, Text, Image, Platform, Pressable } from "react-native"; |
|
|
|
|
import React from "react"; |
|
|
|
|
import { connect } from "react-redux"; |
|
|
|
|
import {user} from "../../../redux/actions"; |
|
|
|
|
import Svg, { Path } from "react-native-svg"; |
|
|
|
|
import { asyncAwesomeAlert } from "../../../utils/AsyncWrappers"; |
|
|
|
|
|
|
|
|
@ -11,7 +12,7 @@ import Colors from "../../../constants/Colors"; |
|
|
|
|
|
|
|
|
|
const ios = Platform.OS === "ios"; |
|
|
|
|
|
|
|
|
|
const User = ({ user, mobile, theme }) => { |
|
|
|
|
const User = ({ user, mobile, theme, logout }) => { |
|
|
|
|
const [dropdown, setDropdown] = React.useState(true); |
|
|
|
|
return ( |
|
|
|
|
<View style={tw(`w-full ${ios ? "items-end" : ""}`)}> |
|
|
|
@ -79,49 +80,77 @@ const User = ({ user, mobile, theme }) => { |
|
|
|
|
</Svg> |
|
|
|
|
</Pressable> |
|
|
|
|
{dropdown && ( |
|
|
|
|
<Pressable |
|
|
|
|
style={tw( |
|
|
|
|
`flex w-full pr-16 ${ios ? "items-end" : " "} ${ |
|
|
|
|
mobile ? "mt-0" : "mt-4" |
|
|
|
|
}` |
|
|
|
|
)} |
|
|
|
|
onPress={() => |
|
|
|
|
asyncAwesomeAlert("نتیجه", "این قابلیت در حال توسعه است.", { |
|
|
|
|
showCancelButton: false, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<View |
|
|
|
|
style={[ |
|
|
|
|
tw(`flex items-center w-full pb-3 mb-3 flex-row-reverse`), |
|
|
|
|
{ |
|
|
|
|
borderBottomWidth: 1, |
|
|
|
|
borderColor: Colors.theme1[theme].grayE3, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
<View style={tw(`flex flex-col pr-16 ${ios ? "items-end" : " "}`)}> |
|
|
|
|
<Pressable |
|
|
|
|
style={tw(`flex w-full ${mobile ? "mt-0" : "mt-4"}`)} |
|
|
|
|
onPress={() => |
|
|
|
|
asyncAwesomeAlert("نتیجه", "این قابلیت در حال توسعه است.", { |
|
|
|
|
showCancelButton: false, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontSize: mobile ? fontSize.base : fontSize.xl, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: Colors.theme1[theme].gray20, |
|
|
|
|
}} |
|
|
|
|
<View |
|
|
|
|
style={[ |
|
|
|
|
tw(`flex items-center w-full pb-3 mb-3 flex-row-reverse`), |
|
|
|
|
{ |
|
|
|
|
borderBottomWidth: 1, |
|
|
|
|
borderColor: Colors.theme1[theme].grayE3, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
افزودن حساب کاربری جدید |
|
|
|
|
</Text> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
marginRight: 5, |
|
|
|
|
marginTop: 3, |
|
|
|
|
fontSize: fontSize.xl2, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: Colors.theme1[theme].gray20, |
|
|
|
|
}} |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontSize: mobile ? fontSize.base : fontSize.xl, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: Colors.theme1[theme].gray20, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
افزودن حساب کاربری جدید |
|
|
|
|
</Text> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
marginRight: 5, |
|
|
|
|
marginTop: 3, |
|
|
|
|
fontSize: fontSize.xl2, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: Colors.theme1[theme].gray20, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
+ |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</Pressable> |
|
|
|
|
<Pressable |
|
|
|
|
style={tw(`flex w-full ${mobile ? "mt-0" : "mt-4"}`)} |
|
|
|
|
onPress={() => |
|
|
|
|
asyncAwesomeAlert( |
|
|
|
|
"نتیجه", |
|
|
|
|
"آیا قصد خروج از حساب کاربری فعلی رو داری؟", |
|
|
|
|
{ |
|
|
|
|
showCancelButton: true, |
|
|
|
|
onConfirm : () => logout(), |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<View |
|
|
|
|
style={[ |
|
|
|
|
tw(`flex items-center w-full pb-3 mb-3 flex-row-reverse`), |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
+ |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</Pressable> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontSize: mobile ? fontSize.base : fontSize.xl, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: Colors.theme1[theme].redFF1, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خروج از حساب کاربری |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</Pressable> |
|
|
|
|
</View> |
|
|
|
|
)} |
|
|
|
|
</View> |
|
|
|
|
); |
|
|
|
@ -133,4 +162,8 @@ const mapStateToProps = (state) => ({ |
|
|
|
|
theme: state.publicApi.theme, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(User); |
|
|
|
|
const mapDispatchToProps = { |
|
|
|
|
logout : user.logout |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(User); |
|
|
|
|