From 5a84cdb19a9f58f1a0360f99a6355036b2e351d0 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Thu, 17 Mar 2022 22:04:34 +0330 Subject: [PATCH] reza changed product page buttons --- src/components/ButtonBetween/index.js | 27 +++++ src/router.js | 6 +- src/views/Product/index.js | 151 ++++++++++++-------------- 3 files changed, 98 insertions(+), 86 deletions(-) create mode 100644 src/components/ButtonBetween/index.js diff --git a/src/components/ButtonBetween/index.js b/src/components/ButtonBetween/index.js new file mode 100644 index 0000000..36bb3ec --- /dev/null +++ b/src/components/ButtonBetween/index.js @@ -0,0 +1,27 @@ +import React from "react"; +import { connect } from "react-redux"; + +export const ButtonBetween = ({ item, status, onClick, width }) => { + return ( + + ); +}; + +const mapStateToProps = (state) => ({}); + +const mapDispatchToProps = {}; + +export default connect(mapStateToProps, mapDispatchToProps)(ButtonBetween); diff --git a/src/router.js b/src/router.js index 539d8c0..a8a1803 100644 --- a/src/router.js +++ b/src/router.js @@ -130,8 +130,8 @@ function Router({ isDark, isMobile, headerOptions, dialog, menu, setMenu }) { hamburgerMenu: false, title: false, back: true, - menu: true, - bookmark: true, + menu: false, + bookmark: 'productId', }} /> } @@ -196,7 +196,7 @@ function Router({ isDark, isMobile, headerOptions, dialog, menu, setMenu }) { back: true, shown: true, menu: true, - bookmark: true, + bookmark: false, }} /> } diff --git a/src/views/Product/index.js b/src/views/Product/index.js index 606b873..d76abc5 100644 --- a/src/views/Product/index.js +++ b/src/views/Product/index.js @@ -2,19 +2,23 @@ import React, { useState, useEffect } from "react"; import { connect } from "react-redux"; import { toast } from "react-toastify"; import { book, userProduct, publicApi } from "../../redux/actions"; -import { Link } from "react-router-dom"; +import { Link, useNavigate } from "react-router-dom"; import proxy from "../../redux/proxy"; import location from "../../utils/location"; +import separate from "../../utils/separate"; + +//components import Button from "../../components/Button"; import Header from "../../components/Header"; import Comment from "./Comment"; import Rate from "./Rate"; import DesktopProductLayout from "./Desktop"; +import Loading from "../../components/Loading"; +import ButtonBetween from "../../components/ButtonBetween"; //assets import arrow from "../../assets/icons/dropdown-blue.svg"; - export const Product = ({ isMobile, productType, @@ -29,7 +33,8 @@ export const Product = ({ }) => { const [type, setType] = useState("physical"); const [desktopContentTransform, setDesktopContentTransform] = useState(false); - + const navigation = useNavigate(); + useEffect(() => { getInfo({ id: location.getId(), vod: true }); setHeaderOptions(headerOptions); @@ -43,11 +48,17 @@ export const Product = ({ }); } }, []); + return ( <> {/* Portrait */} {isMobile ? (
+ {!book && ( +
+ +
+ )}

- {type === "digital" - ? book?.product[0]?.name - : book?.product[1]?.name} + {book?.name}

{"پایه" + " " + grades[book?.gradeId]} @@ -70,7 +79,7 @@ export const Product = ({
-

+

نسخه محصول را انتخاب کنید

-
-
- - مشاهده دوره ویدیویی این محصول - - + + userId + ? pushToCart({ + productId: book?.product[2]?.id, + userId, + count: 1, + }) + : toast.info("ابتدا وارد حساب کاربری خود شوید.") + } + /> + navigation('/videos/' + book?.idK)} + />
-
+
-

+

خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ : ” ﭘﺴﺮﻡ ﺩﺭ ﺯﻧﺪﮔﯽ ﻫﺮﮔﺰ ﺩﺯﺩﯼ ﻧﮑﻦ ” ﭘﺴﺮ ﻣﺘﻌﺠﺐ ﻭ ﻣﺒﻬﻮﺕ ﺑﻪ ﭘﺪﺭ ﻧﮕﺎﻩ ﮐﺮﺩ ﺑﺪﯾﻦ ﻣﻌﻨﺎ ﮐﻪ ﺍﻭ @@ -183,12 +168,12 @@ export const Product = ({ ﺩﺯﺩﯾﺪﻩ ﺍی... ﭘﺲ ﺩﺭ ﺯﻧﺪﮔﯽ ﻓﻘﻂ ﺩﺯﺩﯼ نکن{" "}

-
+
{[0, 1, 2, 2].map((comment, index) => (