11import { Box , Typography } from "@mui/material" ;
2- import WifiIcon from '@mui/icons-material/Wifi' ;
3- import SensorsOffIcon from '@mui/icons-material/SensorsOff' ;
42import { useTranslation } from "react-i18next" ;
53
64interface ConnectInfoProps {
75 connectedRobot : boolean ;
86 connectedRemote : boolean ;
7+ isMock ?: boolean ;
98}
109
11- export const ConnectInfo = ( { connectedRobot, connectedRemote } : ConnectInfoProps ) => {
10+ export const ConnectInfo = ( { connectedRobot, connectedRemote, isMock } : ConnectInfoProps ) => {
1211 const { t } = useTranslation ( ) ;
1312
14- const StatusBadge = ( { label, active } : { label : string , active : boolean } ) => (
15- < Box sx = { { display : 'flex' , alignItems : 'center' , gap : 1 } } >
16- < Box
17- className = { active ? "status-pulse" : "" }
18- sx = { {
19- width : 8 ,
20- height : 8 ,
21- borderRadius : "50%" ,
22- backgroundColor : active ? 'var(--success)' : 'var(--error)' ,
23- boxShadow : `0 0 8px ${ active ? 'var(--success-glow)' : 'var(--error-glow)' } ` ,
24- } }
25- />
26- < Typography sx = { {
27- fontSize : '0.7rem' ,
28- fontWeight : 700 ,
29- color : active ? 'var(--text-main)' : 'var(--text-muted)'
30- } } >
31- { label }
32- </ Typography >
33- </ Box >
34- ) ;
13+ const StatusBadge = ( { label, active, simulated } : { label : string , active : boolean , simulated ?: boolean } ) => {
14+ // If simulated, it should look disconnected (Red/Offline) as per user request
15+ const isActuallyConnected = active && ! simulated ;
16+
17+ const color = isActuallyConnected ? 'var(--success)' : 'var(--error)' ;
18+ const glow = isActuallyConnected ? 'var(--success-glow)' : 'var(--error-glow)' ;
19+ const textLabel = isActuallyConnected ? label : "OFFLINE" ;
20+
21+ return (
22+ < Box sx = { { display : 'flex' , alignItems : 'center' , gap : 1 } } >
23+ < Box
24+ className = { isActuallyConnected ? "status-pulse" : "" }
25+ sx = { {
26+ width : 8 ,
27+ height : 8 ,
28+ borderRadius : "50%" ,
29+ backgroundColor : color ,
30+ boxShadow : `0 0 8px ${ glow } ` ,
31+ } }
32+ />
33+ < Typography sx = { {
34+ fontSize : '0.7rem' ,
35+ fontWeight : 700 ,
36+ color : isActuallyConnected ? 'var(--text-main)' : 'var(--text-muted)'
37+ } } >
38+ { textLabel }
39+ </ Typography >
40+ </ Box >
41+ ) ;
42+ } ;
3543
3644 return (
3745 < Box
@@ -46,9 +54,9 @@ export const ConnectInfo = ({ connectedRobot, connectedRemote }: ConnectInfoProp
4654 background : `rgba(0,0,0,0.2)` ,
4755 } }
4856 >
49- < StatusBadge label = "ROBOT" active = { connectedRobot } />
57+ < StatusBadge label = "ROBOT" active = { connectedRobot } simulated = { isMock } />
5058 < Box sx = { { width : '1px' , height : '12px' , background : 'rgba(255,255,255,0.1)' } } />
51- < StatusBadge label = "REMOTE" active = { connectedRemote } />
59+ < StatusBadge label = "REMOTE" active = { connectedRemote } simulated = { isMock } />
5260 </ Box >
5361 ) ;
5462} ;
0 commit comments