1
1
import { Show } from 'solid-js'
2
2
import { OrangeLoader } from '@components/Loader'
3
+ import { CameraStatus } from '@store/camera/camera'
3
4
import { showCameraView } from '@store/ui/selectors'
4
5
5
- // TODO: Grab selected camera from store, connect if not connected, and display video stream on component mounted
6
+ // TODO: Grab selected camera from store, connect if not connected, and display video stream on component mounted
7
+ interface IWsProps {
8
+ status : CameraStatus
9
+ }
10
+
11
+ // TODO: Make other loader components for other statuses
12
+ export const LoaderHandler = ( props : IWsProps ) => {
13
+ return (
14
+ < >
15
+ < Show when = { props . status == CameraStatus . LOADING } >
16
+ < OrangeLoader width = { 100 } unit = { '%' } />
17
+ </ Show >
18
+ < Show when = { props . status == CameraStatus . ACTIVE } >
19
+ < OrangeLoader width = { 100 } unit = { '%' } />
20
+ </ Show >
21
+ < Show when = { props . status == CameraStatus . DISABLED } >
22
+ < OrangeLoader width = { 100 } unit = { '%' } />
23
+ </ Show >
24
+ < Show when = { props . status == CameraStatus . FAILED } >
25
+ < OrangeLoader width = { 100 } unit = { '%' } />
26
+ </ Show >
27
+ < Show when = { props . status == CameraStatus . NONE } >
28
+ < OrangeLoader width = { 100 } unit = { '%' } />
29
+ </ Show >
30
+ </ >
31
+ )
32
+ }
6
33
7
- const WebSocketHandler = ( ) => {
34
+ const WebSocketHandler = ( props : IWsProps ) => {
8
35
return (
9
36
< div class = { 'w-full h-full' } >
10
37
< Show
@@ -14,7 +41,7 @@ const WebSocketHandler = () => {
14
41
class = {
15
42
'text-[#FFFF] flex justify-center bg-[#2b2f38] rounded-t-xl min-[1750px]:rounded-xl w-full h-full'
16
43
} >
17
- < OrangeLoader width = { 100 } unit = { '%' } />
44
+ < LoaderHandler status = { props . status } />
18
45
</ div >
19
46
) } >
20
47
< video class = "bg-black rounded-t-xl w-full h-full" autoplay >
0 commit comments