Skip to content

Commit 391b4e1

Browse files
Show current inspection area
1 parent 9722662 commit 391b4e1

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

frontend/src/language/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@
265265
"InterventionNeeded": "Intervention Needed",
266266
"ReturnHomePaused": "Returning home paused",
267267
"Current Inspection Area": "Current Inspection Area",
268+
"Loading...": "Loading...",
269+
"No inspection area found": "No inspection area found",
268270
"GoingToRecharging": "Returning to recharge",
269271
"GoingToLockdown": "Returning due to lockdown",
270272
"Set maintenance mode": "Set maintenance mode",

frontend/src/language/no.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@
265265
"InterventionNeeded": "Intervensjon nødvendig",
266266
"ReturnHomePaused": "Kjøring hjem pauset",
267267
"Current Inspection Area": "Nåværende inspeksjonsområde",
268+
"Loading...": "Laster...",
269+
"No inspection area found": "Ingen inspeksjonsområde funnet",
268270
"GoingToRecharging": "Returnerer for å lade",
269271
"GoingToLockdown": "Returnerer på grunn av lockdown",
270272
"Set maintenance mode": "Sett vedlikeholdsmodus",

frontend/src/pages/RobotPage/RobotPage.tsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ export const RobotPage = ({ robot }: RobotPageProps) => {
144144
<></>
145145
)
146146

147-
const currentInspectionArea = useQuery({
147+
const {
148+
data: currentInspectionArea,
149+
isLoading: isLoadingCurrentInspectionArea,
150+
error: currentInspectionAreaError,
151+
} = useQuery({
148152
queryKey: ['fetchCurrentInspectionArea', robot.id],
149153
queryFn: async () => {
150154
if (robot && robot.currentInspectionAreaId)
@@ -154,7 +158,7 @@ export const RobotPage = ({ robot }: RobotPageProps) => {
154158
retry: 2,
155159
retryDelay: 2000,
156160
enabled: robot && robot.currentInspectionAreaId != null,
157-
}).data
161+
})
158162

159163
return (
160164
<>
@@ -200,6 +204,24 @@ export const RobotPage = ({ robot }: RobotPageProps) => {
200204
</Typography>
201205
</MetricCard>
202206
)}
207+
{isLoadingCurrentInspectionArea && (
208+
<MetricCard>
209+
<FieldLabel>{TranslateText('Current Inspection Area')}</FieldLabel>
210+
<Typography style={{ fontSize: '24px' }}>
211+
{TranslateText('Loading...')}
212+
</Typography>
213+
</MetricCard>
214+
)}
215+
{((!isLoadingCurrentInspectionArea && !currentInspectionArea) ||
216+
currentInspectionAreaError ||
217+
robot.currentInspectionAreaId === null) && (
218+
<MetricCard>
219+
<FieldLabel>{TranslateText('Current Inspection Area')}</FieldLabel>
220+
<Typography style={{ fontSize: '24px' }}>
221+
{TranslateText('No inspection area found')}
222+
</Typography>
223+
</MetricCard>
224+
)}
203225
</MetricsRow>
204226
)}
205227

0 commit comments

Comments
 (0)