Skip to content

Commit

Permalink
Sort robots by status and name
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddasol committed Jan 8, 2024
1 parent c56e503 commit 92ed6f8
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const RobotView = styled.div`
grid-column: 1/ -1;
gap: 1rem;
`

const isRobotBlocked = (robot: Robot): boolean => {
return robot.status === 'Blocked'
}
Expand All @@ -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)
Expand Down

0 comments on commit 92ed6f8

Please sign in to comment.