Skip to content

Commit 2742b25

Browse files
committedApr 6, 2023
refactor: attempt at failed loader state
- issue with alignment
1 parent 023ffef commit 2742b25

File tree

3 files changed

+55
-15
lines changed

3 files changed

+55
-15
lines changed
 

‎GUI/ETVR/src/components/Camera/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Camera = (props: IProps) => {
1414
onClick={() => props.onClick()}>
1515
<div class="responsive-flex-container w-full h-full flex items-center flex-row">
1616
<div class="responsive-iframe-container flex items-center h-full w-full ">
17-
<div class="h-full w-full">
17+
<div class="h-full w-full ">
1818
<WebSocketHandler status={props.status} />
1919
</div>
2020
</div>

‎GUI/ETVR/src/components/Loader/index.tsx

+46-4
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,51 @@ interface LoaderProps {
55
gradientMid: string
66
gradientBot: string
77
width: string
8+
height: string
89
}
910

1011
interface CustomLoaderProps {
1112
width: number
13+
height: number
1214
unit?: string
1315
}
1416

15-
const CircularLoader = (props: LoaderProps) => {
17+
export const XLoader = (props: LoaderProps) => {
1618
return (
1719
<div class="spinner">
1820
<svg
1921
viewBox="0 0 100 100"
22+
fill="none"
2023
xmlns="http://www.w3.org/2000/svg"
21-
class="shape"
2224
preserveAspectRatio="none"
23-
style={{ width: props.width }}>
25+
width={props.width}
26+
height={props.height}>
27+
<defs>
28+
<linearGradient id="x-shape-gradient" x2="0.35" y2="1">
29+
<stop offset="0%" stop-color={props.gradient} />
30+
<stop offset="30%" stop-color={props.gradientMid} />
31+
<stop offset="100%" stop-color={props.gradientBot} />
32+
</linearGradient>
33+
</defs>
34+
<path
35+
d="M76.4969 11.3291C78.7942 8.54415 78.4233 4.40773 75.6653 2.08829C74.4498 1.06618 72.9739 0.566208 71.5073 0.566208C69.6443 0.566208 67.7962 1.37052 66.5125 2.9287L39 36.4307L11.4969 3.10548C10.2115 1.54812 8.36469 0.742981 6.50204 0.742981C5.03568 0.742981 3.56079 1.24297 2.34407 2.26508C-0.414369 4.5845 -0.786088 8.72093 1.51247 11.5059L30.539 46.6768L1.5076 81.6709C-0.790353 84.4559 -0.419041 88.5923 2.34001 90.9117C5.09438 93.2373 9.19141 92.8633 11.4928 90.0721L39 56.7539L66.5031 90.0791C68.7984 92.8641 72.8975 93.2414 75.6559 90.9187C78.4144 88.5993 78.7861 84.4628 76.4875 81.6779L47.461 46.507L76.4969 11.3291Z"
36+
fill="url(#x-shape-gradient)"
37+
/>
38+
</svg>
39+
</div>
40+
)
41+
}
42+
43+
export const CircularLoader = (props: LoaderProps) => {
44+
return (
45+
<div class="spinner">
46+
<svg
47+
viewBox="0 0 100 100"
48+
xmlns="http://www.w3.org/2000/svg"
49+
class="shape"
50+
width={props.width}
51+
height={props.height}
52+
preserveAspectRatio="none">
2453
<defs>
2554
<linearGradient id="shape-gradient" x2="0.35" y2="1">
2655
<stop offset="0%" stop-color={props.gradient} />
@@ -44,9 +73,22 @@ export const OrangeLoader = (props: CustomLoaderProps) => {
4473
gradientMid="rgba(255, 153, 0, 0.594)"
4574
gradientBot="rgba(255, 153, 0, 0.144)"
4675
width={`${props.width}${props.unit || 'px'}`}
76+
height={`${props.height}${props.unit || 'px'}`}
4777
/>
4878
</div>
4979
)
5080
}
5181

52-
export default CircularLoader
82+
export const MagentaLoader = (props: CustomLoaderProps) => {
83+
return (
84+
<div class="flex justify-center items-center">
85+
<XLoader
86+
gradient="magenta"
87+
gradientMid="rgba(255, 0, 255, 0.594)"
88+
gradientBot="rgba(255, 0, 255, 0.144)"
89+
width={`${props.width}${props.unit || 'px'}`}
90+
height={`${props.height}${props.unit || 'px'}`}
91+
/>
92+
</div>
93+
)
94+
}

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

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Show } from 'solid-js'
2-
import { OrangeLoader } from '@components/Loader'
2+
import { OrangeLoader, MagentaLoader } from '@components/Loader'
33
import { CameraStatus } from '@store/camera/camera'
44
import { showCameraView } from '@store/ui/selectors'
55

@@ -13,19 +13,17 @@ export const LoaderHandler = (props: IWsProps) => {
1313
return (
1414
<>
1515
<Show when={props.status == CameraStatus.LOADING}>
16-
<OrangeLoader width={100} unit={'%'} />
16+
<OrangeLoader width={100} height={100} unit={'%'} />
1717
</Show>
1818
<Show when={props.status == CameraStatus.ACTIVE}>
19-
<OrangeLoader width={100} unit={'%'} />
19+
<OrangeLoader width={100} height={100} unit={'%'} />
2020
</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={'%'} />
21+
<Show
22+
when={props.status == CameraStatus.DISABLED || props.status == CameraStatus.FAILED}>
23+
<MagentaLoader width={50} height={50} unit={'%'} />
2624
</Show>
2725
<Show when={props.status == CameraStatus.NONE}>
28-
<OrangeLoader width={100} unit={'%'} />
26+
<OrangeLoader width={100} height={100} unit={'%'} />
2927
</Show>
3028
</>
3129
)
@@ -39,7 +37,7 @@ const WebSocketHandler = (props: IWsProps) => {
3937
fallback={() => (
4038
<div
4139
class={
42-
'text-[#FFFF] flex justify-center bg-[#2b2f38] rounded-t-xl min-[1750px]:rounded-xl w-full h-full'
40+
'text-[#FFFF] flex justify-center items-center bg-[#2b2f38] rounded-t-xl min-[1750px]:rounded-xl w-full h-full'
4341
}>
4442
<LoaderHandler status={props.status} />
4543
</div>

0 commit comments

Comments
 (0)