import Api from './api.js'; import React from 'react'; import {PFBalanceMinimal} from './balance.js'; import Panel from './panel.js'; class AdminDashboard extends React.Component { constructor(state) { super(state); this.state = {'portfolios': null, 'globalPerformance': null}; } load = () => { Api.Call('ADMIN_PORTFOLIOS', {}, function(err, status, data) { if (err) { console.error(err, data); return; } this.setState({ 'portfolios': data.portfolios, 'globalPerformance': { 'totalBtcValue': data.totalBtcValue, 'totalBtcVariation': data.totalBtcVariation } }); }.bind(this)); } componentDidMount = () => { this.load(); } render = () => { if (this.state.portfolios === null) { return
; } var globalPerformance =
Total:
; var portfolios = Object.keys(this.state.portfolios).map(function(email) { return
{email}:
; }.bind(this)); portfolios.push(
, globalPerformance); return {portfolios}} title="Portfolios Overview"/>; } } export default AdminDashboard;