Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2023 Web App Revamp #5

Merged
merged 7 commits into from
Apr 19, 2023
Merged

2023 Web App Revamp #5

merged 7 commits into from
Apr 19, 2023

Conversation

amalnanavati
Copy link
Contributor

@amalnanavati amalnanavati commented Apr 14, 2023

In service of #16

Although the 2023 web app we've been working on (2023PreDeployment branch) has a functioning UI, it has several process issues:

  • Nested branches that go several layers deep.
  • Multiple people pushing code to the same branch.
  • No formal PR / code review process.
  • Lack of in-code documentation.
  • Large functions/components that should be split up.
  • Copy-pasted code.
  • Lack of a consistent style.

This is not anyone's fault, because when we were initially developing the web app we saw it as a small component of the overall feeding system. But the web app is will now be the central hub that users will use to interact with the system. Hence, it is crucial to have high quality code for the web app, and a process to ensure the code stays high quality.

This PR is the first step towards that, by taking the code in the 2023PreDeployment branch, breaking it up into bite-sized, logically contained functions, adding thorough in-code documentation, and running it through a linter and formatter to ensure (mostly) consistent style.


Before creating a pull request

  • Format code with npm run format

Before merging a pull request

  • Squash all your commits into one (or Squash and Merge)

- Began with code from the `2023PreDeployment` branch
- Split each component into a separate file
- Added thorough in-code documentation
- Adding eslint and prettier checks for readability and consistency
- Implemented intentional splits between local and global state
@amalnanavati
Copy link
Contributor Author

@taylorkf The code for this PR is ready to review. My only remaining TODO before it is fully ready to review is updating the readme, but since it's a lot of code I figured you could get started while I'm working on the readme.

Please be brutal in your review; I want to make this code easy and logical for newcomers to onboard onto, and I want it to be easy for multiple people to work on this codebase at once (e.g., unlikely to need to modify the same files too much).

As opposed to reading the files in the alphabetical order github presents them in, I'd recommend starting from App.jsx, which is the launching point for the app, and going from there.

@amalnanavati
Copy link
Contributor Author

Added contribution guidelines and updated Tech Documentation. Fully ready to review

Copy link
Contributor

@atharva-kashyap atharva-kashyap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amalnanavati I love how much more organized this is!!
And, please let me know if any of my comments don't make sense! I am happy to explain!

feedingwebapp/src/Pages/Header/Header.jsx Outdated Show resolved Hide resolved
feedingwebapp/src/Pages/Header/Header.jsx Outdated Show resolved Hide resolved
feedingwebapp/src/Pages/Home/MealStates/PlateLocator.jsx Outdated Show resolved Hide resolved
feedingwebapp/src/helpers.js Outdated Show resolved Hide resolved
feedingwebapp/src/helpers.js Show resolved Hide resolved
feedingwebapp/src/Pages/Header/LiveVideoModal.jsx Outdated Show resolved Hide resolved
feedingwebapp/src/Pages/Footer/Footer.jsx Outdated Show resolved Hide resolved
feedingwebapp/src/Pages/Footer/Footer.jsx Outdated Show resolved Hide resolved
feedingwebapp/README.md Outdated Show resolved Hide resolved
feedingwebapp/README.md Outdated Show resolved Hide resolved
feedingwebapp/README.md Outdated Show resolved Hide resolved
feedingwebapp/README.md Outdated Show resolved Hide resolved
feedingwebapp/README.md Outdated Show resolved Hide resolved
case MEAL_STATE.R_StowingArm:
return <StowingArm debug={debug} />
case MEAL_STATE.U_PostMeal:
return <PostMeal debug={debug} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we end up deciding that the app would just say "bite done" when moving away from the mouth and back to above the plate, or should we add another state for slowly backing up from the mouth?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the user perspective, I think they should just click a "Bite Done" button. Whether that is implemented as a "slowly back away" or "go straight above plate" or something else should be left to the ROS action that is called when that button is clicked, imo.

feedingwebapp/src/Pages/Home/Home.jsx Show resolved Hide resolved
/**
* Callback function for if the user decides to cancel the bite.
*/
function cancelBite() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this button take the user back to the food selection screen? Right now in debug = true, pressing "cancel bite" does nothing visually, and you still have to advance forward through the bite acquisition to move on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, are you sure "Cancel Bite" did nothing? It should go back to the "Moving Above Plate" screen+state, which it does on my computer and is what I see reflected in the code.

I think reverting to "Moving Above Plate" makes more sense than food selection, because if you cancel when the fork is very close to the plate, it will be too close to make a food selection. Food Selection will come once moving above plate is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants