...

/

Pilot Form UI State

Pilot Form UI State

We'll cover the following...

Now that we can edit the basic attributes for our combat unit, it’s time to move on to the Pilots panel. We want to add the ability to edit the attributes for our individual Pilot entries. As part of that, it would be nice if we actually could toggle whether we’re in “edit mode” or not. For now, let’s implement logic to track “editing mode” for pilots, and hold off on actually connecting the inputs until next time.

We already have logic for tracking which pilot is selected. To add to that, we should only be able to start editing if a pilot is selected. If we’re editing one pilot, and click to select another, editing mode should be turned off.

Tracking Editing State for the UI

Let’s start by adding some logic to track whether we’re editing a pilot or not. We’ll create a couple new action types (PILOT_EDIT_START and PILOT_EDIT_STOP), and update our pilots reducer with a new flag and the logic to update it appropriately:

Commit ed3c460: Add logic to track if a pilot is being edited

...