master
Reza_ashrafi 3 years ago
parent d86d4b99af
commit 6978496507
  1. 10
      src/screens/DeliveryForm/Address/index.js
  2. 36
      src/screens/DeliveryForm/TransportDate/index.js
  3. 4
      src/screens/DeliveryForm/TransportMethod/index.js
  4. 6
      src/screens/DeliveryForm/index.js
  5. 8
      src/screens/Faq/components/Instance.js
  6. 2
      src/screens/Faq/index.js
  7. 8
      src/screens/Home/components/Blogs.js
  8. 4
      src/screens/Home/components/MyBooks.js
  9. 4
      src/screens/Home/components/Scroll.js
  10. 14
      src/screens/Home/components/Videos.js
  11. 8
      src/screens/Home/index.js
  12. 10
      src/screens/OrderDetails/components/Book.js
  13. 24
      src/screens/OrderDetails/index.js
  14. 14
      src/screens/OrdersFollowUp/components/Order.js
  15. 30
      src/screens/OrdersFollowUp/index.js

@ -63,11 +63,11 @@ const Address = ({
),
]}
onPress={() => {
setSelectedItem(address.id);
active ? {} : update({ userAddressId: address.id, userId });
setSelectedItem(address?.id);
active ? {} : update({ userAddressId: address?.id, userId });
}}
>
{selectedItem === address.id && loading ? (
{selectedItem === address?.id && loading ? (
<ActivityIndicator size="small" color={Colors.theme1.greenC8} />
) : active ? (
<Entypo
@ -100,7 +100,7 @@ const Address = ({
},
]}
>
{address.address}
{address?.address}
</Text>
</View>
</Pressable>
@ -110,7 +110,7 @@ const Address = ({
return (
<View style={tw("w-full mt-2")}>
<View style={tw("p-0 m-0 flex ")}>
{addresses.map((address, index) => (
{addresses?.map((address, index) => (
<Location
address={address}
key={index}

@ -20,15 +20,19 @@ const TransportDate = ({ transportDate, mobile, theme }) => {
return (
<Pressable
style={[
tw(`flex flex-row-reverse justify-between items-center w-full px-3 ${mobile ? "py-3" : "py-2"} rounded-sm mt-3`),
tw(
`flex flex-row-reverse justify-between items-center w-full px-3 ${
mobile ? "py-3" : "py-2"
} rounded-sm mt-3`
),
{
backgroundColor: light ? active
backgroundColor: light
? active
? Colors.theme1.greenCF + "15"
: Colors.theme1.grayE3 + "44" : null,
: Colors.theme1.grayE3 + "44"
: null,
borderWidth: 1.5,
borderColor: active
? Colors.theme1.greenCF
: Colors.theme1.grayE3,
borderColor: active ? Colors.theme1.greenCF : Colors.theme1.grayE3,
},
]}
onPress={() => setActiveDate(time)}
@ -38,11 +42,15 @@ const TransportDate = ({ transportDate, mobile, theme }) => {
fontFamily: "regular",
fontSize: mobile ? fontSize.tiny : fontSize.xl,
color: active
? light ? Colors.theme1.gray20 : Colors.theme1.greenCF
: light ? Colors.theme1.gray20 : Colors.theme1.white,
? light
? Colors.theme1.gray20
: Colors.theme1.greenCF
: light
? Colors.theme1.gray20
: Colors.theme1.white,
}}
>
{time.time}
{time?.time}
</Text>
<View style={tw("flex flex-row-reverse items-center")}>
@ -61,8 +69,12 @@ const TransportDate = ({ transportDate, mobile, theme }) => {
fontFamily: "regular",
fontSize: mobile ? fontSize.sm : fontSize.base,
color: active
? light ? Colors.theme1.green20 : Colors.theme1.greenCF
: light ? Colors.theme1.gray20 : Colors.theme1.white,
? light
? Colors.theme1.green20
: Colors.theme1.greenCF
: light
? Colors.theme1.gray20
: Colors.theme1.white,
}}
>
تکمیل ظرفیت
@ -95,7 +107,7 @@ const TransportDate = ({ transportDate, mobile, theme }) => {
const mapStateToProps = (state) => ({
mobile: state.publicApi.mobile,
theme: state.publicApi.theme
theme: state.publicApi.theme,
});
const mapDispatchToProps = {};

@ -99,7 +99,7 @@ const TransportMethod = ({
: Colors.theme1.white,
}}
>
{method.name}
{method?.name}
</Text>
)}
<View style={tw("flex flex-row-reverse items-center")}>
@ -130,7 +130,7 @@ const TransportMethod = ({
: Colors.theme1.white,
}}
>
{separate(method.price) + " " + "تومان"}
{separate(method?.price) + " " + "تومان"}
</Text>
</View>
</Pressable>

@ -80,9 +80,9 @@ const DeliveryForm = ({
<View style={tw("w-full flex flex-row mt-5")}>
<TransportMethod />
</View>
{factorInfo.transportId === 2 ? (
{factorInfo?.transportId === 2 ? (
<View style={tw("w-full flex flex-row mt-5 mb-5")}>
<TransportDate transportDate={form.transportDate} />
<TransportDate transportDate={form?.transportDate} />
</View>
) : null}
</View>
@ -95,7 +95,7 @@ const DeliveryForm = ({
border={{ color: "#196EC0", width: 0 }}
width={"100%"}
onPress={() =>
factorInfo.transportId && factorInfo.userAddressId
factorInfo?.transportId && factorInfo?.userAddressId
? payFactor({ userId })
: asyncAwesomeAlert("خطا", "آدرس یا نحوه ارسال را وارد کنید", {
showCancelButton: false,

@ -40,9 +40,9 @@ function Instance({ question, selectFaq, mobile, theme }) {
},
]}
>
{question.title}
{question?.title}
</Text>
{question.active ? (
{question?.active ? (
<Entypo
name="minus"
size={18}
@ -60,7 +60,7 @@ function Instance({ question, selectFaq, mobile, theme }) {
/>
)}
</View>
{question.active ? (
{question?.active ? (
<View style={tw("w-full flex flex-row-reverse pt-2")}>
<Text
style={[
@ -75,7 +75,7 @@ function Instance({ question, selectFaq, mobile, theme }) {
tw("text-right flex-1"),
]}
>
{question.description}
{question?.description}
</Text>
</View>
) : null}

@ -80,7 +80,7 @@ function Faq({
placeholder={"بخشی از پرسش خود را اینجا بنویسید"}
/>
</View>
{search.length ? (
{search?.length ? (
searchResult?.length ? (
<FlatList
contentContainerStyle={{ paddingBottom: height / 2 }}

@ -30,7 +30,7 @@ const ios = Platform.OS === "ios";
function Blogs({ blogs, mobile, theme }) {
return (
<View style={[tw("flex")]}>
{blogs.length ? (
{blogs?.length ? (
<>
<View style={tw("w-full px-4")}>
<Header title={"خواندنیها"} route={"Blogs"} />
@ -40,11 +40,11 @@ function Blogs({ blogs, mobile, theme }) {
horizontal={true}
inverted={true}
style={[tw("flex flex-row mt-3")]}
data={blogs.slice(0, 7)}
data={blogs?.slice(0, 7)}
renderItem={({ item }) => (
<Blog blog={item} mobile={mobile} theme={theme} />
)}
keyExtractor={(item) => item.id}
keyExtractor={(item) => item?.id}
initialNumToRender={5}
/>
</>
@ -98,7 +98,7 @@ const Blog = ({ blog, mobile, theme }) => {
},
]}
>
{blog.title}
{blog?.title}
</Text>
<View style={[tw("flex flex-row-reverse justify-between")]}>
<View style={tw("flex-row-reverse items-center")}>

@ -20,7 +20,7 @@ import fontSize from "../../../constants/fontSize";
const ios = Platform.OS === "ios";
function MyBooks({ books, grades, theme }) {
return books?.filter((book) => book.condition >= 2).length ? (
return books?.filter((book) => book?.condition >= 2).length ? (
<View style={[tw("flex w-full mb-5")]}>
<View
style={[
@ -55,7 +55,7 @@ function MyBooks({ books, grades, theme }) {
style={[tw("py-3")]}
horizontal={true}
inverted={true}
data={books?.filter((book) => book.condition >= 2)}
data={books?.filter((book) => book?.condition >= 2)}
renderItem={({ item }) => (
<Book book={item} grades={grades} theme={theme} />
)}

@ -28,7 +28,7 @@ function Scroll({ books, mobile }) {
>
<Image
resizeMode="contain"
source={{ uri: `https://dnvn.ir/api/v1/file/${book.fileIds}` }}
source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }}
style={{ width: "100%", height: "100%" }}
/>
</Pressable>
@ -43,7 +43,7 @@ function Scroll({ books, mobile }) {
{ height: mobile ? 242 : 350, direction: "rtl" },
]}
>
{books.slice(0, 14).map((book, index) => (
{books.slice(0, 14)?.map((book, index) => (
<Product book={book} position={Number(index)} key={index} />
))}
</View>

@ -17,7 +17,7 @@ function Videos({ videos, grades, mobile, theme }) {
return (
<View style={[tw("w-full mb-0")]}>
<View style={[tw("w-full flex rounded-md pt-2 overflow-hidden")]}>
{videos.length ? (
{videos?.length ? (
<>
<View style={tw("flex px-4")}>
<Header title="دورههای ویدئویی شما" route={"VOD"} />
@ -27,7 +27,7 @@ function Videos({ videos, grades, mobile, theme }) {
style={[tw("py-3")]}
horizontal={true}
inverted={true}
data={videos.slice(0, 7)}
data={videos?.slice(0, 7)}
renderItem={({ item }) => (
<Video
video={item}
@ -36,7 +36,7 @@ function Videos({ videos, grades, mobile, theme }) {
theme={theme}
/>
)}
keyExtractor={(item) => item.id}
keyExtractor={(item) => item?.id}
/>
</>
) : null}
@ -53,10 +53,10 @@ const Video = ({ video, mobile, grades, theme }) => {
tw(`flex relative ${mobile ? "mr-4" : "ml-5"}`),
{ width: mobile ? 200 : 200, height: mobile ? 210 : 210 },
]}
onPress={() => navigation.navigate("Video", { id: video.id })}
onPress={() => navigation.navigate("Video", { id: video?.id })}
>
<Image
source={{ uri: `https://dnvn.ir/api/v1/file/${video.fileIds}` }}
source={{ uri: `https://dnvn.ir/api/v1/file/${video?.fileIds}` }}
// resizeMode="contain"
style={[
tw("bg-gray-100"),
@ -77,7 +77,7 @@ const Video = ({ video, mobile, grades, theme }) => {
},
]}
>
{"دوره ویدئویی" + " " + video.name}
{"دوره ویدئویی" + " " + video?.name}
</Text>
<Text
style={[
@ -91,7 +91,7 @@ const Video = ({ video, mobile, grades, theme }) => {
},
]}
>
{"پایه" + " " + grades[video.gradeId]}
{"پایه" + " " + grades[video?.gradeId]}
</Text>
<View style={tw("absolute bottom-0 left-0 w-full")}>
<Progress percent={60} alignItems={"items-end"} />

@ -47,11 +47,11 @@ const Home = ({
};
React.useEffect(() => {
if (blogs.length === 0) {
if (blogs?.length === 0) {
getBlogs();
} else if (books.length === 0) {
} else if (books?.length === 0) {
getBooks({ vod: true });
} else if (userProducts.length === 0) {
} else if (userProducts?.length === 0) {
getUserProducts();
}
}, [books, userProducts, blogs]);
@ -77,7 +77,7 @@ const Home = ({
>
{!mobile ? <View style={tw("mt-5")}></View> : null}
<MyBooks books={userProducts} />
{books.length ? (
{books?.length ? (
<View style={tw("px-4 w-full")}>
<Header title={"فروشگاه"} route={"Products"} />
</View>

@ -23,7 +23,7 @@ function Book({ book, mobile, grades, theme }) {
<Image
resizeMode="contain"
source={{
uri: `https://dnvn.ir/api/v1/file/${book.product.book.fileIds}`,
uri: `https://dnvn.ir/api/v1/file/${book?.product?.book.fileIds}`,
}}
style={[
tw("rounded-md"),
@ -46,7 +46,7 @@ function Book({ book, mobile, grades, theme }) {
},
]}
>
{book.product.book.name || " "}
{book?.product?.book?.name || " "}
</Text>
<Text
style={[
@ -61,7 +61,7 @@ function Book({ book, mobile, grades, theme }) {
},
]}
>
{"پایه" + " " + grades[book.product.book.gradeId]}
{"پایه" + " " + grades[book?.product?.book?.gradeId]}
</Text>
{/* <Text
style={[
@ -91,7 +91,7 @@ function Book({ book, mobile, grades, theme }) {
},
]}
>
{book.product.count}
{book?.product?.count}
</Text>
<View style={tw("flex flex-row items-center")}>
<Text
@ -117,7 +117,7 @@ function Book({ book, mobile, grades, theme }) {
},
]}
>
{book.product.price}
{book?.product?.price}
</Text>
</View>
</View>

@ -43,7 +43,7 @@ const status = {
};
function OrderDetails({ mobile, route, theme }) {
const { order } = route.params;
const { order } = route?.params;
const [position, setPosition] = useState("100%");
React.useEffect(() => {
@ -112,12 +112,12 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
{status[order.condition]}
{status[order?.condition]}
</Text>
<View
style={[
tw("h-4 w-4 rounded-full mr-2"),
{ backgroundColor: colors[order.condition] },
{ backgroundColor: colors[order?.condition] },
]}
></View>
</View>
@ -206,7 +206,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
{order.recieverName || " "}
{order?.recieverName || " "}
</Text>
</View>
<View style={tw("flex flex-row-reverse items-center")}>
@ -240,7 +240,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
{order.recieverPhone || " "}
{order?.recieverPhone || " "}
</Text>
</View>
</View>
@ -272,7 +272,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
{"کد تحویل" + " " + order.recieverPostalCode}
{"کد تحویل" + " " + order?.recieverPostalCode}
</Text>
<Text
style={[
@ -296,7 +296,7 @@ function OrderDetails({ mobile, route, theme }) {
</Text>
</View>
<View style={tw("w-full flex items-end")}>
{order.userProducts.map((item, index) => (
{order?.userProducts.map((item, index) => (
<Book book={item} key={index} />
))}
</View>
@ -331,7 +331,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
{order.sumPrice + " " + "تومان"}
{order?.sumPrice + " " + "تومان"}
</Text>
</View>
</View>
@ -375,7 +375,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
{order.transportPrice + " " + "تومان"}
{order?.transportPrice + " " + "تومان"}
</Text>
</View>
<View style={tw("flex flex-row-reverse")}>
@ -408,7 +408,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
{order.payPrice + " " + "تومان"}
{order?.payPrice + " " + "تومان"}
</Text>
</View>
</View>
@ -452,7 +452,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
{order.transactionId}
{order?.transactionId}
</Text>
</View>
</View>
@ -487,7 +487,7 @@ function OrderDetails({ mobile, route, theme }) {
},
]}
>
{moment(order.payedAt).format("jYYYY/jMM/jDD")}
{moment(order?.payedAt)?.format("jYYYY/jMM/jDD")}
</Text>
</View>
</View>

@ -67,7 +67,7 @@ function Order({ order, mobile, theme }) {
},
]}
>
{"شماره سفارش:" + " " + order.transactionId}
{"شماره سفارش:" + " " + order?.transactionId}
</Text>
<View style={tw("flex flex-row-reverse items-center")}>
<Text
@ -83,12 +83,12 @@ function Order({ order, mobile, theme }) {
},
]}
>
{status[order.condition]}
{status[order?.condition]}
</Text>
<View
style={[
tw("h-4 w-4 rounded-full mr-2"),
{ backgroundColor: colors[order.condition] },
{ backgroundColor: colors[order?.condition] },
]}
></View>
</View>
@ -96,7 +96,7 @@ function Order({ order, mobile, theme }) {
<View style={tw("w-full flex flex-row-reverse justify-between p-3")}>
<View style={tw("flex ")}>
<View style={tw("flex flex-row-reverse mb-2")}>
{order.userProducts.map((product, index) => (
{order?.userProducts?.map((product, index) => (
<Image
key={index}
source={{
@ -126,7 +126,7 @@ function Order({ order, mobile, theme }) {
},
]}
>
{"کد تحویل:" + " " + order.followCode}
{"کد تحویل:" + " " + order?.followCode}
</Text>
</View>
</View>
@ -144,7 +144,7 @@ function Order({ order, mobile, theme }) {
},
]}
>
{"جمع فاکتور:" + " " + order.payPrice}
{"جمع فاکتور:" + " " + order?.payPrice}
</Text>
<TouchableOpacity
onPress={() => navigation.navigate("Order", { order: order })}
@ -199,7 +199,7 @@ function Order({ order, mobile, theme }) {
>
{"تاریخ سفارش:" +
" " +
moment(order.payedAt).format("jYYYY/jMM/jDD")}
moment(order?.payedAt)?.format("jYYYY/jMM/jDD")}
</Text>
</View>
</View>

@ -67,7 +67,7 @@ function OrdersFollowUp({ orders, getList, theme }) {
contentContainerStyle={styles.contentContainerStyle}
style={styles.container}
>
{orders.map((order, index) => (
{orders?.map((order, index) => (
<Order order={order} key={index} />
))}
</ScrollView>
@ -105,31 +105,3 @@ const mapDispatchToProps = {
export default connect(mapStateToProps, mapDispatchToProps)(OrdersFollowUp);
OrdersFollowUp.defaultProps = {
orders: [
{
number: "535353523653",
receiveCode: "300031",
status: 2,
items: [b1Image, b1Image, b1Image, b1Image],
date: "1400/1/12",
cost: "1.240.000",
},
{
number: "535353523653",
receiveCode: "300031",
status: 3,
items: [b1Image, b1Image, b1Image],
date: "1400/1/12",
cost: "1.240.000",
},
{
number: "535353523653",
receiveCode: "300031",
status: 4,
items: [b1Image, b1Image, b1Image],
date: "1400/1/12",
cost: "1.240.000",
},
],
};

Loading…
Cancel
Save