import React from "react"; import proxy from "~/Redux/proxy"; import { toast } from "react-toastify"; import { connect } from "react-redux"; import { userProduct } from "~/Redux/actions"; import { Link, useHistory } from "react-router-dom"; import "./index.scss"; import document_red from "~/assets/icons/document-red.png"; import ebook_blue from "~/assets/icons/e-book-blue.png"; import basket_white from "~/assets/icons/basket-white.png"; const maxDesktopSize = 1250; const fontSize = { desktop: { div: window.innerWidth > maxDesktopSize ? 13 : window.innerWidth / 95, strong: window.innerWidth > maxDesktopSize ? 24 : window.innerWidth / 70, span: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80, button: window.innerWidth > maxDesktopSize ? 18 : window.innerWidth / 80, p: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 100, h2: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 100, }, }; function AddToCart(props) { let history = useHistory(); const { price, off, supportItems, page, info, sampleFileId, productType, } = props; function Navigate({ path }) { history.push(path); } let productId = localStorage.getItem("pushToCart"); if (productId) { localStorage.removeItem("pushToCart"); props.pushToCart({ productId, userId: props.id, count: 1, }); setTimeout(() => history.push("/cart"), 2000); } // if (this.state.path) return Navigate({ path: this.state.path }); return ( <> {window.innerWidth > 1000 ? (
{/* {info.product[productType].name} */} {info.product[0].name}
{price} {" "} تومان
{off ? ( {off} تومان تخفیف ) : null}
مشاهده نمونه کتاب {page === "digital" ? "کتاب چاپی" : window.t("نسخه الکترونیک")}
شرایط استفاده از دانوین و حریم خصوصی را مطالعه کرده ام
شرایط مرجوع کردن کالا در دانوین
) : null} ); } export default connect( (state) => ({ loading: state.userProduct.loading, info: state.book.info, id: state.user.status.id, }), { pushToCart: userProduct.add } )(AddToCart);