import React, { useState, useEffect } from "react"; import { connect } from "react-redux"; import { toast } from "react-toastify"; import { Link } from "react-router-dom"; import { publicApi, userProduct } from "../../redux/actions"; import location from "../../utils/location"; import separate from "../../utils/separate"; //components import Season from "./components/Season"; import Videos from "./components/Desktop/Videos"; import StarRating from "../../components/StarRating"; import Button from "../../components/Button"; import ProductTab from "../../components/ProductTab"; import Table from "./components/Desktop/Table"; import Comments from "../../components/Comments"; import Loading from "../../components/Loading"; //assets import tickIcon from "../../components/ProductStatusCard/tick-circle.svg"; import arrow from "../../assets/icons/dropdown-blue.svg"; import bookmarkDeactiveLightIcon from "../../assets/icons/bookmark-deactive-light.svg"; import bookmarkDeactiveDarkIcon from "../../assets/icons/bookmark-deactive-dark.svg"; function Video({ isLogin, pushToCart, userId, isMobile, isDark, headerOptions, setHeaderOptions, grades, getBook, book, seasons, addToFavorite, }) { useEffect(() => { getBook({ bookId: location.getId() }, { id: location.getId(), vod: true }); setHeaderOptions(headerOptions); }, []); useEffect(() => { window.scrollTo(0, 0); }, []); const { bookmark } = headerOptions; return isMobile ? (
{!book && (
)}
{"دوره ویدئویی" + " " + book?.product[2]?.name} {"پایه" + " " + (grades[book?.gradeId] || "پایه دوازدهم")}
{seasons ?.sort((a, b) => a[0]?.categoryId - b[0]?.categoryId) ?.map((season, index) => ( ))}
) : (
{seasons?.length > 0 && ( {seasons ?.sort((a, b) => a[0]?.categoryId - b[0]?.categoryId) ?.map((season, index) => ( ))}
), }, { title: "مشخصات", shown: book?.product.filter( (product) => product?.productType === 4 )?.properties?.length, components: ( product?.productType === 4 )?.properties } /> ), }, { title: "نقد و بررسی", shown: true, components: (
این بخش فعلا قابل دسترسی نیست.
), }, { title: "پرسش و پاسخ", shown: true, components: (
این بخش فعلا قابل دسترسی نیست.
), }, ]} /> )}

{"دوره ویدئویی" + " " + book?.product[2]?.name}

{"پایه" + " " + grades[book?.gradeId]}
بیش از {book?.product[2]?.suggestedCounter} نفر امتیاز داده اند

{`توصیه خرید توسط ${book?.product[2]?.suggestedCounter} نفر`}

bookmark addToFavorite({ [bookmark]: location.getId() })} /> اضافه کردن به لیست علاقه مندی ها
{separate(book?.product[2]?.price)} تومان
{book?.product[2]?.fakePrice ? (

با خرید این کالا 540.000 صرفه جویی کنید

) : (
)}
مشاهده کتاب این محصول
); } const mapStateToProps = (state) => ({ isMobile: state.publicApi.isMobile, isDark: state.publicApi.isDark, book: state.book.info, seasons: state.publicApi.categories, grades: state.publicApi.grades, isLogin: state.user.status, userId: state.user.status.id, }); const mapDispatchToProps = { setHeaderOptions: publicApi.setHeaderOptions, getBook: publicApi.bookInfo, pushToCart: userProduct.add, }; export default connect(mapStateToProps, mapDispatchToProps)(Video); Video.defaultProps = {};