-
Notifications
You must be signed in to change notification settings - Fork 0
/
DashboardStats.jsx
41 lines (35 loc) · 1.76 KB
/
DashboardStats.jsx
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
import React from 'react';
import { connect } from 'react-redux';
import {ListGroup,ListGroupItem} from 'react-bootstrap';
import { dashboardActions } from '../_actions';
import '../styles/third-party.css';
class DashboardStats extends React.Component {
componentDidMount() {
this.props.dispatch(dashboardActions.getStats());
}
render() {
const { stats } = this.props;
return (
<div className="EventSummary module-wrapper">
<h3>At A Glance</h3>
{stats &&
<ListGroup componentClass="ul">
<ListGroupItem><span className="pull-left">Events</span><span className="pull-right">{new Intl.NumberFormat().format(stats.events)}</span></ListGroupItem>
<ListGroupItem><span className="pull-left">Attendees</span><span className="pull-right">{new Intl.NumberFormat().format(stats.attendees)}</span></ListGroupItem>
<ListGroupItem><span className="pull-left">Event Revenue</span><span className="pull-right">${new Intl.NumberFormat().format(stats.eventRevenue)}</span></ListGroupItem>
<ListGroupItem><span className="pull-left">Average Event ROI</span><span className="pull-right">{new Intl.NumberFormat().format(stats.averageEventROI)}</span></ListGroupItem>
<ListGroupItem><span className="pull-left">Hashtag Reposts</span><span className="pull-right">${new Intl.NumberFormat().format(stats.hashtagReposts)}</span></ListGroupItem>
</ListGroup>
}
</div>
);
}
}
function mapStateToProps(state) {
const { stats } = state.dashboard;
return {
stats
}
}
const connectedDashboardStats = connect(mapStateToProps)(DashboardStats);
export { connectedDashboardStats as DashboardStats };