Skip to content

Commit 7338e3a

Browse files
committed
fix: fix websocket component fallback
- migrate away from Show and use Switch - fixed fallback JSX callback method
1 parent 274a7d0 commit 7338e3a

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

ETVR.code-workspace

+2
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@
6868
"hashset",
6969
"hookable",
7070
"Iinternal",
71+
"iocp",
7172
"kobalte",
7273
"nanos",
7374
"notif",
7475
"notififcation",
7576
"notifs",
7677
"partytown",
78+
"ratelimit",
7779
"reqwest",
7880
"shakram",
7981
"solidjs",

GUI/ETVR/src/components/WebSocket/index.tsx

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import { Show } from 'solid-js'
1+
import { Switch, Match, Show } from 'solid-js'
22
import { OrangeLoader, MagentaLoader } from '@components/Loader'
33
import { classNames } from '@src/utils'
44
import { CameraStatus } from '@store/camera/camera'
55
import { showCameraView } from '@store/ui/selectors'
66

77
// TODO: Grab selected camera from store, connect if not connected, and display video stream on component mounted
8-
interface IWsProps {
8+
type IWsProps = {
99
status: CameraStatus
1010
styles?: string
1111
}
1212

1313
// TODO: Make other loader components for other statuses
1414
export const LoaderHandler = (props: IWsProps) => {
1515
return (
16-
<>
17-
<Show when={props.status == CameraStatus.LOADING}>
16+
<Switch>
17+
<Match when={props.status == CameraStatus.LOADING}>
1818
<OrangeLoader width={100} height={100} unit={'%'} />
19-
</Show>
20-
<Show when={props.status == CameraStatus.ACTIVE}>
19+
</Match>
20+
<Match when={props.status == CameraStatus.ACTIVE}>
2121
<OrangeLoader width={100} height={100} unit={'%'} />
22-
</Show>
23-
<Show
22+
</Match>
23+
<Match
2424
when={props.status == CameraStatus.DISABLED || props.status == CameraStatus.FAILED}>
2525
<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}>
2828
<OrangeLoader width={100} height={100} unit={'%'} />
29-
</Show>
30-
</>
29+
</Match>
30+
</Switch>
3131
)
3232
}
3333

@@ -36,15 +36,15 @@ const WebSocketHandler = (props: IWsProps) => {
3636
<div class="w-full h-full">
3737
<Show
3838
when={showCameraView()}
39-
fallback={() => (
39+
fallback={
4040
<div
4141
class={classNames(
4242
props.styles,
4343
'text-[#FFFF] flex justify-center items-center bg-[#2b2f38] rounded-t-xl min-[1750px]:rounded-xl w-full h-full',
4444
)}>
4545
<LoaderHandler status={props.status} />
4646
</div>
47-
)}>
47+
}>
4848
<video class="bg-black rounded-t-xl w-full h-full" autoplay>
4949
<source src="" type="video/mp4" />
5050
</video>

0 commit comments

Comments
 (0)