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