import React, { Component, PropTypes } from 'react'; import { withRouter } from 'react-router'; import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; import styles from './styles.scss'; import { FormattedMessage } from 'react-intl'; import cx from 'classnames'; import UserListItem from './user-list-item/component.jsx'; import ChatListItem from './chat-list-item/component.jsx'; const propTypes = { openChats: PropTypes.array.isRequired, users: PropTypes.array.isRequired, }; const defaultProps = { }; const listTransition = { enter: styles.enter, enterActive: styles.enterActive, appear: styles.appear, appearActive: styles.appearActive, leave: styles.leave, leaveActive: styles.leaveActive, }; class UserList extends Component { constructor(props) { super(props); this.state = { compact: this.props.compact, }; } render() { return (
{this.renderHeader()} {this.renderContent()}
); } renderHeader() { return (
{ !this.state.compact ?

: null }
); } renderContent() { return (
{this.renderMessages()} {this.renderParticipants()}
); } renderMessages() { const { openChats, openChat, } = this.props; return (
{ !this.state.compact ?

:
}
{openChats.map(chat => ( ))}
); } renderParticipants() { const { users, currentUser, userActions, compact, } = this.props; return (
{ !this.state.compact ?

 ({users.length})

:
} { users.map(user => ( ))}
); } } UserList.propTypes = propTypes; export default withRouter(UserList);