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

105 lines
2.7 KiB
React
Raw Normal View History

2016-05-20 02:22:56 +08:00
import React, { Component } from 'react';
import styles from './styles.scss';
import { Link } from 'react-router';
import { withRouter } from 'react-router';
import { FormattedMessage } from 'react-intl';
2016-05-20 02:22:56 +08:00
import UserListItem from './user-list-item/component.jsx';
import ChatListItem from './chat-list-item/component.jsx';
class UserList extends Component {
constructor(props) {
super(props);
this.handleMessageClick = this.handleMessageClick.bind(this);
this.handleParticipantDblClick = this.handleParticipantDblClick.bind(this);
}
handleMessageClick(chatID) {
this.props.router.push(`/users/chat/${chatID}`);
}
handleParticipantDblClick(userID) {
this.props.router.push(`/users/chat/${userID}`);
}
2016-05-20 02:22:56 +08:00
render() {
return (
<div className={styles.userList}>
2016-05-26 03:29:22 +08:00
{this.renderHeader()}
{this.renderContent()}
</div>
);
}
renderHeader() {
return (
<div className={styles.header}>
<h2 className={styles.headerTitle}>
<FormattedMessage
id="app.userlist.participantsTitle"
description="Title for the Header"
defaultMessage="Participants"
/>
</h2>
</div>
);
2016-05-26 03:29:22 +08:00
}
2016-05-20 02:22:56 +08:00
2016-05-26 03:29:22 +08:00
renderContent() {
return (
<div className={styles.content}>
{this.renderMessages()}
{this.renderParticipants()}
2016-05-20 02:22:56 +08:00
</div>
);
}
2016-05-26 03:29:22 +08:00
renderMessages() {
return (
<div className={styles.messages}>
<h3 className={styles.smallTitle}>
<FormattedMessage
id="app.userlist.messagesTitle"
description="Title for the messages list"
2016-05-26 03:29:22 +08:00
defaultMessage="Messages"
/>
</h3>
<ul className={styles.chatsList} tabIndex="1">
<ChatListItem onClick={() => this.handleMessageClick('public')} />
2016-05-26 03:29:22 +08:00
</ul>
</div>
);
2016-05-26 03:29:22 +08:00
}
renderParticipants() {
return (
<div className={styles.participants}>
<h3 className={styles.smallTitle}>
<FormattedMessage
id="app.userlist.participantsTitle"
description="Title for the Participants list"
defaultMessage="Participants"
/>
&nbsp;({this.props.users.length})
</h3>
<div className={styles.scrollableList}>
<ul className={styles.participantsList} tabIndex="1">
{this.props.users.map(user => (
<UserListItem
onDoubleClick={() => this.handleParticipantDblClick(user.id)}
accessibilityLabel={'Status abc'}
accessible={true}
key={user.id}
user={user}
/>
))}
</ul>
</div>
2016-05-26 03:29:22 +08:00
</div>
);
2016-05-26 03:29:22 +08:00
}
2016-05-20 02:22:56 +08:00
}
export default withRouter(UserList);