Skip to content

Commit

Permalink
Fix robot status icon and font sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonsf committed Nov 26, 2024
1 parent 3d43288 commit 451c5ee
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const BatteryAlignment = styled.div`
`

const StyledTypography = styled(Typography)<{ $fontSize?: 24 | 16 | 18 | 32 | 40 | 48 }>`
font-size: ${(props) => props.$fontSize};
font-size: ${(props) => props.$fontSize}px;
`
interface BatteryStatusDisplayProps {
batteryLevel?: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const PressureAlignment = styled.div`
align-items: center;
`
const StyledTypography = styled(Typography)<{ $fontSize?: 24 | 16 | 18 | 32 | 40 | 48 }>`
font-size: ${(props) => props.$fontSize};
font-size: ${(props) => props.$fontSize}px;
`
interface PressureStatusDisplayProps {
pressure: number
Expand Down
18 changes: 8 additions & 10 deletions frontend/src/components/Displays/RobotDisplays/RobotStatusIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface StatusProps {
status?: RobotStatus
isarConnected: boolean
flotillaStatus?: RobotFlotillaStatus
itemSize?: 24 | 16 | 18 | 32 | 40 | 48 | undefined
}

const StyledStatus = styled.div`
Expand All @@ -18,21 +19,16 @@ const StyledStatus = styled.div`
gap: 2px;
`

const LongTypography = styled(Typography)`
const LongTypography = styled(Typography)<{ $fontSize?: 24 | 16 | 18 | 32 | 40 | 48 }>`
font-size: ${(props) => props.$fontSize}px;
overflow: visible;
white-space: normal;
text-overflow: unset;
word-break: break-word;
hyphens: auto;
`

const StyledIcon = styled(Icon)`
width: 24px;
min-width: 24px;
height: 24px;
`

export const RobotStatusChip = ({ status, flotillaStatus, isarConnected }: StatusProps) => {
export const RobotStatusChip = ({ status, flotillaStatus, isarConnected, itemSize }: StatusProps) => {
const { TranslateText } = useLanguageContext()

var iconColor = tokens.colors.text.static_icons__default.hex
Expand Down Expand Up @@ -81,8 +77,10 @@ export const RobotStatusChip = ({ status, flotillaStatus, isarConnected }: Statu

return (
<StyledStatus>
<StyledIcon name={statusIcon} style={{ color: iconColor }} />
<LongTypography variant="body_short">{TranslateText(status)}</LongTypography>
<Icon name={statusIcon} size={itemSize} style={{ color: iconColor }} />
<LongTypography $fontSize={itemSize} variant="body_short">
{TranslateText(status)}
</LongTypography>
</StyledStatus>
)
}
5 changes: 3 additions & 2 deletions frontend/src/components/Pages/RobotPage/RobotPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,20 @@ export const RobotPage = () => {
status={selectedRobot.status}
flotillaStatus={selectedRobot.flotillaStatus}
isarConnected={selectedRobot.isarConnected}
itemSize={32}
/>

{selectedRobot.status !== RobotStatus.Offline && (
<>
<BatteryStatusDisplay
itemSize={48}
itemSize={32}
batteryLevel={selectedRobot.batteryLevel}
batteryWarningLimit={selectedRobot.model.batteryWarningThreshold}
/>
{selectedRobot.pressureLevel !== null &&
selectedRobot.pressureLevel !== undefined && (
<PressureStatusDisplay
itemSize={48}
itemSize={32}
pressure={selectedRobot.pressureLevel}
upperPressureWarningThreshold={
selectedRobot.model.upperPressureWarningThreshold
Expand Down

0 comments on commit 451c5ee

Please sign in to comment.