some change

master
Reza_ashrafi 3 years ago
parent 9400f85860
commit ed0b11f49b
  1. 4
      src/redux/actions/userFactor.js
  2. 2
      src/redux/actions/userFavorite.js
  3. 11
      src/redux/reducers/userFactor.js
  4. 20
      src/redux/reducers/userFavorite.js
  5. 44
      src/screens/Address/index.js
  6. 24
      src/screens/OrdersFollowUp/index.js
  7. 44
      src/screens/Profile/components/ProfileBookmark/index.js
  8. 2
      src/screens/ShoppingCart/index.js

@ -50,6 +50,10 @@ const userFactor = {
await proxy.delete("userFactor/deleteUserOffCode", data, { dispatch }); await proxy.delete("userFactor/deleteUserOffCode", data, { dispatch });
await proxy.get("userFactor/info", data2, { dispatch }); await proxy.get("userFactor/info", data2, { dispatch });
}, },
fullList:
(data = {}) =>
async (dispatch) =>
await proxy.get("userFactor/fullList", data, { dispatch }),
}; };
export default userFactor; export default userFactor;

@ -21,7 +21,7 @@ const userFavorite = {
del: del:
(data = {}, data2 = {}) => (data = {}, data2 = {}) =>
async (dispatch) => { async (dispatch) => {
await proxy.delete("userFavorite/delete", data); await proxy.delete("userFavorite/delete", data, { dispatch });
await proxy.get("userFavorite/list", data2, { dispatch }); await proxy.get("userFavorite/list", data2, { dispatch });
}, },
}; };

