import React, { Component, PropTypes } from 'react'; import { defineMessages, injectIntl } from 'react-intl'; import _ from 'lodash'; import ModalContainer from '../modal/container'; import NotificationsBarContainer from '../notifications-bar/container'; import AudioNotificationContainer from '../audio/audio-notification/container'; import AudioContainer from '../audio/container'; import ChatNotificationContainer from '../chat/notification/container'; import styles from './styles'; import cx from 'classnames'; const intlMessages = defineMessages({ userListLabel: { id: 'app.userlist.Label', description: 'Aria-label for Userlist Nav', }, chatLabel: { id: 'app.chat.Label', description: 'Aria-label for Chat Section', }, mediaLabel: { id: 'app.media.Label', description: 'Aria-label for Media Section', }, actionsbarLabel: { id: 'app.actionsBar.Label', description: 'Aria-label for ActionsBar Section', }, }); const propTypes = { fontSize: PropTypes.string, navbar: PropTypes.element, sidebar: PropTypes.element, media: PropTypes.element, actionsbar: PropTypes.element, }; const defaultProps = { fontSize: '16px', }; class App extends Component { constructor(props) { super(props); this.state = { compactUserList: false, //TODO: Change this on userlist resize (?) }; } componentDidMount() { document.getElementsByTagName('html')[0].style.fontSize = this.props.fontSize; } renderNavBar() { const { navbar } = this.props; if (!navbar) return null; return (
{navbar}
); } renderSidebar() { const { sidebar } = this.props; if (!sidebar) return null; return ( ); } renderClosedCaption() { const { closedCaption } = this.props; if (!closedCaption) return null; return (
{closedCaption}
); } renderUserList() { let { userList, intl } = this.props; const { compactUserList } = this.state; if (!userList) return; let userListStyle = {}; userListStyle[styles.compact] = compactUserList; userList = React.cloneElement(userList, { compact: compactUserList, }); return ( ); } renderChat() { const { chat, intl } = this.props; if (!chat) return null; return (
{chat}
); } renderMedia() { const { media, intl } = this.props; if (!media) return null; return (
{media} {this.renderClosedCaption()}
); } renderActionsBar() { const { actionsbar, intl } = this.props; if (!actionsbar) return null; return (
{actionsbar}
); } render() { const { modal, params } = this.props; return (
{this.renderUserList()} {this.renderChat()}
{this.renderNavBar()} {this.renderMedia()} {this.renderActionsBar()}
{this.renderSidebar()}
); } } App.propTypes = propTypes; App.defaultProps = defaultProps; export default injectIntl(App);