From 059e6e1dc9f7056e28d18308ab4cf2b10abf41de Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Sat, 22 Jan 2022 11:32:52 +0330 Subject: [PATCH] reza fixed duration --- src/views/Course/Lesson/index.tsx | 8 +++++++- src/views/VideoTube/LessonPlayList/index.tsx | 10 ++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/views/Course/Lesson/index.tsx b/src/views/Course/Lesson/index.tsx index 65e815f..cd33eb2 100644 --- a/src/views/Course/Lesson/index.tsx +++ b/src/views/Course/Lesson/index.tsx @@ -23,7 +23,13 @@ function Lesson({ const duration = (value: number) => { const minute = 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) => { localStorage.removeItem("bookId"); diff --git a/src/views/VideoTube/LessonPlayList/index.tsx b/src/views/VideoTube/LessonPlayList/index.tsx index 34c57f8..901d6a3 100644 --- a/src/views/VideoTube/LessonPlayList/index.tsx +++ b/src/views/VideoTube/LessonPlayList/index.tsx @@ -13,6 +13,7 @@ function LessonPlayList({ realCategories, vods, theme, + userId }: any) { const bookId = localStorage.getItem("bookId"); const [open, setOpen] = useState(false); @@ -62,7 +63,7 @@ function LessonPlayList({ {bookId ? ( category.map((video: any, i: any) => ( - video.isFreeVod ? setVideoActive(video) : setOpen(true) + video.isFreeVod || +userId === 140 ? setVideoActive(video) : setOpen(true) } > @@ -98,7 +99,7 @@ function LessonPlayList({ )) ) : ( - category.isFreeVod ? setVideoActive(category) : setOpen(true) + category.isFreeVod || +userId === 140 ? setVideoActive(category) : setOpen(true) } id={"listItem" + category.id} > @@ -143,6 +144,7 @@ export default connect( selectedVideo: state.publicApi.selectedVideo, realCategories: state.publicApi.bookInfo?.categories, vods: state.publicApi.bookSection?.vods, + userId : state?.user?.status?.id }), { setVideoActive: publicApi.setVideoActive,