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

temp
mahdi 3 years ago
parent 477282518b
commit 76c719796c
  1. 2
      src/components/Comments/index.js
  2. 23
      src/views/Blog/index.js
  3. 2
      src/views/Blogs/index.js
  4. 41
      src/views/Video/index.js
  5. 2
      src/views/Videos/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,19 +24,28 @@ 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 />
{isMobile && ( {isMobile && (
<div <div
@ -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,9 +163,11 @@ export const Blog = ({
/> />
} }
> >
{blogs.map((blog, index) => ( {blogs
<Suggest blog={blog} key={index} /> .filter((e) => e.id != blog.id)
))} .map((blog, index) => (
<Suggest blog={blog} key={index} />
))}
</Carousel> </Carousel>
)} )}
</div> </div>

@ -33,7 +33,7 @@ export const Blogs = ({ isMobile, getList, blogs, setHeaderOptions }) => {
}, []); }, []);
return ( return (
<div className="flex w-full px-4 lg:px-0 flex-col lg:w-11/12 mx-auto lg:py-24 pb-24 lg:pb-0 "> <div className="flex w-full px-4 lg:px-0 flex-col lg:w-11/12 mx-auto lg:py-24 pb-24 lg:pb-0">
<Hashtags /> <Hashtags />
<Single /> <Single />
<Header title={window.t(" تازهترینها از وبلاگ")} /> <Header title={window.t(" تازهترینها از وبلاگ")} />

@ -40,10 +40,15 @@ 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 ? (
<div className="w-full flex flex-col px-4 pb-24"> <div className="w-full flex flex-col px-4 pb-24 ">
{!book && ( {!book && (
<div className="w-full h-screen flex justify-center items-center bg-white bg-opacity-20 backdrop-filter backdrop-blur-xl fixed left-0 top-0 z-50"> <div className="w-full h-screen flex justify-center items-center bg-white bg-opacity-20 backdrop-filter backdrop-blur-xl fixed left-0 top-0 z-50">
<Loading size={4} color="bg-green-400" /> <Loading size={4} color="bg-green-400" />
@ -105,7 +110,7 @@ function Video({
</div> </div>
</div> </div>
) : ( ) : (
<div className="flex flex-col w-11/12 min-h-screen mx-auto pb-20 pt-24"> <div className="flex flex-col w-11/12 min-h-screen mx-auto pb-20 pt-24 ">
<header className="w-full flex flex-row gap-12"> <header className="w-full flex flex-row gap-12">
<div className="w-9/12"> <div className="w-9/12">
<Videos videos={book?.fileIds} /> <Videos videos={book?.fileIds} />
@ -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 ? bookmarkDeactiveDarkIcon : bookmarkDeactiveLightIcon
isDark }
? bookmarkDeactiveDarkIcon alt="bookmark"
: bookmarkDeactiveLightIcon className="w-7"
} onClick={() => addToFavorite({ [bookmark]: location.getId() })}
alt="bookmark" />
className="w-7" <span className="mr-3 text-sm">
onClick={() => اضافه کردن به لیست علاقه مندی ها
addToFavorite({ [bookmark]: location.getId() }) </span>
} </div>
/>
<span className="mr-3 text-sm">
اضافه کردن به لیست علاقه مندی ها
</span>
</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">

@ -31,7 +31,7 @@ function Videos({ headerOptions, setHeaderOptions, getList, videos, grades }) {
<div className="pr-4"> <div className="pr-4">
<MostViewedVideo videos={videos} grades={grades} /> <MostViewedVideo videos={videos} grades={grades} />
</div> </div>
<div className="px-4 flex flex-col"> <div className="px-4 flex flex-col ">
<Divider type={"vertical"} /> <Divider type={"vertical"} />
<NewestVideo videos={videos} grades={grades} /> <NewestVideo videos={videos} grades={grades} />
</div> </div>

Loading…
Cancel
Save