This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
/
forgingStats.js
60 lines (54 loc) 路 1.6 KB
/
forgingStats.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React from 'react';
import { Card, CardText } from 'react-toolbox/lib/card';
import moment from 'moment';
import grid from 'flexboxgrid/dist/flexboxgrid.css';
import LiskAmount from '../liskAmount';
import style from './forging.css';
const statCardObjects = [
{
key: 'last24h',
label: 'Last 24 hours',
startMoment: moment().subtract(1, 'days'),
}, {
key: 'last7d',
label: 'Last 7 days',
startMoment: moment().subtract(7, 'days'),
}, {
key: 'last30d',
label: 'Last 30 days',
startMoment: moment().subtract(30, 'days'),
}, {
key: 'last365d',
label: 'Last 365 days',
startMoment: moment().subtract(365, 'days'),
},
];
class ForgingStats extends React.Component {
componentDidMount() {
statCardObjects.map(obj => this.props.loadStats(obj.key, obj.startMoment));
}
render() {
return (
<div className={`${grid.row} ${grid['between-xs']}`}>
{statCardObjects.map(cardObj => (
<div className={`${grid['col-xs-12']} ${grid['col-sm-3']}`} key={cardObj.key}>
<Card className={style.grayCard}>
<CardText>
<div className={grid['col-xs-12']}>
<div className={`${grid.row} ${grid['between-xs']}`}>
<span className='title'> {cardObj.label} </span>
<span>
<LiskAmount val={this.props.statistics[cardObj.key]}
/> LSK
</span>
</div>
</div>
</CardText>
</Card>
</div>
))}
</div>
);
}
}
export default ForgingStats;