|
@@ -13,14 +13,17 @@ const baseUrl = `https://joystreamstats.live/static`;
|
|
class KPI extends Component {
|
|
class KPI extends Component {
|
|
constructor(props: { tokenomics: Tokenomics }) {
|
|
constructor(props: { tokenomics: Tokenomics }) {
|
|
super(props);
|
|
super(props);
|
|
- this.state = { round: null, rounds: [], leaderboard: [] };
|
|
|
|
|
|
+ this.state = { round: null, rounds: [], leaderboard: [], grading: [] };
|
|
this.fetchKpi = this.fetchKpi.bind(this);
|
|
this.fetchKpi = this.fetchKpi.bind(this);
|
|
this.fetchLeaderboard = this.fetchLeaderboard.bind(this);
|
|
this.fetchLeaderboard = this.fetchLeaderboard.bind(this);
|
|
this.toggleShowLeaderboard = this.toggleShowLeaderboard.bind(this);
|
|
this.toggleShowLeaderboard = this.toggleShowLeaderboard.bind(this);
|
|
}
|
|
}
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
|
|
+ this.loadData();
|
|
|
|
+ }
|
|
|
|
+ loadData() {
|
|
this.fetchKpi();
|
|
this.fetchKpi();
|
|
- //this.fetchLeaderboard()
|
|
|
|
|
|
+ this.fetchLeaderboard();
|
|
}
|
|
}
|
|
fetchKpi() {
|
|
fetchKpi() {
|
|
axios
|
|
axios
|
|
@@ -37,9 +40,13 @@ class KPI extends Component {
|
|
.catch((e) => console.error(`Failed to fetch KPI data.`, e));
|
|
.catch((e) => console.error(`Failed to fetch KPI data.`, e));
|
|
}
|
|
}
|
|
fetchLeaderboard() {
|
|
fetchLeaderboard() {
|
|
|
|
+ axios
|
|
|
|
+ .get(`${baseUrl}/kpi-grading.json`)
|
|
|
|
+ .then(({ data }) => this.setState({ grading: data }))
|
|
|
|
+ .catch((e) => console.error(`Failed to fetch KPI grading data.`, e));
|
|
axios
|
|
axios
|
|
.get(`${baseUrl}/leaderboard.json`)
|
|
.get(`${baseUrl}/leaderboard.json`)
|
|
- .then((res) => this.setState({ leaderboard: res.data }))
|
|
|
|
|
|
+ .then(({ data }) => this.setState({ leaderboard: data }))
|
|
.catch((e) => console.error(`Failed to fetch Leadboard data.`, e));
|
|
.catch((e) => console.error(`Failed to fetch Leadboard data.`, e));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -54,7 +61,7 @@ class KPI extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
render() {
|
|
render() {
|
|
- const { round, rounds, leaderboard, showLeaderboard } = this.state;
|
|
|
|
|
|
+ const { round, rounds, grading, leaderboard, showLeaderboard } = this.state;
|
|
if (!round) return <Loading target="KPI" />;
|
|
if (!round) return <Loading target="KPI" />;
|
|
return (
|
|
return (
|
|
<div className="m-3 p-2 text-light">
|
|
<div className="m-3 p-2 text-light">
|
|
@@ -96,6 +103,7 @@ class KPI extends Component {
|
|
|
|
|
|
{showLeaderboard ? (
|
|
{showLeaderboard ? (
|
|
<Leaderboard
|
|
<Leaderboard
|
|
|
|
+ kpi={grading}
|
|
leaderboard={leaderboard}
|
|
leaderboard={leaderboard}
|
|
tokenomics={this.props.tokenomics}
|
|
tokenomics={this.props.tokenomics}
|
|
/>
|
|
/>
|