درست کردن قسمت بلاگ و اینکه مقاله تکراری نداشته باشیم وقتی وارد یک مقالیه میشیم و اینکه چند تا دیگه از صفحاتی که وقتی میزدیم روی لینکشون و از وسط صفحه نمایش میدادیم درست شد |120

temp
mahdi 3 years ago
parent 477282518b
commit 76c719796c
  1. 2
      src/components/Comments/index.js
  2. 17
      src/views/Blog/index.js
  3. 15
      src/views/Video/index.js

@ -79,7 +79,7 @@ export const Comments = ({ comments, indent }) => {
{comment?.status === true && ( {comment?.status === true && (
<> <>
<img src={positiveIcon} alt="" className="w-6 ml-2" /> <img src={positiveIcon} alt="" className="w-6 ml-2" />
<span className="text-sm text-black"> <span className="text-sm">
{window.t("برای خرید توصیه میکنم")} {window.t("برای خرید توصیه میکنم")}
</span> </span>
</> </>

@ -9,6 +9,7 @@ import Header from "../Blogs/layouts/Header";
import Suggest from "../Blogs/layouts/Suggest"; import Suggest from "../Blogs/layouts/Suggest";
import New from "../Blogs/layouts/New"; import New from "../Blogs/layouts/New";
import Avatar from "../../components/Avatar"; import Avatar from "../../components/Avatar";
import { useParams } from "react-router-dom";
//assets //assets
import arrow from "../../assets/icons/dropdown-blue.svg"; import arrow from "../../assets/icons/dropdown-blue.svg";
@ -23,17 +24,26 @@ export const Blog = ({
blogs, blogs,
activeBlog, activeBlog,
}) => { }) => {
let { id } = useParams();
console.log(id);
// let id = location.getId();
useEffect(() => { useEffect(() => {
setHeaderOptions(headerOptions); setHeaderOptions(headerOptions);
getInfo({ id: location.getId() }); getInfo({ id: location.getId() });
if (blogs.length === 0) { if (blogs.length === 0) {
getList(); getList();
} }
}, []); }, [id]);
useEffect(() => { useEffect(() => {
getInfo({ id: location.getId() }); getInfo({ id: location.getId() });
}, [activeBlog]); }, [activeBlog]);
useEffect(() => {
window.scrollTo(0, 0);
}, []);
return ( return (
<div className="flex flex-col lg:w-11/12 mx-auto lg:py-24 lg:px-0 px-4 lg:pb-0 pb-24"> <div className="flex flex-col lg:w-11/12 mx-auto lg:py-24 lg:px-0 px-4 lg:pb-0 pb-24">
<Hashtags /> <Hashtags />
@ -120,6 +130,7 @@ export const Blog = ({
dangerouslySetInnerHTML={{ __html: blog?.text }} dangerouslySetInnerHTML={{ __html: blog?.text }}
/> />
<Header title={window.t("پیشنهادی")} /> <Header title={window.t("پیشنهادی")} />
{isMobile ? ( {isMobile ? (
<div className="w-full flex overflow-x-scroll no-scrollbar gap-4"> <div className="w-full flex overflow-x-scroll no-scrollbar gap-4">
{blogs.map((blog, index) => ( {blogs.map((blog, index) => (
@ -152,7 +163,9 @@ export const Blog = ({
/> />
} }
> >
{blogs.map((blog, index) => ( {blogs
.filter((e) => e.id != blog.id)
.map((blog, index) => (
<Suggest blog={blog} key={index} /> <Suggest blog={blog} key={index} />
))} ))}
</Carousel> </Carousel>

@ -40,6 +40,11 @@ function Video({
getBook({ bookId: location.getId() }, { id: location.getId(), vod: true }); getBook({ bookId: location.getId() }, { id: location.getId(), vod: true });
setHeaderOptions(headerOptions); setHeaderOptions(headerOptions);
}, []); }, []);
useEffect(() => {
window.scrollTo(0, 0);
}, []);
const { bookmark } = headerOptions; const { bookmark } = headerOptions;
return isMobile ? ( return isMobile ? (
@ -184,25 +189,19 @@ function Video({
<img src={tickIcon} alt="" className="w-9" /> <img src={tickIcon} alt="" className="w-9" />
<p className="text-blue52 text-sm font-light">{`توصیه خرید توسط ${book?.product[2]?.suggestedCounter} نفر`}</p> <p className="text-blue52 text-sm font-light">{`توصیه خرید توسط ${book?.product[2]?.suggestedCounter} نفر`}</p>
</div> </div>
{bookmark && (
<div className="flex flex-row items-center py-3"> <div className="flex flex-row items-center py-3">
<img <img
src={ src={
isDark isDark ? bookmarkDeactiveDarkIcon : bookmarkDeactiveLightIcon
? bookmarkDeactiveDarkIcon
: bookmarkDeactiveLightIcon
} }
alt="bookmark" alt="bookmark"
className="w-7" className="w-7"
onClick={() => onClick={() => addToFavorite({ [bookmark]: location.getId() })}
addToFavorite({ [bookmark]: location.getId() })
}
/> />
<span className="mr-3 text-sm"> <span className="mr-3 text-sm">
اضافه کردن به لیست علاقه مندی ها اضافه کردن به لیست علاقه مندی ها
</span> </span>
</div> </div>
)}
<div className="flex flex-col w-full py-4 px-4"> <div className="flex flex-col w-full py-4 px-4">
<div className="flex flex-row items-center justify-center gap-2"> <div className="flex flex-row items-center justify-center gap-2">
<strong className="text-blueC0 text-5xl"> <strong className="text-blueC0 text-5xl">

Loading…
Cancel
Save