Skip to content

Commit a15547c

Browse files
author
Taylor Kessler Faulkner
committed
Allow users to go into settings when the robot is paused
1 parent e7ca7eb commit a15547c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

feedingwebapp/src/Pages/Header/Header.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const Header = (props) => {
4848
// Get the relevant global state variables
4949
const mealState = useGlobalState((state) => state.mealState)
5050
const inNonMovingState = useGlobalState((state) => state.inNonMovingState)
51+
const paused = useGlobalState((state) => state.paused)
5152
const setAppPage = useGlobalState((state) => state.setAppPage)
5253

5354
/**
@@ -66,15 +67,15 @@ const Header = (props) => {
6667
// Both checks are necessary because some states that are nominally non-moving
6768
// could be in an auto-continue state, and some states that are nominally moving
6869
// could be paused.
69-
if (inNonMovingState && NON_MOVING_STATES.has(mealState)) {
70+
if ((inNonMovingState && NON_MOVING_STATES.has(mealState)) || (!NON_MOVING_STATES.has(mealState) && paused)) {
7071
setAppPage(APP_PAGE.Settings)
7172
} else {
7273
toast.info('Wait for robot motion to complete before accessing Settings.', {
7374
containerId: REGULAR_CONTAINER_ID,
7475
toastId: 'noSettings'
7576
})
7677
}
77-
}, [inNonMovingState, mealState, setAppPage])
78+
}, [inNonMovingState, mealState, paused, setAppPage])
7879

7980
// Render the component. The NavBar will stay fixed even as we vertically scroll.
8081
return (

0 commit comments

Comments
 (0)