import React, { Component } from "react"; import { toast } from "react-toastify"; import proxy from "~/Redux/proxy"; import { Link, useHistory } from "react-router-dom"; import { connect } from "react-redux"; import { book } from "~/Redux/actions"; import { userProduct } from "~/Redux/actions"; import Footer from "../Home/Footer/index"; import Navbar from "../Home/Navbar/index"; import Comment from "./Comment/index"; import Breadcrumbs from "./BreadCrumb/index"; import Gallery from "./Gallery/index"; import Info from "./Info/index"; import AddToCart from "./AddToCart/index"; import HomeScroll from "../Home/HomeScroll/index"; import HomeSlider from "../Home/HomeSlider/index"; import Loader from "~/components/Loader/index"; import MaterialModal from "./MaterialModal/index"; import product_shipping from "~/assets/icons/product-shipping.png"; import product_cash_back from "~/assets/icons/product-cash-back.png"; import product_support from "~/assets/icons/product-support.png"; import send_comment from "~/assets/icons/send-comment.png"; import "./index.scss"; const maxDesktopSize = 1250; const maxMobileSize = 550; const grades = [ window.t("پیش دبستان"), window.t("اول"), window.t("دوم"), window.t("سوم"), window.t("چهارم"), window.t("پنجم"), window.t("ششم"), window.t("هفتم"), window.t("هشتم"), window.t("نهم"), window.t("دهم"), window.t("یازدهم"), window.t("دوازدهم"), ]; const fontSize = { desktop: { h1: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 70, }, mobile: { h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 18, h2: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 24, h3: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 26, a: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 26, p: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 30, li: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 29, }, }; function Addbutton({ page, info, pushToCart, userId }) { let history = useHistory(); function Navigate({ path }) { history.push(path); } let productId = localStorage.getItem("pushToCart"); if (productId) { toast.info(window.t("جهت ادامه فرآیند خرید وارد حساب خود شوید")); localStorage.removeItem("pushToCart"); pushToCart({ productId, userId, count: 1, }); setTimeout(() => history.push("/cart"), 2000); } return ( ); } class Product extends Component { state = { openComment: false, }; handleOpenComment = () => [ this.setState({ openComment: !this.state.openComment, }), ]; componentDidMount() { window.scrollTo(0, 0); this.props.getInfo({ id: window.location.pathname.slice( window.location.pathname.lastIndexOf("/") + 1, window.location.pathname.length ), }); this.props.getList(); } render() { const { supportItems, info, page } = this.props; return ( <> {window.innerWidth > 1000 ? ( info ? ( <>
{info.description || window.t("توضیحات محصول خالیست")}
{info.description}