From fb94e09e10489b027468f314f91aa4b43a46ec5a Mon Sep 17 00:00:00 2001 From: Eddasol Date: Thu, 12 Dec 2024 09:53:07 +0100 Subject: [PATCH] Use battery charging symbol when robot is charging --- .../Displays/RobotDisplays/BatteryStatusDisplay.tsx | 5 +++++ .../components/Pages/FrontPage/MissionOverview/RobotCard.tsx | 1 + frontend/src/components/Pages/RobotPage/RobotPage.tsx | 1 + frontend/src/models/Robot.ts | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Displays/RobotDisplays/BatteryStatusDisplay.tsx b/frontend/src/components/Displays/RobotDisplays/BatteryStatusDisplay.tsx index 5be830e38..8f5b96327 100644 --- a/frontend/src/components/Displays/RobotDisplays/BatteryStatusDisplay.tsx +++ b/frontend/src/components/Displays/RobotDisplays/BatteryStatusDisplay.tsx @@ -2,6 +2,7 @@ import { tokens } from '@equinor/eds-tokens' import { Icon, Typography } from '@equinor/eds-core-react' import styled from 'styled-components' import { Icons } from 'utils/icons' +import { BatteryStatus } from 'models/Battery' const BatteryAlignment = styled.div` display: flex; @@ -12,6 +13,7 @@ const StyledTypography = styled(Typography)<{ $fontSize?: 24 | 16 | 18 | 32 | 40 ` interface BatteryStatusDisplayProps { batteryLevel?: number + batteryState?: BatteryStatus itemSize?: 24 | 16 | 18 | 32 | 40 | 48 | undefined batteryWarningLimit?: number textAlignedBottom?: boolean @@ -19,6 +21,7 @@ interface BatteryStatusDisplayProps { export const BatteryStatusDisplay = ({ batteryLevel, + batteryState, itemSize, batteryWarningLimit, textAlignedBottom, @@ -27,6 +30,8 @@ export const BatteryStatusDisplay = ({ const getBatteryIcon = (batteryLevel?: number) => { switch (true) { + case batteryState === BatteryStatus.Charging: + return Icons.BatteryCharging case batteryLevel === null || batteryLevel === undefined: return Icons.BatteryUnknown case !batteryWarningLimit || batteryLevel! > batteryWarningLimit: diff --git a/frontend/src/components/Pages/FrontPage/MissionOverview/RobotCard.tsx b/frontend/src/components/Pages/FrontPage/MissionOverview/RobotCard.tsx index a03fa9fcb..a7dfb05d5 100644 --- a/frontend/src/components/Pages/FrontPage/MissionOverview/RobotCard.tsx +++ b/frontend/src/components/Pages/FrontPage/MissionOverview/RobotCard.tsx @@ -145,6 +145,7 @@ export const RobotCard = ({ robot }: { robot: Robot }) => { {TranslateText('Battery')} diff --git a/frontend/src/components/Pages/RobotPage/RobotPage.tsx b/frontend/src/components/Pages/RobotPage/RobotPage.tsx index 16f66db7c..c21848214 100644 --- a/frontend/src/components/Pages/RobotPage/RobotPage.tsx +++ b/frontend/src/components/Pages/RobotPage/RobotPage.tsx @@ -137,6 +137,7 @@ export const RobotPage = () => { {selectedRobot.pressureLevel !== null && diff --git a/frontend/src/models/Robot.ts b/frontend/src/models/Robot.ts index 99e9f09da..9b83abb2b 100644 --- a/frontend/src/models/Robot.ts +++ b/frontend/src/models/Robot.ts @@ -28,7 +28,7 @@ export interface Robot { serialNumber?: string currentInstallation: Installation batteryLevel?: number - batteryStatus?: BatteryStatus + batteryState?: BatteryStatus pressureLevel?: number pose?: Pose status: RobotStatus