bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/user-list/component.jsx

76 lines
2.3 KiB
React
Raw Normal View History

import React, { Component } from 'react';
2017-08-24 00:29:21 +08:00
import { injectIntl } from 'react-intl';
import PropTypes from 'prop-types';
import { withRouter } from 'react-router';
import styles from './styles';
2017-08-24 00:29:21 +08:00
import UserListHeader from './user-list-header/component';
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 = {
openChats: PropTypes.arrayOf(String).isRequired,
users: PropTypes.arrayOf(Object).isRequired,
2017-07-28 21:43:39 +08:00
compact: PropTypes.bool,
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,
isMeetingLocked: PropTypes.func.isRequired,
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
};
class UserList extends Component {
constructor(props) {
super(props);
this.state = {
2016-09-15 01:48:50 +08:00
compact: this.props.compact,
};
2017-07-28 21:43:39 +08:00
this.handleToggleCompactView = this.handleToggleCompactView.bind(this);
}
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}
/>
{<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}
isMeetingLocked={this.props.isMeetingLocked}
isPublicChat={this.props.isPublicChat}
/>}
2017-07-28 21:43:39 +08:00
</div>
);
}
2016-05-20 02:22:56 +08:00
}
2016-06-29 03:52:03 +08:00
UserList.propTypes = propTypes;
2017-07-28 21:43:39 +08:00
UserList.defaultProps = defaultProps;
export default withRouter(injectIntl(UserList));