@ -1,4 +1,4 @@
import {asyncAwesomeAlert} from '../../utils/AsyncWrappers'; import { asyncAwesomeAlert } from "../../utils/AsyncWrappers";
const initialState = { const initialState = {
loading: false, loading: false,
@ -8,6 +8,7 @@ const initialState = {
sum: null, sum: null,
checkEmpty: false, checkEmpty: false,
isVerified: null, isVerified: null,
fullList: [],
}; };
export default function userFactor(state = initialState, action) { export default function userFactor(state = initialState, action) {
// const navigation = useNavigation(); // const navigation = useNavigation();
@ -26,6 +27,14 @@ export default function userFactor(state = initialState, action) {
checkEmpty: checkEmpty.length > 0 ? false : true, checkEmpty: checkEmpty.length > 0 ? false : true,
error: null, error: null,
}; };
case "userFactor/fullList":
console.log(data);
return {
...state,
loading: false,
fullList: data,
error: null,
};
case "userFactor/info": case "userFactor/info":
return { ...state, loading: false, info: data, error: null }; return { ...state, loading: false, info: data, error: null };
case "userFactor/add": case "userFactor/add":

@ -1,31 +1,31 @@
import { toastMessage} from '../../utils/message'; import { toastMessage } from "../../utils/message";
import { asyncAwesomeAlert } from '../../utils/AsyncWrappers'; import { asyncAwesomeAlert } from "../../utils/AsyncWrappers";
const initialState = { const initialState = {
loading: false, loading: false,
error: null, error: null,
list: [], list: [],
}; };
export default function userAddress(state = initialState, action) { export default function userFavorite(state = initialState, action) {
let { type, data } = action; let { type, data } = action;
switch (type) { switch (type) {
case "userAddress/list": case "userFavorite/list":
return { return {
...state, ...state,
loading: false, loading: false,
list: data, list: data,
error: null, error: null,
}; };
case "userAddress/update": case "userFavorite/update":
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
case "userAddress/add": case "userFavorite/add":
toastMessage('به لیست علاقهمندیها اضافه شد.'); toastMessage("به لیست علاقهمندیها اضافه شد.");
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
case "userAddress/delete": case "userFavorite/delete":
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
case "userAddress/loading": case "userFavorite/loading":
return { ...state, loading: true }; return { ...state, loading: true };
case "userAddress/error": case "userFavorite/error":
asyncAwesomeAlert("خطا", data.message, { asyncAwesomeAlert("خطا", data.message, {
showCancelButton: false, showCancelButton: false,
}); });

@ -57,28 +57,28 @@ const Address = ({
useEffect(() => { useEffect(() => {
getProvince(); getProvince();
setProfileFields({ setProfileFields({
file: user.picFileId, file: user?.picFileId,
picFileId: user.picFileId, picFileId: user?.picFileId,
docFileIds: user.docFileIds, docFileIds: user?.docFileIds,
cellphone: user.cellphone, cellphone: user?.cellphone,
firstName: user.firstName, firstName: user?.firstName,
lastName: user.lastName, lastName: user?.lastName,
password: user.password, password: user?.password,
username: user.username, username: user?.username,
address: user.address, address: user?.address,
email: user.email, email: user?.email,
birthDate: user.birthDate, birthDate: user?.birthDate,
gender: user.gender, gender: user?.gender,
status: user.status, status: user?.status,
nationalId: user.nationalId, nationalId: user?.nationalId,
phone: user.phone, phone: user?.phone,
schools: user.schools, schools: user?.schools,
zoneId: user.zoneId, zoneId: user?.zoneId,
schoolId: user.schoolId, schoolId: user?.schoolId,
postalCode: user.postalCode, postalCode: user?.postalCode,
gradeIds: user.gradeIds, gradeIds: user?.gradeIds,
provinceId: user.provinceId, provinceId: user?.provinceId,
cityId: user.cityId, cityId: user?.cityId,
}); });
}, []); }, []);

@ -1,4 +1,7 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { connect } from "react-redux";
import { userFactor } from "../../redux/actions";
import { import {
Dimensions, Dimensions,
StyleSheet, StyleSheet,
@ -8,20 +11,29 @@ import {
Platform, Platform,
LayoutAnimation, LayoutAnimation,
} from "react-native"; } from "react-native";
//components
import Order from "./components/Order"; import Order from "./components/Order";
import Navbar from "../../components/Navbar"; import Navbar from "../../components/Navbar";
import Drawer from "../../components/Drawer"; import Drawer from "../../components/Drawer";
//assets
import b1Image from "./assets/b1.png"; import b1Image from "./assets/b1.png";
const width = Dimensions.get("window").width; const width = Dimensions.get("window").width;
function OrdersFollowUp({ orders }) { function OrdersFollowUp({ orders, getList }) {
const [position, setPosition] = useState("100%"); const [position, setPosition] = useState("100%");
const setBoxPosition = () => { const setBoxPosition = () => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setPosition(position === "100%" ? "0%" : "100%"); setPosition(position === "100%" ? "0%" : "100%");
}; };
React.useEffect(() => {
getList();
},[]);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
@ -67,7 +79,15 @@ const styles = StyleSheet.create({
}, },
}); });
export default OrdersFollowUp; const mapStateToProps = (state) => ({
});
const mapDispatchToProps = {
getList: userFactor.fullList,
}
export default connect(mapStateToProps, mapDispatchToProps)(OrdersFollowUp);
OrdersFollowUp.defaultProps = { OrdersFollowUp.defaultProps = {
orders: [ orders: [

@ -2,7 +2,6 @@ import {
View, View,
Text, Text,
Pressable, Pressable,
Appearance,
SafeAreaView, SafeAreaView,
ScrollView, ScrollView,
StyleSheet, StyleSheet,
@ -10,7 +9,7 @@ import {
Dimensions, Dimensions,
StatusBar, StatusBar,
Image, Image,
mobile, Appearance
} from "react-native"; } from "react-native";
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
@ -21,6 +20,7 @@ import { userFavorite } from "../../../../redux/actions";
//components //components
import Navbar from "../../../../components/Navbar"; import Navbar from "../../../../components/Navbar";
import Empty from "../../../../components/Empty"; import Empty from "../../../../components/Empty";
import Blur from "../../../../components/Blur";
//style //style
import tw from "tailwind-rn"; import tw from "tailwind-rn";
@ -33,7 +33,9 @@ import bookImage from "../../..//OrdersFollowUp/assets/b1.png";
const { height, width } = Dimensions.get("window"); const { height, width } = Dimensions.get("window");
const ios = Platform.OS === "ios"; const ios = Platform.OS === "ios";
const ProfileBookmark = ({ bookmarkList, getList }) => { const ProfileBookmark = ({ bookmarkList, getList, deleteItem, loading, mobile }) => {
const colorScheme = Appearance.getColorScheme();
React.useEffect(() => { React.useEffect(() => {
getList(); getList();
}, []); }, []);
@ -57,7 +59,22 @@ const ProfileBookmark = ({ bookmarkList, getList }) => {
back: true, back: true,
}} }}
/> />
{bookmarkList?.length > 0 ? ( {loading && (
<View
style={[
tw("absolute left-0 top-0 rounded-md overflow-hidden"),
{
width: Dimensions.get("window").width,
height: height,
zIndex: 1,
backgroundColor: Colors.theme1[colorScheme].white + "60",
},
]}
>
<Blur />
</View>
)}
{bookmarkList.length > 0 ? (
<ScrollView <ScrollView
contentContainerStyle={styles.contentContainerStyle} contentContainerStyle={styles.contentContainerStyle}
style={styles.container} style={styles.container}
@ -65,7 +82,12 @@ const ProfileBookmark = ({ bookmarkList, getList }) => {
<View style={tw("w-full mt-2 px-4")}> <View style={tw("w-full mt-2 px-4")}>
<View style={tw("p-0 m-0 flex")}> <View style={tw("p-0 m-0 flex")}>
{bookmarkList?.map((bookmark, index) => ( {bookmarkList?.map((bookmark, index) => (
<Bookmark key={index} bookmark={bookmark} /> <Bookmark
key={index}
bookmark={bookmark}
deleteItem={deleteItem}
mobile={mobile}
/>
))} ))}
</View> </View>
</View> </View>
@ -77,13 +99,13 @@ const ProfileBookmark = ({ bookmarkList, getList }) => {
); );
}; };
const Bookmark = ({ bookmark }) => { const Bookmark = ({ bookmark, deleteItem, mobile }) => {
const colorScheme = Appearance.getColorScheme(); const colorScheme = Appearance.getColorScheme();
return ( return (
<Pressable <Pressable
style={[ style={[
tw("flex flex-row-reverse rounded-md justify-between px-3.5 py-2 bg-red-100"), tw("flex flex-row-reverse rounded-md justify-between px-3.5 py-2 mb-4"),
{ {
borderWidth: 1.5, borderWidth: 1.5,
borderColor: Colors.theme1[colorScheme].greenCF, borderColor: Colors.theme1[colorScheme].greenCF,
@ -92,7 +114,7 @@ const Bookmark = ({ bookmark }) => {
> >
<View style={tw("flex flex-row-reverse items-end")}> <View style={tw("flex flex-row-reverse items-end")}>
<Image <Image
source={bookmark.image} source={bookmark?.image}
style={{ style={{
width: mobile ? width / 5 : width / 7, width: mobile ? width / 5 : width / 7,
minWidth: 80, minWidth: 80,
@ -118,10 +140,11 @@ const Bookmark = ({ bookmark }) => {
color: Colors.theme1[colorScheme].gray20, color: Colors.theme1[colorScheme].gray20,
}} }}
> >
{bookmark.grade} {bookmark?.grade}
</Text> </Text>
</View> </View>
</View> </View>
<Pressable onPress={() => deleteItem({ id: bookmark.id })}>
<Svg <Svg
data-name="vuesax/linear/archive-add" data-name="vuesax/linear/archive-add"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -143,6 +166,7 @@ const Bookmark = ({ bookmark }) => {
/> />
</Svg> </Svg>
</Pressable> </Pressable>
</Pressable>
); );
}; };
@ -150,10 +174,12 @@ const mapStateToProps = (state) => ({
loading: state.userFactor.loading, loading: state.userFactor.loading,
mobile: state.publicApi.mobile, mobile: state.publicApi.mobile,
bookmarkList: state.userFavorite.list, bookmarkList: state.userFavorite.list,
loading: state.userFavorite.loading,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
getList: userFavorite.list, getList: userFavorite.list,
deleteItem: userFavorite.del,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(ProfileBookmark); export default connect(mapStateToProps, mapDispatchToProps)(ProfileBookmark);

@ -199,7 +199,7 @@ function ShoppingCart({
}, },
]} ]}
> >
{isEmpty ? 0 : separate(factorInfo?.payPrice)} {isEmpty ? 0 : separate(factorInfo?.payPrice || '')}
</Text> </Text>
<Text <Text
style={[ style={[

Loading…
Cancel
Save