From 76c719796c8d7583fe762fcb2665e6394f1a6925 Mon Sep 17 00:00:00 2001 From: mahdi Date: Sun, 3 Jul 2022 15:11:52 +0430 Subject: [PATCH] =?UTF-8?q?=D8=AF=D8=B1=D8=B3=D8=AA=20=DA=A9=D8=B1=D8=AF?= =?UTF-8?q?=D9=86=20=D9=82=D8=B3=D9=85=D8=AA=20=D8=A8=D9=84=D8=A7=DA=AF=20?= =?UTF-8?q?=D9=88=20=D8=A7=DB=8C=D9=86=DA=A9=D9=87=20=D9=85=D9=82=D8=A7?= =?UTF-8?q?=D9=84=D9=87=20=D8=AA=DA=A9=D8=B1=D8=A7=D8=B1=DB=8C=20=D9=86?= =?UTF-8?q?=D8=AF=D8=A7=D8=B4=D8=AA=D9=87=20=D8=A8=D8=A7=D8=B4=DB=8C=D9=85?= =?UTF-8?q?=20=D9=88=D9=82=D8=AA=DB=8C=20=D9=88=D8=A7=D8=B1=D8=AF=20=DB=8C?= =?UTF-8?q?=DA=A9=20=D9=85=D9=82=D8=A7=D9=84=DB=8C=D9=87=20=D9=85=DB=8C?= =?UTF-8?q?=D8=B4=DB=8C=D9=85=20=D9=88=20=D8=A7=DB=8C=D9=86=DA=A9=D9=87=20?= =?UTF-8?q?=DA=86=D9=86=D8=AF=20=D8=AA=D8=A7=20=D8=AF=DB=8C=DA=AF=D9=87=20?= =?UTF-8?q?=D8=A7=D8=B2=20=D8=B5=D9=81=D8=AD=D8=A7=D8=AA=DB=8C=20=DA=A9?= =?UTF-8?q?=D9=87=20=D9=88=D9=82=D8=AA=DB=8C=20=D9=85=DB=8C=D8=B2=D8=AF?= =?UTF-8?q?=DB=8C=D9=85=20=D8=B1=D9=88=DB=8C=20=D9=84=DB=8C=D9=86=DA=A9?= =?UTF-8?q?=D8=B4=D9=88=D9=86=20=D9=88=20=D8=A7=D8=B2=20=D9=88=D8=B3=D8=B7?= =?UTF-8?q?=20=D8=B5=D9=81=D8=AD=D9=87=20=D9=86=D9=85=D8=A7=DB=8C=D8=B4=20?= =?UTF-8?q?=D9=85=DB=8C=D8=AF=D8=A7=D8=AF=DB=8C=D9=85=20=D8=AF=D8=B1=D8=B3?= =?UTF-8?q?=D8=AA=20=D8=B4=D8=AF=20|120?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Comments/index.js | 2 +- src/views/Blog/index.js | 23 ++++++++++++++---- src/views/Blogs/index.js | 2 +- src/views/Video/index.js | 41 ++++++++++++++++---------------- src/views/Videos/index.js | 2 +- 5 files changed, 41 insertions(+), 29 deletions(-) diff --git a/src/components/Comments/index.js b/src/components/Comments/index.js index 730f2cd..b23f511 100644 --- a/src/components/Comments/index.js +++ b/src/components/Comments/index.js @@ -79,7 +79,7 @@ export const Comments = ({ comments, indent }) => { {comment?.status === true && ( <> - + {window.t("برای خرید توصیه می‌کنم")} diff --git a/src/views/Blog/index.js b/src/views/Blog/index.js index 21cbb5c..cc6907d 100644 --- a/src/views/Blog/index.js +++ b/src/views/Blog/index.js @@ -9,6 +9,7 @@ import Header from "../Blogs/layouts/Header"; import Suggest from "../Blogs/layouts/Suggest"; import New from "../Blogs/layouts/New"; import Avatar from "../../components/Avatar"; +import { useParams } from "react-router-dom"; //assets import arrow from "../../assets/icons/dropdown-blue.svg"; @@ -23,19 +24,28 @@ export const Blog = ({ blogs, activeBlog, }) => { + let { id } = useParams(); + console.log(id); + + // let id = location.getId(); useEffect(() => { setHeaderOptions(headerOptions); getInfo({ id: location.getId() }); if (blogs.length === 0) { getList(); } - }, []); + }, [id]); useEffect(() => { getInfo({ id: location.getId() }); }, [activeBlog]); + + useEffect(() => { + window.scrollTo(0, 0); + }, []); + return ( -
+
{isMobile && (
+ {isMobile ? (
{blogs.map((blog, index) => ( @@ -152,9 +163,11 @@ export const Blog = ({ /> } > - {blogs.map((blog, index) => ( - - ))} + {blogs + .filter((e) => e.id != blog.id) + .map((blog, index) => ( + + ))} )}
diff --git a/src/views/Blogs/index.js b/src/views/Blogs/index.js index 3b85c6b..60cc25e 100644 --- a/src/views/Blogs/index.js +++ b/src/views/Blogs/index.js @@ -33,7 +33,7 @@ export const Blogs = ({ isMobile, getList, blogs, setHeaderOptions }) => { }, []); return ( -
+
diff --git a/src/views/Video/index.js b/src/views/Video/index.js index 244110f..7081d68 100644 --- a/src/views/Video/index.js +++ b/src/views/Video/index.js @@ -40,10 +40,15 @@ function Video({ getBook({ bookId: location.getId() }, { id: location.getId(), vod: true }); setHeaderOptions(headerOptions); }, []); + + useEffect(() => { + window.scrollTo(0, 0); + }, []); + const { bookmark } = headerOptions; return isMobile ? ( -
+
{!book && (
@@ -105,7 +110,7 @@ function Video({
) : ( -
+
@@ -184,25 +189,19 @@ function Video({

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

- {bookmark && ( -
- bookmark - addToFavorite({ [bookmark]: location.getId() }) - } - /> - - اضافه کردن به لیست علاقه مندی ها - -
- )} +
+ bookmark addToFavorite({ [bookmark]: location.getId() })} + /> + + اضافه کردن به لیست علاقه مندی ها + +
diff --git a/src/views/Videos/index.js b/src/views/Videos/index.js index ee7910f..d8a95ad 100644 --- a/src/views/Videos/index.js +++ b/src/views/Videos/index.js @@ -31,7 +31,7 @@ function Videos({ headerOptions, setHeaderOptions, getList, videos, grades }) {
-
+