@@ -40,7 +40,7 @@ export default function Comment(props) {
className="comment__user"
style={{ fontSize: fontSize.desktop.strong }}
>
- {comment.username}
+ {comment.username || "حسین"}
{comment.text}
diff --git a/src/views/Product/Gallery/index.js b/src/views/Product/Gallery/index.js
index b753739..fdcf7e8 100644
--- a/src/views/Product/Gallery/index.js
+++ b/src/views/Product/Gallery/index.js
@@ -1,87 +1,112 @@
-import React, { Component, useState } from 'react';
-import MoreHorizIcon from '@material-ui/icons/MoreHoriz';
-import Video from '../../QR/VideoBox/React-video-js-player/index';
-import Modal from './Modal/index';
+import React, { Component, useState } from "react";
+import MoreHorizIcon from "@material-ui/icons/MoreHoriz";
+import Video from "../../QR/VideoBox/React-video-js-player/index";
+import Modal from "./Modal/index";
-import './index.scss';
+import "./index.scss";
export default function Gallery(props) {
- const [selectedMedia,setSelectedMedia] = useState(props.gallery[1]);
+ const [selectedMedia, setSelectedMedia] = useState(props.gallery[0]);
const [modal, setModal] = useState(null);
- return(
+ return (
<>
- {
- window.innerWidth > 1000 ?
+ {window.innerWidth > 1000 ? (
- {
- selectedMedia ?
+ {selectedMedia ? (
<>
- {
- selectedMedia.type === 'image' ?
-
: null
- }
- {
- selectedMedia.type === 'film' ?
-
: null
- }
- > : null
- }
+ {selectedMedia.type === "image" ? (
+
+ ) : null}
+ {selectedMedia.type === "film" ?
: null}
+ >
+ ) : null}
- {
- props.gallery.length > 3 ?
+ {props.gallery.length > 3 ? (
<>
-
-
-
- > :
+
+
+
+ >
+ ) : (
<>
- {
- props.gallery.map((item, i) => (
-
- ))
- }
+ {props.gallery.map((item, i) => (
+
+ ))}
>
- }
+ )}
- {
- modal ?
- : null
- }
- : null
- }
+ {modal ? (
+
+ ) : null}
+
+ ) : null}
>
);
}
const Item = (props) => {
- const {item, more, setSelectedMedia, setModal, active} = props;
- return(
+ const { item, more, setSelectedMedia, setModal, active } = props;
+ return (
<>
- {
- window.innerWidth > 1000 ?
-
- {
- item.type === 'image' ?
-
: null
- }
- {
- item.type === 'film' ?
-
: null
- }
- {
- !more ?
-
setSelectedMedia(item)}>
-
-
:
-
setModal(item)}>
-
+ {window.innerWidth > 1000 ? (
+
+ {item.type === "image" ? (
+
+ ) : null}
+ {item.type === "film" ? (
+
+ ) : null}
+ {!more ? (
+
setSelectedMedia(item)}
+ >
+ ) : (
+
setModal(item)}
+ >
+
- }
-
: null
- }
+ )}
+
+ ) : null}
>
-
);
-}
\ No newline at end of file
+};
diff --git a/src/views/Product/index.js b/src/views/Product/index.js
index f3ff250..9fb10c1 100644
--- a/src/views/Product/index.js
+++ b/src/views/Product/index.js
@@ -1,4 +1,6 @@
import React, { Component } from "react";
+import { ToastContainer } from "react-toastify";
+
import { Link } from "react-router-dom";
import { connect } from "react-redux";
import { book } from "~/Redux/actions";
@@ -14,12 +16,6 @@ import HomeScroll from "../Home/HomeScroll/index";
import HomeSlider from "../Home/HomeSlider/index";
import Loader from "~/components/Loader/index";
-import sciense_7 from "~/assets/images/sciense-7.png";
-import sciense_6 from "~/assets/images/sciense-6.png";
-import sciense_8 from "~/assets/images/sciense-8.png";
-import sciense_9 from "~/assets/images/sciense-9.png";
-import zist_10 from "~/assets/images/zist-10.png";
-import film from "~/assets/Video/film.mp4";
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";
@@ -51,29 +47,40 @@ class Product extends Component {
window.location.pathname.length
),
});
+ this.props.getList();
}
render() {
- const { product, sameProducts, supportItems, info } = this.props;
+ const { product, sameProducts, supportItems, info, page, loading, list } =
+ this.props;
return (
<>
{window.innerWidth > 1000 ? (
- this.props.info ? (
+ info ? (
<>
@@ -88,10 +95,12 @@ class Product extends Component {
-
+ {info.comment.length > 0 ? (
+
+ ) : null}
-
+ {0 ?
: null}
>
@@ -105,7 +114,7 @@ class Product extends Component {
)
) : null}
{window.innerWidth < 1000 ? (
- this.props.info ? (
+ info ? (
<>
@@ -200,6 +209,17 @@ class Product extends Component {
)
) : null}
+
>
);
}
@@ -209,8 +229,10 @@ export default connect(
(state) => ({
info: state.book.info,
// status: state.user.status,
+ loading: state.book.loading,
+ list: state.book.list,
}),
- { getInfo: book.info }
+ { getInfo: book.info, getList: book.list }
)(Product);
Product.defaultProps = {
@@ -219,175 +241,6 @@ Product.defaultProps = {
{ title: "پشتیبانی 24 ساعته ", icon: product_support },
{ title: "ضمانت بازگشت ", icon: product_cash_back },
],
- sameProducts: {
- type: window.innerWidth > 1000 ? "slider" : "scroll",
- title: "محصولات مرتبط",
- moreText: "لیست کتابها",
- height: window.innerWidth > 1000 ? 470 : 320,
- design: window.innerWidth > 1000 ? "simple" : "product",
- number: window.innerWidth > 1000 ? 4 : 2.8,
- data: [
- {
- id: 0,
- image: sciense_6,
- title: "منفجر کردن مغز خود را به ما بسپارید",
- subTitle: "پایه دهم ابتدایی",
- price: "78.000",
- oldPrice: "",
- date: new Date(),
- },
- {
- id: 1,
- image: sciense_7,
- title: "منفجر کردن مغز خود را به ما بسپارید",
- subTitle: "پایه ششم ابتدایی",
- price: "39.000",
- oldPrice: "59.000",
- date: new Date(),
- },
- {
- id: 2,
- image: sciense_8,
- title: "منفجر کردن مغز خود را به ما بسپارید",
- subTitle: "پایه ششم ابتدایی",
- price: "21.000",
- oldPrice: "",
- },
- {
- id: 3,
- image: sciense_9,
- title: "منفجر کردن مغز خود را به ما بسپارید",
- subTitle: "پایه دهم ابتدایی",
- price: "",
- oldPrice: "",
- },
- {
- id: 4,
- image: zist_10,
- title: "منفجر کردن مغز خود را به ما بسپارید",
- subTitle: "پایه هفتم ابتدایی",
- price: "59.000",
- oldPrice: "",
- },
- {
- id: 5,
- image: sciense_6,
- title: "منفجر کردن مغز خود را به ما بسپارید",
- subTitle: "پایه دهم ابتدایی",
- price: "78.000",
- oldPrice: "",
- date: new Date(),
- },
- {
- id: 6,
- image: sciense_7,
- title: "منفجر کردن مغز خود را به ما بسپارید",
- subTitle: "پایه ششم ابتدایی",
- price: "39.000",
- oldPrice: "59.000",
- date: new Date(),
- },
- {
- id: 7,
- image: sciense_8,
- title: "منفجر کردن مغز خود را به ما بسپارید",
- subTitle: "پایه ششم ابتدایی",
- price: "21.000",
- oldPrice: "",
- date: new Date(),
- },
- {
- id: 8,
- image: sciense_9,
- title: "منفجر کردن مغز خود را به ما بسپارید",
- subTitle: "پایه دهم ابتدایی",
- price: "",
- oldPrice: "",
- date: new Date(),
- },
- {
- id: 9,
- image: zist_10,
- title: "منفجر کردن مغز خود را به ما بسپارید",
- subTitle: "پایه هفتم ابتدایی",
- price: "59.000",
- oldPrice: "",
- date: new Date(),
- },
- ],
- },
- product: {
- id: 1,
- image: sciense_7,
- title: "منفجر کردن مغز خود را به ما بسپارید",
- subTitle: "پایه ششم ابتدایی",
- price: "39.000",
- off: "30%",
- oldPrice: "59.000",
- date: new Date(),
- abstraction:
- "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ، و با استفاده از طراحان گرافیک است، چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است، و برای شرایط فعلی تکنولوژی مورد نیاز، و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد، کتابهای زیادی در شصت و سه درصد گذشته حال و آینده، شناخت فراوان جامعه و متخصصان را می طلبد، تا با نرم افزارها شناخت بیشت",
- modules: [
- "پک هدیه شامل یک عدد جلد سخت",
- "عینک واقعیت مجازی",
- "کارت گرافیک مناسب جهت اجرای بازی",
- ],
- tips: [
- "پک هدیه شامل یک عدد جلد سخت",
- "عینک واقعیت مجازی",
- "کارت گرافیک مناسب جهت اجرای بازی",
- ],
- gallery: [
- { id: 0, value: film, type: "film" },
- { id: 1, value: sciense_6, type: "image" },
- { id: 2, value: sciense_7, type: "image" },
- { value: sciense_8, type: "image" },
- ],
- description:
- "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ، و با استفاده از طراحان گرافیک است، چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است، و برای شرایط فعلی تکنولوژی مورد نیاز، و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد، کتابهای زیادی در شصت و سه درصد گذشته حال و آینده، شناخت فراوان جامعه و متخصصان را می طلبد، تا با نرم افزارها شناخت بیشت",
- comments: [
- {
- id: 0,
- username: "محمدرضا",
- date: new Date(),
- text: "عالی بود. ممنون از سایت زیباتون",
- score: 4,
- reply: "ممنون از شما که به ما اعتماد کردید",
- },
- {
- id: 1,
- username: "محمدرضا",
- date: new Date(),
- text: "عالی بود. ممنون از سایت زیباتون",
- score: 2.5,
- reply: "",
- },
- {
- id: 2,
- username: "محمدرضا",
- date: new Date(),
- text: "عالی بود. ممنون از سایت زیباتون",
- score: 5,
- reply: "",
- },
- {
- id: 3,
- username: "محمدرضا",
- date: new Date(),
- text: "عالی بود. ممنون از سایت زیباتون",
- score: 3.7,
- reply: "",
- },
- {
- id: 4,
- username: "محمدرضا",
- date: new Date(),
- text: "عالی بود. ممنون از سایت زیباتون",
- score: 2,
- reply: "",
- },
- ],
- },
};
const Item = (props) => {
@@ -397,25 +250,36 @@ const Item = (props) => {
const Identifier = (props) => {
return (
<>
- {props.item.type === "scroll" ? (
+ {window.innerWidth < 1000 ? (
) : null}
- {props.item.type === "slider" ? (
+ {window.innerWidth > 1000 ? (
) : null}
+
>
);
};
diff --git a/src/views/Products/Product/index.js b/src/views/Products/Product/index.js
index c764757..77cf98e 100644
--- a/src/views/Products/Product/index.js
+++ b/src/views/Products/Product/index.js
@@ -37,36 +37,54 @@ export default class Product extends Component {