|
|
|
@ -2,6 +2,7 @@ import React, { useEffect } from "react"; |
|
|
|
|
import "./index.scss"; |
|
|
|
|
import { connect } from "react-redux"; |
|
|
|
|
import { publicApi } from "../../../redux/actions"; |
|
|
|
|
import { Link } from "react-router-dom"; |
|
|
|
|
|
|
|
|
|
function LessonPlayList({ |
|
|
|
|
category, |
|
|
|
@ -16,12 +17,12 @@ function LessonPlayList({ |
|
|
|
|
if (localStorage.getItem("scroll-list") && vods) { |
|
|
|
|
const list: HTMLElement = document.getElementById("list") as HTMLElement; |
|
|
|
|
const listItem: HTMLElement = document.getElementById( |
|
|
|
|
"listItem" + selectedVideo.id |
|
|
|
|
"listItem" + selectedVideo?.id |
|
|
|
|
) as HTMLElement; |
|
|
|
|
const elementHeight: any = (listItem as any)?.offsetHeight; |
|
|
|
|
const listHeight: any = (list as any).offsetHeight; |
|
|
|
|
const index = vods.findIndex(( |
|
|
|
|
(item: any) => item.name === selectedVideo.name |
|
|
|
|
const index = vods?.findIndex(( |
|
|
|
|
(item: any) => item?.name === selectedVideo?.name |
|
|
|
|
)); |
|
|
|
|
console.log(index); |
|
|
|
|
console.log(listHeight,elementHeight * (Number(index) + 1)); |
|
|
|
@ -52,7 +53,8 @@ function LessonPlayList({ |
|
|
|
|
|
|
|
|
|
{bookId ? ( |
|
|
|
|
category.map((video: any, i: any) => ( |
|
|
|
|
<div |
|
|
|
|
<Link |
|
|
|
|
to={"/video/" + video.id} |
|
|
|
|
className={ |
|
|
|
|
"lesson-playlist__item d-flex align-items-center" + |
|
|
|
|
" " + |
|
|
|
@ -82,10 +84,11 @@ function LessonPlayList({ |
|
|
|
|
<h4>{video.name}</h4> |
|
|
|
|
{/* <p>{file.text}</p> */} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</Link> |
|
|
|
|
)) |
|
|
|
|
) : ( |
|
|
|
|
<div |
|
|
|
|
<Link |
|
|
|
|
to={"/video/" + category.id} |
|
|
|
|
className={ |
|
|
|
|
"lesson-playlist__item d-flex align-items-center" + |
|
|
|
|
" " + |
|
|
|
@ -112,7 +115,7 @@ function LessonPlayList({ |
|
|
|
|
<h4>{category.name}</h4> |
|
|
|
|
{/* <p>{file.text}</p> */} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</Link> |
|
|
|
|
)} |
|
|
|
|
</div> |
|
|
|
|
} |
|
|
|
|