Files
mattermost/webapp/components/user_list.jsx
Harrison Healey fb6f2a123c PLT-5860 Updated copyright date (#6058)
* PLT-5860 Updated copyright date in about modal

* PLT-5860 Updated copyright notice in JSX files

* PLT-5860 Updated copyright notice in go files

* Fixed misc copyright dates

* Fixed component snapshots
2017-04-12 08:27:57 -04:00

80 lines
2.1 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import UserListRow from './user_list_row.jsx';
import LoadingScreen from 'components/loading_screen.jsx';
import React from 'react';
import {FormattedMessage} from 'react-intl';
export default class UserList extends React.Component {
constructor(props) {
super(props);
this.scrollToTop = this.scrollToTop.bind(this);
}
scrollToTop() {
if (this.refs.container) {
this.refs.container.scrollTop = 0;
}
}
render() {
const users = this.props.users;
let content;
if (users == null) {
return <LoadingScreen/>;
} else if (users.length > 0) {
content = users.map((user) => {
return (
<UserListRow
key={user.id}
user={user}
extraInfo={this.props.extraInfo[user.id]}
actions={this.props.actions}
actionProps={this.props.actionProps}
actionUserProps={this.props.actionUserProps[user.id]}
/>
);
});
} else {
content = (
<div
key='no-users-found'
className='more-modal__placeholder-row'
>
<p>
<FormattedMessage
id='user_list.notFound'
defaultMessage='No users found'
/>
</p>
</div>
);
}
return (
<div ref='container'>
{content}
</div>
);
}
}
UserList.defaultProps = {
users: [],
extraInfo: {},
actions: [],
actionProps: {}
};
UserList.propTypes = {
users: React.PropTypes.arrayOf(React.PropTypes.object),
extraInfo: React.PropTypes.object,
actions: React.PropTypes.arrayOf(React.PropTypes.func),
actionProps: React.PropTypes.object,
actionUserProps: React.PropTypes.object
};