-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8338d41
commit 50e8016
Showing
12 changed files
with
145 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 0 additions & 62 deletions
62
frontend/src/components/Displays/RobotDisplays/RobotStatusChip.tsx
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
frontend/src/components/Displays/RobotDisplays/RobotStatusIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Icon, Typography } from '@equinor/eds-core-react' | ||
import { RobotStatus } from 'models/Robot' | ||
import { tokens } from '@equinor/eds-tokens' | ||
import { useLanguageContext } from 'components/Contexts/LanguageContext' | ||
import { useSafeZoneContext } from 'components/Contexts/SafeZoneContext' | ||
import { Icons } from 'utils/icons' | ||
import { styled } from 'styled-components' | ||
|
||
interface StatusProps { | ||
status?: RobotStatus | ||
isarConnected: boolean | ||
} | ||
|
||
const StyledStatus = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
align-items: end; | ||
gap: 2px; | ||
` | ||
|
||
const StyledIcon = styled(Icon)` | ||
width: 24px; | ||
height: 24px; | ||
` | ||
|
||
export const RobotStatusChip = ({ status, isarConnected }: StatusProps) => { | ||
const { TranslateText } = useLanguageContext() | ||
const { safeZoneStatus } = useSafeZoneContext() | ||
|
||
var iconColor = tokens.colors.text.static_icons__default.hex | ||
var statusIcon = Icons.CloudOff | ||
switch (status) { | ||
case RobotStatus.Available: { | ||
statusIcon = Icons.Successful | ||
iconColor = tokens.colors.interactive.success__resting.hex | ||
break | ||
} | ||
case RobotStatus.Busy: { | ||
statusIcon = Icons.ClosedCircleOutlined | ||
iconColor = tokens.colors.interactive.warning__resting.hex | ||
break | ||
} | ||
case RobotStatus.Blocked: { | ||
statusIcon = Icons.Blocked | ||
iconColor = tokens.colors.interactive.danger__resting.hex | ||
break | ||
} | ||
default: { | ||
iconColor = tokens.colors.text.static_icons__default.hex | ||
statusIcon = Icons.CloudOff | ||
status = RobotStatus.Offline | ||
break | ||
} | ||
} | ||
|
||
if (!isarConnected) { | ||
iconColor = tokens.colors.interactive.disabled__text.hex | ||
statusIcon = Icons.Info | ||
status = RobotStatus.ConnectionIssues | ||
} else if (safeZoneStatus) { | ||
iconColor = tokens.colors.interactive.danger__resting.hex | ||
statusIcon = Icons.Warning | ||
status = RobotStatus.SafeZone | ||
} | ||
|
||
return ( | ||
<StyledStatus> | ||
<StyledIcon name={statusIcon} style={{ color: iconColor }} /> | ||
<Typography variant="body_short">{TranslateText(status)}</Typography> | ||
</StyledStatus> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters