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

var MemberListItem = require('./member_list_item.jsx');

module.exports = React.createClass({
    render: function() {
        var members = [];

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

        var message = "";
        if (members.length === 0)
            message = <span>No users to add.</span>;

        return (
            <div className="member-list-holder">
                {members.map(function(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}
            </div>
        );
    }
});