blob: cf2e2668c7de2554f9de1b8c826b77363d098676 (
plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import * as Utils from '../utils/utils.jsx';
export default function UserListRow({user, actions}) {
const details = [];
const fullName = Utils.getFullName(user);
if (fullName) {
details.push(
<span
key={`${user.id}__full-name`}
className='full-name'
>
{fullName}
</span>
);
}
if (user.nickname) {
const separator = fullName ? ' - ' : '';
details.push(
<span
key={`${user.nickname}__nickname`}
>
{separator + user.nickname}
</span>
);
}
const buttons = actions.map((Action, index) => {
return (
<Action
key={index.toString()}
user={user}
/>
);
});
return (
<tr>
<td
key={user.id}
className='direct-channel'
style={{display: 'flex'}}
>
<img
className='profile-img'
src={`/api/v1/users/${user.id}/image?time=${user.update_at}&${Utils.getSessionIndex()}`}
/>
<div
className='user-list-item__details'
>
<div className='more-name'>
{user.username}
</div>
<div className='more-description'>
{details}
</div>
</div>
<div
className='user-list-item__actions'
>
{buttons}
</div>
</td>
</tr>
);
}
UserListRow.defaultProps = {
actions: []
};
UserListRow.propTypes = {
user: React.PropTypes.object.isRequired,
actions: React.PropTypes.arrayOf(React.PropTypes.func)
};
|