|
|
@ -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 && ( |
|
|
|