{"size": 1344, "ext": "js", "max_stars_repo_path": "src/views/App/AppBranch.js", "max_stars_repo_name": "recursive-redundancy/snake-web-browser", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/views/App/AppBranch.js", "max_issues_repo_name": "recursive-redundancy/snake-web-browser", "max_issues_repo_issues_event_min_datetime": "2021-05-11T14:10:45.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T04:45:42.000Z", "max_forks_repo_path": "src/views/App/AppBranch.js", "max_forks_repo_name": "recursive-redundancy/snake-web-browser", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 24.8888888889, "max_line_length": 61, "alphanum_fraction": 0.5550595238}
import PubSub from 'pubsub-js';
import React, {Suspense} from 'react';

const Difficulty = React.lazy(() => 
  import(
    /* webpackChunkName: "view-difficulty" */
    '../Difficulty'
  )
);
const GameBoard = React.lazy(() => 
  import(
    /* webpackChunkName: "view-gameboard" */
    '../GameBoard'
  )
);
const HowTo = React.lazy(() => 
  import(
    /* webpackChunkName: "view-howto" */
    '../HowTo'
  )
);
import TitleScreen from '../TitleScreen';

const AppBranch = (
  {
    isGamePlaying, lastGameScore, 
    handleDifficultyClose, handleHowTo, handleHowToClose, 
    handlePlayGame, handleSettings,
    showHowTo, showSettings, showGameOver,
  }
) => {
  return(
    <Suspense fallback={<div>Loading...</div>}>
      {
        (showSettings) ?
          <Difficulty handleClose={handleDifficultyClose} />
        :
          (showHowTo) ? 
            <HowTo handleClose={handleHowToClose} />
          :
            (isGamePlaying) ?
              <GameBoard />
            :
              <TitleScreen handleHowTo={handleHowTo} 
                handlePlayGame={handlePlayGame}
                handleSettings={handleSettings}
                lastGameScore={lastGameScore} 
                showGameOver={showGameOver} />
      }
    </Suspense>
  );
};

export default AppBranch;