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-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';
|
2018-03-21 03:35:28 +08:00
|
|
|
import CustomLogo from './custom-logo/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-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
|
|
|
};
|
2018-04-04 22:05:58 +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
|
|
|
};
|
|
|
|
|
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() {
|
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
|
|
|
{
|
2018-04-04 22:05:58 +08:00
|
|
|
SHOW_BRANDING
|
2018-03-21 03:35:28 +08:00
|
|
|
&& !this.props.compact
|
|
|
|
&& CustomLogoUrl
|
|
|
|
? <CustomLogo CustomLogoUrl={CustomLogoUrl} /> : null
|
|
|
|
}
|
2017-09-22 02:40:18 +08:00
|
|
|
{<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-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)));
|