App Stages - addicted-2-you/wizards-hat GitHub Wiki

App Stages

I use app stages to group visibility modes of the UI.

For example, if I want to hide spinner and show terminal and hide the menu (if menu opened):

dispatch(setAppStage(EAppStages.GAME_IN_PROGRESS));

// instead of
dispatch(hideSpinner());
dispatch(showTerminal());
dispatch(hideMenu());

1. App start

When

  • app is just open;
  • prev game is ended;

Signs

  • terminal is hidden (but can be shown);
  • menu is visible (but can be hidden);
  • opponent's field is hidden;

2. Searching for the opponent

When

  • "PLAY ONLINE" button clicked and no opponent found yet;

Signs

  • terminal is hidden (but can be shown);
  • menu is hidden (but can be shown);
  • opponent's field is hidden;
  • loading spinner is shown;

3. Game start

When

  • Opponent found;
  • "PLAY SINGLE" button clicked;

Signs

  • terminal is shown (but can be hidden);
  • menu is hidden (but can be shown);
  • opponent's field is shown;
  • loading spinner is hidden;

4. Game over

When

  • All buildings of one of the players were destroyed;
  • "QUITE" button clicked;

Signs

  • terminal is hidden (but can be shown);
  • menu is hidden (but can be shown);
  • opponent's field is shown (with all marks);
  • loading spinner is hidden;