-
Notifications
You must be signed in to change notification settings - Fork 200
/
UserStats.jsx
35 lines (32 loc) · 971 Bytes
/
UserStats.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
import React from 'react';
import _ from 'lodash';
import Loading from './Loading';
import UserAchievements from './UserAchievements';
const UserStats = ({ data }) => {
if (data) {
const { stats, achievements } = data;
const achivementsTitle = _.isEmpty(achievements) ? 'No achievements' : 'Achievements:';
return (
<div>
<ul className="list-inline">
<li className="list-inline-item">
Won:
<b className="text-success">{stats.won}</b>
</li>
<li className="list-inline-item">
Lost:
<b className="text-danger">{stats.lost}</b>
</li>
<li className="list-inline-item">
Gave up:
<b className="text-warning">{stats.gave_up}</b>
</li>
</ul>
{achivementsTitle}
{UserAchievements(achievements)}
</div>
);
}
return <Loading small />;
};
export default UserStats;