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-07-28 21:43:39 +08:00
|
|
|
|
2017-09-26 07:45:44 +08:00
|
|
|
import injectWbResizeEvent from '/imports/ui/components/presentation/resize-wrapper/component';
|
2018-01-08 14:17:18 +08:00
|
|
|
import { styles } from './styles';
|
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-29 02:19:57 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2017-09-22 02:40:18 +08:00
|
|
|
currentUser: PropTypes.shape({}).isRequired,
|
|
|
|
meeting: PropTypes.shape({}),
|
2017-08-24 00:29:21 +08:00
|
|
|
isBreakoutRoom: PropTypes.bool,
|
|
|
|
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,
|
2017-09-29 02:19:57 +08:00
|
|
|
setEmojiStatus: PropTypes.func.isRequired,
|
|
|
|
assignPresenter: PropTypes.func.isRequired,
|
2018-01-10 06:28:48 +08:00
|
|
|
removeUser: PropTypes.func.isRequired,
|
2017-09-29 02:19:57 +08:00
|
|
|
toggleVoice: PropTypes.func.isRequired,
|
|
|
|
changeRole: PropTypes.func.isRequired,
|
2017-12-07 00:53:16 +08:00
|
|
|
roving: 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-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}
|
2017-09-29 02:19:57 +08:00
|
|
|
setEmojiStatus={this.props.setEmojiStatus}
|
|
|
|
assignPresenter={this.props.assignPresenter}
|
2018-01-10 06:28:48 +08:00
|
|
|
removeUser={this.props.removeUser}
|
2017-09-29 02:19:57 +08:00
|
|
|
toggleVoice={this.props.toggleVoice}
|
|
|
|
changeRole={this.props.changeRole}
|
2017-08-24 00:29:21 +08:00
|
|
|
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-12-06 03:13:11 +08:00
|
|
|
roving={this.props.roving}
|
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-09-26 07:45:44 +08:00
|
|
|
export default withRouter(injectWbResizeEvent(injectIntl(UserList)));
|