diff --git a/navigation/index.js b/navigation/index.js index 6d8f6da..edd1d56 100644 --- a/navigation/index.js +++ b/navigation/index.js @@ -30,10 +30,13 @@ import ShoppingCart from "../src/screens/ShoppingCart"; import DeliveryForm from "../src/screens/DeliveryForm"; import Address from "../src/screens/Address"; import Profile from "../src/screens/Profile"; +import ProfileBookmark from "../src/screens/Profile/components/ProfileBookmark"; +import ProfileAddress from "../src/screens/Profile/components/ProfileAddress"; //style import fontSize from "../src/constants/fontSize"; import Colors from "../src/constants/Colors"; +import tw from "tailwind-react-native-classnames"; const Tab = createBottomTabNavigator(); @@ -405,7 +408,7 @@ const Navigation = ({ getStatus, isLogin }) => { @@ -420,7 +423,8 @@ const Navigation = ({ getStatus, isLogin }) => { - + + ); diff --git a/src/components/BottomSheetComponents/ProfileAddress.js b/src/components/BottomSheetComponents/ProfileAddress.js new file mode 100644 index 0000000..e69de29 diff --git a/src/redux/store.js b/src/redux/store.js index 3fc02b8..5661daf 100644 --- a/src/redux/store.js +++ b/src/redux/store.js @@ -65,7 +65,6 @@ try { console.log(e); } -AsyncStorage.clear(); console.disableYellowBox = true; diff --git a/src/screens/Profile/arrow-left.svg b/src/screens/Profile/arrow-left.svg deleted file mode 100644 index 56ac1ad..0000000 --- a/src/screens/Profile/arrow-left.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/screens/Profile/components/List.js b/src/screens/Profile/components/List.js index bdc79de..5a901ea 100644 --- a/src/screens/Profile/components/List.js +++ b/src/screens/Profile/components/List.js @@ -5,23 +5,27 @@ import { Appearance, Platform, TouchableOpacity, + Dimensions } from "react-native"; import React from "react"; import { connect } from "react-redux"; import Svg, { Path, G } from "react-native-svg"; import { useNavigation } from "@react-navigation/native"; +//components + //style import tw from "tailwind-rn"; import fontSize from "../../../constants/fontSize"; import Colors from "../../../constants/Colors"; const ios = Platform.OS === "ios"; +const {height} = Dimensions.get("window"); const List = ({}) => { const navigation = useNavigation(); const colorScheme = Appearance.getColorScheme(); - const [dropdown, setDropdown] = React.useState(true); + const pages = [ { icon: ( @@ -158,7 +162,7 @@ const List = ({}) => { ), name: "لیست علاقه‌مندی‌ها", - onPress: () => {}, + onPress: () => navigation.push('ProfileBookmark'), }, { icon: ( @@ -192,9 +196,10 @@ const List = ({}) => { ), name: "آدرس‌ها", - onPress: () => {}, + onPress: () => navigation.push("ProfileAddress"), }, ]; + return ( {pages.map((page, index) => ( diff --git a/src/screens/Profile/components/ProfileAddress/dots.svg b/src/screens/Profile/components/ProfileAddress/dots.svg new file mode 100644 index 0000000..a7e8e05 --- /dev/null +++ b/src/screens/Profile/components/ProfileAddress/dots.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/screens/Profile/components/ProfileAddress/index.js b/src/screens/Profile/components/ProfileAddress/index.js new file mode 100644 index 0000000..ec2ea01 --- /dev/null +++ b/src/screens/Profile/components/ProfileAddress/index.js @@ -0,0 +1,303 @@ +import { + View, + Text, + Pressable, + TouchableOpacity, + Appearance, + ActivityIndicator, + SafeAreaView, + ScrollView, + StyleSheet, + Platform, + Dimensions, + StatusBar, +} from "react-native"; +import React from "react"; +import { connect } from "react-redux"; +import { useNavigation } from "@react-navigation/native"; +import { userAddress, userFactor } from "../../../../redux/actions"; +import Svg, { G, Path } from "react-native-svg"; + +//components +import Navbar from "../../../../components/Navbar"; +import CustomPressable from "../../../../components/Pressable"; + +//style +import tw from "tailwind-rn"; +import Colors from "../../../../constants/Colors"; +import fontSize from "../../../../constants/fontSize"; + +const { height, width } = Dimensions.get("window"); + +const ProfileAddress = ({ + addresses, + update, + getList, + userId, + userAddressId, + getFactorInfo, + loading, + closeBottomSheet, +}) => { + const colorScheme = Appearance.getColorScheme(); + const navigation = useNavigation(); + + const Location = ({ address, active }) => { + console.log(address); + return ( + + userAddressId === address?.id + ? {} + : update({ userAddressId: address.id, userId }) + } + > + + {active && ( + + + + آدرس انتخابی شما + + + فعال + + + + + + + + + + )} + + + + {"آدرس:" + " " + address.address} + + + {"نام:" + " " + address.firstName + " " + address.lastName} + + + {"کد پستی:" + " " + address.postalCode} + + + {"شماره تماس:" + " " + address.cellphone} + + + {!active && ( + + + + + + + )} + + + {}} + /> + + + ); + }; + + React.useEffect(() => { + getFactorInfo({ userId }); + getList(); + }, []); + + return ( + + + + + + {addresses.map((address, index) => ( + + ))} + + + + + navigation.push("CreateAddress")} + > + + یک آدرس جدید اضافه کنید + + + + + + + + + ); +}; + +const mapStateToProps = (state) => ({ + userId: state.user.status?.id, + userAddressId: state.userFactor.info?.userAddressId, + loading: state.userFactor.loading, + addresses: state.userAddress.list, +}); + +const mapDispatchToProps = { + getFactorInfo: userFactor.info, + update: userFactor.update, + getList: userAddress.list, +}; + +export default connect(mapStateToProps, mapDispatchToProps)(ProfileAddress); + +const styles = StyleSheet.create({ + contentContainerStyle: { + paddingBottom: 100, + position: "relative", + minHeight: height - 150, + }, + container: { + width: Dimensions.get("window").width, + backgroundColor: "white", + flexDirection: "column", + paddingVertical: 0, + paddingHorizontal: 0, + }, +}); diff --git a/src/screens/Profile/components/ProfileBookmark/index.js b/src/screens/Profile/components/ProfileBookmark/index.js new file mode 100644 index 0000000..289889b --- /dev/null +++ b/src/screens/Profile/components/ProfileBookmark/index.js @@ -0,0 +1,12 @@ +import { View, Text } from 'react-native' +import React from 'react' + +const ProfileBookmark = () => { + return ( + + ProfileBookmark + + ) +} + +export default ProfileBookmark \ No newline at end of file diff --git a/src/screens/Profile/index.js b/src/screens/Profile/index.js index 0f6e8ff..dce652d 100644 --- a/src/screens/Profile/index.js +++ b/src/screens/Profile/index.js @@ -82,6 +82,7 @@ const styles = StyleSheet.create({ contentContainerStyle: { paddingBottom: 100, position: "relative", + minHeight: height - 100 }, container: { width: Dimensions.get("window").width,