l-min-components 1.0.407 → 1.0.412

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.0.407",
3
+ "version": "1.0.412",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -35,7 +35,7 @@
35
35
  "react-input-emoji": "^5.3.1",
36
36
  "react-mic": "^12.4.6",
37
37
  "react-modal": "^3.16.1",
38
- "react-player": "^2.13.0",
38
+ "react-player": "2.12.0",
39
39
  "react-router-dom": "^6.8.2",
40
40
  "react-toastify": "^9.1.3",
41
41
  "react-tooltip": "^5.10.1",
@@ -82,7 +82,7 @@ const AppMainLayout = () => {
82
82
  break;
83
83
  }
84
84
  }
85
- setAccessToken(cookieValue)
85
+ setAccessToken(cookieValue);
86
86
  }, [defaultAcct]);
87
87
 
88
88
  return (
@@ -109,7 +109,7 @@ const AppMainLayout = () => {
109
109
  // return true if instructor affiliates is Active
110
110
  setHideAffilicates,
111
111
  affiliatesActive,
112
- accessToken
112
+ accessToken,
113
113
  }}
114
114
  >
115
115
  <Layout
@@ -161,24 +161,24 @@ const AppMainLayout = () => {
161
161
 
162
162
  {rightLayout && !coming && (
163
163
  <RightLayout>
164
- {
165
- window.location.pathname.includes("enterprise")
166
- && !window.location.pathname.includes("file-manager")
167
- ? <EnterpriseRightBar/>
168
- : window.location.pathname.includes("personal")
169
- ? <InstructorRightBar />
170
- : window.location.pathname.includes("instructor")
171
- && !window.location.pathname.includes("manage-teams")
172
- && !window.location.pathname.includes("file-manager")
173
- ? <InstructorRightBar />
174
- : window.location.pathname.includes("developer")
175
- ? <Banner />
176
- : <Banner />
177
- }
164
+ {rightComponent ??
165
+ (window.location.pathname.includes("enterprise") &&
166
+ !window.location.pathname.includes("file-manager") ? (
167
+ <EnterpriseRightBar />
168
+ ) : window.location.pathname.includes("personal") ? (
169
+ <InstructorRightBar />
170
+ ) : window.location.pathname.includes("instructor") &&
171
+ !window.location.pathname.includes("manage-teams") &&
172
+ !window.location.pathname.includes("file-manager") ? (
173
+ <InstructorRightBar />
174
+ ) : window.location.pathname.includes("developer") ? (
175
+ <Banner />
176
+ ) : (
177
+ <Banner />
178
+ ))}
178
179
 
179
180
  {/* {rightComponent ?? <Banner />} */}
180
-
181
- </RightLayout>
181
+ </RightLayout>
182
182
  )}
183
183
  </MainLayout>
184
184
  </Layout>
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  const PauseIcon = ({ fill, onClick }) => {
2
3
  return (
3
4
  <svg
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  const PlayVideoIcon = () => {
2
3
  return (
3
4
  <svg
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  const VideoScreenIcon = ({ onClick }) => {
2
3
  return (
3
4
  <svg
@@ -1,4 +1,4 @@
1
- import { useState, useRef, useEffect } from "react";
1
+ import { useState, useRef, React } from "react";
2
2
  import screenfull from "screenfull";
3
3
  import {
4
4
  RangeContainer,
@@ -13,23 +13,20 @@ import PauseIcon from "./icons/pause";
13
13
 
14
14
  const VideoPlayer = ({
15
15
  width,
16
- height,
16
+ height = "360px",
17
17
  style,
18
18
  src,
19
19
  hideRange,
20
20
  showPrompts,
21
21
  controlSize,
22
22
  }) => {
23
- const [player, setPlayer] = useState({
24
- playing: false,
25
- played: 0,
26
- seeking: false,
27
- });
23
+ const [isPlaying, setIsPlayering] = useState(false);
24
+ const [isSeeking, setIsSeeking] = useState(false);
25
+ const [progress, setProgress] = useState();
28
26
  const [hideController, setHideController] = useState(false);
29
27
  const [count, setCount] = useState(0);
30
28
  const playContainerRef = useRef();
31
29
  const playerRef = useRef();
32
- const { playing, played, seeking } = player;
33
30
 
34
31
  const format = (secs) => {
35
32
  const sec_num = parseInt(secs, 10);
@@ -43,7 +40,7 @@ const VideoPlayer = ({
43
40
  };
44
41
 
45
42
  const handlePlayPause = () => {
46
- setPlayer({ ...player, playing: !player.playing });
43
+ setIsPlayering(!isPlaying);
47
44
  };
48
45
 
49
46
  const handleFullScreen = () => {
@@ -58,19 +55,19 @@ const VideoPlayer = ({
58
55
  if (!hideController) {
59
56
  setCount(count + 1);
60
57
  }
61
- if (seeking === false) {
62
- setPlayer({ ...player, ...changeState });
58
+ if (isSeeking === false) {
59
+ setProgress(changeState);
63
60
  }
64
61
  };
65
62
 
66
63
  const handleSeek = (e) => {
67
- setPlayer({ ...player, played: parseFloat(e.target?.value / 100) });
64
+ setProgress({ ...progress, played: parseFloat(e.target?.value / 100) });
68
65
  };
69
66
  const handleSeekMouseDown = () => {
70
- setPlayer({ ...player, seeking: true });
67
+ setIsSeeking(true);
71
68
  };
72
69
  const handleSeekMouseUp = (e) => {
73
- setPlayer({ ...player, seeking: false });
70
+ setIsSeeking(true);
74
71
  playerRef.current?.seekTo(e.target?.value / 100);
75
72
  };
76
73
 
@@ -80,23 +77,12 @@ const VideoPlayer = ({
80
77
  };
81
78
 
82
79
  const calcShowPrompts = () => {
83
- if (player?.playedSeconds) {
84
- return Math.floor((player.playedSeconds * 100) / player.loadedSeconds);
80
+ if (progress?.playedSeconds) {
81
+ return Math.floor(
82
+ (progress.playedSeconds * 100) / progress.loadedSeconds,
83
+ );
85
84
  }
86
85
  };
87
- const currentValue = playerRef?.current?.getCurrentTime();
88
- const durrationValue = playerRef.current?.getDuration();
89
- useEffect(() => {
90
- if (currentValue && durrationValue) {
91
- if (currentValue === durrationValue) {
92
- setTimeout(() => {
93
- setPlayer({ ...player, playing: false });
94
- setHideController(false);
95
- setCount(0);
96
- }, 500);
97
- }
98
- }
99
- }, [currentValue, durrationValue, player]);
100
86
 
101
87
  const currentTime = playerRef.current
102
88
  ? format(playerRef.current?.getCurrentTime())
@@ -135,8 +121,14 @@ const VideoPlayer = ({
135
121
  "https://joy1.videvo.net/videvo_files/video/free/video0474/small_watermarked/_import_61ea3dd6ab62a0.19123787_preview.mp4"
136
122
  }
137
123
  // muted={true}
138
- playing={playing}
124
+ playing={isPlaying}
139
125
  onProgress={handleProgess}
126
+ onEnded={() => {
127
+ setIsPlayering(false);
128
+ setHideController(false);
129
+ setCount(0);
130
+ setProgress({ ...progress, played: 1 });
131
+ }}
140
132
  />
141
133
  <VideoController hide={hideController} size={controlSize}>
142
134
  {!hideRange && (
@@ -146,19 +138,21 @@ const VideoPlayer = ({
146
138
  </p>
147
139
  <input
148
140
  type="range"
141
+ name=""
142
+ id=""
149
143
  className="range"
150
144
  min={0}
151
145
  max={100}
152
146
  onChange={handleSeek}
153
147
  onMouseDown={handleSeekMouseDown}
154
148
  onMouseUp={handleSeekMouseUp}
155
- value={played * 100}
149
+ value={Math.round(progress?.played * 100)}
156
150
  />
157
151
  <VideoScreenIcon onClick={handleFullScreen} />
158
152
  </RangeContainer>
159
153
  )}
160
154
  <div className="play_pause_wrap" onClick={handlePlayPause}>
161
- {playing ? <PauseIcon fill="#fff" /> : <PlayIcon fill="#fff" />}
155
+ {isPlaying ? <PauseIcon fill="#fff" /> : <PlayIcon fill="#fff" />}
162
156
  </div>
163
157
  </VideoController>
164
158
  </VideoPlayerContainer>