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

115 lines
3.0 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 injectWbResizeEvent from '/imports/ui/components/presentation/resize-wrapper/component';
2018-01-08 14:17:18 +08:00
import { styles } from './styles';
2018-03-21 03:35:28 +08:00
import CustomLogo from './custom-logo/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({
formatMessage: PropTypes.func.isRequired,
}).isRequired,
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,
isMeetingLocked: PropTypes.func.isRequired,
isPublicChat: PropTypes.func.isRequired,
setEmojiStatus: PropTypes.func.isRequired,
assignPresenter: PropTypes.func.isRequired,
removeUser: PropTypes.func.isRequired,
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 SHOW_BRANDING = Meteor.settings.public.app.branding.displayBrandingArea;
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() {
2018-03-21 03:35:28 +08:00
const {
intl,
openChats,
users,
compact,
currentUser,
isBreakoutRoom,
setEmojiStatus,
assignPresenter,
removeUser,
toggleVoice,
changeRole,
meeting,
getAvailableActions,
normalizeEmojiName,
isMeetingLocked,
isPublicChat,
roving,
CustomLogoUrl,
} = this.props;
2017-07-28 21:43:39 +08:00
return (
<div className={styles.userList}>
2018-03-21 03:35:28 +08:00
{
SHOW_BRANDING
2018-03-21 03:35:28 +08:00
&& !this.props.compact
&& CustomLogoUrl
? <CustomLogo CustomLogoUrl={CustomLogoUrl} /> : null
}
{<UserContent
2018-03-21 03:35:28 +08:00
{...{
intl,
openChats,
users,
compact,
currentUser,
isBreakoutRoom,
setEmojiStatus,
assignPresenter,
removeUser,
toggleVoice,
changeRole,
meeting,
getAvailableActions,
normalizeEmojiName,
isMeetingLocked,
isPublicChat,
roving,
}
}
/>}
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(injectWbResizeEvent(injectIntl(UserList)));