aboutsummaryrefslogtreecommitdiff
path: root/cmd/web/js/admin.jsx
diff options
context:
space:
mode:
authorjloup <jloup@jloup.work>2018-05-13 23:14:26 +0200
committerjloup <jloup@jloup.work>2018-05-13 23:18:48 +0200
commit2e4885d98ec49203180deb7e4e9148762e4720e7 (patch)
treef018a158d2f39133a21dba899176f6fde606bd92 /cmd/web/js/admin.jsx
parent6bf174a95ba0f71abf25397316fc101405381cdf (diff)
downloadFront-2e4885d98ec49203180deb7e4e9148762e4720e7.tar.gz
Front-2e4885d98ec49203180deb7e4e9148762e4720e7.tar.zst
Front-2e4885d98ec49203180deb7e4e9148762e4720e7.zip
Admin minimal dashboard.v0.0.14
Diffstat (limited to 'cmd/web/js/admin.jsx')
-rw-r--r--cmd/web/js/admin.jsx45
1 files changed, 45 insertions, 0 deletions
diff --git a/cmd/web/js/admin.jsx b/cmd/web/js/admin.jsx
new file mode 100644
index 0000000..81ce15d
--- /dev/null
+++ b/cmd/web/js/admin.jsx
@@ -0,0 +1,45 @@
1import Api from './api.js';
2import React from 'react';
3import {PFBalanceMinimal} from './balance.js';
4import Panel from './panel.js';
5
6class AdminDashboard extends React.Component {
7 constructor(state) {
8 super(state);
9 this.state = {'portfolios': null};
10 }
11
12 load = () => {
13 Api.Call('ADMIN_PORTFOLIOS', {}, function(err, status, data) {
14 if (err) {
15 console.error(err, data);
16 return;
17 }
18
19 this.setState({'portfolios': data});
20 }.bind(this));
21 }
22
23 componentDidMount = () => {
24 this.load();
25 }
26
27 render = () => {
28 if (this.state.portfolios === null) {
29 return <div></div>;
30 }
31 var portfolios = Object.keys(this.state.portfolios).map(function(email) {
32 return <div className="row" key={email}>
33 <div className="col-6"><span>{email}:</span></div>
34 <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}/>
36 </div>
37 </div>;
38 }.bind(this));
39
40 return <Panel component={<div>{portfolios}</div>} title="Portfolios Overview"/>;
41 }
42
43}
44
45export default AdminDashboard;