reza fixed and build app

master
Reza_ashrafi 3 years ago
parent 45773daa26
commit 75b33697d5
  1. 4
      src/components/Drawer.js
  2. 41
      src/screens/Address/index.js
  3. 55
      src/screens/Blog/index.js
  4. 3
      src/screens/Blogs/layouts/Header.js
  5. 17
      src/screens/DeliveryForm/Address/index.js
  6. 1
      src/screens/Home/components/MyBooks.js
  7. 2
      src/screens/Home/index.js
  8. 120
      src/screens/Product/components/Book.js
  9. 6
      src/screens/Products/components/Header.js
  10. 350
      src/screens/Products/components/Main.js
  11. 59
      src/screens/Profile/components/ProfileAddress/index.js
  12. 8
      src/screens/Profile/components/User.js
  13. 2
      src/screens/Profile/index.js
  14. 2
      src/screens/QR/layouts/Scan/index.js

@ -270,8 +270,10 @@ const Drawer = ({
{}, {},
]} ]}
onPress={() => { onPress={() => {
navigation.navigate(route.route);
setBoxPosition(); setBoxPosition();
setTimeout(() => {
navigation.navigate(route.route);
}, 300);
}} }}
> >
{route.icon} {route.icon}

@ -9,6 +9,7 @@ import {
Dimensions, Dimensions,
Appearance, Appearance,
KeyboardAvoidingView, KeyboardAvoidingView,
TextInput,
TouchableWithoutFeedback, TouchableWithoutFeedback,
} from "react-native"; } from "react-native";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
@ -151,7 +152,7 @@ const Address = ({
} }
); );
} }
if (cel.length !== 11) { if (cellphone.length !== 11) {
return asyncAwesomeAlert( return asyncAwesomeAlert(
"خطا", "خطا",
"شماره موبایل میبایست یازده رقم باشد.", "شماره موبایل میبایست یازده رقم باشد.",
@ -361,7 +362,6 @@ const Address = ({
title="اطلاعات هویتی" title="اطلاعات هویتی"
text="( لطفا نام و نام خانوادگی خود را به طور کامل وارد نمایید )" text="( لطفا نام و نام خانوادگی خود را به طور کامل وارد نمایید )"
/> />
<MapSelector />
<CustomTextInput <CustomTextInput
label={profilePage ? "نام" : "نام تحویل گیرنده"} label={profilePage ? "نام" : "نام تحویل گیرنده"}
placeholder="" placeholder=""
@ -443,7 +443,6 @@ const Address = ({
} }
autoFocus={false} autoFocus={false}
regex={(text) => onInput.numberOnly(text)} regex={(text) => onInput.numberOnly(text)}
editable={false}
/> />
<CustomTextInput <CustomTextInput
keyboardType="numeric" keyboardType="numeric"
@ -474,7 +473,7 @@ const Address = ({
? provinces?.filter( ? provinces?.filter(
(province) => province.id === profileFields.provinceId (province) => province.id === profileFields.provinceId
)[0]?.name || province[0] )[0]?.name || province[0]
: city[0] : province[0]
} }
onChange={(name, value) => onChange={(name, value) =>
value === "استان" ? {} : onChange(name, value) value === "استان" ? {} : onChange(name, value)
@ -501,6 +500,40 @@ const Address = ({
name="cityId" name="cityId"
/> />
</View> </View>
{!profilePage ? (
<TextInput
style={[
tw("w-full mt-4 py-4 px-2 rounded-md h-40"),
{
backgroundColor:
theme === "light" ? Colors.theme1.grayF9 : null,
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.white,
fontSize: fontSize.tiny,
textAlign: "right",
fontFamily: "light",
borderWidth: 1,
borderColor:
theme === "light"
? Colors.theme1.grayE3
: Colors.theme1.white + "55",
},
]}
value={mapAddress}
multiline={true}
textAlignVertical="top"
placeholder="آدرس مورد نظر ..."
onChangeText={(text) => setMapAddress(text)}
placeholderTextColor={
theme === "light"
? Colors.theme1.gray2077
: Colors.theme1.white + "aa"
}
/>
) : null}
<View style={tw("mb-4")}> <View style={tw("mb-4")}>
<CustomTextInput <CustomTextInput
keyboardType="numeric" keyboardType="numeric"

@ -15,6 +15,7 @@ import { connect } from "react-redux";
import { blog, publicApi } from "../../redux/actions"; import { blog, publicApi } from "../../redux/actions";
import { LinearGradient } from "expo-linear-gradient"; import { LinearGradient } from "expo-linear-gradient";
import HTMLView from "react-native-htmlview"; import HTMLView from "react-native-htmlview";
import moment from "jalali-moment";
//components //components
import Header from "../Blogs/layouts/Header"; import Header from "../Blogs/layouts/Header";
@ -121,7 +122,7 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
textAlign: ios ? "right" : "auto", textAlign: ios ? "right" : "auto",
}} }}
> >
{"نوشته از:" + " " + "کامران ایزدی"} {/* {"نوشته از:" + " " + "کامران ایزدی"} */}
</Text> </Text>
<Text <Text
style={{ style={{
@ -136,7 +137,8 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
</View> </View>
</View> </View>
<View style="flex justify-center items-end"> <View style="flex justify-center items-end">
<Text {
blog?.duration ? <Text
style={{ style={{
fontFamily: "regular", fontFamily: "regular",
color: Colors.theme1.white, color: Colors.theme1.white,
@ -144,8 +146,10 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
textAlign: ios ? "left" : "left", textAlign: ios ? "left" : "left",
}} }}
> >
{"زمان مطالعه" + " " + "۳۰ دقیقه"} {"زمان مطالعه" + " " + blog?.duration + " دقیقه"}
</Text> </Text> : null
}
<Text <Text
style={{ style={{
fontFamily: "regular", fontFamily: "regular",
@ -154,7 +158,9 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
textAlign: ios ? "left" : "left", textAlign: ios ? "left" : "left",
}} }}
> >
{"1400/11/24"} {
moment(blog?.createdAt).format('jYYYY/jMM/jDD')
}
</Text> </Text>
</View> </View>
</View> </View>
@ -189,6 +195,40 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
value={blog?.text} value={blog?.text}
renderNode={renderNode} renderNode={renderNode}
stylesheet={{ stylesheet={{
h1 : {
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.grayF9,
textAlign: "right",
fontFamily: "bold",
lineHeight: 25,
fontSize: fontSize.xl4,
marginVertical: -15,
paddingTop: 5,
},
h2 : {
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.grayF9,
textAlign: "right",
fontFamily: "bold",
lineHeight: 25,
fontSize: fontSize.xl,
marginVertical: -10,
},
h3 : {
color:
theme === "light"
? Colors.theme1.gray20
: Colors.theme1.grayF9,
textAlign: "right",
fontFamily: "bold",
lineHeight: 25,
fontSize: fontSize.lg,
marginVertical: -10,
},
p: { p: {
color: color:
theme === "light" theme === "light"
@ -197,7 +237,7 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
textAlign: "right", textAlign: "right",
fontFamily: "light", fontFamily: "light",
lineHeight: 25, lineHeight: 25,
marginVertical: -35, marginVertical: -20,
}, },
strong: { strong: {
color: color:
@ -221,6 +261,9 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
fontFamily: "light", fontFamily: "light",
lineHeight: 25, lineHeight: 25,
}, },
span : {
color : 'red'
}
}} }}
/> />
</View> </View>

@ -58,8 +58,7 @@ export const Header = ({ title, theme }) => {
<Text <Text
style={{ style={{
fontSize: fontSize.sm, fontSize: fontSize.sm,
fontWeight: "light", color: theme === "light" ? Colors.theme1.green79 : Colors.theme1.grayE3,
color: Colors.theme1.green79,
}} }}
> >
مشاهده بیشتر مشاهده بیشتر

@ -58,18 +58,13 @@ const Address = ({
> >
{loading ? ( {loading ? (
userAddressId !== address?.id ? ( userAddressId !== address?.id ? (
<ActivityIndicator <ActivityIndicator size="small" color={Colors.theme1.greenC8} />
size="small"
color={Colors.theme1.greenC8}
/>
) : ( ) : (
<View <View
style={[ style={[
tw("w-5 h-5 rounded-full"), tw("w-5 h-5 rounded-full"),
{ {
backgroundColor: active backgroundColor: active ? Colors.theme1.greenCF : "white",
? Colors.theme1.greenCF
: "white",
borderWidth: userAddressId === address?.id ? 4 : 1, borderWidth: userAddressId === address?.id ? 4 : 1,
borderColor: borderColor:
userAddressId === address?.id userAddressId === address?.id
@ -99,8 +94,8 @@ const Address = ({
}; };
const light = React.useMemo(() => { const light = React.useMemo(() => {
return theme === 'light'; return theme === "light";
},[theme]); }, [theme]);
return ( return (
<View style={tw("w-full mt-2")}> <View style={tw("w-full mt-2")}>
@ -117,7 +112,9 @@ const Address = ({
style={[ style={[
{ {
backgroundColor: light ? Colors.theme1.grayE3 + "44" : null, backgroundColor: light ? Colors.theme1.grayE3 + "44" : null,
borderColor: light ? Colors.theme1.gray2077 + "55" : Colors.theme1.grayE3, borderColor: light
? Colors.theme1.gray2077 + "55"
: Colors.theme1.grayE3,
borderWidth: 1.5, borderWidth: 1.5,
}, },
tw( tw(

@ -20,6 +20,7 @@ import fontSize from "../../../constants/fontSize";
const ios = Platform.OS === "ios"; const ios = Platform.OS === "ios";
function MyBooks({ books, grades, theme }) { function MyBooks({ books, grades, theme }) {
console.log(books);
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={[tw("flex w-full mb-5")]}>
<View <View

@ -82,7 +82,7 @@ const Home = ({
) : null} ) : null}
<Scroll books={books} /> <Scroll books={books} />
<Videos videos={books} /> {/* <Videos videos={books} /> */}
<Blogs blogs={blogs} /> <Blogs blogs={blogs} />
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>

@ -53,6 +53,18 @@ function Book({
}, 500); }, 500);
}, [type]); }, [type]);
const physicalProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 2)[0];
});
const digitalProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 1)[0];
});
const videoProduct = React.useMemo(() => {
return book?.product?.filter((product) => product?.productType === 4)[0];
});
const physicalAvailabileInCart = React.useMemo(() => { const physicalAvailabileInCart = React.useMemo(() => {
return userProducts?.filter( return userProducts?.filter(
(product) => product?.productId === book?.product[1]?.id (product) => product?.productId === book?.product[1]?.id
@ -206,7 +218,15 @@ function Book({
}} }}
> >
{" "} {" "}
{"فیزیکی- دیجیتالی - ویدئو" + "\n" + "در دسترس"} {`${
videoProduct
? "ویدئو"
: "" + physicalProduct
? "فیزیکی"
: "" + digitalProduct
? "دیجیتال"
: ""
} \n در دسترس`}
</Text> </Text>
</View> </View>
<View <View
@ -231,13 +251,16 @@ function Book({
</Text> </Text>
</View> </View>
</View> </View>
{book?.product?.length > 1 ? (
<View style={"flex mt-8"}> <View style={"flex mt-8"}>
<Text <Text
style={[ style={[
tw("w-full text-right"), tw("w-full text-right"),
{ {
color: color:
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white, theme === "light"
? Colors.theme1.green79
: Colors.theme1.white,
fontSize: mobile ? fontSize.tiny : fontSize.lg, fontSize: mobile ? fontSize.tiny : fontSize.lg,
fontFamily: "demi", fontFamily: "demi",
@ -248,16 +271,19 @@ function Book({
</Text> </Text>
<View style={tw("flex justify-between")}></View> <View style={tw("flex justify-between")}></View>
</View> </View>
) : null}
<View style={tw("flex flex-row-reverse justify-between flex-wrap py-3")}> <View style={tw("flex flex-row-reverse justify-between flex-wrap py-3")}>
{physicalProduct ? (
<TouchableHighlight <TouchableHighlight
underlayColor={Colors.theme1.greenFF + "22"} underlayColor={Colors.theme1.greenFF + "22"}
style={[ style={[
tw("flex flex-row-reverse w-full justify-between px-2 py-3 mb-4"), tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"),
{ {
borderWidth: 1, borderWidth: 1,
borderColor: Colors.theme1.greenCF, borderColor: Colors.theme1.greenCF,
backgroundColor: backgroundColor:
theme === "light" ? Colors.theme1.greenFF + "0a" : null, theme === "light" ? Colors.theme1.greenFF + "0a" : null,
width: width - 32 - 8 - (fontSize.sm * 6 + 18),
}, },
]} ]}
onPress={() => onPress={() =>
@ -277,7 +303,7 @@ function Book({
) )
: addToCart( : addToCart(
pushToCart({ pushToCart({
productId: book?.product[1]?.id, productId: physicalProduct?.id,
userId: userId, userId: userId,
count: 1, count: 1,
}), }),
@ -329,12 +355,48 @@ function Book({
}, },
]} ]}
> >
{(separate(book?.product[1]?.price) || " ") + " " + "تومان"} {(separate(physicalProduct?.price) || " ") + " " + "تومان"}
</Text> </Text>
</View> </View>
</View> </View>
</> </>
</TouchableHighlight> </TouchableHighlight>
) : null}
{physicalProduct ? (
<TouchableHighlight
underlayColor={Colors.theme1.greenFF + "22"}
style={[
tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"),
{
borderWidth: 1,
borderColor: Colors.theme1.greenCF,
backgroundColor:
theme === "light" ? Colors.theme1.greenFF + "0a" : null,
width: fontSize.sm * 6 + 18,
},
]}
onPress={() =>
navigation.push("Sample", { id: book?.sampleFileId })
}
>
<Text
style={{
fontFamily: "bold",
fontSize: fontSize.xs,
color:
theme === "light"
? Colors.theme1.green79
: Colors.theme1.greenCF,
paddingVertical: 4,
}}
>
مشاهده نمونه
</Text>
</TouchableHighlight>
) : null}
{digitalProduct ? (
<TouchableHighlight <TouchableHighlight
underlayColor={Colors.theme1.greenFF + "22"} underlayColor={Colors.theme1.greenFF + "22"}
style={[ style={[
@ -364,7 +426,7 @@ function Book({
) )
: addToCart( : addToCart(
pushToCart({ pushToCart({
productId: book?.product[0]?.id, productId: digitalProduct?.id,
userId: userId, userId: userId,
count: 1, count: 1,
}), }),
@ -415,11 +477,13 @@ function Book({
}, },
]} ]}
> >
{(separate(book?.product[0]?.price) || " ") + " " + "تومان"} {(separate(digitalProduct?.price) || " ") + " " + "تومان"}
</Text> </Text>
</View> </View>
</> </>
</TouchableHighlight> </TouchableHighlight>
) : null}
{digitalProduct ? (
<TouchableHighlight <TouchableHighlight
underlayColor={Colors.theme1.greenFF + "22"} underlayColor={Colors.theme1.greenFF + "22"}
style={[ style={[
@ -432,7 +496,7 @@ function Book({
width: fontSize.sm * 6 + 18, width: fontSize.sm * 6 + 18,
}, },
]} ]}
onPress={() => navigation.push("Sample", { id: book?.sampleFileId })} onPress={() => navigation.navigate("Video", { id: book?.id })}
> >
<Text <Text
style={{ style={{
@ -446,9 +510,12 @@ function Book({
paddingVertical: 4, paddingVertical: 4,
}} }}
> >
مشاهده نمونه پیش نمایش
</Text> </Text>
</TouchableHighlight> </TouchableHighlight>
) : null}
{videoProduct ? (
<TouchableHighlight <TouchableHighlight
underlayColor={Colors.theme1.greenFF + "22"} underlayColor={Colors.theme1.greenFF + "22"}
style={[ style={[
@ -478,7 +545,7 @@ function Book({
) )
: addToCart( : addToCart(
pushToCart({ pushToCart({
productId: book?.product[2]?.id, productId: videoProduct?.id,
userId: userId, userId: userId,
count: 1, count: 1,
}), }),
@ -528,42 +595,13 @@ function Book({
}, },
]} ]}
> >
{(separate(book?.product[2]?.price) || " ") + " " + "تومان"} {(separate(videoProduct?.price) || " ") + " " + "تومان"}
</Text> </Text>
</View> </View>
</> </>
</TouchableHighlight> </TouchableHighlight>
<TouchableHighlight ) : null}
underlayColor={Colors.theme1.greenFF + "22"}
style={[
tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"),
{
borderWidth: 1,
borderColor: Colors.theme1.greenCF,
backgroundColor:
theme === "light" ? Colors.theme1.greenFF + "0a" : null,
width: fontSize.sm * 6 + 18,
},
]}
onPress={() => navigation.navigate("Video", { id: book?.id })}
>
<Text
style={{
fontFamily: "bold",
fontSize: fontSize.xs,
color:
theme === "light"
? Colors.theme1.green79
: Colors.theme1.greenCF,
paddingVertical: 4,
}}
>
پیش نمایش
</Text>
</TouchableHighlight>
</View> </View>
{console.log(book?.text)}
{book?.text ? ( {book?.text ? (
<LinkBox <LinkBox
title="توضیحات" title="توضیحات"

@ -19,7 +19,7 @@ const Header = ({ setFilterOptions, filterOptions, levels, productTypes }) => {
value={filterOptions.search} value={filterOptions.search}
/> />
<View style={[tw("flex flex-1 flex-row justify-between items-center")]}> <View style={[tw("flex flex-1 flex-row justify-between items-center")]}>
<Select {/* <Select
defaultValue={productTypes[0]} defaultValue={productTypes[0]}
onChange={(name, value) => onChange={(name, value) =>
value !== "نوع محصول" value !== "نوع محصول"
@ -29,7 +29,7 @@ const Header = ({ setFilterOptions, filterOptions, levels, productTypes }) => {
options={productTypes} options={productTypes}
width={"48%"} width={"48%"}
name="productType" name="productType"
/> /> */}
<Select <Select
defaultValue={Object.values(levels)[0]} defaultValue={Object.values(levels)[0]}
onChange={(name, value) => onChange={(name, value) =>
@ -38,7 +38,7 @@ const Header = ({ setFilterOptions, filterOptions, levels, productTypes }) => {
: setFilterOptions({ ...filterOptions, [name]: null }) : setFilterOptions({ ...filterOptions, [name]: null })
} }
options={Object.values(levels)} options={Object.values(levels)}
width={"48%"} width={"100%"}
name="grade" name="grade"
/> />
</View> </View>

@ -70,77 +70,82 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
return filterOptions.productType === "دوره ویدئویی" return filterOptions.productType === "دوره ویدئویی"
? bySearchFilter?.map((product, index) => ( ? bySearchFilter?.map((product, index) => (
<Pressable // <Pressable
style={[ // style={[
{ // {
width: mobile ? "auto" : width / 2.2, // width: mobile ? "auto" : width / 2.2,
borderWidth: 1, // borderWidth: 1,
borderColor: // borderColor:
Colors.theme1.grayE3 + (theme === "light" ? "" : "55"), // Colors.theme1.grayE3 + (theme === "light" ? "" : "55"),
}, // },
tw(`flex mb-5 p-2 rounded-md ${mobile ? "w-full" : ""}`), // tw(`flex mb-5 p-2 rounded-md ${mobile ? "w-full" : ""}`),
]} // ]}
key={index} // key={index}
onPress={() => navigation.navigate("Video", { id: product.id })} // onPress={() => navigation.navigate("Video", { id: product.id })}
> // >
<View style={[tw("relative w-full mb-1")]}> // <View style={[tw("relative w-full mb-1")]}>
<Image // <Image
source={{ // source={{
uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`, // uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`,
}} // }}
style={[ // style={[
tw("w-full rounded-sm"), // tw("w-full rounded-sm"),
{ height: ((mobile ? width - 25 : width / 2.2) * 9) / 16 }, // { height: ((mobile ? width - 25 : width / 2.2) * 9) / 16 },
]} // ]}
/> // />
</View> // </View>
<Text // <Text
style={[ // style={[
tw("mb-1"), // tw("mb-1"),
{ // {
fontFamily: "bold", // fontFamily: "bold",
fontSize: fontSize.lg, // fontSize: fontSize.lg,
color: // color:
theme === "light" // theme === "light"
? Colors.theme1.gray20 // ? Colors.theme1.gray20
: Colors.theme1.white, // : Colors.theme1.white,
textAlign: ios ? "right" : "auto", // textAlign: ios ? "right" : "auto",
}, // },
]} // ]}
> // >
{"دوره ویدئویی" + " " + product?.name} // {"دوره ویدئویی" + " " + product?.name}
</Text> // </Text>
<Text // <Text
style={[ // style={[
tw("mb-4"), // tw("mb-4"),
{ // {
fontSize: fontSize.tiny, // fontSize: fontSize.tiny,
fontFamily: "regular", // fontFamily: "regular",
color: Colors.theme1.greenBA, // color: Colors.theme1.greenBA,
textAlign: ios ? "right" : "auto", // textAlign: ios ? "right" : "auto",
}, // },
]} // ]}
> // >
{"پایه" + " " + grades[product?.gradeId]} // {"پایه" + " " + grades[product?.gradeId]}
</Text> // </Text>
<Text // <Text
style={[ // style={[
tw("w-full flex flex-row text-left"), // tw("w-full flex flex-row text-left"),
{ // {
fontSize: fontSize.xl, // fontSize: fontSize.xl,
fontFamily: "bold", // fontFamily: "bold",
color: // color:
theme === "light" // theme === "light"
? Colors.theme1.gray20 // ? Colors.theme1.gray20
: Colors.theme1.white, // : Colors.theme1.white,
}, // },
]} // ]}
> // >
{separate(product?.product[2]?.price)}{" "} // {separate(
<Text style={{ fontSize: fontSize.sm }}>تومان</Text> // product?.product?.filter(
</Text> // (product) => product?.productType === 4
</Pressable> // )[0].price
// )}{" "}
// <Text style={{ fontSize: fontSize.sm }}>تومان</Text>
// </Text>
// </Pressable>
<></>
)) ))
: bySearchFilter?.map((product, index) => ( : bySearchFilter?.map((product, index) => (
<React.Fragment key={index}> <React.Fragment key={index}>
@ -149,103 +154,108 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
? productType === ("کتاب دیجیتال" || "همه محصولات") ? productType === ("کتاب دیجیتال" || "همه محصولات")
: true : true
) ? ( ) ? (
<Pressable // <Pressable
key={product?.product[0]?.id} // key={product?.product[0]?.id}
style={[ // style={[
{ // {
width: mobile ? width / 2 - 25 : width / 3.2, // width: mobile ? width / 2 - 25 : width / 3.2,
marginBottom: 15, // marginBottom: 15,
borderWidth: 1, // borderWidth: 1,
borderColor: // borderColor:
Colors.theme1.grayE3 + (theme === "light" ? "" : "55"), // Colors.theme1.grayE3 + (theme === "light" ? "" : "55"),
}, // },
tw("flex justify-between px-2 pt-2 rounded-md"), // tw("flex justify-between px-2 pt-2 rounded-md"),
]} // ]}
onPress={() => // onPress={() =>
navigation.navigate("Product", { // navigation.navigate("Product", {
id: product?.id, // id: product?.id,
type: "book", // type: "book",
}) // })
} // }
> // >
<View style={tw("w-full flex")}> // <View style={tw("w-full flex")}>
<Image // <Image
resizeMode="contain" // resizeMode="contain"
source={{ // source={{
uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`, // uri: `https://dnvn.ir/api/v1/file/${product?.fileIds}`,
}} // }}
style={[ // style={[
tw("rounded-sm"), // tw("rounded-sm"),
{ // {
flex: 1, // flex: 1,
height: mobile // height: mobile
? ((width / 2 - 25) * 4) / 2.9 // ? ((width / 2 - 25) * 4) / 2.9
: ((width / 3.2) * 16) / 14, // : ((width / 3.2) * 16) / 14,
}, // },
]} // ]}
/> // />
<Text // <Text
style={{ // style={{
fontSize: fontSize.base, // fontSize: fontSize.base,
marginTop: 5, // marginTop: 5,
fontFamily: "bold", // fontFamily: "bold",
width: "100%", // width: "100%",
textAlign: ios ? "right" : "auto", // textAlign: ios ? "right" : "auto",
color: // color:
theme === "light" // theme === "light"
? Colors.theme1.gray20 // ? Colors.theme1.gray20
: Colors.theme1.white, // : Colors.theme1.white,
}} // }}
> // >
{"کتاب دیجیتال" + " " + product?.name} // {"کتاب دیجیتال" + " " + product?.name}
</Text> // </Text>
<Text // <Text
style={{ // style={{
color: Colors.theme1.greenBA, // color: Colors.theme1.greenBA,
fontSize: fontSize.tiny, // fontSize: fontSize.tiny,
marginTop: 5, // marginTop: 5,
fontFamily: "regular", // fontFamily: "regular",
width: "100%", // width: "100%",
textAlign: ios ? "right" : "auto", // textAlign: ios ? "right" : "auto",
}} // }}
> // >
{"پایه" + " " + grades[product?.gradeId]} // {"پایه" + " " + grades[product?.gradeId]}
</Text> // </Text>
</View> // </View>
<View // <View
style={tw( // style={tw(
"flex flex-row-reverse items-center justify-center pb-1 pt-2" // "flex flex-row-reverse items-center justify-center pb-1 pt-2"
)} // )}
> // >
<Text // <Text
style={[ // style={[
tw("text-center ml-1"), // tw("text-center ml-1"),
{ // {
color: // color:
theme === "light" // theme === "light"
? Colors.theme1.gray20 // ? Colors.theme1.gray20
: Colors.theme1.white, // : Colors.theme1.white,
fontFamily: "bold", // fontFamily: "bold",
fontSize: fontSize.xl2, // fontSize: fontSize.xl2,
}, // },
]} // ]}
> // >
{separate(product?.product[0].price)} // {separate(
</Text> // product?.product?.filter(
<Text // (product) => product?.productType === 1
style={{ // )[0]?.price
fontSize: fontSize.sm, // )}
color: // </Text>
theme === "light" // <Text
? Colors.theme1.gray20 // style={{
: Colors.theme1.white, // fontSize: fontSize.sm,
fontFamily: "regular", // color:
}} // theme === "light"
> // ? Colors.theme1.gray20
تومان // : Colors.theme1.white,
</Text> // fontFamily: "regular",
</View> // }}
</Pressable> // >
// تومان
// </Text>
// </View>
// </Pressable>
<></>
) : null} ) : null}
{( {(
productType productType
@ -333,7 +343,7 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
}, },
]} ]}
> >
{separate(product?.product[1].price)} {separate(product?.product[0].price)}
</Text> </Text>
<Text <Text
style={{ style={{
@ -365,8 +375,8 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
), ),
]} ]}
> >
{filterOptions?.productType === "دوره ویدئویی" ? Items(2) : null} {/* {filterOptions?.productType === "دوره ویدئویی" ? Items(2) : null} */}
{filterOptions?.productType === "کتاب دیجیتال" ? Items(0) : null} {/* {filterOptions?.productType === "کتاب دیجیتال" ? Items(0) : null} */}
{filterOptions?.productType === "کتاب فیزیکی" ? Items(1) : null} {filterOptions?.productType === "کتاب فیزیکی" ? Items(1) : null}
{!filterOptions?.productType ? Items(0) : null} {!filterOptions?.productType ? Items(0) : null}
{/* {filterLoading && ( {/* {filterLoading && (

@ -12,7 +12,9 @@ import {
} from "react-native"; } from "react-native";
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { asyncAwesomeAlert } from "../../../../utils/AsyncWrappers";
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import { Ionicons, Entypo } from "@expo/vector-icons";
import { userAddress, userFactor } from "../../../../redux/actions"; import { userAddress, userFactor } from "../../../../redux/actions";
import Svg, { G, Path } from "react-native-svg"; import Svg, { G, Path } from "react-native-svg";
@ -36,7 +38,9 @@ const ProfileAddress = ({
userAddressId, userAddressId,
getFactorInfo, getFactorInfo,
mobile, mobile,
theme loading,
theme,
deleteItem,
}) => { }) => {
const navigation = useNavigation(); const navigation = useNavigation();
const [height, setHeight] = React.useState(Dimensions.get("window").height); const [height, setHeight] = React.useState(Dimensions.get("window").height);
@ -91,15 +95,11 @@ const ProfileAddress = ({
فعال فعال
</Text> </Text>
</View> </View>
<Svg xmlns="http://www.w3.org/2000/svg" width={24} height={24}> <Entypo
<G fill="#07612c" data-name="vuesax/linear/more"> name="dots-three-vertical"
<Path d="M10 19a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2Z" /> size={24}
<Path color={theme === "light" ? "#52796F" : Colors.theme1.white}
data-name="Vector"
d="M10 5a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2ZM10 12a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2Z"
/> />
</G>
</Svg>
</View> </View>
) : null} ) : null}
<View style={tw(`flex w-full ${active ? "" : "flex-row-reverse"}`)}> <View style={tw(`flex w-full ${active ? "" : "flex-row-reverse"}`)}>
@ -157,22 +157,35 @@ const ProfileAddress = ({
</Text> </Text>
</View> </View>
{!active ? ( {!active ? (
<Svg xmlns="http://www.w3.org/2000/svg" width={24} height={24}> <View style={tw("flex flex-row-reverse")}>
<G <Pressable style={tw("ml-2")}>
fill={Colors.theme1.gray20} <Ionicons
data-name="vuesax/linear/more" name="ios-pencil-sharp"
size={20}
color={theme === "light" ? "#52796F" : Colors.theme1.white}
/>
</Pressable>
<Pressable
onPress={() =>
asyncAwesomeAlert("", "آدرس مورد نظر حذف شود؟", {
showCancelButton: true,
confirmText: "بله",
cancelText: "لغو",
onConfirm: () => deleteItem({ id: address.id }),
})
}
> >
<Path d="M10 19a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2Z" /> <Ionicons
<Path name="trash-bin"
data-name="Vector" size={20}
d="M10 5a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2ZM10 12a2 2 0 1 0 2-2 2.006 2.006 0 0 0-2 2Z" color={theme === "light" ? "#52796F" : Colors.theme1.white}
/> />
</G> </Pressable>
</Svg> </View>
) : null} ) : null}
</View> </View>
<CustomPressable {/* <CustomPressable
title={"مشاهده روی نقشه"} title={"مشاهده روی نقشه"}
backgroundColor={ backgroundColor={
active active
@ -183,7 +196,7 @@ const ProfileAddress = ({
border={{ color: "#196EC0", width: 0 }} border={{ color: "#196EC0", width: 0 }}
width={"100%"} width={"100%"}
onPress={() => {}} onPress={() => {}}
/> /> */}
</View> </View>
</Pressable> </Pressable>
); );
@ -281,13 +294,14 @@ const mapStateToProps = (state) => ({
loading: state.userFactor.loading, loading: state.userFactor.loading,
addresses: state.userAddress.list, addresses: state.userAddress.list,
mobile: state.publicApi.mobile, mobile: state.publicApi.mobile,
theme: state.publicApi.theme theme: state.publicApi.theme,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
getFactorInfo: userFactor.info, getFactorInfo: userFactor.info,
update: userFactor.update, update: userFactor.update,
getList: userAddress.list, getList: userAddress.list,
deleteItem: userAddress.del,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(ProfileAddress); export default connect(mapStateToProps, mapDispatchToProps)(ProfileAddress);
@ -298,7 +312,6 @@ const styles = StyleSheet.create({
position: "relative", position: "relative",
}, },
container: { container: {
backgroundColor: "white",
flexDirection: "column", flexDirection: "column",
paddingVertical: 0, paddingVertical: 0,
paddingHorizontal: 0, paddingHorizontal: 0,

@ -67,7 +67,7 @@ const User = ({ user, mobile, theme }) => {
</Text> </Text>
</View> </View>
</View> </View>
<Svg {/* <Svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width={24} width={24}
height={24} height={24}
@ -78,9 +78,9 @@ const User = ({ user, mobile, theme }) => {
fill="#c6c6c6" fill="#c6c6c6"
data-name="vuesax/bold/arrow-down" data-name="vuesax/bold/arrow-down"
/> />
</Svg> </Svg> */}
</Pressable> </Pressable>
{dropdown ? ( {/* {dropdown ? (
<View style={tw(`flex flex-col pr-16 ${ios ? "items-end" : " "}`)}> <View style={tw(`flex flex-col pr-16 ${ios ? "items-end" : " "}`)}>
<Pressable <Pressable
style={tw(`flex w-full ${mobile ? "mt-0" : "mt-4"}`)} style={tw(`flex w-full ${mobile ? "mt-0" : "mt-4"}`)}
@ -130,7 +130,7 @@ const User = ({ user, mobile, theme }) => {
</View> </View>
</Pressable> </Pressable>
</View> </View>
) : null} ) : null} */}
</View> </View>
); );
}; };

@ -65,7 +65,7 @@ function Profile({ mobile, theme, logout, loading }) {
style={styles.container} style={styles.container}
> >
<User /> <User />
<Trophy /> {/* <Trophy /> */}
<List /> <List />
<Pressable <Pressable
style={tw(`flex w-full ${mobile ? "mt-0" : "mt-4"}`)} style={tw(`flex w-full ${mobile ? "mt-0" : "mt-4"}`)}

@ -57,10 +57,12 @@ function Scan({ theme, page }) {
)} )}
> >
<View style={{ width: height / 2.5, height: height / 2.5 }}> <View style={{ width: height / 2.5, height: height / 2.5 }}>
{hasPermission ? (
<BarCodeScanner <BarCodeScanner
onBarCodeScanned={scanned ? undefined : handleBarCodeScanned} onBarCodeScanned={scanned ? undefined : handleBarCodeScanned}
style={{ width: "100%", height: "100%" }} style={{ width: "100%", height: "100%" }}
/> />
) : null}
</View> </View>
{/* {scanned && ( */} {/* {scanned && ( */}

Loading…
Cancel
Save