Skip to content

Commit

Permalink
Allow users to go into settings when the robot is paused
Browse files Browse the repository at this point in the history
  • Loading branch information
Taylor Kessler Faulkner committed Aug 27, 2024
1 parent e7ca7eb commit a15547c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions feedingwebapp/src/Pages/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const Header = (props) => {
// Get the relevant global state variables
const mealState = useGlobalState((state) => state.mealState)
const inNonMovingState = useGlobalState((state) => state.inNonMovingState)
const paused = useGlobalState((state) => state.paused)
const setAppPage = useGlobalState((state) => state.setAppPage)

/**
Expand All @@ -66,15 +67,15 @@ const Header = (props) => {
// Both checks are necessary because some states that are nominally non-moving
// could be in an auto-continue state, and some states that are nominally moving
// could be paused.
if (inNonMovingState && NON_MOVING_STATES.has(mealState)) {
if ((inNonMovingState && NON_MOVING_STATES.has(mealState)) || (!NON_MOVING_STATES.has(mealState) && paused)) {
setAppPage(APP_PAGE.Settings)
} else {
toast.info('Wait for robot motion to complete before accessing Settings.', {
containerId: REGULAR_CONTAINER_ID,
toastId: 'noSettings'
})
}
}, [inNonMovingState, mealState, setAppPage])
}, [inNonMovingState, mealState, paused, setAppPage])

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

0 comments on commit a15547c

Please sign in to comment.