diff --git a/frontend/src/components/Displays/RobotDisplays/RobotStatusIcon.tsx b/frontend/src/components/Displays/RobotDisplays/RobotStatusIcon.tsx index 0042ede4d..eb8323a2c 100644 --- a/frontend/src/components/Displays/RobotDisplays/RobotStatusIcon.tsx +++ b/frontend/src/components/Displays/RobotDisplays/RobotStatusIcon.tsx @@ -1,14 +1,14 @@ import { Icon, Typography } from '@equinor/eds-core-react' -import { RobotStatus } from 'models/Robot' +import { RobotFlotillaStatus, 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 + flotillaStatus?: RobotFlotillaStatus } const StyledStatus = styled.div` @@ -23,9 +23,8 @@ const StyledIcon = styled(Icon)` height: 24px; ` -export const RobotStatusChip = ({ status, isarConnected }: StatusProps) => { +export const RobotStatusChip = ({ status, flotillaStatus, isarConnected }: StatusProps) => { const { TranslateText } = useLanguageContext() - const { safeZoneStatus } = useSafeZoneContext() var iconColor = tokens.colors.text.static_icons__default.hex var statusIcon = Icons.CloudOff @@ -57,10 +56,14 @@ export const RobotStatusChip = ({ status, isarConnected }: StatusProps) => { iconColor = tokens.colors.interactive.disabled__text.hex statusIcon = Icons.Info status = RobotStatus.ConnectionIssues - } else if (safeZoneStatus) { + } else if (flotillaStatus && flotillaStatus === RobotFlotillaStatus.SafeZone) { iconColor = tokens.colors.interactive.danger__resting.hex statusIcon = Icons.Warning status = RobotStatus.SafeZone + } else if (flotillaStatus && flotillaStatus === RobotFlotillaStatus.Recharging) { + iconColor = '#FFC300' + statusIcon = Icons.BatteryCharging + status = RobotStatus.Recharging } return ( diff --git a/frontend/src/components/Pages/FrontPage/MissionOverview/StopDialogs.tsx b/frontend/src/components/Pages/FrontPage/MissionOverview/StopDialogs.tsx index 091cccc0f..2928b995c 100644 --- a/frontend/src/components/Pages/FrontPage/MissionOverview/StopDialogs.tsx +++ b/frontend/src/components/Pages/FrontPage/MissionOverview/StopDialogs.tsx @@ -7,11 +7,12 @@ import { tokens } from '@equinor/eds-tokens' import { useMissionControlContext } from 'components/Contexts/MissionControlContext' import { BackendAPICaller } from 'api/ApiCaller' import { useInstallationContext } from 'components/Contexts/InstallationContext' -import { useSafeZoneContext } from 'components/Contexts/SafeZoneContext' import { TaskType } from 'models/Task' import { AlertType, useAlertContext } from 'components/Contexts/AlertContext' import { FailedRequestAlertContent } from 'components/Alerts/FailedRequestAlert' import { AlertCategory } from 'components/Alerts/AlertsBanner' +import { useRobotContext } from 'components/Contexts/RobotContext' +import { RobotFlotillaStatus } from 'models/Robot' const StyledDisplayButtons = styled.div` display: flex; @@ -135,11 +136,18 @@ export const StopMissionDialog = ({ missionName, robotId, missionTaskType }: Mis export const StopRobotDialog = (): JSX.Element => { const [isStopRobotDialogOpen, setIsStopRobotDialogOpen] = useState(false) - const { safeZoneStatus } = useSafeZoneContext() + const { enabledRobots } = useRobotContext() const { TranslateText } = useLanguageContext() const { installationCode } = useInstallationContext() const { setAlert } = useAlertContext() + const safeZoneActivated = + enabledRobots.find( + (r) => + r.currentInstallation.installationCode === installationCode && + r.flotillaStatus === RobotFlotillaStatus.SafeZone + ) !== undefined + const openDialog = async () => { setIsStopRobotDialogOpen(true) } @@ -176,7 +184,7 @@ export const StopRobotDialog = (): JSX.Element => { return ( <> - {!safeZoneStatus ? ( + {!safeZoneActivated ? ( <>{TranslateText('Send robots to safe zone')} ) : ( <>{TranslateText('Dismiss robots from safe zone')} @@ -186,7 +194,7 @@ export const StopRobotDialog = (): JSX.Element => { - {!safeZoneStatus + {!safeZoneActivated ? TranslateText('Send robots to safe zone') + '?' : TranslateText('Dismiss robots from safe zone') + '?'} @@ -195,12 +203,12 @@ export const StopRobotDialog = (): JSX.Element => { - {!safeZoneStatus + {!safeZoneActivated ? TranslateText('Send robots to safe zone long text') : TranslateText('Dismiss robots from safe zone long text')} - {!safeZoneStatus + {!safeZoneActivated ? TranslateText('Send robots to safe confirmation text') : TranslateText('Dismiss robots from safe confirmation text')} @@ -217,7 +225,7 @@ export const StopRobotDialog = (): JSX.Element => { > {TranslateText('Cancel')} - {!safeZoneStatus ? ( + {!safeZoneActivated ? ( diff --git a/frontend/src/components/Pages/FrontPage/RobotCards/RobotStatusCard.tsx b/frontend/src/components/Pages/FrontPage/RobotCards/RobotStatusCard.tsx index 5369821b1..2a0c915d2 100644 --- a/frontend/src/components/Pages/FrontPage/RobotCards/RobotStatusCard.tsx +++ b/frontend/src/components/Pages/FrontPage/RobotCards/RobotStatusCard.tsx @@ -93,7 +93,11 @@ export const RobotStatusCard = ({ robot }: RobotProps) => { {TranslateText('Status')} - + {robot.status !== RobotStatus.Offline ? ( diff --git a/frontend/src/components/Pages/RobotPage/RobotPage.tsx b/frontend/src/components/Pages/RobotPage/RobotPage.tsx index 9df7425b9..232257249 100644 --- a/frontend/src/components/Pages/RobotPage/RobotPage.tsx +++ b/frontend/src/components/Pages/RobotPage/RobotPage.tsx @@ -91,6 +91,7 @@ export const RobotPage = () => { diff --git a/frontend/src/language/en.json b/frontend/src/language/en.json index afdadbd8a..f944420dd 100644 --- a/frontend/src/language/en.json +++ b/frontend/src/language/en.json @@ -257,5 +257,6 @@ "Failed to release robots from safe zone": "Failed to release robots from safe zone", "Failed to send robot {0} home": "Failed to send robot {0} to starting position", "Failed to update inspection": "Failed to update inspection", - "Battery": "Battery" + "Battery": "Battery", + "Recharging": "Recharging" } diff --git a/frontend/src/language/no.json b/frontend/src/language/no.json index 3c7b75c5e..22b6121ee 100644 --- a/frontend/src/language/no.json +++ b/frontend/src/language/no.json @@ -257,5 +257,6 @@ "Failed to release robots from safe zone": "Kunne ikke slippe roboter ut av trygg sone", "Failed to send robot {0} home": "Kunne ikke sende robot {0} til startposisjon", "Failed to update inspection": "Kunne ikke oppdatere inspeksjon", - "Battery": "Batteri" + "Battery": "Batteri", + "Recharging": "Lader" } diff --git a/frontend/src/models/Robot.ts b/frontend/src/models/Robot.ts index 335dc4f2b..2a28c15b2 100644 --- a/frontend/src/models/Robot.ts +++ b/frontend/src/models/Robot.ts @@ -11,6 +11,7 @@ export enum RobotStatus { Offline = 'Offline', Blocked = 'Blocked', SafeZone = 'Safe Zone', + Recharging = 'Recharging', ConnectionIssues = 'Connection Issues', }