reza fixed duration

master
Reza_ashrafi 3 years ago
parent 914bd79d94
commit 059e6e1dc9
  1. 8
      src/views/Course/Lesson/index.tsx
  2. 10
      src/views/VideoTube/LessonPlayList/index.tsx

@ -23,7 +23,13 @@ function Lesson({
const duration = (value: number) => { const duration = (value: number) => {
const minute = value % 60; const minute = value % 60;
const hour = Math.round(value / 60); const hour = Math.round(value / 60);
return (hour > 0 ? hour + " " + "ساعت" : "") + " " + minute + " " + "دقیقه"; return (
(hour > 0
? (hour.toString().length === 1 ? "0" + hour.toString() : hour) + ""
: "") +
":" +
(minute.toString().length === 1 ? "0" + minute.toString() : minute)
);
}; };
const setCategory = (catId: any, videoId: any) => { const setCategory = (catId: any, videoId: any) => {
localStorage.removeItem("bookId"); localStorage.removeItem("bookId");

@ -13,6 +13,7 @@ function LessonPlayList({
realCategories, realCategories,
vods, vods,
theme, theme,
userId
}: any) { }: any) {
const bookId = localStorage.getItem("bookId"); const bookId = localStorage.getItem("bookId");
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
@ -62,7 +63,7 @@ function LessonPlayList({
{bookId ? ( {bookId ? (
category.map((video: any, i: any) => ( category.map((video: any, i: any) => (
<Link <Link
to={video.isFreeVod ? "/video/" + video.id : "#"} to={video.isFreeVod || +userId === 140 ? "/video/" + video.id : "#"}
className={ className={
"lesson-playlist__item d-flex align-items-center" + "lesson-playlist__item d-flex align-items-center" +
" " + " " +
@ -72,7 +73,7 @@ function LessonPlayList({
key={i} key={i}
id={"listItem" + video.id} id={"listItem" + video.id}
onClick={() => onClick={() =>
video.isFreeVod ? setVideoActive(video) : setOpen(true) video.isFreeVod || +userId === 140 ? setVideoActive(video) : setOpen(true)
} }
> >
<span className="lesson-playlist__item--count"> <span className="lesson-playlist__item--count">
@ -98,7 +99,7 @@ function LessonPlayList({
)) ))
) : ( ) : (
<Link <Link
to={category.isFreeVod ? "/video/" + category.id : "#"} to={category.isFreeVod || +userId === 140 ? "/video/" + category.id : "#"}
className={ className={
"lesson-playlist__item d-flex align-items-center" + "lesson-playlist__item d-flex align-items-center" +
" " + " " +
@ -106,7 +107,7 @@ function LessonPlayList({
"lesson-playlist__item--active") "lesson-playlist__item--active")
} }
onClick={() => onClick={() =>
category.isFreeVod ? setVideoActive(category) : setOpen(true) category.isFreeVod || +userId === 140 ? setVideoActive(category) : setOpen(true)
} }
id={"listItem" + category.id} id={"listItem" + category.id}
> >
@ -143,6 +144,7 @@ export default connect(
selectedVideo: state.publicApi.selectedVideo, selectedVideo: state.publicApi.selectedVideo,
realCategories: state.publicApi.bookInfo?.categories, realCategories: state.publicApi.bookInfo?.categories,
vods: state.publicApi.bookSection?.vods, vods: state.publicApi.bookSection?.vods,
userId : state?.user?.status?.id
}), }),
{ {
setVideoActive: publicApi.setVideoActive, setVideoActive: publicApi.setVideoActive,

Loading…
Cancel
Save