summaryrefslogtreecommitdiffstats
path: root/web/react/components/member_list.jsx
blob: 8c6dc4209c1f0170c3488d90c404e13072e975b2 (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
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

import MemberListItem from './member_list_item.jsx';

export default class MemberList extends React.Component {
    constructor(props) {
        super(props);
    }

    render() {
        var members = [];

        if (this.props.memberList !== null) {
            members = this.props.memberList;
        }

        var message = null;
        if (members.length === 0) {
            message = <tr><td>No users to add.</td></tr>;
        }

        return (
            <table className='table more-table member-list-holder'>
                <tbody>
                    {members.map(function mymembers(member) {
                        return (
                            <MemberListItem
                                key={member.id}
                                member={member}
                                isAdmin={this.props.isAdmin}
                                handleInvite={this.props.handleInvite}
                                handleRemove={this.props.handleRemove}
                                handleMakeAdmin={this.props.handleMakeAdmin}
                            />
                        );
                    }, this)}
                    {message}
                </tbody>
            </table>
        );
    }
}

MemberList.propTypes = {
    memberList: React.PropTypes.array,
    isAdmin: React.PropTypes.bool,
    handleInvite: React.PropTypes.func,
    handleRemove: React.PropTypes.func,
    handleMakeAdmin: React.PropTypes.func
};