|
|
|
@ -55,31 +55,31 @@ function Book({ |
|
|
|
|
|
|
|
|
|
const physicalProduct = React.useMemo(() => { |
|
|
|
|
return book?.product?.filter((product) => product?.productType === 2)[0]; |
|
|
|
|
}); |
|
|
|
|
},[book]); |
|
|
|
|
|
|
|
|
|
const digitalProduct = React.useMemo(() => { |
|
|
|
|
return book?.product?.filter((product) => product?.productType === 1)[0]; |
|
|
|
|
}); |
|
|
|
|
},[book]); |
|
|
|
|
|
|
|
|
|
const videoProduct = React.useMemo(() => { |
|
|
|
|
return book?.product?.filter((product) => product?.productType === 4)[0]; |
|
|
|
|
}); |
|
|
|
|
},[book]); |
|
|
|
|
|
|
|
|
|
const physicalAvailabileInCart = React.useMemo(() => { |
|
|
|
|
return userProducts?.filter( |
|
|
|
|
(product) => product?.productId === book?.product[1]?.id |
|
|
|
|
(product) => product?.productId === physicalProduct?.id |
|
|
|
|
)[0]; |
|
|
|
|
}, [userProducts, book]); |
|
|
|
|
|
|
|
|
|
const digitalAvailabileInCart = React.useMemo(() => { |
|
|
|
|
return userProducts?.filter( |
|
|
|
|
(product) => product?.productId === book?.product[0]?.id |
|
|
|
|
(product) => product?.productId === digitalProduct?.id |
|
|
|
|
)[0]; |
|
|
|
|
}, [userProducts, book]); |
|
|
|
|
|
|
|
|
|
const videoAvailabileInCart = React.useMemo(() => { |
|
|
|
|
return userProducts?.filter( |
|
|
|
|
(product) => product?.productId === book?.product[2]?.id |
|
|
|
|
(product) => product?.productId === videoProduct?.id |
|
|
|
|
)[0]; |
|
|
|
|
}, [userProducts, book]); |
|
|
|
|
|
|
|
|
@ -131,9 +131,9 @@ function Book({ |
|
|
|
|
}, [userProducts]); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<ScrollView style={[tw("flex flex-1 relative")]}> |
|
|
|
|
<View style={[tw("flex flex-1 relative")]}> |
|
|
|
|
{!mobile ? <View style={tw("mt-5")}></View> : null} |
|
|
|
|
{imageSlider ? <ImageSlider /> : null} |
|
|
|
|
{/* {imageSlider ? <ImageSlider /> : null} */} |
|
|
|
|
<View style={[tw("flex flex-row-reverse")]}> |
|
|
|
|
<Image |
|
|
|
|
source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }} |
|
|
|
@ -180,7 +180,6 @@ function Book({ |
|
|
|
|
{"پایه" + " " + (grades[book?.gradeId] || " ")} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
|
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
@ -609,7 +608,7 @@ function Book({ |
|
|
|
|
onPress={() => |
|
|
|
|
navigation.push("Info", { |
|
|
|
|
type: { name: "توضیحات", value: "productDescription" }, |
|
|
|
|
data : book?.text |
|
|
|
|
data: book?.text, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
@ -640,7 +639,7 @@ function Book({ |
|
|
|
|
onPress={() => |
|
|
|
|
navigation.push("Info", { |
|
|
|
|
type: { name: "پرسش و پاسخ", value: "productQuestion" }, |
|
|
|
|
data: [] |
|
|
|
|
data: [], |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
@ -671,7 +670,7 @@ function Book({ |
|
|
|
|
/> |
|
|
|
|
</> |
|
|
|
|
) : null} |
|
|
|
|
</ScrollView> |
|
|
|
|
</View> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|