From 92ed6f893d81db35ea22633ff2c3c3106b25ea6a Mon Sep 17 00:00:00 2001 From: Eddasol Date: Mon, 8 Jan 2024 09:38:28 +0100 Subject: [PATCH] Sort robots by status and name --- .../Pages/FrontPage/RobotCards/RobotStatusSection.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Pages/FrontPage/RobotCards/RobotStatusSection.tsx b/frontend/src/components/Pages/FrontPage/RobotCards/RobotStatusSection.tsx index 6ff4a4218..0a0abd4c9 100644 --- a/frontend/src/components/Pages/FrontPage/RobotCards/RobotStatusSection.tsx +++ b/frontend/src/components/Pages/FrontPage/RobotCards/RobotStatusSection.tsx @@ -20,6 +20,7 @@ const RobotView = styled.div` grid-column: 1/ -1; gap: 1rem; ` + const isRobotBlocked = (robot: Robot): boolean => { return robot.status === 'Blocked' } @@ -35,7 +36,15 @@ export const RobotStatusSection = () => { (robot) => robot.currentInstallation.installationCode.toLocaleLowerCase() === installationCode.toLocaleLowerCase() ) - .sort((robot, robotToCompareWith) => (robot.status! > robotToCompareWith.status! ? 1 : -1)) + .sort((robot, robotToCompareWith) => + robot.status! !== robotToCompareWith.status! + ? robot.status! > robotToCompareWith.status! + ? 1 + : -1 + : robot.name! > robotToCompareWith.name! + ? 1 + : -1 + ) useEffect(() => { const missionQueueFozenStatus = relevantRobots.some((robot: Robot) => robot.missionQueueFrozen)