React Front End - majo-z/ChessProject GitHub Wiki
We initially decided to use html, jQuery & css as the front end. This quickly became unmanageable. We looked into multiple more modern front end solutions such as Angular, Vue.js and React. We ended up settling on React to use as our front end framework.
Components Used.
-
<Header/>
displays the title and an inspirational message. -
<FormComponent/>
Allows the user to enter username and password and sends login/register requests.
-
<LogoutButton/>
This component updates the state of the application to log the user out. -
<NewGameButton/>
This component makes a GET request to thechess/v1/newgame
endpoint and updates the current game id. -
<PrivateGameButton/>
This component makes a GET request to create a new private game and updates the current game id. -
<BotButton/>
This component makes a request to thechess/v1/computergame
end point and prompts the server to run the python script to join the current game. -
<InfoComponent/>
This component displays information about the current game. -
<CanvasWindow/>
This component renders the HTML canvas and continually polls for game state, as well as allow the user to make POST requests to update the board on the server side. -
<SurrenderButton/>
This component sends a/chess/v1/surrender
request. -
<GameList/>
This component displays all the ongoing games of the player that is logged in.
There is also a <ChessApp/>
root component that holds all the other ones.