reza added some change

master
Reza_ashrafi 3 years ago
parent 7b16deabe0
commit 9400f85860
  1. 2
      navigation/index.js
  2. 81
      src/components/BottomSheetComponents/ProductQuestion.js
  3. 44
      src/components/Empty.js
  4. 2
      src/components/Navbar.js
  5. 7
      src/redux/reducers/userFavorite.js
  6. 7
      src/screens/Home/components/Blogs.js
  7. 82
      src/screens/Home/components/MyBooks.js
  8. 6
      src/screens/Home/components/Scroll.js
  9. 12
      src/screens/Home/components/Videos.js
  10. 6
      src/screens/Product/components/Book.js
  11. 15
      src/screens/Profile/components/ProfileAddress/index.js
  12. 39
      src/screens/Profile/components/ProfileBookmark/index.js
  13. 3
      src/screens/Profile/components/User.js
  14. 17
      src/screens/ShoppingCart/index.js
  15. 2
      src/screens/VideoDisplay/index.js

@ -67,7 +67,7 @@ const BottomTabNavigator = ({}) => {
tabBarActiveTintColor: Colors.theme1[colorScheme].green79,
tabBarInactiveTintColor: "grey",
tabBarStyle: {
backgroundColor: Colors.theme1[colorScheme].greenFF1,
backgroundColor: Colors.theme1[colorScheme].white,
},
tabBarLabelStyle: {
// fontSize: fontSize.sm,

@ -15,12 +15,48 @@ import fontSize from "../../constants/fontSize";
import tw from "tailwind-rn";
import Colors from "../../constants/Colors";
const { width } = Dimensions.get("window");
const ios = Platform.OS === "ios";
const ProductQuestion = ({ list, mobile }) => {
const colorScheme = Appearance.getColorScheme();
const Question = ({ question }) => {
return (
<View style={{ flex: 1, paddingHorizontal: 16 }}>
<View
onPress={() => refRBSheet.current.open()}
style={[
tw(
`flex flex-row-reverse justify-between items-center mt-3 rounded-md px-2 ${
mobile ? "py-3" : "py-4"
} mb-4`
),
{
backgroundColor: Colors.theme1[colorScheme].greenFF1,
},
]}
>
<Text
style={[
{
fontSize: mobile ? fontSize.sm : fontSize.xl3,
color: Colors.theme1[colorScheme].green79,
fontFamily: "demi",
},
]}
>
پرسش و پاسخ
</Text>
</View>
<ScrollView style={tw("flex-1")}>
{/* {list?.map((question, index) => (
<Question question={question} key={index} mobile={mobile} />
))} */}
</ScrollView>
</View>
);
};
const Question = ({ question, mobile }) => {
const colorScheme = Appearance.getColorScheme();
return (
<View style={[tw("flex mb-3")]}>
<Text
@ -41,9 +77,9 @@ const ProductQuestion = ({ list, mobile }) => {
textAlign: ios ? "right" : "auto",
}}
>
{question.question}
{question?.question}
</Text>
{question.answer && (
{question?.answer && (
<>
<Text
style={{
@ -65,7 +101,7 @@ const ProductQuestion = ({ list, mobile }) => {
marginTop: mobile ? "" : 10,
}}
>
{question.question}
{question?.answer}
</Text>
</>
)}
@ -73,41 +109,6 @@ const ProductQuestion = ({ list, mobile }) => {
<Divider type="vertical" />
</View>
);
};
return (
<View style={{ flex: 1, paddingHorizontal: 16 }}>
<View
onPress={() => refRBSheet.current.open()}
style={[
tw(
`flex flex-row-reverse justify-between items-center mt-3 rounded-md px-2 ${
mobile ? "py-3" : "py-4"
} mb-4`
),
{
backgroundColor: Colors.theme1[colorScheme].greenFF1,
},
]}
>
<Text
style={[
{
fontSize: mobile ? fontSize.sm : fontSize.xl3,
color: Colors.theme1[colorScheme].green79,
fontFamily: "demi",
},
]}
>
پرسش و پاسخ
</Text>
</View>
<ScrollView style={tw("flex-1")}>
{list.map((question, index) => (
<Question question={question} key={index} />
))}
</ScrollView>
</View>
);
};
const mapStateToProps = (state) => ({

@ -0,0 +1,44 @@
import { View, Text, Pressable, Appearance } from "react-native";
import React from "react";
//style
import Colors from "../constants/Colors";
import tw from "tailwind-rn";
import fontSize from "../constants/fontSize";
const Empty = ({ text, buttonText, buttonAction }) => {
const colorScheme = Appearance.getColorScheme();
return (
<View style={tw("flex-1 flex justify-center items-center")}>
<Text
style={[
tw("text-gray-500"),
{
fontFamily: "regular",
fontSize: fontSize.tiny,
transform: [{ translateY: -50 }],
},
]}
>
{text + " " + ":("}
</Text>
{buttonText && (
<Pressable style={[tw('py-2 px-5 rounded-sm'),{ backgroundColor: Colors.theme1[colorScheme].greenCF }]} onPress={() => buttonAction()}>
<Text
style={[
tw("text-white"),
{
fontFamily: "regular",
fontSize: fontSize.tiny,
},
]}
>
{buttonText}
</Text>
</Pressable>
)}
</View>
);
};
export default Empty;

@ -80,7 +80,7 @@ const Navbar = ({
<Text
style={{
fontFamily: "bold",
fontSize: fontSize.xl,
fontSize: fontSize.lg,
color: Color.theme1[colorScheme].green79,
paddingRight: 16,
}}

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

@ -29,8 +29,8 @@ const ios = Platform.OS === "ios";
function Blogs({ blogs, mobile }) {
return (
<View style={[tw("flex pr-3 mb-5")]}>
<View style={tw("w-full pl-3")}>
<View style={[tw("flex mb-5")]}>
<View style={tw("w-full px-4")}>
<Header title={"خواندنیها"} route={"Blogs"} />
</View>
<FlatList
@ -54,7 +54,7 @@ const Blog = ({ blog, mobile }) => {
return (
<Pressable
style={[
tw("rounded-md ml-3 rounded-md relative"),
tw("rounded-md mr-4 rounded-md relative"),
{ width: mobile ? 250 : width / 2.2 },
]}
onPress={() => navigation.push("Blog", { id: blog?.id })}
@ -106,7 +106,6 @@ const Blog = ({ blog, mobile }) => {
style={[tw("rounded-full ml-1"), { width: 20, flex: 1 }]}
/>
</View>
<Text
style={[
{

@ -22,12 +22,50 @@ const ios = Platform.OS === "ios";
function MyBooks({ books, grades }) {
const colorScheme = Appearance.getColorScheme();
return (
<View style={[tw("flex w-full mb-5")]}>
<View
style={[
tw(`w-full flex rounded-md pt-3 overflow-hidden`),
{
backgroundColor: Colors.theme1[colorScheme].greenCF + "0F",
borderColor: Colors.theme1[colorScheme].greenD9 + "",
borderWidth: 1,
},
]}
>
<Text
style={[
tw(`pr-4 ${ios ? "text-right" : ""} w-full`),
{
color: Colors.theme1[colorScheme].green79,
fontFamily: "demi",
fontSize: fontSize.lg,
},
]}
>
کتابهای من
</Text>
<FlatList
showsHorizontalScrollIndicator={false}
style={[tw("py-3")]}
horizontal={true}
inverted={true}
data={books}
renderItem={({ item }) => <Book book={item} grades={grades} />}
keyExtractor={(book) => book?.id}
/>
</View>
</View>
);
}
const Book = ({ book }) => {
const Book = ({ book, grades }) => {
const colorScheme = Appearance.getColorScheme();
const navigation = useNavigation();
return (
<Pressable
style={tw(`flex ml-3 ${ios ? "items-end" : ""}`)}
style={tw(`flex mr-4 ${ios ? "items-end" : ""}`)}
onPress={() => {}}
>
<View style={{ height: 165 }}>
@ -71,45 +109,7 @@ function MyBooks({ books, grades }) {
<Progress percent={60} alignItems={"items-end"} />
</Pressable>
);
};
return (
<View style={[tw("flex w-full px-4 mb-5")]}>
<View
style={[
tw(`w-full flex rounded-md pt-3 px-2 overflow-hidden`),
{
backgroundColor: Colors.theme1[colorScheme].greenCF + "0F",
borderColor: Colors.theme1[colorScheme].greenD9 + "",
borderWidth: 1,
},
]}
>
<Text
style={[
tw(`${ios ? "text-right" : ""} w-full`),
{
color: Colors.theme1[colorScheme].green79,
fontFamily: "demi",
fontSize: fontSize.lg,
},
]}
>
کتابهای من
</Text>
<FlatList
showsHorizontalScrollIndicator={false}
style={[tw("py-3")]}
horizontal={true}
inverted={true}
data={books}
renderItem={({ item }) => <Book book={item} />}
keyExtractor={(book) => book?.id}
/>
</View>
</View>
);
}
};
const mapStateToProps = (state) => ({
grades: state.publicApi.grades,

@ -25,10 +25,11 @@ function Scroll({ books, mobile }) {
navigation.navigate("Product", { id: book?.id, type: "book" })
}
style={[
tw("mx-1 overflow-hidden"),
tw("mr-1 overflow-hidden"),
{
width: position === 0 ? mobile ? 163 : 240 : mobile ? 84 : 125,
height: position === 0 ? mobile ? 245 : 350 : mobile ? 118 : 170,
marginLeft : position === 0 ? 16 : 4,
},
]}
>
@ -58,7 +59,7 @@ function Scroll({ books, mobile }) {
);
};
return (
<View style={[tw(`flex pr-3 mb-5`)]}>
<View style={[tw(`flex mb-5`)]}>
<FlatList
showsHorizontalScrollIndicator={false}
horizontal={true}
@ -67,7 +68,6 @@ function Scroll({ books, mobile }) {
data={[{ id: 0 }]}
renderItem={({}) => <Box books={books} />}
keyExtractor={(item) => item.id}
/>
</View>
);

@ -23,13 +23,11 @@ const ios = Platform.OS === "ios";
function Videos({ videos, grades, mobile }) {
return (
<View style={[tw("w-full px-2 mb-5")]}>
<View
style={[
tw("w-full flex rounded-md pt-2 px-2 overflow-hidden"),
]}
>
<View style={[tw("w-full mb-5")]}>
<View style={[tw("w-full flex rounded-md pt-2 overflow-hidden")]}>
<View style={tw('flex px-4')}>
<Header title="دورههای ویدئویی شما" route={"VOD"} />
</View>
<FlatList
showsHorizontalScrollIndicator={false}
style={[tw("py-3")]}
@ -52,7 +50,7 @@ const Video = ({ video, mobile, grades }) => {
return (
<Pressable
style={[
tw(`flex relative ${mobile ? "ml-3" : "ml-5"}`),
tw(`flex relative ${mobile ? "mr-4" : "ml-5"}`),
{ width: mobile ? 130 : 200, height: mobile ? 280 : 280 },
]}
onPress={() => navigation.navigate("Video", { id: video.id })}

@ -594,19 +594,19 @@ function Book({
component={
<ProductSpecifications list={book?.product[type]?.properties} />
}
height={height - height / 4}
height={height / 2}
/>
<LinkBox
title="نقد بررسی و توضیحات تکمیلی محصول"
key={"1"}
component={<ProductReview />}
height={height - height / 4}
height={height / 2}
/>
<LinkBox
title="پرسش و پاسخ"
key={"2"}
component={<ProductQuestion />}
height={height - height / 4}
height={height / 2}
/>
{product.rates && (
<View

@ -21,6 +21,7 @@ import Svg, { G, Path } from "react-native-svg";
//components
import Navbar from "../../../../components/Navbar";
import CustomPressable from "../../../../components/Pressable";
import Empty from "../../../../components/Empty";
//style
import tw from "tailwind-rn";
@ -106,11 +107,7 @@ const ProfileAddress = ({
</Svg>
</View>
)}
<View
style={tw(
`flex w-full ${active ? "" : "flex-row-reverse"}`
)}
>
<View style={tw(`flex w-full ${active ? "" : "flex-row-reverse"}`)}>
<View style={tw("flex flex-1 mb-4")}>
<Text
style={[
@ -208,8 +205,8 @@ const ProfileAddress = ({
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
position: "relative",
backgroundColor: "white",
flex : 1,
paddingBottom : 20
flex: 1,
paddingBottom: 20,
}}
>
<Navbar
@ -223,6 +220,7 @@ const ProfileAddress = ({
back: true,
}}
/>
{addresses.length > 0 ? (
<ScrollView
contentContainerStyle={styles.contentContainerStyle}
style={[styles.container]}
@ -240,6 +238,9 @@ const ProfileAddress = ({
</View>
</View>
</ScrollView>
) : (
<Empty text="هیچ آدرسی ثبت نشده :(" />
)}
<View style={tw("w-full px-4")}>
<TouchableOpacity
style={[

@ -16,10 +16,11 @@ import React from "react";
import { connect } from "react-redux";
import { useNavigation } from "@react-navigation/native";
import Svg, { Path } from "react-native-svg";
import {userFavorite} from '../../../../redux/actions';
import { userFavorite } from "../../../../redux/actions";
//components
import Navbar from "../../../../components/Navbar";
import Empty from "../../../../components/Empty";
//style
import tw from "tailwind-rn";
@ -33,10 +34,9 @@ const { height, width } = Dimensions.get("window");
const ios = Platform.OS === "ios";
const ProfileBookmark = ({ bookmarkList, getList }) => {
React.useEffect(() => {
getList();
},[]);
}, []);
return (
<SafeAreaView
@ -57,28 +57,33 @@ const ProfileBookmark = ({ bookmarkList, getList }) => {
back: true,
}}
/>
{bookmarkList?.length > 0 ? (
<ScrollView
contentContainerStyle={styles.contentContainerStyle}
style={styles.container}
>
<View style={tw("w-full mt-2 px-4")}>
<View style={tw("p-0 m-0 flex ")}>
{bookmarkList.map((bookmark, index) => (
<View style={tw("p-0 m-0 flex")}>
{bookmarkList?.map((bookmark, index) => (
<Bookmark key={index} bookmark={bookmark} />
))}
</View>
</View>
</ScrollView>
) : (
<Empty text="لیست علاقهمندیها خالی است." />
)}
</SafeAreaView>
);
};
const Bookmark = ({ bookmark }) => {
const colorScheme = Appearance.getColorScheme();
return (
<Pressable
style={[
tw("flex flex-row-reverse rounded-md justify-between px-3.5 py-2"),
tw("flex flex-row-reverse rounded-md justify-between px-3.5 py-2 bg-red-100"),
{
borderWidth: 1.5,
borderColor: Colors.theme1[colorScheme].greenCF,
@ -144,11 +149,11 @@ const Bookmark = ({ bookmark }) => {
const mapStateToProps = (state) => ({
loading: state.userFactor.loading,
mobile: state.publicApi.mobile,
bookmarkList : state.userFavorite.list
bookmarkList: state.userFavorite.list,
});
const mapDispatchToProps = {
getList : userFavorite.list,
getList: userFavorite.list,
};
export default connect(mapStateToProps, mapDispatchToProps)(ProfileBookmark);
@ -166,12 +171,12 @@ const styles = StyleSheet.create({
},
});
ProfileBookmark.defaultProps = {
bookmarkList: [
{
name: "کتاب آموزشی علوم تجربی",
grade: "پایه ششم ابتدایی",
image: bookImage,
},
],
};
// ProfileBookmark.defaultProps = {
// bookmarkList: [
// {
// name: "کتاب آموزشی علوم تجربی",
// grade: "پایه ششم ابتدایی",
// image: bookImage,
// },
// ],
// };

@ -58,7 +58,7 @@ const User = ({ user, mobile }) => {
fontFamily: "bold",
}}
>
{user?.firstName + " " + user?.lastName}
{(user?.firstName || " ") + " " + (user?.lastName || " ")}
</Text>
<Text
style={{
@ -93,7 +93,6 @@ const User = ({ user, mobile }) => {
}`
)}
>
<View
style={[
tw(`flex items-center w-full pb-3 mb-3 flex-row-reverse`),

@ -17,7 +17,7 @@ import { Ionicons } from "@expo/vector-icons";
import { useNavigation } from "@react-navigation/native";
import { asyncAwesomeAlert } from "../../utils/AsyncWrappers";
import separate from "../../utils/separate";
import * as Linking from 'expo-linking';
import * as Linking from "expo-linking";
//components
import Product from "./components/Product";
@ -25,6 +25,7 @@ import Code from "./components/Code";
import CustomPressable from "../../components/Pressable";
import Navbar from "../../components/Navbar";
import Drawer from "../../components/Drawer";
import Empty from "../../components/Empty";
//style
import fontSize from "../../constants/fontSize";
@ -103,7 +104,7 @@ function ShoppingCart({
.length !== 0;
useEffect(() => {
if(list.length === 0){
if (list.length === 0) {
getList();
}
getFactorInfo({ userId });
@ -135,6 +136,7 @@ function ShoppingCart({
}}
/>
<Drawer setBoxPosition={setBoxPosition} position={position} />
{list?.filter((product) => product.condition < 2)?.length > 0 ? (
<ScrollView
contentContainerStyle={styles.contentContainerStyle}
style={styles.container}
@ -252,11 +254,20 @@ function ShoppingCart({
? asyncAwesomeAlert("خطا", "سبد خرید شما خالی است.", {
showCancelButton: false,
})
: hasPhysical ? navigation.push("DeliveryForm") : payFactor({userId})
: hasPhysical
? navigation.push("DeliveryForm")
: payFactor({ userId })
}
/>
</View>
</ScrollView>
) : (
<Empty
text={"سبد خرید شما خالی است"}
buttonText={"فروشگاه"}
buttonAction={() => navigation.navigate("Products")}
/>
)}
</SafeAreaView>
);
}

@ -35,8 +35,6 @@ function VideoDisplay({ route, mobile }) {
const [status, setStatus] = React.useState({});
const [position, setPosition] = useState("100%");
useEffect(() => {}, []);
const setBoxPosition = () => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setPosition(position === "100%" ? "0%" : "100%");

Loading…
Cancel
Save