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