import React, { useState, useRef } from "react"; import { View, Text, Image, ScrollView, TouchableOpacity, Dimensions, StatusBar, } from "react-native"; import { useNavigation } from "@react-navigation/native"; import { Entypo } from "@expo/vector-icons"; import CustomPressable from "../../../components/Pressable"; import Description from "./Description"; import LinkBox from "./LinkBox"; import Comments from "./Comments"; import Rates from "./Rates"; import ProductSpecifications from "../../../components/BottomSheetComponents/ProductSpecifications"; import ProductReview from "../../../components/BottomSheetComponents/ProductReview"; import ProductQuestion from "../../../components/BottomSheetComponents/ProductQuestion"; import tw from "tailwind-react-native-classnames"; import fontSize from "../../../constants/fontSize"; import { product, userProduct } from "../../../redux/actions"; import { connect } from "react-redux"; const { height } = Dimensions.get("window"); function Book({ book, grades, pushToCart, userId }) { const navigation = useNavigation(); const [type, setType] = useState(1); return ( {book.product[type].name} {"پایه" + " " + grades[book.gradeId]} {book.text} {" "} {book.pagesNum + "\n" + "صفحه"} {" "} {"فیزیکی- دیجیتالی - ویدئو" + "\n" + "در دسترس"} {" "} {4.8 + "\n" + "امتیاز"} نسخه محصول را انتخاب کنید setType(1)} backgroundColor={type === 0 ? "transparent" : "#196EC0"} color={type === 0 ? "#196EC0" : "white"} border={{ color: "#196EC0", width: 1 }} width={"49%"} /> setType(0)} title={"نسخه دیجیتال"} backgroundColor={type === 1 ? "transparent" : "#196EC0"} color={type === 1 ? "#196EC0" : "white"} border={{ color: "#196EC0", width: 1 }} width={"49%"} /> pushToCart({ productId: book?.product[type]?.id, userId: userId, count: 1, }) } /> {}} /> navigation.navigate("Video", { id: book.id })} > مشاهده دوره ویدئویی این محصول {book.product[type].description && ( )} } height={height - height / 4} /> } height={height - height / 4} /> } height={height - height / 4} /> {product.rates && ( امتیازات و نظرات )} {/* */} ); } const mapStateToProps = (state) => ({ userId: state.user.status.id, }); const mapDispatchToProps = { pushToCart: userProduct.add, }; export default connect(mapStateToProps, mapDispatchToProps)(Book);