|
|
|
@ -23,29 +23,26 @@ function VodTube({ |
|
|
|
|
getInfo, |
|
|
|
|
categories, |
|
|
|
|
setVideoActive, |
|
|
|
|
allBooks, |
|
|
|
|
}: any) { |
|
|
|
|
const videoListTag = useRef(null); |
|
|
|
|
useEffect(() => { |
|
|
|
|
localStorage.setItem("scroll-list", "on"); |
|
|
|
|
scroll.goToTop(); |
|
|
|
|
// getInfo({
|
|
|
|
|
// bookId: 1,
|
|
|
|
|
// // window.location.pathname.slice(
|
|
|
|
|
// // window.location.pathname.lastIndexOf("/") + 1,
|
|
|
|
|
// // window.location.pathname.length
|
|
|
|
|
// // ),
|
|
|
|
|
// });
|
|
|
|
|
getInfo({ bookId: localStorage.getItem("bookId") }); |
|
|
|
|
getInfo({ |
|
|
|
|
bookId: localStorage.getItem("bookId") |
|
|
|
|
? localStorage.getItem("bookId") |
|
|
|
|
: localStorage.getItem("category")?.split(",")[0], |
|
|
|
|
}); |
|
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (!info && localStorage.getItem("category")) { |
|
|
|
|
if (allBooks && localStorage.getItem("category")) { |
|
|
|
|
const cat: any = localStorage.getItem("category")?.split(","); |
|
|
|
|
bookSection({ bookId: cat[0], categoryId: cat[1] }); |
|
|
|
|
} |
|
|
|
|
if(info && localStorage.getItem("category")){ |
|
|
|
|
// document.getElementsByClassName('video-tube__sidebar--playlist___list').scrollTo(0,)
|
|
|
|
|
} |
|
|
|
|
}, [info]); |
|
|
|
|
}, [allBooks]); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
<div |
|
|
|
@ -94,12 +91,16 @@ function VodTube({ |
|
|
|
|
</div> |
|
|
|
|
<img src={listIcon} alt="" /> |
|
|
|
|
</header> |
|
|
|
|
<div ref={videoListTag} className="video-tube__sidebar--playlist___list d-flex flex-column"> |
|
|
|
|
<div |
|
|
|
|
ref={videoListTag} |
|
|
|
|
className="video-tube__sidebar--playlist___list d-flex flex-column" |
|
|
|
|
id="list" |
|
|
|
|
> |
|
|
|
|
{localStorage.getItem("bookId") |
|
|
|
|
? categories?.map((video: any, i: any) => ( |
|
|
|
|
<LessonPlayList category={video} key={i} /> |
|
|
|
|
)) |
|
|
|
|
: info?.vods?.map((video: any, i: any) => ( |
|
|
|
|
: info?.vods.map((video: any, i: any) => ( |
|
|
|
|
<LessonPlayList category={video} key={i} /> |
|
|
|
|
))} |
|
|
|
|
</div> |
|
|
|
@ -125,7 +126,7 @@ function VodTube({ |
|
|
|
|
<span>تا 50% تخفیف </span> |
|
|
|
|
</header> |
|
|
|
|
<div className="video-tube__sidebar--suggests___list d-flex justify-content-between align-items-center"> |
|
|
|
|
{info?.related?.map((item: any, i: any) => ( |
|
|
|
|
{info?.related.slice(0,3).map((item: any, i: any) => ( |
|
|
|
|
<Book data={item} key={i} /> |
|
|
|
|
))} |
|
|
|
|
</div> |
|
|
|
@ -163,6 +164,7 @@ export default connect( |
|
|
|
|
info: state.publicApi.bookSection, |
|
|
|
|
loading: state.publicApi.loading, |
|
|
|
|
categories: state.publicApi.categories, |
|
|
|
|
allBooks: state.publicApi.bookInfo?.vods, |
|
|
|
|
}), |
|
|
|
|
{ |
|
|
|
|
getInfo: publicApi.bookInfo, |
|
|
|
|