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