diff --git a/package.json b/package.json
index 647d364..26f5575 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,7 @@
"element-react": "^1.4.34",
"element-theme-default": "^1.4.13",
"node-sass": "^4.13.0",
+ "query-string": "^6.13.1",
"react": "^16.12.0",
"react-addons-css-transition-group": "^15.6.2",
"react-dom": "^16.12.0",
diff --git a/src/assets/index.scss b/src/assets/index.scss
index 310028e..897ea96 100644
--- a/src/assets/index.scss
+++ b/src/assets/index.scss
@@ -7,10 +7,6 @@ body {
font-family: 'Arvo', 'Rockwell', monospace;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-
- .MuiTypography-body1 {
- font-family: 'Arvo', 'Rockwell', monospace;
- }
}
code {
diff --git a/src/components/MenuBar.js b/src/components/MenuBar.js
index 6fb485a..7314e09 100644
--- a/src/components/MenuBar.js
+++ b/src/components/MenuBar.js
@@ -1,4 +1,5 @@
import React from 'react';
+import { useHistory } from 'react-router-dom';
import Drawer from '@material-ui/core/Drawer';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
@@ -7,6 +8,7 @@ import Collapse from '@material-ui/core/Collapse';
import ExpandLess from '@material-ui/icons/ExpandLess';
import ExpandMore from '@material-ui/icons/ExpandMore';
import {makeStyles} from "@material-ui/core/styles";
+import qs from 'query-string';
const gameList = [
{game: 'leduc-holdem', dispName: 'Leduc Hold\'em'},
@@ -47,8 +49,15 @@ const useStyles = makeStyles((theme) => ({
'& span': {
fontWeight: 400,
fontSize: 14
+ },
+ '&$active': {
+ '& span': {
+ color: '#3f51b5',
+ fontWeight: 600
+ }
}
- }
+ },
+ active: {}
}));
function MenuBar () {
@@ -62,18 +71,27 @@ function MenuBar () {
setOpen({game: open.game, agent: !open.agent});
};
+ const history = useHistory();
+ const handleGameJump = (gameName) => {
+ history.push(`/leaderboard?type=game&name=${gameName}`);
+ }
+ const handleAgentJump = (agentName) => {
+ history.push(`/leaderboard?type=agent&name=${agentName}`);
+ }
+
+ const { type, name } = qs.parse(window.location.search);
const gameMenu = gameList.map(game => {
return
-
});
const agentMenu = modelList.map(model => {
return
-
});
diff --git a/src/view/GameView/DoudizhuGameView.js b/src/view/GameView/DoudizhuGameView.js
index 8a485c3..770d56c 100644
--- a/src/view/GameView/DoudizhuGameView.js
+++ b/src/view/GameView/DoudizhuGameView.js
@@ -32,7 +32,6 @@ class DoudizhuGameView extends React.Component {
this.initConsiderationTime = 2000;
this.considerationTimeDeduction = 200;
this.gameStateTimeout = null;
- this.apiUrl = apiUrl;
this.moveHistory = [];
this.gameStateHistory = [];
this.initGameState = {
@@ -180,7 +179,7 @@ class DoudizhuGameView extends React.Component {
// start full screen loading
this.setState({fullScreenLoading: true});
- axios.get(`${this.apiUrl}/replay/doudizhu/${replayId}`)
+ axios.get(`${apiUrl}/replay/doudizhu/${replayId}`)
.then(res => {
res = res.data;
// init replay info
diff --git a/src/view/LeaderBoard.js b/src/view/LeaderBoard.js
index 0490094..df7d0a9 100644
--- a/src/view/LeaderBoard.js
+++ b/src/view/LeaderBoard.js
@@ -1,18 +1,200 @@
import React from 'react';
import MenuBar from "../components/MenuBar";
-// import axios from 'axios';
+
+import PropTypes from 'prop-types';
+import { lighten, makeStyles } from '@material-ui/core/styles';
+import Table from '@material-ui/core/Table';
+import TableBody from '@material-ui/core/TableBody';
+import TableCell from '@material-ui/core/TableCell';
+import TableContainer from '@material-ui/core/TableContainer';
+import TableHead from '@material-ui/core/TableHead';
+import TableRow from '@material-ui/core/TableRow';
+import Toolbar from '@material-ui/core/Toolbar';
+import Typography from '@material-ui/core/Typography';
+import Paper from '@material-ui/core/Paper';
+import { apiUrl } from "../utils/config";
+import axios from 'axios';
function LeaderBoard () {
+ console.log(`${apiUrl}/tournament/query_game?name=doudizhu`);
+ axios.get(`${apiUrl}/tournament/query_game?name=doudizhu`)
+
return (