add frontend readme

This commit is contained in:
Songyi Huang 2020-12-04 13:24:31 -08:00
parent b6711547b0
commit 38cf4c8f2e
1 changed files with 38 additions and 71 deletions

109
README.md
View File

@ -1,4 +1,42 @@
**NOTE: This project is under final tesing. The one in the repo only supports the visualization of some sampled data. The full version will be available soon!** **NOTE: This project is under final tesing. The one in the repo only supports the visualization of some sampled data. The full version will be available soon!**
# Frontend
## Frontend Setup
RLCard-Showdown has separated frontend and backend. The frontend part is built with React and the backend is with Django.
### Prerequisite
To set up the frontend part, you should make sure you have [Node.js](https://nodejs.org/) and NPM installed. Normally you just need to manually install Node.js, and the NPM package would be automatically installed together with Node.js for you. Please refer to its official website for installation of Node.js.
You can run the following commands to verify the installation
```
node -v
npm -v
```
### Install Dependencies
The dependencies can be easily installed with the help of NPM:
```
git clone https://github.com/datamllab/rlcard-showdown.git
cd rlcard-showdown
npm install
```
### Run Frontend in Development Mode
Run the following command under the project folder to start frontend in development mode.
```
npm start
```
The frontend would be started in port 3000 in localhost by default, you can view it by entering [http://127.0.0.1:3000/](http://127.0.0.1:3000/) in the browser.
### Config
You will see blank tables on the frontend if you haven't started the backend Django server, or the backend server URL is configured incorrectly.
The default configuration for backend server URL is [http://127.0.0.1:8000/](http://127.0.0.1:8000/), you can also change it in `/src/utils/config.js`.
### Screenshots
# Django Server # Django Server
## Server Setup ## Server Setup
@ -84,74 +122,3 @@ We can delete the agent with
``` ```
curl 'http://127.0.0.1:8000/tournament/delete_agent?name=leduc-new' curl 'http://127.0.0.1:8000/tournament/delete_agent?name=leduc-new'
``` ```
# Others
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `yarn start`
Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br />
You will also see any lint errors in the console.
### `yarn test`
Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `yarn build`
Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `yarn eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
### Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
### Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
### Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
### Deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `yarn build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify