Skip to content

Conversation

@breville
Copy link
Member

@breville breville commented Oct 26, 2019

This PR converts all the HTML-based UI from jQuery to React. It also simplifies some of the UI as we start to think about driving the progression via a https://studio.code.org script, rather than doing everything in this app.

Some notable changes:

  • We use React to render all the UI. We register a callback with the state manager so that we can re-render the React UI each time state is changed, though most of the time React will do very little since nothing in the UI will have changed.
  • The header & footer areas outside the canvas have been removed and now all UI is inside the canvas area.
  • We no longer show options to go backwards in the UI, though they can certainly come back later as we finesse the narrative.
  • Use ?words=small or ?words=large to specify which words list to use. We will expand the use of parameterisation to specify fish vs. non-fish mode, and maybe other things like how many items we expect the user to train on, as the progression design requires.
  • A placeholder background has been added to each scene. Buttons are now brighter to look clickable.
  • The training question looks disabled when the fish are moving.
  • The sorting screen now shows the label as the fish pass the robot, the fish bob up and down, and the button is labeled "Skip".

screen1b
screen2
screen3
screen4
screen5
screen6

Beginnings of a model in which we keep the app running with its own state machine, rendering to a couple canvases at full frame rate, using its own model classes... but with React used to draw the HTML-based UI on top of it, for headers, footers, and the body of the app.  This first attempt just tells React to re-render 10 times per second.

In this first commit, the first scene is rendered with both its original UI and a React-render duplicate UI on top.  The React UI doesn't yet shrink text below certain widths, though.
Now, the legacy UI is drawn semi-opaque so that the new React UI drawn over the top is more clear.
We are showing the legacy non-React UI below, for comparison.
Conflicts:
	public/index.html
This adds the ability to set a callback handler with the state manager which will be called when state is set.
Use ?words=small or ?words=large to specify which set of words to show.
@breville breville changed the title Use React for UI & simplify the UI too Simplified UI in React Oct 26, 2019
Copy link
Contributor

@maddiedierker maddiedierker left a comment

Choose a reason for hiding this comment

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

🎉

@breville breville merged commit 612b2ed into master Oct 28, 2019
@breville breville deleted the use-react-for-ui branch October 28, 2019 20:17
imgName = 'underwater';
}

// Temporarily show background for every mode.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to see how UI elements looked on a background other than plain white, since I presume we will have some kind of background for each scene.

Copy link
Contributor

@bethanyaconnor bethanyaconnor left a comment

Choose a reason for hiding this comment

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

Yay thanks for doing this!

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.

3 participants