diff options
Diffstat (limited to 'cmd/web/js/admin.jsx')
-rw-r--r-- | cmd/web/js/admin.jsx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/cmd/web/js/admin.jsx b/cmd/web/js/admin.jsx index 81ce15d..19eb3ef 100644 --- a/cmd/web/js/admin.jsx +++ b/cmd/web/js/admin.jsx | |||
@@ -6,7 +6,7 @@ import Panel from './panel.js'; | |||
6 | class AdminDashboard extends React.Component { | 6 | class AdminDashboard extends React.Component { |
7 | constructor(state) { | 7 | constructor(state) { |
8 | super(state); | 8 | super(state); |
9 | this.state = {'portfolios': null}; | 9 | this.state = {'portfolios': null, 'globalPerformance': null}; |
10 | } | 10 | } |
11 | 11 | ||
12 | load = () => { | 12 | load = () => { |
@@ -16,7 +16,13 @@ class AdminDashboard extends React.Component { | |||
16 | return; | 16 | return; |
17 | } | 17 | } |
18 | 18 | ||
19 | this.setState({'portfolios': data}); | 19 | this.setState({ |
20 | 'portfolios': data.portfolios, | ||
21 | 'globalPerformance': { | ||
22 | 'totalBtcValue': data.totalBtcValue, | ||
23 | 'totalBtcVariation': data.totalBtcVariation | ||
24 | } | ||
25 | }); | ||
20 | }.bind(this)); | 26 | }.bind(this)); |
21 | } | 27 | } |
22 | 28 | ||
@@ -28,15 +34,24 @@ class AdminDashboard extends React.Component { | |||
28 | if (this.state.portfolios === null) { | 34 | if (this.state.portfolios === null) { |
29 | return <div></div>; | 35 | return <div></div>; |
30 | } | 36 | } |
37 | |||
38 | var globalPerformance = <div className="row" key="global"> | ||
39 | <div className="col-6"><span>Total:</span></div> | ||
40 | <div className="col-6 text-center"> | ||
41 | <PFBalanceMinimal variationP={this.state.globalPerformance.totalBtcVariation} balance={this.state.globalPerformance.totalBtcValue} isPercent={false}/> | ||
42 | </div> | ||
43 | </div>; | ||
31 | var portfolios = Object.keys(this.state.portfolios).map(function(email) { | 44 | var portfolios = Object.keys(this.state.portfolios).map(function(email) { |
32 | return <div className="row" key={email}> | 45 | return <div className="row" key={email}> |
33 | <div className="col-6"><span>{email}:</span></div> | 46 | <div className="col-6"><span>{email}:</span></div> |
34 | <div className="col-6 text-center"> | 47 | <div className="col-6 text-center"> |
35 | <PFBalanceMinimal variationP={this.state.portfolios[email].performance.variationP} balance={this.state.portfolios[email].value} periodStart={this.state.portfolios[email].periodStart}/> | 48 | <PFBalanceMinimal variationP={this.state.portfolios[email].performance.variationP} balance={this.state.portfolios[email].value} isPercent={true}/> |
36 | </div> | 49 | </div> |
37 | </div>; | 50 | </div>; |
38 | }.bind(this)); | 51 | }.bind(this)); |
39 | 52 | ||
53 | portfolios.push(<hr key="hr"/>, globalPerformance); | ||
54 | |||
40 | return <Panel component={<div>{portfolios}</div>} title="Portfolios Overview"/>; | 55 | return <Panel component={<div>{portfolios}</div>} title="Portfolios Overview"/>; |
41 | } | 56 | } |
42 | 57 | ||