2017-06-04 10:40:14 +08:00
|
|
|
import React, { Component } from 'react';
|
2017-08-24 00:29:21 +08:00
|
|
|
import { injectIntl } from 'react-intl';
|
2017-06-04 10:40:14 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2016-06-02 21:00:57 +08:00
|
|
|
import { withRouter } from 'react-router';
|
2017-09-23 01:03:14 +08:00
|
|
|
import styles from './styles';
|
2017-08-24 00:29:21 +08:00
|
|
|
import UserListHeader from './user-list-header/component';
|
2017-08-24 02:03:50 +08:00
|
|
|
import UserContent from './user-list-content/component';
|
2016-05-20 02:22:56 +08:00
|
|
|
|
2016-06-29 03:52:03 +08:00
|
|
|
const propTypes = {
|
2017-09-22 02:40:18 +08:00
|
|
|
openChats: PropTypes.arrayOf(String).isRequired,
|
|
|
|
users: PropTypes.arrayOf(Object).isRequired,
|
2017-07-28 21:43:39 +08:00
|
|
|
compact: PropTypes.bool,
|
2017-09-22 02:40:18 +08:00
|
|
|
intl: PropTypes.shape({}).isRequired,
|
|
|
|
currentUser: PropTypes.shape({}).isRequired,
|
|
|
|
meeting: PropTypes.shape({}),
|
2017-08-24 00:29:21 +08:00
|
|
|
isBreakoutRoom: PropTypes.bool,
|
|
|
|
makeCall: PropTypes.func.isRequired,
|
|
|
|
getAvailableActions: PropTypes.func.isRequired,
|
|
|
|
normalizeEmojiName: PropTypes.func.isRequired,
|
2017-09-22 02:40:18 +08:00
|
|
|
isMeetingLocked: PropTypes.func.isRequired,
|
2017-09-22 22:24:24 +08:00
|
|
|
isPublicChat: PropTypes.func.isRequired,
|
2016-06-29 03:52:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const defaultProps = {
|
2017-07-28 21:43:39 +08:00
|
|
|
compact: false,
|
2017-08-24 00:29:21 +08:00
|
|
|
isBreakoutRoom: false,
|
|
|
|
// This one is kinda tricky, meteor takes sometime to fetch the data and passing down
|
|
|
|
// So the first time its create, the meeting comes as null, sending an error to the client.
|
|
|
|
meeting: {},
|
2016-06-29 03:52:03 +08:00
|
|
|
};
|
|
|
|
|
2016-06-02 21:00:57 +08:00
|
|
|
class UserList extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2016-08-25 02:56:06 +08:00
|
|
|
this.state = {
|
2016-09-15 01:48:50 +08:00
|
|
|
compact: this.props.compact,
|
2016-08-25 02:56:06 +08:00
|
|
|
};
|
2017-05-05 04:39:53 +08:00
|
|
|
|
2017-07-28 21:43:39 +08:00
|
|
|
this.handleToggleCompactView = this.handleToggleCompactView.bind(this);
|
2017-05-05 04:39:53 +08:00
|
|
|
}
|
|
|
|
|
2017-07-28 21:43:39 +08:00
|
|
|
handleToggleCompactView() {
|
|
|
|
this.setState({ compact: !this.state.compact });
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className={styles.userList}>
|
2017-08-24 00:29:21 +08:00
|
|
|
<UserListHeader
|
|
|
|
intl={this.props.intl}
|
|
|
|
compact={this.state.compact}
|
|
|
|
/>
|
2017-09-22 02:40:18 +08:00
|
|
|
{<UserContent
|
2017-08-24 00:29:21 +08:00
|
|
|
intl={this.props.intl}
|
|
|
|
openChats={this.props.openChats}
|
|
|
|
users={this.props.users}
|
|
|
|
compact={this.props.compact}
|
|
|
|
currentUser={this.props.currentUser}
|
|
|
|
isBreakoutRoom={this.props.isBreakoutRoom}
|
|
|
|
makeCall={this.props.makeCall}
|
|
|
|
meeting={this.props.meeting}
|
|
|
|
getAvailableActions={this.props.getAvailableActions}
|
|
|
|
normalizeEmojiName={this.props.normalizeEmojiName}
|
2017-09-22 02:40:18 +08:00
|
|
|
isMeetingLocked={this.props.isMeetingLocked}
|
2017-09-22 22:24:24 +08:00
|
|
|
isPublicChat={this.props.isPublicChat}
|
2017-09-22 02:40:18 +08:00
|
|
|
/>}
|
2017-07-28 21:43:39 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2016-05-20 02:22:56 +08:00
|
|
|
}
|
2016-06-02 21:00:57 +08:00
|
|
|
|
2016-06-29 03:52:03 +08:00
|
|
|
UserList.propTypes = propTypes;
|
2017-07-28 21:43:39 +08:00
|
|
|
UserList.defaultProps = defaultProps;
|
|
|
|
|
2017-04-04 02:05:47 +08:00
|
|
|
export default withRouter(injectIntl(UserList));
|